Advertisement
Guest User

Untitled

a guest
May 25th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. fun int fibo(int n) =
  2. if n == 0 then 0
  3. else if n == 1 then 1
  4. else fibo(n - 1) + fibo(n - 2)
  5.  
  6. fun int factorial(int n) =
  7. if n == 0 then 1
  8. else n * factorial(n-1)
  9.  
  10. fun bool getBool(bool b) =
  11. !!b
  12.  
  13. fun bool nega(bool a) =
  14. a
  15.  
  16. fun int write_int(int x) = write(x)
  17.  
  18. fun [int] write_int_arr([int] x) = map(write_int, x)
  19.  
  20. fun [int] main() =
  21. let n = read(int) in
  22. let z = iota(n) in
  23. write_int_arr(map(fn int (int x) => factorial(x+1), z))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement