| Paste number 52642: | cartesian-product |
| Pasted by: | faxathisia |
| 8 months, 3 weeks ago | |
| #lispcafe | Context in IRC logs | |
| Paste contents: |
| (defun cartesian-product (&rest lists) (if (endp lists) '(()) (apply #'append (mapcar #'(lambda (head) (mapcar #'(lambda (tail) (cons head tail)) (apply #'cartesian-product (rest lists)))) (first lists))))) |
Annotations for this paste:
| Annotation number 1: | cartesian-product car/cdr |
| Pasted by: | faxathisia |
| 8 months, 3 weeks ago | |
| Context in IRC logs | |
| Paste contents: |
| (defun cartesian-product (list &rest lists) (if (endp lists) (mapcar #'list list) (apply #'append (mapcar #'(lambda (head) (mapcar #'(lambda (tail) (cons head tail)) (apply #'cartesian-product lists))) list)))) |