2015-12-28 23:13 GMT+01:00 David Kastrup <d...@gnu.org>:
> 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

Indeed interesting.

Thanks again,
  Harm

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

Reply via email to