home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / Caml Light 0.7 / examples / asl / example.asl < prev    next >
Encoding:
Text File  |  1995-06-01  |  480 b   |  21 lines  |  [TEXT/MPS ]

  1. 1;
  2. + 2 ((\x.x) 3);
  3. if + 0 1 then 1 else 0 fi;
  4. let f = \x. + x 1;
  5. let I = \x. x;
  6. let x = I (f 2);
  7. let g = \x.x 1;
  8. + (I 1) (I I 2);
  9. (\x.x x) (\x.x);
  10. (if x then (\x.x) else 2 fi) 0;
  11. let Z = \f. (\x.f(\y.x x y)) (\x.f(\y.x x y));
  12. let Z = \f. (\V.V (magic V)) (\x.f(\y.magic x x y));
  13. let fact = Z (\fact.\n. if = n 0 then 1 else * n (fact (- n 1)) fi);
  14. fact 8;
  15. let fib = Z (\fib.\n.
  16.   if = n 1 then 1
  17.   else if = n 2 then 1 else + (fib(- n 1)) (fib(- n 2)) fi fi
  18. );
  19. fib 9;
  20. + (\x.x) 1;
  21.