Hi Alex, Well thats two improvements to the documentation. The description of set says:
Stores new values any in the var arguments. I suspect it should say what you said above. and have a see also link to con. regs Konrad. On 11/10/2008, Alexander Burger <[EMAIL PROTECTED]> wrote: > Hi Konrad, > >> (set 'A (1 2 3 4)) >> (set 'B (cdr A)) >> ... >> (set (cdr A) NIL) > > The 'set' function puts a value into the CAR part of a cell (no matter > whether this is a list cell or a symbol). > > A B > > | | > V V > +-----+-----+ +-----+-----+ +-----+-----+ +-----+-----+ > | 1 | ---+---> | 2 | ---+---> | 3 | / |---> | 4 | / | > +-----+-----+ +-----+-----+ +-----+-----+ +-----+-----+ > ^ > | > (cdr A) > > So 'set' receives the cell which is pointed to by 'B', and stores 'NIL' > into its value cell. > > > What you want to achieve is > > A B > > | | > V V > +-----+-----+ +-----+-----+ +-----+-----+ +-----+-----+ > | 1 | / | | 2 | ---+---> | 3 | / |---> | 4 | / | > +-----+-----+ +-----+-----+ +-----+-----+ +-----+-----+ > > i.e. storing NIL into the CDR part of the first cell of 'A'. > > 'set' cannot do this, but 'con' stores a value in the CDR part of a cell: > > : (con A NIL) > -> NIL > : A > -> (1) > : B > -> (2 3 4) > > >> the goal is to take a list build by fifo and turn it into a normal >> list starting at the 2nd element. >> >> so instead of (4 1 2 3 .) >> I get (1 2 3 4) > > You were on the right way: > > : A > -> (4 1 2 3 .) > > : (setq L (cdr A)) > -> (1 2 3 4 .) > > : (con A NIL) > -> NIL > > : L > -> (1 2 3 4) > : A > -> (4) > > Cheers, > - Alex > -- > UNSUBSCRIBE: mailto:[EMAIL PROTECTED] > -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]
