Vector-like operations on python lists

Unique

  • Unique, append
from rlike import *
x = [1, 2, 4, 3, 3]
append(x, [10, 11], 101)
[1, 2, 4, 3, 3, 10, 11, 101]
unique(x)
[1, 2, 3, 4]

Sets

  • Set operations
x = [1, 2, 3, 3]
y = [3, 4, 6]
union(x, y)
[1, 2, 3, 4, 6]
setdiff(x, y)
[1, 2]
intersect(x, y)
[3]
  • Checking a value among a set
x = [1, 2, 4, 3, 3]
y = [3, 4, 6]
match(x, y)
[None, None, 1, 0, 0]
match(y, x)
[3, 2, None]
match_arg('y', ['x', 'y', 'z'])
'y'