[REBOL] Re: How to use parenthesis
From: carl:cybercraft at: 18-Apr-2002 7:57
On 18-Apr-02, COFFRE Richard FTO wrote:
> Hi Rebolers,
> I have this instruction :
> tcr: remove/part copy/part ligne 11 9
> but I need to have something like this :
> offset: 7
> tcr: remove/part copy/part ligne (4 + offset) (2 + offset)
> SO far, it doesn't work ???
Hi Richard,
It depends what you mean by "work". It doesn't return an error...
>> ligne: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
== [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
>> offset: 7
== 7
>> tcr: remove/part copy/part ligne (4 + offset) (2 + offset)
== [10 11]
>> tcr
== [10 11]
and gives the same result as...
>> tcr: remove/part copy/part ligne 11 9
== [10 11]
so I assume it's not giving the result you want? If that's the case,
you'll need to tell us what result is wanted. The following, broken
into its parts, is what's happening above...
>> a: copy/part ligne (4 + offset)
== [1 2 3 4 5 6 7 8 9 10 11]
>> tcr: remove/part a (2 + offset)
== [10 11]
If, by offset you mean you want to move into the series a certain
amount, use skip to do it. ie...
>> a: copy/part skip ligne offset 4
== [8 9 10 11]
Though that doesn't make sense with your example as you'd always be
left with an empty series...
>> tcr: remove/part skip a offset 2
== []
Though perhaps you just mean...
>> tcr: remove/part a 2
== [10 11]
?
if so, then the one-liner would be...
>> tcr: remove/part copy/part skip ligne offset 4 2
== [10 11]
But if not ???
--
Carl Read