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]

Reply via email to