DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Legacy and Other Languages (http://www.daniweb.com/forums/forum42.html)
-   -   How to get "NIGHT" node from LISP list (((GOOD))((NIGHT))) ? (http://www.daniweb.com/forums/thread143829.html)

bicarbonato Sep 3rd, 2008 4:00 pm
How to get "NIGHT" node from LISP list (((GOOD))((NIGHT))) ?
 
Hi all,

I'm using a common Lisp compiler and I don't know the syntax to get the node "NIGHT" from the list (((GOOD))((NIGHT))). Could someone help me?

Thanks

Duoas Sep 3rd, 2008 10:57 pm
Re: How to get "NIGHT" node from LISP list (((GOOD))((NIGHT))) ?
 
Take it one step at a time with car and cdr:

define xs (((GOOD))((NIGHT)))

car xs --> ((GOOD))
cdr xs --> ((NIGHT))

car (car xs) --> (GOOD)
cdr (car xs) --> ()

etc.

bicarbonato Sep 4th, 2008 2:30 pm
Re: How to get "NIGHT" node from LISP list (((GOOD))((NIGHT))) ?
 
It helped me a lot.

Thank you!


All times are GMT -4. The time now is 9:10 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC