Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] List! series [Was: blank] Re:(2)

From: larry:ecotope at: 4-Oct-2000 16:54

Hi gmassar Some of the series functions work differently for lists then other series.
>From the new Core PDF doc:
Removing the element currently referenced in a list causes the reference to reset to the tail of the list So using your example:
>> list: make list! [1 2 3 4]
== make list! [1 2 3 4]
>> remove list
== make list! [2 3 4]
>> list: head list
== make list! [2 3 4]
>> first list
== 2 The value returned from the remove function is a pointer to the list after the removed element, but the current pointer for the list is at the tail. Other functions work differently as well, I would suggest reading the manual. Cheers -Larry ----- Original Message ----- From: <[gmassar--dreamsoft--com]> To: <[list--rebol--com]> Sent: Wednesday, October 04, 2000 4:04 PM Subject: [REBOL] Re: List! series [Was: blank] I followed Elan's suggestion to try out list! series. Here is what I did:
>> list: make list! [1 2 3 4]
== make list! [1 2 3 4]
>> first list
== 1
>> remove list
== make list! [2 3 4]
>> first list
** Script Error: Out of range or past end. ** Where: first list What!!!
>> list
== make list! [] Oh, the series is completely empty! Can anybody explain why remove all elements in the list instead of just the first element? Remove block! series just one element at the head. Why different? ------------snip-----------------