Am Mittwoch, den 05.12.2018, 13:50 +0100 schrieb Jan Kromhout via
Amforth-devel:
> Hello
> 
> 
> I wont to use the forward declaration “forward:” to solve my
> recursive word roll.
> 
> Is this use of forward: correct?

the forward declaration is for cases in which
one word calls another one before the other
one is defined. Something like

: foo bar ;
: bar foo ;



> 
> forward: roll
> 
> : roll
>   dup 0<  \ 0<=
>   if
>     drop
>   else
>     swap >r 1- roll r> swap
> then
> ;

Replace the roll inside your definition with 
recurse and it should work (if the
code is correct, I did not check it)

> 
> When I look into the definition of forward: I find the word “iplace”.

Oops. I'll update the docs.

> What is this iplace?


\ copy a counted flash string to ram
: iplace ( f-addr r-addr -- )
  >r icount $ff and ( -- f-addr' len )
  dup r@ c! r>  ( -- f-addr' len r-addr)
  1+ rot rot
  2/ 1+ bounds ?do
    i @i over !
    cell+
  loop
  drop
;

Matthias



_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to