Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

This is a strange thing

 [1/11] from: allenk:powerup:au at: 2-Jul-2001 22:24


----- Original Message ----- From: "Romano Paolo Tenca" <[rotenca--telvia--it]> To: <[rebol-list--rebol--com]> Sent: Monday, July 02, 2001 9:53 PM Subject: [REBOL] This is a strange thing
> 3 point are not as one, two or four. > This is normal:
<<quoted lines omitted: 9>>
> print reduce a/1 > == "..."
Seems ok to me. get a/1 =="foo"

 [2/11] from: rotenca:telvia:it at: 2-Jul-2001 13:53


3 point are not as one, two or four. This is normal: a: [.] set a/1 "foo" print a/1 == "foo" This is a strange thing: a: [...] set a/1 "foo" print a/1 == "..." print reduce a/1 == "..." This is normal: a: [....] set a/1 "foo" print a/1 == "foo" Romano Paolo Tenca

 [3/11] from: rotenca:telvia:it at: 2-Jul-2001 15:55


Get works fine for me also; not the same for print, mold, form. Seems these function exchange 3 point with autoreference (3 point for human viewer). romano paolo tenca -----Messaggio Originale----- Da: "Allen Kamp" <[allenk--powerup--com--au]> A: <[rebol-list--rebol--com]> Data invio: 2 lug 2001 14:24 Oggetto: [REBOL] Re: This is a strange thing

 [4/11] from: joel:neely:fedex at: 2-Jul-2001 3:55


Hi, Romano, I get the same results as Allen. What version of REBOL are you using? -jn- Romano Paolo Tenca wrote:
> 3 point are not as one, two or four. >
... -- ------------------------------------------------------------ Programming languages: compact, powerful, simple ... Pick any two! joel'dot'neely'at'fedex'dot'com

 [5/11] from: rotenca:telvia:it at: 2-Jul-2001 18:48


Da: "Joel Neely" <[joel--neely--fedex--com]> A: <[rebol-list--rebol--com]> Data invio: 2 lug 2001 10:55 Oggetto: [REBOL] Re: This is a strange thing
> Hi, Romano, > > I get the same results as Allen. What version of REBOL are > you using?
I was wrong (and confused). I do not understand why, but now, I do not see more the "strange thing". The "strange" thing now appear to me normal and the "normal" strange es. a:[...] set a/1 "foo" b:[.] set b/1 "foo" print a/1 ==... print b/1 ==. What has confuse me, i think, is this:
>> b: "foo"
== "foo"
>> a: [b]
== [b]
>> reduce a
== ["foo"]
>> reduce a/1
== b
>> get a/1
== "foo" Can you explain to me the different behaviour of Reduce with "a" and "a/1"? ciao romano paolo tenca

 [6/11] from: g:santilli:tiscalinet:it at: 2-Jul-2001 19:17


Hello Romano! On 02-Lug-01, you wrote: RT> "Get" works fine for me also; not the same for print, mold, RT> form. Seems these function exchange 3 point with RT> autoreference (3 point for human viewer). I can't see any special treatment here.
>> .: "one dot"
== "one dot"
>> ..: "two dots"
== "two dots"
>> ...: "three dots"
== "three dots"
>> print [.]
one dot
>> print [..]
two dots
>> print [...]
three dots
>> print first [.]
.
>> print first [..]
..
>> print first [...]
... Also, I can't reproduce your test:
>> a: [...]
== [...]
>> print a/1
...
>> a: [..]
== [..]
>> print a/1
.. since a/1 is a word! and PRINT does *not* get its value automatically. RT> romano paolo tenca BTW, are you Romano Tenca of Amiga Magazine? Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [7/11] from: rotenca:telvia:it at: 2-Jul-2001 20:07


> I can't see any special treatment here. > Also, I can't reproduce your test:
I also... see my previous msg.
> since a/1 is a word! and PRINT does *not* get its value > automatically.
Reduce does not get the value of a word? Why?
> RT> romano paolo tenca > > BTW, are you Romano Tenca of Amiga Magazine?
Yes. Starting to learning Rebol.
> Regards, > Gabriele.
ciao romano paolo tenca

 [8/11] from: joel:neely:fedex at: 2-Jul-2001 15:11


Hi, Romano Romano Paolo Tenca wrote:
> What has confuse me, i think, is this: > >> b: "foo"
<<quoted lines omitted: 9>>
> Can you explain to me the different behaviour of Reduce with > "a" and "a/1"?
First, take a look at HELP for REDUCE
>> help reduce
USAGE: REDUCE value DESCRIPTION: Evaluates an expression or block expressions and returns the result. REDUCE is a native value. ARGUMENTS: value -- (Type: any) When you REDUCE a block you get back a block of results (the results of evaluating all expressions within the argument block). That's why
>> b: "foo" == "foo" >> a: [b] == [b] >> reduce a == ["foo"]
However, a path (as an expression!) evaluates to whatever is at that path. Therefore, evaluating
>> reduce a/1 == b
provides you with what is identified by A/1, namely the word B. In the same way, given glorp: make object! [ x: 17 y: 42 z: does [print "hello"] ] one can say
>> reduce glorp/x == 17
To understand your last line, consider this:
>> a/1 == b
tells us that what is in the 1 position of A is the word B. The definition of GET is
>> help get
USAGE: GET word /any DESCRIPTION: Gets the value of a word. GET is a native value. ARGUMENTS: word -- Word to get (Type: any-word) REFINEMENTS: /any -- Allows any type of value, even unset. that is, GET retrieves the value of a word. So this expression
>> get a/1 == "foo"
first evaluates A/1 to the word B, then applies GET to B, and returns the result, which is B's associated value "foo". HTH! -jn- -- It's turtles all the way down! joel'dot'neely'at'fedex'dot'com

 [9/11] from: g:santilli:tiscalinet:it at: 3-Jul-2001 19:41


Hello Romano! On 02-Lug-01, you wrote: RT> I also... see my previous msg. Maybe you had redefined something that made the strange thing happen. :) RT> Reduce does not get the value of a word? Why? REDUCE only evaluates blocks. You should use GET on words (as Joel explained). RT>> BTW, are you Romano Tenca of Amiga Magazine? RT> Yes. Starting to learning Rebol. I'm very glad to see you here! Any chance Sergio Ruocco will appear, too? ;) (Others, please ignore this.) A proposito, c' anche una lista italiana su REBOL che ho creato su egroups (ora yahoogroups): [rebol-it--yahoogroups--com]. Per l'iscrizione sufficiente inviare un messaggio (anche vuoto) a: [rebol-it-subscribe--yahoogroups--com]. Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [10/11] from: rotenca:telvia:it at: 4-Jul-2001 14:52


Hello, can some (gentle) man explain me this behaviour? The script which follow can be copied and executed to see the problem. Given a block, it generates rules for parsing block like this: [set string!] It fails with decimal! (and something else), not with decimal!, word!, string!... Where is my error? Another thing: why doesn't exist the function: to-datatype ciao (excuse my bad english) romano paolo tenca --------------------- REBOL[] inb: [34] rules: copy [] bn: 0 foreach tok inb [ mytype: type? tok bn: bn + 1 append rules 'set append rules to-word join form mytype bn append rules mytype ] print ["*** Block is:^/" mold inb] print ["*** Rules are:^/" mold rules] print ["*** Rules application give:^/" parse inb rules] print "^/^/Now with decimal..." inb: [34.1] rules: copy [] bn: 0 foreach tok inb [ mytype: type? tok bn: bn + 1 append rules 'set append rules to-word join form mytype bn append rules mytype ] print ["*** Block is:^/" mold inb] print ["*** Rules are:^/" mold rules] print ["*** Rules application give:^/" parse inb rules] halt

 [11/11] from: dockimbel:free at: 4-Jul-2001 15:31


Romano Paolo Tenca wrote: [...]
> Another thing: why doesn't exist the function: > > to-datatype > > ciao (excuse my bad english) > romano paolo tenca
Hi Romano, Here's a quick implementation of 'to-datatype : to-datatype: func [word][first reduce bind to-block word 'system] ex:
>> type? to-datatype 'string!
= datatype!
>> type? to-datatype "string!"
= datatype!
>> type? to-datatype [string!]
= datatype! HTH, DocKimbel.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted