Skip to content

Comment on One Major Difference Between Clojure and Common Lisp

Comments

The Common Lisp version he has is pretty poor; I think this is more idiomatic, and is two lines as well:

    (defun build (list1 list2) 
       (loop for x in list1 append (loop for y in list2 collect `(,x ,y))))
or:
    (defun build (list1 list2) 
       (mapcan (lambda (x) (mapcar (lambda (y) `(,x ,y)) list2)) list1))
Still more verbose, of course, but not at all bad.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.