Skip to content

Instantly share code, notes, and snippets.

@dce
Created June 22, 2011 13:31
Show Gist options
  • Save dce/1040095 to your computer and use it in GitHub Desktop.
Save dce/1040095 to your computer and use it in GitHub Desktop.
How to make a closure in IO (http://www.iolanguage.com/)
Io> make_adder := method(x, block(y, x + y))
==> method(x,
block(y, x + y)
)
Io> add5 := make_adder(5)
==> method(y,
x + y
)
Io> add5 call(3)
==> 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment