Created
July 13, 2009 21:40
-
-
Save treed/146470 to your computer and use it in GitHub Desktop.
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
a = [1,2,3] | |
puts a | |
a = a * 3 | |
puts a | |
a = [1,2,3] | |
a = a * ":" | |
puts a |
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
.sub 'infix:*' :multi('CardinalArray','CardinalInteger') | |
.param pmc this | |
.param pmc count | |
.local pmc array | |
.local int i | |
say "Entered *i" | |
i = count | |
if i > 0 goto sane | |
$P0 = undef() | |
.return ($P0) | |
sane: | |
say "Verified sanity" | |
array = new 'CardinalArray' | |
loop: | |
say "Beginning loop." | |
array.'append'(this) | |
say "Appended array." | |
dec i | |
say "dec i" | |
say i | |
if i > 0 goto loop | |
say "about to return" | |
.return (array) | |
.end |
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
[14:35] [inara:/Users/treed/code/cardinal]% ./cardinal arraytest.rb | |
[1, 2, 3] | |
Entered *i | |
Verified sanity | |
Beginning loop. | |
Appended array. | |
dec i | |
2 | |
Beginning loop. | |
Appended array. | |
dec i | |
1 | |
Beginning loop. | |
zsh: bus error ./cardinal arraytest.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment