Language Comparison
List of languages by support of convolution:
| Language | Zip | Zip 3 lists | Zip n lists | Notes |
|---|---|---|---|---|
| Clojure | (map list list1 list2) (map vector list1 list2) |
(map vector list1 list2 list3) (map vector list1 list2 list3) |
(map list list1 … listn) (map vector list1 … listn) |
Stops after the length of the shortest list. |
| Common Lisp | (mapcar #'list list1 list2) | (mapcar #'list list1 list2 list3) | (mapcar #'list list1 ... listn) | Stops after the length of the shortest list. |
| Haskell | zip list1 list2 | zip3 list1 list2 list3 | zipn list1 … listn | zipn for n > 3 is available in the module Data.List. Stops after the shortest list ends. |
| Python | zip(list1, list2) | zip(list1, list2, list3) | zip(list1, …, listn) | zip and map (3.x) stops after the shortest list ends, whereas map (2.x) and itertools.zip_longest (3.x) extends the shorter lists with None items |
| Language | Unzip | Unzip 3 tuples | Unzip n tuples | Notes |
|---|---|---|---|---|
| Clojure | (apply map vector convlist) | (apply map vector convlist) | (apply map vector convlist) | |
| Common Lisp | (apply #'mapcar #'list convlist) | (apply #'mapcar #'list convlist) | (apply #'mapcar #'list convlist) | |
| Haskell | unzip convlist | unzip3 convlist | unzipn convlist | unzipn for n > 3 is available in the module Data.List. |
| Python | zip(*convvlist) | zip(*convvlist) | zip(*convvlist) |
Read more about this topic: Convolution (computer Science)
Famous quotes containing the words language and/or comparison:
“And what the dead had no speech for, when living,
They can tell you, being dead: the communication
Of the dead is tongued with fire beyond the language of the living.”
—T.S. (Thomas Stearns)
“We teach boys to be such men as we are. We do not teach them to aspire to be all they can. We do not give them a training as if we believed in their noble nature. We scarce educate their bodies. We do not train the eye and the hand. We exercise their understandings to the apprehension and comparison of some facts, to a skill in numbers, in words; we aim to make accountants, attorneys, engineers; but not to make able, earnest, great- hearted men.”
—Ralph Waldo Emerson (18031882)