Why do 'append and 'repend return the head of the series? (I'm using latest
Rebol/Core)

>> source append
append: func [
    {Appends a value to the tail of a series and returns the series head.}
    series [series! port!]
    value
    /only "Appends a block value as a block"
][
    head either only [
        insert/only tail series :value
    ] [
        insert tail series :value
    ]
]
>> x: 'test/foo/bar
== test/foo/bar
>> append x 'ping
== test/foo/bar/ping
>> x
== test/foo/bar/ping
>> x: at x 3
== bar/ping
>> x
== bar/ping
>> append x 'tau
== test/foo/bar/ping/tau
>> x
== bar/ping/tau

Would it be better for 'append and 'repend to return the 'series, instead of
the 'head of the 'series?

In other words, like:
Append: func [
    {Appends a value to the tail of a series and returns the series head.}
    Series [series! port!]
    Value
    /Only "Appends a block value as a block."
    ][
    either only [
        insert/only tail :Series :Value
        ] [
        insert tail :Series :Value
        ]
    :Series
    ]

(I've added in ":" to allow use of the above on Rebol/View with path! data
type for the series.)

After all, if one has set the position in a series explicitly, why should a
function return the series at a different position?

Andrew Martin
ICQ: 26227169 http://valley.150m.com/
-><-


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to