[REBOL] Re: Limitation coming from the "initialize" refinement used with the "Ar
From: gerardcote:sympatico:ca at: 27-Jun-2002 13:08
Hello Tom,
> Tom Conlin wrote :
>
> a bit prettier
> do rejoin['tab_nbr "/" l "/" c ": " 20]
>
You're almost right but a small glitch appeared in your version. The final
one should be :
do rejoin["tab_nbr/" L "/" C ": " 20]
instead of my original one :
> > join join join join "tab_nbr/" L join "/" C ": " 20
> > which generates > > "tab_nbr/2/1:
20" then the "do" word will do it like this.
> >
> > do join join join join "tab_nbr/" L join "/" C ": " 20
> >
Thanks for the "cue". As you can see below, even if I knew the effect of the
reduce
word - when used alone, I didn't think to use it, at least in the
form you submitted me - that is with the combined "rejoin" word.
And the worst here is that when confronted with this face-to-face encounter
I quickly told myself : Wow! It could have been great if the "join" word had
been used with so many parameters as I had under the hand. I simply missed
it but be sure that next time I'll try harder !!!
But as I have grabbed your attention for a moment, can I submit you another
question which I also asked myself when confronted with this other coding
example I tried a couple of days ago while submitting it to a friend of mine
who want to start in REBOL - don't worry about the apparent difficulty level
for this intro to REBOL because he is already doing professional coding in
other programming languages and I was effectively comparing many ways to do
the same thing - assignment (multiple ones in this case) :
The original try was :
set [ 'n1 'n2 'total 'diff ] [ 15 25 n1 + n2 n2 - n1] <--
the error is pointing n1 as having no value
print [n1 n2 somme diff]
while trying to eval n1 + n2
The expected result was : 15 25 40 10
but I had to rearrange it according to one of these alternatives to get the
expected result :
a) set [ 'n1 'n2 ] [ 15 25 ]
set 'somme n1 + n2
set 'diff n2 - n1
b) set [ 'n1 'n2 ] [ 15 25 ]
set ['somme 'diff ] reduce [ n1 + n2 n2 - n1 ]
c) set [ 'n1 'n2 ] [ 15 25 ]
set ['somme 'diff ] compose [ (n1 + n2) (n2 - n1) ]
And the related question : Is there is a way for REBOL to assign many
variables simultaneously (that is in a pseudo-parallel form on the same line
instead of serializing them by putting them on many successive lines) like I
was able to do in the Lisp language with the LET (for parallel assignment)
and LET* (for serial assignment) statements.
I know this is just a purist question for academicians but I'd like to know
if this is possible or not with REBOL as it is now
Thanks,
Gerard.