Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A number of languages have listcomps that can do this, and which are actually more useful for this than CL's LOOP macro, but the thing I meant to point at was the APPENDING bit. I guess (loop for x in xs append (loop for y in (f x) collect y)) is awfully similar to [y for x in xs for y in f(x)], though.


Including Clojure for those who might not know:

    (defn cross [xs ys]
      (for [x xs, y ys]
        [x y]))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: