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:
****************************************
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * *
* * * * * * * *
* * * * * *
* * * * *
* * * * *
* * * *
* * * *
* * *
* * *
* * *
* *
* *
* *
* *
* *
* *
* *
@drawstar ( -> )
#1501
&for-i ( -- )
STHk
#2901
&for-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 17:43:09 by CapitalEx (Add Factor to Examples)