Skip to content

Instantly share code, notes, and snippets.

@ReaperUnreal
Created November 30, 2011 15:51
Show Gist options
  • Save ReaperUnreal/1409567 to your computer and use it in GitHub Desktop.
Save ReaperUnreal/1409567 to your computer and use it in GitHub Desktop.
Fun times...
(define (product los1 los2)
(define (product-elem los e)
(if (eq? los `())
`()
(cons (list (car los) e)
(product-elem (cdr los) e))))
(if (eq? los1 `())
`()
(append (product-elem los2 (car los1))
(product (cdr los1) los2))))
> (product `(1 2 3) `(x y))
((x 1) (y 1) (x 2) (y 2) (x 3) (y 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment