Created
July 14, 2009 21:15
-
-
Save treed/147200 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
.sub 'infix:-' :multi('CardinalArray','CardinalArray') | |
.param pmc this | |
.param pmc that | |
.local pmc array, hash, key, includes | |
.local int i, len | |
array = new 'CardinalArray' | |
hash = new 'CardinalHash' | |
len = that.'size'() | |
i = 0 | |
hash_loop: | |
if i == len goto hash_done | |
key = that[i] | |
hash[key] = 1 | |
i = i + 1 | |
goto hash_loop | |
hash_done: | |
len = this.'size'() | |
i = 0 | |
diff_loop: | |
if i == len goto diff_done | |
key = this[i] | |
includes = hash.'includes?'(key) | |
unless includes goto diff_loop | |
array.'push'(key) | |
goto diff_loop | |
diff_done: | |
.return (array) | |
.end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment