Skip to content

Instantly share code, notes, and snippets.

@treed
Created July 14, 2009 21:15
Show Gist options
  • Save treed/147200 to your computer and use it in GitHub Desktop.
Save treed/147200 to your computer and use it in GitHub Desktop.
.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