RosettaCodeData/Task/Pascals-triangle/Forth/pascals-triangle-1.fth
2023-07-01 13:44:08 -04:00

11 lines
277 B
Forth

: init ( n -- )
here swap cells erase 1 here ! ;
: .line ( n -- )
cr here swap 0 do dup @ . cell+ loop drop ;
: next ( n -- )
here swap 1- cells here + do
i @ i cell+ +!
-1 cells +loop ;
: pascal ( n -- )
dup init 1 .line
1 ?do i next i 1+ .line loop ;