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

postfix? -> prefix

 [1/3] from: arolls:bigpond:au at: 19-Jul-2001 6:11


Hang on, we have prefix too, don't we? You'll still have to rewrite your games, but it seems just as stack-based to me. :) Anton.

 [2/3] from: rryost:home at: 18-Jul-2001 13:49


Anton, you're right! I never thought of trying prefix notation! Did earlier REBOL/core's support that? Your observation that prefix means "stack-based" seems to clash with the Forth approach in which an operator can be applied to one or more results of preceding operations that were "left on the stack". With prefix syntax the operator signals an intent to operate on the result((s) of one or more future operations. I agree that "stack-based" isn't a clear concept, but it's definitely not "Forth-like". I may be misusing terms, but prefix operator is more like a function, which is followed by arguments. Russell [rryost--home--com]

 [3/3] from: arolls::bigpond::net::au at: 19-Jul-2001 20:50


> Anton, you're right! I never thought of trying prefix notation! Did > earlier REBOL/core's support that?
Umm.... can't remember. It's been around for a while. How early is early?
> Your observation that prefix means "stack-based" seems to clash with the > Forth approach in which an operator can be applied to one or more
<<quoted lines omitted: 5>>
> operator is more like a function, which is followed by arguments. > Russell [rryost--home--com]
More like a function, yes, easy for rebol. But they tend to grab arguments too quickly. The infix and prefix notations work against each other a bit, but infix was considered too necessary for beginners and lovers of usual math notation. Caution: when making prefix notation, watch out for - (minus) If you try:
>> - 100 10
== 10 ; you might be expecting 90 This is because the minus (-) is used here as a unary operator, taking just one argument. Therefore the above is just two values, -100 followed by 10. In such a case, the result returned is simply the last value. Anton.

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