Initial Import from SVN

This commit is contained in:
Matt Jenkins
2014-04-09 14:27:18 +01:00
parent 8976e834c4
commit 895f96d2f7
3153 changed files with 748589 additions and 0 deletions

23
share/example/fact.fth Normal file
View File

@@ -0,0 +1,23 @@
\ Iterative factorial function.
." Defining fact function ... "
: fact ( n -- n! )
dup 2 < if drop 1 else
dup begin 1- swap over * swap dup 1 = until
drop then
; ." done." cr
." 1! = " 1 fact . cr
." 2! = " 2 fact . cr
." 3! = " 3 fact . cr
." 4! = " 4 fact . cr
." 5! = " 5 fact . cr
." 6! = " 6 fact . cr
." 7! = " 7 fact . cr
." 8! = " 8 fact . cr
." 9! = " 9 fact . cr
." 10! = " 10 fact . cr
." 11! = " 11 fact . cr
." 12! = " 12 fact . cr
halt