[REBOL] Re: paths & lookups & change
From: ingo:2b1 at: 18-Oct-2003 11:28
Hi Robert,
Robert M. Münch wrote:
> Hi, I seem to be stucked here:
>
>>>test
>
> == ["Bug Report" 1]
>
>>>key
>
> == "Bug Report"
>
>>>type? select test key
>
> == integer!
>
>>>add select test key + 1
>
> ** Script Error: Cannot use add on string! value
> ** Near: add select test key +
>
> Hmm... Ok, maybe a priority problem:
>
>>>add (select test key) + 1
>
> ** Script Error: add expected value2 argument of type: number pair char
> money date time tuple
> ** Near: add (select test key) + 1
>
> Strange. Shouldn't this be possible?
Have a look at these to statements, please
>> add select test key 1
== 2
>> (select test key) + 1
== 2
You're doing both of the above in one line, so the '+ eats away one of
'add s arguments
> I would like to write something like this, to increment the integer in the
> block:
>
> test/:key: test/:key + 1
I'd like that, too ;-) But until then, this works:
>> change next pos: find test key pos/2 + 1
== []
>> test
== ["Bug Report" 2]
Though I'm sure, someone will come up with a better idea ...
> How can I do such a thing? Using to-set-path? I tried but failed. Robert
I wouldn't know how to do it, either, anyone else?
Kind regards,
Ingo