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 ;
≡&p⊏:" *"=0⊞◿∩(+1⇡)20 40
This revision created on Sun, 10 Mar 2024 07:17:59 by razetime (add uiua)