"mutate" now actually works
This commit is contained in:
+10
-1
@@ -5,6 +5,15 @@
|
||||
"Checks if the argument is nil."
|
||||
(= x nil)))
|
||||
|
||||
(define append
|
||||
(lambda (seq elem)
|
||||
(if (nil? seq)
|
||||
nil
|
||||
(if (not (= (type (rest seq)) :pair))
|
||||
;; we are on the last element
|
||||
(mutate seq (pair (first seq) elem))
|
||||
(append (rest seq) elem)))))
|
||||
|
||||
(define last
|
||||
(lambda (seq)
|
||||
"Returns the last element of the given sequence."
|
||||
@@ -79,5 +88,5 @@ as compared to `reduce'."
|
||||
(print sep))
|
||||
;; TODO(Felix): later we should use `extend' here:
|
||||
;; (eval (extend (quote (printf :sep sep :end end)) (rest args)))
|
||||
(eval (pair printf (pair :sep (pair sep (pair :end (pair end (rest args)))))))
|
||||
(eval (extend '(printf :sep sep :end end) (rest args)))
|
||||
nil))))
|
||||
|
||||
Reference in New Issue
Block a user