newLISP Fan Club

Forum => Whither newLISP? => Topic started by: cameyo on April 19, 2024, 12:28:25 PM

Title: Strange behavior
Post by: cameyo on April 19, 2024, 12:28:25 PM

(define (test a) (extend '() (sequence 1 a)))
(test 4)
;-> (1 2 3 4)
(test 4)
;-> (1 2 3 4 1 2 3 4)
(test 4)
;-> (1 2 3 4 1 2 3 4 1 2 3 4)
test
;-> (lambda (a) (extend '(1 2 3 4 1 2 3 4) (sequence 1 a)))
Title: Re: Strange behavior
Post by: fdb on April 25, 2024, 01:42:02 PM
extend is destructive, so in place extending the list. if you do not want this use append