2 ms·
I was fond of the Common Lisp loop macro that handled iterating over multiple things quite nicely: https://lispcookbook.github.io/cl-cookbook/iteration.html#lo
by arethuza 4y ago
I was fond of the Common Lisp loop macro that handled iterating over multiple things quite nicely:
https://lispcookbook.github.io/cl-cookbook/iteration.html#loop-1 https://lispcookbook.github.io/cl-cookbook/iteration.html#lo...
Edit: 27 years since I was paid to write Lisp....
- masklinn 4y agoThis is very strange, because it looks like a comprehension (https://wiki.haskell.org/List_comprehension https://wiki.haskell.org/List_comprehension), which would be a product iteration. Most languages have a function called zip or something similar (https://hackage.haskell.org/package/base-4.17.0.0/docs/Prelude.html#v:zip https://hackage.haskell.org/package/base-4.17.0.0/docs/Prelu...) which handles pairing sequences, to be composed upstream of the iteration proper.
- tuukkah 4y agoIt's a parallel list comprehension, as linked from the wiki page you referenced: https://downloads.haskell.org/ghc/9.4.4/docs/users_guide/exts/parallel_list_comprehensions.html https://downloads.haskell.org/ghc/9.4.4/docs/users_guide/ext...
- taeric 4y agoPretty sure it predates most of the "similar" things mentioned. :)
- bjoli 4y agoI wrote a looping facility for guile scheme recently, which was somewhat inspired by common lisps other big looping macro Iterate: https://git.sr.ht/%7Ebjoli/goof-loop https://git.sr.ht/%7Ebjoli/goof-loop scroll down for examples. It is more limited than the one in common lisp, since it turns all loops into tail recursion and this uses no mutation outside the higher-order looping constructs. It is written mostly using the hygienic syntax-rules facility (yes, it actually works) and I haven't managed to get it to produce slow code yet.