It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
That sounds more like FORTH's "SELF" than Haskell's "id". Haskell's "id" can be defined in Pike as
mixed id(mixed x) { return x; }
array a = ({ 1,3,5,7 }); array b = ({ 2,4,6,8 }); Array.zip(a,b); ({1,2,3,4,5,6,7,8});
To work like in Haskell, it should give ({({1,2}),({3,4}),({5,6}),({7,8})}) The inner things should really be pairs (2-tuples), but since we don't have that...
Prelude> zip [1,3,5,7] [2,4,7,8] [(1,2),(3,4),(5,7),(7,8)] Prelude>
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-09-03 19:36: Subject: Re: Language comparisions
Should we have an identity function for the fun of it (Haskell has id and Smalltalk has yourself)?
how is that different from this_object() ?
It would be an this_function() or a magic variable this_function. No, I don't know what it should be used for.
Should we add Array.zip and Array.unzip to merge and split arrays.
how does that work?
array a = ({ 1,3,5,7 }); array b = ({ 2,4,6,8 }); Array.zip(a,b); ({1,2,3,4,5,6,7,8});
zip and unzip sound rather unintuitive in what they would do.
No, its a zipper. The name is from Haskell, merd, Python, Scheme and SML, which has the functionality.
/ Martin Nilsson (ja till euro, nej till cent)