[REBOL] Re: insert
From: izkata::gmail::com at: 2-Apr-2009 11:09
2009/4/2 =C5=9Eemseddin Moldibi [ Bircom ] <semseddinm-bircom.com>:
> -----Original Message-----
> From: rebol-bounce-rebol.com [mailto:rebol-bounce-rebol.com] On Behalf
> Of Iyer
> Sent: Thursday, April 02, 2009 6:55 PM
> To: rebolist-rebol.com
> Subject: [REBOL] insert
>
> All,
> I have defined the following (on my OS X, both R2 2.7.6 & R3 A40) :
>
>>> num: [1 2 3]
>
> then I execute the following:
>
>>> num: insert tail num [4], expecting [1 2 3 4]. However, I get:
>
>>> []
>
>>> print num
>
>>> []
>
> Any suggestions? Join works though!
>
> Thanks
> -Narayan-
>
> Insert returns the series after the insert.
> You should use "head num",
> But "print num" gives the expected output on my winxp?
>
> print n
>>> 1 2 3 4
>
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
>> X: [1 2 3]
== [1 2 3]
>> Y: insert tail X 4
== []
>> ? X
X is a block of value: [1 2 3 4]
>> ? Y
Y is a block of value: []
>> index? X
== 1
>> index? Y
== 5
>> head X
== [1 2 3 4]
>> head Y
== [1 2 3 4]
Insert is inserting at the tail, then returning the series after the
inserted value. So Y is at the tail, but X still points at the head
of the series.
--
=E5=A5=8F=E3=81=A7=E3=81=A6=E5=A4=A2