
25 Jun
2008
25 Jun
'08
1:29 p.m.
2008/6/25 Conal Elliott
I have a foggy memory that early ML had only binary pairing, nesting for n-tuples. Can anyone confirm this memory. If so, does anyone remember the rationale for going to n-tuples? Performance, perhaps?
Similarly, did the Haskell designers consider pairs as an alternative to n-ary tuples?
I think performance was part of it: accessing the nth element of a
tuple is O(1), but the nth element of a nested pair is O(n).
On the other hand, you can't internally represent nested pairs as
n-tuples because of laziness. (a,(b,c)) has elements of the form
(x,_|_) that don't correspond to any triple.
--
Dave Menendez