Category:Forth: Difference between revisions

no edit summary
(mention ANS standard forth; common extension words)
No edit summary
Line 12:
: bounds ( addr len -- limit addr ) over + swap ; \ convert string/array to DO-LOOP limits
 
DEFER-IS for late-bound, revectorable, and forward-referenced words:
Alternate local variable syntax using curly braces, designed to look like a regular stack comment:
: noop ( -- ) ;
: defer create ( "name" -- ) ['] noop , does> ( -- ) @ execute ;
: is ( xt "name" -- ) ' >body ! ;
defer lessthan
' < is lessthan
2 3 lessthan . \ -1 (true)
 
Alternate local variable syntax using curly braces, designed to look like a regular stack comment:
: muldiv { a b -- a*b a/b } \ all stuff after "--" is ignored
a b * a b / ;
Anonymous user