Hello [EMAIL PROTECTED]
On 30-Nov-99, [EMAIL PROTECTED] wrote:
>
> Hi,
>
>
> I try just something very ugly and it works:
>
>>> 1. x/:i syntax can get but not set values in a block... why?
>>>
>>> Script started on Mon Nov 29 14:07:07 1999
>>> l
>>>>> x: [ "this" "is" "a" "test" ]
>>> == ["this" "is" "a" "test"]
>>>>> i: 3
>>> == 3
>>>>> x/:i
>>> == "a"
>>>
>>>>> ; but all attempts to set x/:i seem to fail
>>>
>>>>> x/:i: "the"
>>> ** Syntax Error: Invalid word -- :i:.
>>> ** Where: (line 1) x/:i: "the"
>
>
>>> do rejoin compose [ "x/"(:i)": " "{the}"]
> == ["this" "is" "the" "test"]
>>>
>
> (I know, it's ugly :-).
Butt ugly =) .. a much nicer solution is to use 'change with 'at or 'poke
>> x: ["a" "b" "c" "d"]
== ["a" "b" "c" "d"]
>> change at x 3 "zzz"
== ["d"]
>> x
== ["a" "b" "zzz" "d"]
>> poke x 2 "yyy"
== ["a" "yyy" "zzz" "d"]
>> y: ["this" "is" "a" "test"]
Taking from the example above ....
== ["this" "is" "a" "test"]
>> poke y 3 "the"
== ["this" "is" "the" "test"]
'poke for me seems to be the 'nicer' way of changing values in a
series/block though being a big Smalltalk fan 'change/'at is not too
bad :)
> Jan
>
> --
> Jan Strejcek
> [EMAIL PROTECTED]
>
Regards
Blaz