Guest User

Untitled

a guest
May 24th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. # fun x -> x x;;
  2. - : ('a -> 'b as 'a) -> 'b = <fun>
  3.  
  4. # (fun x -> x x) (fun x -> x x);;
  5. C-c C-cInterrupted.
  6.  
  7. # fun _ -> (fun x -> x x) (fun x -> x x);;
  8. - : 'a -> 'b = <fun>
  9.  
  10. # (fun x -> x x) (fun x -> x x);;
  11. # let x = (fun x -> x x) in x x;; (* applying the function on the left *)
  12. # (fun x -> x x) (fun x -> x x);; (* inlining the let-binding *)
  13. (* We came back to our original state, infinite loop *)
  14.  
  15. $ echo 'let x = (fun x -> x x) (fun x -> x x)' > rectypes.ml
  16. $ ocamlc -i -rectypes rectypes.ml
  17. val x : 'a
  18.  
  19. # let x =
  20. let rec f () = f () in
  21. f ();;
Add Comment
Please, Sign In to add comment