Boost logo

Boost :

Subject: Re: [boost] painless currying
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2011-08-25 09:13:19


> > Could you explain what you mean by asymmetry here? That my currying
> > code prefers one function over another based on the available arguments?
>
> I mean this, for a ternary function f:
>
> f(x) => doesn't call f
> f(x)(y) => doesn't call f
> f(x)(y)(z) => calls f
>
> That last step looks asymmetric to me.
>
> In a lazy language, f(x)(y)(z) *doesn't* call f... until you actually use
> the result for something... which is more consistent-looking.
>
> I suppose the symmetrical non-lazy version looks like:
>
> f(x) => doesn't call f
> f(x)(y) => doesn't call f
> f(x)(y)(z) => doesn't call f
> f(x)(y)(z)() => calls f

... which makes it lazy again :-P

Regards Hartmut
---------------
http://boost-spirit.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk