Skip to content

Instantly share code, notes, and snippets.

@t0yv0
Created July 15, 2010 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t0yv0/476646 to your computer and use it in GitHub Desktop.
Save t0yv0/476646 to your computer and use it in GitHub Desktop.
class functional_point y =
object
val x = y
method get_x = x
method move d = {< x = x + d >}
end
#let p = new functional_point 7;;
val p : functional_point = <obj>
#p#get_x;;
- : int = 7
#(p#move 3)#get_x;;
- : int = 10
#p#get_x;;
- : int = 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment