We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 201366b commit e66fa67Copy full SHA for e66fa67
1 file changed
examples/library.lisp
@@ -56,6 +56,13 @@
56
(cons (fn (car lis))
57
(map (cdr lis) fn))))
58
59
+(defun reduce (fn lst init)
60
+ (if (eq () lst)
61
+ init
62
+ (reduce fn
63
+ (cdr lst)
64
+ (fn init (car lst)))))
65
+
66
;; Applies each element of lis to pred. If pred returns a true value, terminate
67
;; the evaluation and returns pred's return value. If all of them return (),
68
;; returns ().
@@ -98,7 +105,7 @@
98
105
(or (not lis)
99
106
(progn (fn (car lis))
100
107
(for-each (cdr lis) fn))))
101
-
108
102
109
; Concatenates and flattens lists into a single list
103
110
(defun append (first . rest)
104
111
(if (eq () rest)
0 commit comments