[REBOL] Re: More syntax/documentation Q's Re:(2)

1999-12-09 Thread ejolson

Hello, 
On 30-Nov-99, [EMAIL PROTECTED] wrote:

> [EMAIL PROTECTED] wrote:
> 
>>>2. y: make string! 100   creates a string of length 0... why?
>>>rebol dictionary entry implies 100 would be length or
>>>value...
>> 
>> IMHO, it's a big fat bug. The same happens with blocks BTW. I just
>> reported both as a bug.
> 
> I think "make string! 100" should create an empty string with the
> space to hold 100 characters.

IMHO "make string! 100" should create a string of value "100" (or am I
thinking of to-string?), just like "make integer! 100" (or to-integer 100)
makes an interger of value 100.  If you want a function to create an empty
string with the space to hold 100 characters, perhaps a new function or
refinement could do that.

Elliott



[REBOL] Re: More syntax/documentation Q's Re:(2)

1999-12-03 Thread blazs

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