Monday, August 10, 2009

Forth - inlined data


\ Created 20-Apr-2009
\ Example of how to create custom commands that read data from
\ the source file itself

: line# ( n -- ) ." line " . ." : " ;
: line ( n -- ) line#
refill drop
source type
cr ;

: scanit 1 line 2 line refill drop ;

cr

scanit
this is the first line
this is the second line

." Finished" cr
bye

No comments: