|
Boost : |
Subject: Re: [boost] painless currying
From: Eric Niebler (eric_at_[hidden])
Date: 2011-08-25 13:21:47
On 8/24/2011 6:15 PM, Dave Abrahams wrote:
>
> on Wed Aug 24 2011, "Peter Dimov" <pdimov-AT-pdimov.com> wrote:
>
>> Dave Abrahams wrote:
>>
>>> 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
I simply don't see the problem with:
f(x) ==> curry
f(x, y) or f(x)(y) ==> curry
f(x, y, z) or etc. ==> evaluate
Can you say specifically what you think the problem is? This is how its
done in Haskell, for instance (although Haskell doesn't use parens
around argument lists).
>> This allows you to express bind( f, x, y, z ), which was impossible
>> before, but you've now lost the capability to express bind( f, x, y,
>> _1 ), which was.
>>
>> bind( f, _1, y, z ), which is often needed in practice, is possible
>> under neither, which makes me view this whole exercise as somewhat
>> academic.
I don't see any technical obstacles to:
f(_, y, z)
where _ is a placeholder. You could use positional placeholders for
argument reordering.
> Yes, it has always been my view that bind was unambiguously better for
> non-lazy languages, and at least more flexible even for lazy ones.
Better and more flexible in what ways?
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk