initializing lists

For the Compleat Fan
Locked
didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

initializing lists

Post 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 ;-)

Sleeper
Posts: 24
Joined: Fri Nov 24, 2006 2:24 pm

Post by Sleeper »

Code: Select all

(set 'b1 (list cmin cmin cmin))

didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

Post by didi »

Thankyou :-)

Locked