fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 246: Count distinct elements
Idiom # 246: Count distinct elements
See
programming-idioms.org
:
Code
c := (container.set_of_ordered items).count
What are effects?
Running Example
ex246 is items := ["Lies", "lies", "lies", "lies", "Gold", "gold", "gold", "gold", "Guns", "guns", "guns", "guns", "Fire", "fire", "fire", "oh!", "Gold", "gold", "gold", "gold", "Church", "church", "church", "church", "Guns", "guns", "guns", "guns", "Fire", "fire", "fire", "oh!", "Oh!"] say items c := (container.set_of_ordered items).count say c
What are effects?
last changed: 2024-07-01
next: Idiom # 247: Filter list in-place