On 9 Sep, George Russell wrote:
> Here is my revised version of the documentation.
my :-) (which incorporates some of the other suggestions.)
I've given reasons at the bottom.
Type:
> unzip :: [(a,b)] -> ([a],[b])
unzip takes a list of pairs and returns a pair of lists.
Definition:
> unzip l = (map fst l, map snd l) -- [1]
Description:
see zip; unzip is such that if
unzip l = (a, b)
then zip a b = l -- [2]
Examples:
unzip [(1, 4), (2, 5), (3, 6)] = ([1, 2, 3], [4, 5, 6]) -- [3]
See Also: unzip3
Notes about the above:
[1] The prelude is supposed to give definitions that are semantically
correct but are not necessarily efficient (eg sort), and I think
this is clearer. There are other definitions in the prelude that
could be made easier to understand.
[2] the motivation for the name comes from zip, and it makes it harder
to describe unzip when it's only necessarily true that zip undoes
what unzip does, and not vice versa.
[3] I think this example is slightly easier, though on second thoughts
unzip [('a', 1), ('b', 2), ('c', 3)] = (['a', 'b', 'c'], [1, 2, 3])
is better still.
Unrelated whinge:
I missed the discussion that decided that show should omit the
syntactically unnecessary spaces when converting lists and tuples.
While this may save space in files, I don't see that we are
equipped to break with centuries of typographic tradition wrt
spaces and commas.
--
Jón Fairbairn [EMAIL PROTECTED]