[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shorter lambda expressions

From: Panicz Maciej Godek
Subject: Re: Shorter lambda expressions
Date: Fri, 23 Sep 2016 18:44:12 +0200

I hope you don't mind me having dug this thread up, with an idea that is only loosely related with the original one.

Recently I've been doing a small project in Clojure, and I've found that it provides a function called "partial" that performs a sort of partial application.

With guile's curried definitions, it can be defined as

(define ((partial function . args) . args+)
  (apply function `(,@args ,@args+)))

and it works rather nicely:

(map (partial cons 2) '((3 4) (3 5) (4 6) (7 1)))
===> ((2 3 4) (2 3 5) (2 4 6) (2 7 1))

I believe that -- since it is just a function -- it is much less controversial than both the short macros and SRFI-26  (although its range of applicability is narrower), and it seems to compose well with the spirit of Scheme, so maybe that would be a nice-have?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]