Concatenative topics
Concatenative meta
Other languages
Meta
Stars is a classic forth example in which for a height of 20 lines, it draws 40 stars wide, and for each x y % 0 = draws a star, it should look like this:
****************************************
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * *
* * * * * * * *
* * * * * *
* * * * *
* * * * *
* * * *
* * * *
* * *
* * *
* * *
* *
* *
* *
* *
* *
* *
* *
|0100 ( -> )
#1501
&for-i ( limit i -- )
STHk #2901
&for-j ( limit j -- )
DUP STHkr DIVk MUL SUB
#202a ROT ?{ SWP } POP #18 DEO
INC GTHk ?&for-j
POP2 POPr
#0a18 DEO
INC GTHk ?&for-i
POP2
BRK: draw-stars ( -- ) 20 [1..b] [ 40 [1..b] swap '[ _ divisor? "*" " " ? write ] each nl ] each ;
This revision created on Fri, 8 Mar 2024 20:06:42 by SnufkinVC (Format tal example.)