Created
August 10, 2011 14:48
-
-
Save jeremytregunna/1136977 to your computer and use it in GitHub Desktop.
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
| Link: Object | |
| .next: nil | |
| .prev: nil | |
| .value: nil | |
| init: n | |
| .value: n | |
| at: idx | |
| .i: 0 | |
| .element: self clone | |
| message: (element isNil) doUntil: | |
| i == idx ifTrue: (return: element) | |
| .i: i + 1 | |
| .element: element next | |
| Exception raise: "index #{idx} is out of bounds" | |
| size | |
| .element: self clone | |
| .count: 0 | |
| message: (element isNil) doUntil: | |
| .count: count + 1 | |
| .element: element next | |
| count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment