Paste number 52642: cartesian-product

Index of paste annotations: 1

Paste number 52642: cartesian-product
Pasted by: faxathisia
8 months, 3 weeks ago
#lispcafe | Context in IRC logs
Paste contents:
Raw Source | XML | Display As
(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:
Raw Source | Display As
(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
)
)
)
)

Colorize as:
Show Line Numbers
Index of paste annotations: 1

Ads absolutely not by Google

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.