Boost logo

Boost :

Subject: Re: [boost] painless currying
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-08-26 14:04:41


On 08/25/11 15:16, Dave Abrahams wrote:
>
> on Thu Aug 25 2011, Eric Niebler <eric-AT-boostpro.com> wrote:
>
>> 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?
>
> It just rubs me the wrong way that sometimes passing arguments to a
> function has no execution semantics, but if you happen to complete an
> argument list, suddenly it's called.
>
[snip]

Since an n-dimensional array can be thought of as a function of
n indexes, I would think then that subscripting multi-dimensional
arrays would rub you the wrong way:

  int f[1][1][1];

  f[0] => doesn't return an int
  f[0][0] => doesn't return an int
  f[0][0][0] => *does* return an int

Instead, would you prefer the following symmetrical version?

  f[0] => doesn't return an int
  f[0][0] => doesn't return an int
  f[0][0][0] => doesn't return an int
  f[0][0][0]() => *does* return an int

-regards,
Larry


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