diff options
Diffstat (limited to 'src/lisp/std.lisp')
-rw-r--r-- | src/lisp/std.lisp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lisp/std.lisp b/src/lisp/std.lisp index a256125..fe09a8a 100644 --- a/src/lisp/std.lisp +++ b/src/lisp/std.lisp | |||
@@ -72,3 +72,18 @@ | |||
72 | acc | 72 | acc |
73 | (rev-helper (cdr p) (cons (car p) acc)))) | 73 | (rev-helper (cdr p) (cons (car p) acc)))) |
74 | (rev-helper ls '()))) | 74 | (rev-helper ls '()))) |
75 | |||
76 | (define (append l1 l2) | ||
77 | (if (null? l1) | ||
78 | l2 | ||
79 | (cons (car l1) | ||
80 | (append (cdr l1) l2)))) | ||
81 | |||
82 | (define (cross xs ys) | ||
83 | (if (or (null? xs) | ||
84 | (null? ys)) | ||
85 | '() | ||
86 | (fold '() | ||
87 | append | ||
88 | (map (lambda (x) | ||
89 | (map (lambda (y) (list x y)) ys)) xs)))) | ||