Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Haskell Newspeak

Name: Anonymous 2022-11-22 21:34

zip is a transpose
unzip is also the transpose
transpose is a transpose obvious

why Haskell people invented 3 words for the same basic list operations?

It is like you have 3 operators `add`, `plus` and `sum`, all doing the addition of two numbers.

Name: Anonymous 2022-11-23 6:56

They are subtly different. Compare:

Takes list of lists, returns list of lists:
https://hackage.haskell.org/package/base-4.17.0.0/docs/Data-List.html#v:transpose


Takes two lists, returns list of tuples:
http://zvon.org/other/haskell/Outputprelude/zip_f.html

Another difference is how they handle element count mismatch. In zip, if one list is bigger than the other, it doesn't create 1-uples.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List