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

[REBOL] Re: The effect of learning Forth on my understanding of REBOL

From: lmecir::mbox::vol::cz at: 23-Mar-2007 19:58

Ged Byrne napsal(a):
> My thinking was strictly imperetive, so every word is a procedure to > be executed. > > So if you have 'red', what does it do? Apparantly nothing. > > So if you have 'a: if arg1 [red]' what happens when red is executed? Nothing? > > My understanding before was that a block is an anonymous method with > an implicit return. >
This explanation is arguable, I guess. A block doesn't return anything except for itself. The function IF is needed to evaluate the block to yield the RED value when ARG1 is considered true. The other case is, that ARG1 is considered false by IF. Even in that case IF has to return a value, which equals to NONE in that case.
> Now I see that what red does is place something on the stack, where it > remains until something picks it up. 'if' just leaves the stack > unchanged. >
Again, the things are simpler - it is not a stack, it is just "result place". Example: 1 2 is an expression in REBOL yielding 2, since 2 replaces 1 in the "result place". I don't know whether this can be of any help to you, but it looks more accurate to me. -L