[REBOL] Re: head reverse annoys me
From: hallvard:ystad:oops-as:no at: 18-Dec-2004 19:24
Seems this never hit the list. I'll try again (even though
most of this has been said by others already):
On Fri, 17 Dec 2004 10:33:15 +0100
"Hallvard Ystad" <[hallvard--ystad--oops-as--no]> wrote:
>It will not break, since head head "123"
>is identical to
>head "123"
>
>i.e. if 'reverse were to do 'head all by itself,
>performing an extra 'head on the series won't change
>anything. I haven't seen _any_ examples of 'reverse being
>used _without_ 'head (situations where scrips might
>actually break), as Carl pointed out in his post.
>
>Then there is the current inconsistency in 'reverse:
>tuples! and pairs! (since they are not series!) will not
>be "empty" after being reversed (see
>
http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlHGYB).
>
>And then there are lists! :
>>> reverse to-list [1 2 3]
>== make list! [1]
>>> head reverse to-list [1 2 3]
>== make list! [3 2 1]
>
>>> index? reverse [1 2 3] ; block
>== 4
>>> index? reverse to-list [1 2 3] ; list
>== 3
>
>An odd difference, if you ask me. Maybe this could be
>done more logical too, if 'reverse's behaviour were to
>change?
>
>HY
>
>On Thu, 16 Dec 2004 15:29:04 EST
>
[SunandaDH--aol--com] wrote:
>>
>>Carl:
>>
>>> I'm not sure if anyone has been annoyed by REVERSE
>>>returning
>>> the tail position. I know I have. Everywhere I see
>>>REVERSE used
>>> like this: ... head reverse foo.
>>
>>Annoying? Yes..
>>
>>But used? Yes -- quite commonly.
>>
>>I've scanned a pile of code and found it on several
>>occasions.
>>
>>Typically something like:
>>
>>if user-display-option = "earliest first" [
>> data: head reverse data
>> ]
>>foreach item data [ .... ]
>>
>>Sadly, all that code would break.
>>
>>How about a related word?
>>
>> invert: func [item] [head reverse item]
>>
>>Sunanda
>>--
>>To unsubscribe from the list, just send an email to
>>rebol-request
>>at rebol.com with unsubscribe as the subject.
>>
>
>Write here:
Write here: