[nem-en] function partial application
Philippe Quesnel
philippe.quesnel at gmail.com
Wed Oct 5 16:21:11 CEST 2005
yes, thank you, interesting solution !
As you said, I guess the 'twice twice twice twice' example looks nice in a
tutorial
but it is not really a real world practical example.
thx again
Philippe
On 10/5/05, Michal Moskal <michal.moskal at gmail.com> wrote:
>
> On 10/5/05, Philippe Quesnel <philippe.quesnel at gmail.com> wrote:
I guess the simplest possible solution would be something along the lines
> of:
>
> def twice['a] (f : 'a -> 'a) {
> fun (x) { f (f (x)) }
> }
>
> def inc = 1 + _;
>
> System.Console.WriteLine (twice (twice) (inc) (0));
> System.Console.WriteLine (twice (twice) (twice) (inc) (0));
> System.Console.WriteLine (twice (twice) (twice) (twice) (inc) (0));
>
> This is all consequence of the fact that we have chosen to create a
> practically usable language, not a pretty one. We tried to support
> these parts of FP that are mostly useful in real world scenarios,
> leaving the rest of the language easy to understand for people with
> OO background.
>
> Hope this answers your questions!
>
> --
> Michal Moskal,
> http://nemerle.org/~malekith/
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/pipermail/devel-en/attachments/20051005/26261911/attachment.html
More information about the devel-en
mailing list