diff --git a/testfiles/fac.f b/testfiles/fac.f new file mode 100644 index 0000000..e2d6e4f --- /dev/null +++ b/testfiles/fac.f @@ -0,0 +1,21 @@ +: fac ( num -- out ) + dup 1 > if dup 1- recurse * then ; + +: 0bye ( num -- ) + 0= if bye then ; + +: xdrop ( count -- ) + 0 do drop loop ; + +: >single ( c-addr u1 -- u2 ) + 0 0 2swap >number 3 xdrop ; + +30 chars buffer: buf + +." Number: " +buf 30 accept dup 0bye +buf swap >single + +." Factorial of " dup . ." is " + +fac . cr