Strange "HEAD" behaviuor
[1/7] from: sharriff:aina:med-iq at: 8-Nov-2000 9:16
Given this snippet:
>> fileblock: read %./
== [%dictionary/ %rebol.exe %dictionary.html %notes.html %setup.html %map.r
%rebdoc.r
%rebol.r %user.r]
>> length? fileblock
== 9
>> forall fileblock [ print fileblock/1 ]
dictionary/
rebol.exe
dictionary.html
notes.html
setup.html
map.r
rebdoc.r
rebol.r
user.r
== false
>> tail? fileblock
== true
>> head fileblock
== [%dictionary/ %rebol.exe %dictionary.html %notes.html %setup.html %map.r
%rebdoc.r
%rebol.r %user.r]
>> length? fileblock
== 0
>> tail? fileblock
== true
>>
Why doesīnt "Head fileblock" work?
Sharriff Aina
med.iq information & quality in healthcare AG
[2/7] from: al:bri:xtra at: 8-Nov-2000 22:43
> >> tail? fileblock
> == true
> >> head fileblock
> == [%dictionary/ %rebol.exe %dictionary.html %notes.html %setup.html
%map.r
Try:
fileblock: head fileblock
as:
tail? head fileblock
will result in:
true
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[3/7] from: al:bri:xtra at: 8-Nov-2000 22:50
> Try:
> fileblock: head fileblock
> as:
> tail? head fileblock
> will result in:
> true
Uhm, actually, that should be:
false
Andrew Martin
Red faced...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[4/7] from: sharriff::aina::med-iq::de at: 8-Nov-2000 9:56
I guessed as mich :-) donīt you think that its buggy logic from REBOL? I
thought it would be logical to write " HEAD series" just as the
the help docs states
USAGE:
HEAD series
DESCRIPTION:
Returns the series at its head.
HEAD is an action value.
ARGUMENTS:
series -- (Type: series port)
>>
your workaround works but that would mean I would need extra code to reset
blocks when using "FORALL" (-sigh-) Iīll have to avoid using FORALL then..
Cheers
Sharriff Aina
med.iq information & quality in healthcare AG
"Andrew
Martin" An: <[rebol-list--rebol--com]>
<[Al--Bri--xtra]. Kopie:
co.nz> Thema: [REBOL] Re: Strange "HEAD" behaviuor
Gesendet von:
rebol-bounce@
rebol.com
08.11.00
22:50
Bitte
antworten an
rebol-list
> Try:
> fileblock: head fileblock
> as:
> tail? head fileblock
> will result in:
> true
Uhm, actually, that should be:
false
Andrew Martin
Red faced...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[5/7] from: petr:krenzelok:trz:cz at: 8-Nov-2000 11:14
[Sharriff--Aina--med-iq--de] wrote:
> I guessed as mich :-) donīt you think that its buggy logic from REBOL? I
> thought it would be logical to write " HEAD series" just as the
> the help docs states
It's not buggy and yet docs are all ok :-)
Look - head is a function - it returns its value. If you don't assign the value to any
word - it just returns its value to console :-)
->> head? ["a" "b" "c"]
== true
->> head? tail ["a" "b" "c"]
== false
->> head? head tail ["a" "b" "c"]
== true
here head? checks for the returned value ....
Andrew is right, just reassign the value of word referring to series ...
Cheers,
-pekr-
[6/7] from: ingo:2b1 at: 8-Nov-2000 11:30
Hi Sharriff,
you have to reassign the return value of head to a word
fileblock: head fileblock
regards,
Ingo
Once upon a time [Sharriff--Aina--med-iq--de] spoketh thus:
[7/7] from: sharriff:aina:med-iq at: 8-Nov-2000 11:27
Thanks Ingo!
Sharriff Aina
med.iq information & quality in healthcare AG
Ingo Hohmann
<[ingo--2b1--de]> An: [rebol-list--rebol--com]
Gesendet von: Kopie:
rebol-bounce@ Thema: [REBOL] Re: Strange "HEAD" behaviuor
rebol.com
08.11.00
10:30
Bitte
antworten an
rebol-list
Hi Sharriff,
you have to reassign the return value of head to a word
fileblock: head fileblock
regards,
Ingo
Once upon a time [Sharriff--Aina--med-iq--de] spoketh thus: