[Haskell-cafe] zip3, zip4 ... -> zipn?

Stefan O'Rear stefanor at cox.net
Sat Aug 11 23:25:43 EDT 2007


On Sun, Aug 12, 2007 at 12:56:31PM +1000, Alexis Hazell wrote:
> On Sunday 12 August 2007 05:24, Stefan O'Rear wrote:
> 
> > Currying makes it MUCH harder to implement varargs functions. 
> 
> That's interesting - why is that the case?

varsum 2 3   -- varsum receives 2, and returns a function, which when
             -- passed 3, returns 5
varsum 2 3 4 -- varsum receives 2, and returns a function, which when
             -- passed 3, returns a function that when passed 4 returns
             -- 9.

Because of this, the number of arguments must somehow be passed
out-of-band; but then the type of the whole function (usually) must
depend on the control parameter, requiring dependent types.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070811/d3ac03f2/attachment.bin


More information about the Haskell-Cafe mailing list