Thomas Morley <thomasmorle...@gmail.com> writes:

> Though I'm not sure with the following one. May I ask: curried or not?
> (define (foo a b)
>   (let ((x2 (lambda (arg) (* 2 arg))))
>     (map x2 (list a b))))

Why would that one be curried?  It's completely boring, returns a list,
and its internal function x2 is totally straightforward (not even a
closure) and is invisible to the caller.

Slightly more interesting is

(define (fie a)
  (lambda (x) (+ x a)))

which is equivalent to the curried definition

(define ((fie a) x) (+ x a))

However, the currying is not a feature of the semantics (the semantics
of returning a function or more often a closure, namely a function with
an environment in the form of variables imported into its scope) but of
the syntax.

So while the second definition of fie is a curried definition, the first
equivalent definition isn't.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to