[REBOL] Re: "piping" functions
From: volker:nitsch:g:mail at: 23-Nov-2005 0:50
On 11/23/05, Jean-Francois Allie <jf_allie-hotmail.com> wrote:
> Hello everyone, I wrote these two functions BUTFIRST and BUTLAST (as in
> LOGO) butlast: func [series] [
> copy/part num (length? num) - 1] butfirst: func [series] [
> copy/part next num (length? num) - 1] It seemed to work: >>num: [1 2 3
> 4]
> == [1 2 3 4]
> >>butfirst num
> == [2 3 4]
> >>butlast num
> == [1 2 3] ... but unfortunately, when I try to compose functions with
> them as in:
> >>butfirst butlast num
> == [2 3 4]
> >>butlast butfirst num
> == [1 2 3] I'm very curious to understand why. many thanks jf
Good question, confused me too.
Until i discovered you wrote:
butlast: func [series] [copy/part num (length? num) - 1]
In rebol 'series is the arguement, 'num is the global.
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
-Volker
Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem.
David
Wheeler