fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 218: List intersection
Idiom # 218: List intersection
See
programming-idioms.org
:
Code
creates an intersection of two sets
intersection(T type: has_equality, s1, s2 container.Set T) => # NYI: intersection missing from stdlib s1.as_list.filter (x -> s2.contains x) c := intersection a b
What are effects?
Running Example
ex218 is intersection(T type: property.equatable, s1, s2 container.Set T) => # NYI: intersection missing from stdlib s1.as_list.filter (x -> s2.contains x) a := ["eins", "zwei", "drei"] b := ["drei", "vier", "fünf"] c := intersection (container.set_of_ordered a) (container.set_of_ordered b) say c
What are effects?
last changed: 2024-07-01
next: Idiom # 219: Replace multiple spaces with single space