diff options
Diffstat (limited to 'nfib_nsa.icl')
-rw-r--r-- | nfib_nsa.icl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/nfib_nsa.icl b/nfib_nsa.icl new file mode 100644 index 0000000..5764e8f --- /dev/null +++ b/nfib_nsa.icl @@ -0,0 +1,26 @@ +module nfib_nsa + +// compile with -nsa -h 2000m -gci 2000m + +(+) :: !Int !Int -> Int +(+) a b = code inline { + addI +} + +(-) :: !Int !Int -> Int +(-) a b = code inline { + subI +} + +(<) :: !Int !Int -> Bool +(<) a b = code inline { + ltI +} + +nfib :: Int -> Int +nfib n + | n < 2 + = 1 + = nfib (n-2) + nfib (n-1) + 1 + +Start = nfib 34 |