Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.35 KB | None | 0 0
  1. (*
  2. Use like this:
  3.  
  4. for 0 to 3 fn x => (
  5.   print (Int.toString x);
  6.   print "\n"
  7. );
  8.  
  9. *)
  10.  
  11. fun to (start, max) = if start >= max then
  12.                           []
  13.                       else
  14.                           start :: to((start+1), max)
  15.  
  16. fun foreach list func = app func list
  17.  
  18. fun for start listop max func = foreach (listop (start, max)) func
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement