Created
November 30, 2011 15:51
-
-
Save ReaperUnreal/1409567 to your computer and use it in GitHub Desktop.
Fun times...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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