How to "return by reference" from a user-defined function/macro?
Code: Select all
(let (l '(a b c)) (pop l) l) # => (b c)
(let (l '(a b c)) (pop (or l)) l) # => (b c)
(let (l '(a b c)) (pop (println l)) l) # => (a b c); is this a bug?
(let (l '(a b c)) (pop (begin (println l) l)) l) # => (b c)
(let (l '(a b c)) (pop (let () l)) l) # => (a b c); is this a bug?
(let (l '(a b c)) (pop ((fn () l))) l) # => (a b c); how to make it return (b c)?
Code: Select all
(define-macro (%p) (println "% " (args 0) " = " (eval (args 0))))
(let (l '(a b c)) (pop (%p l)) l) # => (a b c); how to make it return (b c)?
KS