newLISP Fan Club

Forum => newLISP in the real world => Topic started by: tomtoo on February 20, 2010, 06:23:51 AM

Title: setf and cons
Post by: tomtoo on February 20, 2010, 06:23:51 AM
Hey guys,



given this:

(define (c cc)(setf (eval (cc 0)) (cons (cc 1) '())))

I get this:

ERR: no symbol reference found

I see in the manual that this is normal, but I'd like to find an alternative way of making

("this" "that")

into something that results from something like

(set 'this "that")

let me know if I haven't provided enough info.  it's a bad habit...:-)
Title: Re: setf and cons
Post by: Lutz on February 20, 2010, 08:35:56 AM
Do you mean this?


(define (c cc)
(set (sym (cc 0)) (cons (cc 1) '())))

(c '("this" "that")) => ("that")

; the symbol 'this' is now set to ("that")

this => ("that")
Title: Re: setf and cons
Post by: tomtoo on February 20, 2010, 11:52:58 AM
Yep, I think so, thanks. I think it was "sym" that I was missing.



 I need to memorize all the functions, I guess, because when I need them I either can't remember them or can't find them.