lisp macro Q

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Bacardi151

Senior member
Dec 15, 2003
540
0
0
npe we haven't learned about environmental model.

and i didn't need to use it. but the eval statement you showed in ur code was the key for what i did

basically i just did
(defmacro ZERO (&rest L)
(do ...
(eval `(setf ,(car L) 0))
)
)

i had initially done that whole thing but without the eval part, as our prof. has never mentioned it (at laest not that i can recall), so it would never have crossed my midn to use it in my macro, but thankfully i ran into yah, and picked it up from you.
 

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
Originally posted by: Bacardi151
npe we haven't learned about environmental model.

and i didn't need to use it. but the eval statement you showed in ur code was the key for what i did

basically i just did
(defmacro ZERO (&rest L)
(do ...
(eval `(setf ,(car L) 0))
)
)

i had initially done that whole thing but without the eval part, as our prof. has never mentioned it (at laest not that i can recall), so it would never have crossed my midn to use it in my macro, but thankfully i ran into yah, and picked it up from you.

Interesting that the (eval) in LISP doesn't need an environment parameter. Maybe it's setup differently. But either way, the way eval works (in Scheme) is based on the environmental model...but you can just take it as a cute little function, heh heh.
 

Bacardi151

Senior member
Dec 15, 2003
540
0
0
yeah, i wasn't sure what it would do in lisp, let alone if it would work, but i just gave it a shot, and little did i know that it did work. and the function name itself is a give away of what it should do hehe, but yeah just glad you brought that function up hehe. thx again.

and oh yeah, i'll pm if i ever get stuck again hehe, but fortunately it's only 3 more weeks of this quarter, and i dont think our prof is going to get any deeper into lisp. (thankfully!)
 

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
Originally posted by: Bacardi151
yeah, i wasn't sure what it would do in lisp, let alone if it would work, but i just gave it a shot, and little did i know that it did work. and the function name itself is a give away of what it should do hehe, but yeah just glad you brought that function up hehe. thx again.

and oh yeah, i'll pm if i ever get stuck again hehe, but fortunately it's only 3 more weeks of this quarter, and i dont think our prof is going to get any deeper into lisp. (thankfully!)

haha, yeah it's an unique language...kind of cool, but also extremely annoying at times...

where do you go to school?
 

Bacardi151

Senior member
Dec 15, 2003
540
0
0
Originally posted by: eLiu
Originally posted by: Bacardi151
yeah, i wasn't sure what it would do in lisp, let alone if it would work, but i just gave it a shot, and little did i know that it did work. and the function name itself is a give away of what it should do hehe, but yeah just glad you brought that function up hehe. thx again.

and oh yeah, i'll pm if i ever get stuck again hehe, but fortunately it's only 3 more weeks of this quarter, and i dont think our prof is going to get any deeper into lisp. (thankfully!)

haha, yeah it's an unique language...kind of cool, but also extremely annoying at times...

where do you go to school?

just pm'd u