A role for roll Re Interpreter mode loops
  Home FAQ Contact Sign in
 
Advanced search
MATCHING GROUPS



more...
POPULAR GROUPS

more...

found 9 articles for 0.007 sec
Re: A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Gerry
Date: Dec 31, 2007 11:32

... per line using a [do] ... [loop] 40 0 [do]    [i] dup ... [if] cr [then]    3 .r [loop] cr Nicely done, but with ... lose the data -------------------- With [do] [loop] write: ... [do] ( create and initialise ... the loop; [do] etc have to be defined; all interpret mode...can be used independently of loops, where data can be tucked...
Show full article (5.00Kb) · Show article thread
A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Gerry
Date: Dec 27, 2007 08:29

... is not available in interpreter mode of course. ROLL is indispensable for using...char>lower over c! ( -- caddr ) char+ loop drop ; \ Compare string ca u with...... ca2 u2 f1 ca u ) loop 2drop ( -- fn ) ; \ skip over the first... [leave] [then] [i] 4 .r [loop] cr --------------------------------------------- Again it works with GForth...
Show full article (7.68Kb) · Show article thread
Re: A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Aleksej Saushev
Date: Dec 31, 2007 03:22

... \ Display 0 to 39 with 10 integers per line using a [do] ... [loop] 40 0 [do]    [i] dup 10 mod 0=    [if] cr [then]    3 .r [loop] cr Nicely done, but with "marker" or "forget" there would be ... lay the problem this way: if anyone asks for run-time do-loop, what should we recommend him? -- CKOPO CE3OH...
Show full article (4.39Kb) · Show article thread
Re: A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Gerry
Date: Dec 30, 2007 13:16

...sod the psychological issues. \ Display 0 to 39 with 10 integers per line using a [do] ... [loop] 40 0 [do]    [i] dup 10 mod 0=    [if] cr [then]    3 .r [loop] cr Nicely done, but with "marker" or "forget" there would be less brackets, and it would be much simpler....
Show full article (3.55Kb) · Show article thread
Re: A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Aleksej Saushev
Date: Dec 30, 2007 12:05

... for human to read, and not "each to his own". \ Display 0 to 39 with 10 integers per line using a [do] ... [loop] 40 0 [do]    [i] dup 10 mod 0=    [if] cr [then]    3 .r [loop] cr Nicely done, but with "marker" or "forget" there would be less brackets, and it would be much simpler.  So, ...
Show full article (2.88Kb) · Show article thread
Re: A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Gerry
Date: Dec 30, 2007 04:58

... others would put the whole definition into 1 line. Each to his own. : [+loop]  ( step -- )    >r 2 [nr>]              ( -- lim i )    2dup r@ ... \ Display 0 to 39 with 10 integers per line using a [do] ... [loop] 40 0 [do]    [i] dup 10 mod 0=    [if] cr [then]    3 .r [loop] cr Nicely done, but with "marker" or "forget" there would be...
Show full article (3.49Kb) · Show article thread
Re: A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Aleksej Saushev
Date: Dec 29, 2007 11:43

..." be written on a single line? Lispniks have special "unless" name for it. : [+loop] ( step -- ) r 2 [nr>] ( -- lim i ) 2dup r@ + 2swap ( --...> \ Display 0 to 39 with 10 integers per line using a [do] ... [loop] 40 0 [do] [i] dup 10 mod 0= [if] cr [then] 3 .r [loop] cr Nicely done, but with "marker" or "forget" there would be ...
Show full article (1.82Kb) · Show article thread
Re: A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Gerry
Date: Dec 28, 2007 14:19

... speed things up by doing ROLL and -ROLL recursively like this and both about equally fast c.q. slow: : ROLL         DUP         IF      SWAP R 1- RECURSE SWAP EXIT         THEN         DROP     ;   ANS : -ROLL         DUP         IF      ROT R 1- RECURSE ...   THEN         DROP     ; <snip> Yes your -ROLL is certainly faster than mine. However...
Show full article (0.68Kb) · Show article thread
Re: A role for roll? Re: Interpreter mode loops     

Group: comp.lang.forth · Group Profile · Search for A role for roll Re Interpreter mode loops in comp.lang.forth
Author: Coos Haak
Date: Dec 27, 2007 10:26

...away here if you hate inefficiency! : -roll ( xu ... x0 u -- x0 xu ......dup 0 ?do dup r roll loop drop ; If you don't... things up by doing ROLL and -ROLL recursively like this and both... equally fast c.q. slow: : ROLL DUP IF SWAP R 1-... SWAP EXIT THEN DROP ; ANS : -ROLL DUP IF ROT R 1-...
Show full article (1.09Kb) · Show article thread