Page 1 of 1

initializing lists

Posted: Mon May 21, 2007 5:44 pm
by didi
( set 'cmin 1 )

( set 'b1 '( cmin cmin cmin )) ; generates ( cmin cmin cmin ) , hmm ...

( set 'b2 ( dup cmin 3 )) ; generates ( 1 1 1 ) , thats what i need
Which is the best ( shortest, most elegant, easiest ..) way to initialize a list with some predefined values, what if cmax = 255 and something like ( cmin cmax cmin ) should result in ( 1 255 1 ) ?


PS:
Everytime i've finished my small newLISP program , i see that there is a more 'lispy' way to do the things and i feel the strong wish to start from scratch ;-)

Posted: Mon May 21, 2007 6:04 pm
by Sleeper

Code: Select all

(set 'b1 (list cmin cmin cmin))

Posted: Tue May 22, 2007 4:22 pm
by didi
Thankyou :-)