Search found 3 matches

by Zabolekar
Fri Jul 25, 2014 2:03 pm
Forum: newLISP in the real world
Topic: (define ...) inside a default value
Replies: 4
Views: 3097

Re: (define ...) inside a default value

Thanks for the answer! So the old function definition is collected right after we redefine the function? That makes sense for me. Then, as far as I understand, modifying the function without actually redefining it should be safe (is it?): (define (f a (b (setf (nth 1 f) "D"))) a) (println (f "A" 1) ...
by Zabolekar
Fri Jul 25, 2014 4:31 am
Forum: newLISP in the real world
Topic: (define ...) inside a default value
Replies: 4
Views: 3097

(define ...) inside a default value

I have no reason to use something like that in real code, so this is just pure curiosity. Nevertheless, I would like to understand why this piece of code does what it does. In newLisp, the following code (define (f a (b (define (f a) "D"))) a) (println (f "A" 1) (f "B") (f "C")) will print AnilD. I ...