-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A closure sample to test a recent bugfix
- Loading branch information
Amos Wenger
committed
Jun 8, 2012
1 parent
4d54877
commit bb9ed43
Showing
3 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
|
||
Jar: class <Xaneon> { | ||
_cookie: Xaneon | ||
|
||
cookie: func ~set (=_cookie) | ||
|
||
withCookie: func (falafel: Func (Xaneon)) { | ||
falafel(_cookie) | ||
} | ||
} | ||
|
||
#specialize Jar<Char> // binks | ||
|
||
main: func { | ||
j := Jar<Int> new() | ||
j cookie(99) | ||
j withCookie(|c| | ||
printf("j's cookie = %d\n", c) | ||
) | ||
|
||
k := Jar<Char> new() | ||
k cookie('c') | ||
k withCookie(|c| | ||
printf("k's cookie = %d\n", c) | ||
) | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Main: sorting.ooc | ||
Main: closure.ooc |