Concatenative language
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: [{ **************************************** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * }] = [[Tal|Uxntal]] = [{ |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 }] = [[Factor]] = [factor{: draw-stars ( -- ) 20 [1..b] [ 40 [1..b] swap '[ _ divisor? "*" " " ? write ] each nl ] each ;}] = [[Uiua]] = [{≡&p⊏:" *"=0⊞◿∩(+1⇡)20 40}] = [[Callisto]] = [{ include "cores/select.cal" include "std/io.cal" let cell x let cell y while y 20 < do while x 40 < do if x 1 + y 1 + % 0 = then '*' print_ch else ' ' print_ch end x 1 + -> x end new_line y 1 + -> y 0 -> x end }]
Describe this revision:
Save