Utilities · zero-dependency · MIT

larzset

A real set type - union, intersect, difference, and more.

Built on a dict-as-membership-map (keys only, values unused) - every function takes/returns a plain dict, so a set stays easy to inspect or print, no opaque Set class to unwrap. union/intersect/difference/symmetric_difference/is_subset, the full classic vocabulary.

larzscript pkg install set
View on GitHub →Learn the stack

What you get

Try it

import "set" as set
let a = set.from_list([1, 2, 3])
let b = set.from_list([2, 3, 4])
print(set.to_list(set.union(a, b)))
print(set.to_list(set.intersect(a, b)))
print(set.to_list(set.difference(a, b)))
print(set.has(a, 2))
Output
[1, 2, 3, 4]
[2, 3]
[1]
true

Why it's in the Larz Stack

larzset is a real Larzscript package (larzscript pkg install set) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.