text: #!/usr/bin/env spn
  
  /*
   * fibfact.spn
   * recursive and iterative Fibonacci and factorial functions
   *
   * created by Árpád Goretity on 30/09/2013
   */
  
  let fib_rec = fn (n) -> n < 2 ? 1 : fib_rec(n - 1) + fib_rec(n - 2);
  
  let fib_iter = fn (n) {
  	let f1 = 1, f2 = 1;
  	for let i = 0; i < n; i++ {
  		f2 += f1;
  		f1 = f2 - f1; // f1 = previous value of f2
  	}
  
  	return f1;
  };
  
  let fct_rec = fn (n) -> n < 2 ? 1 : n * fct_rec(n - 1);
  
  let fct_iter = fn (n) {
  	let r = 1;
  	for let i = 2; i <= n; i++ {
  		r *= i;
  	}
  
  	return r;
  };
  
  let n = toint($[1], 10);
  
  print(fib_iter(n));
  print(fib_rec(n));
  
  print(fct_iter(n));
  print(fct_rec(n));
  