noob question: why 3 different outputs
[1/4] from: dougedmunds:gma:il at: 22-Apr-2008 15:18
Hello,
Can someone explain what is going on that causes these
three very similar (to me!) inputs to have such
dissimilar outputs?
Thanks.
Doug Edmunds
;-------code starts
REBOL [Title: "block creation tests"]
myfunc: func [
myfields
][
print "print block:"
print myfields
print "print foreach:"
foreach myfield myfields [ print get myfield ]
print "---"
]
view layout [
myfield1: field "doug"
myfield2: field "was"
myfield3: field "here"
mybutton1: button "button 1"
[
myfields1: [myfield1/text myfield2/text myfield3/text]
print "button1"
myfunc [myfields1]
]
mybutton2: button "button 2"
[
m1a: myfield1/text
m2a: myfield2/text
m3a: myfield3/text
myfields2: [m1a m2a m3a]
print "button2"
myfunc [myfields2]
]
mybutton3: button "button 3"
[
m1b: myfield1/text
m2b: myfield2/text
m3b: myfield3/text
print "button3"
myfunc [m1b m2b m3b]
]
]
[2/4] from: dougedmunds::gmail::com at: 22-Apr-2008 21:08
The q should be Why 4 different outputs?
I left this one out:
mybutton4: button "button 4"
[
m1c: myfield1/text
m2c: myfield2/text
m3c: myfield3/text
myfields3: reduce [m1c m2c m3c]
print "button4"
myfunc [myfields3]
]
DougEdmunds wrote:
[3/4] from: kpeters::otaksoft::com at: 23-Apr-2008 11:05
Hi Doug ~
hmm, none of the gurus who have helped me out so often have replied yet, so I will take
a stab:
Probe
and "type?" are your best friends here.
Take a look at what you are passing to your function with
probe myfields
print type? myfields1
probe myfields1/1
print type? myfields1/1
etc.
Do this for all 4 and you will see that what seems to be a subtle difference is a big
one in Rebol
(some learning curve for programmers coming from more "conventional" languages).
Also, remember that everything inside a block is 'safe' from evaluation - unless you
ask Rebol for
it, as you are doing via "reduce" in example 4
HTH
Kai
[4/4] from: anton::wilddsl::net::au at: 24-Apr-2008 13:38
Hi Doug,
I did not read your question closely,
but it looks like more word/value confusion.
Perhaps this tutorial will help:
do http://anton.wildit.net.au/rebol/doc/rebol-values.r
Regards,
Anton.
DougEdmunds wrote: