AltME: Rebol School

Messages

DideC
Bo: nice tutorial!
SWhite
Lovin' the tutorial.  If I read enough of these that hit REBOL from enough different angles, I start to understand.  I am beginning to reach the point where things that once seemed so hard to understand how seem simple, and I am forgetting why they seemed hard at first.  I wish I could capture what it was in my head that made it hard, and then give it to someone else and say, "Here, this is why you are confused about REBOL.  Your problems are all in your own head.  Absorb this information, and then you will understand."
Gregg
Me too Steven.
Gregg
Nice work as always Bo. "Nesting Functions" led me to think the section was about nested function defintions, not calls in a call chain using returned expressions.
Bo
Thanks for the feedback! What chapter should I write next? Or does anyone have a topic they've already covered that they'd like me to add?

Gregg
Values and datatypes.
GiuseppeC
I would like to know step by step what happen during words and block evaluation and how rebol inner strucuture works.
Gregg
Good timing! I just posted thoughts about that in the #Red group. Wait for feedback before assuming what I wrote is correct though. And it is only a first step. The details of evaluation can be tricky (think of things like inline set-words, and how much evaluation is applied to different types). Even "how much" is not a clear description, but rather how each type is evaluated, and the control you have over it.
GiuseppeC
Another question: If I define some words inside to body of a FUNC or a FUNCTION, are they available outside the fuction itself ?
Endo
If did not provide the local words then yes, they will be available outside of the current function scope.
See the SOURCE of FUNCTION.
Gregg
And easy to test. :-)

Gabriele
(The heart of the matter is DO-STEP which in Topaz is an action and defined in https://github.com/giesse/Project-SnowBall/blob/master/topaz/actions.topaz )
In R2 that would be DO/NEXT

SWhite
Good points about evaluation.  Knowing what happens could have a direct effect on programming.  For example, when I pull things out of a database with SQL, and I want to set a word to refer to, say, the first item in the block of columns that is the result of the SQL, I find myself doing something like "DISPLAY-ITEM: to-string to-integer copy SQL-RESULT/1" or something like that, details not important.  The important point is that I am doing copying and converting only beause I want to be absolutely sure I get the result I want, and some of that probably is not necessary because it already is done as part of the word evaluation.  I just don't know.  I suppose that is an implicit admission that I am too lazy to do a little experimenting to find out.  I do like my ruts.

Sunanda
Any clever ideas on how to push past a error in DO/NEXT?
   do/next [1 / 0 2 + 2] 'var
I'd be very happy if I could get [2 + 2} into 'var
Gregg
I was going to suggest something like:
b: [1 / 0  2 + 2]
while [not tail? b] [
    if error? try [set [res b] do/next b] [b: next b]
]
But that's too simplisitic. In your example, it will skip the first 1, then / will act as a prefix func and consume the rest of the block.
Which brings up a good question, related to the other "How is DO special" chat. Can you safely push past an error? Probably not.

Sunanda
Thanks Gregg -- I tried various things, but none of them work very reliably in all conditions - like pushing correctly past, say [divide 9 + 4 / 0 2 + 2]
It seems likely that DO knows exactly which args were consumed, and so could return the block with those skipped past. If only we could make it talk :)
Gabriele
DO could, but, not in all cases, or rather, not correctly in all cases. But, yeah, you'd need a new refinement that returns the error instead of causing it.

Sunanda
Thanks Gabiele - glad to know it is at least technically possible (within limits)

Last message posted 184 weeks ago.