Created
June 22, 2011 13:31
-
-
Save dce/1040095 to your computer and use it in GitHub Desktop.
How to make a closure in IO (http://www.iolanguage.com/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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