diff options
author | Camil Staps | 2021-01-07 21:52:21 +0100 |
---|---|---|
committer | Camil Staps | 2021-01-07 21:54:50 +0100 |
commit | c6d632ea339d20ccba169088c389ecf9ee0aa25c (patch) | |
tree | 4da154f0b26b0fe7644d554e86d9821e206879a2 /nfib_nsa.icl | |
parent | Add heap pointer (diff) |
Add version of nfib without strictness analysis
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 |