getting newlisp to "wind" up? and practice sets
Posted: Mon Jan 10, 2011 5:52 pm
How do I get a function to keep what it returns as it's "referance" instead of it's value? Or some other logical method that lets you perform getting/setting without having to write lots of messy functions?
I'm also curious if there are anything around like practice sets. That give you a problem then also show an example. This tends to be the fastest way for me to learn since every language has little short cuts that aren't obvious till you see it your way and then someone else's.
I'm also curious if there are anything around like practice sets. That give you a problem then also show an example. This tends to be the fastest way for me to learn since every language has little short cuts that aren't obvious till you see it your way and then someone else's.
Code: Select all
(set 'player-states '(
(myself (levels ( (body 100) (focus 100) (will 100))) (status '()) )
(target (levels ( (body 100) (focus 100) (will 100))) (status '()) )
))
(define
(body-level target)
(lookup 'body (lookup '(target levels) player-states)) )
;works and sets body to 110
(setf
(lookup 'body (lookup '(target levels) player-states))
110)
(body-level myself)
;does not set body to 200, how do I get the 'referance' to wind up?
(setf (body-level 'myself) 200)
(body-level myself)