fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 113: Iterate over map entries, ordered by values
Idiom # 113: Iterate over map entries, ordered by values
See
programming-idioms.org
:
Code
items := mymap.items.sort (a,b -> a.1 <= b.1) for i in items do (k,x) := i say "$k => $x"
What are effects?
Running Example
ex113 is mymap := (container.ordered_map [ "un", "une", "deux", "trois", "quatre" , "cinq" ] [ "ichi", "ichi", "ni", "san" , "shi/yon", "go" ] ) items := mymap.items.sort_by (a,b -> a.1 <= b.1) for i in items do (k,x) := i say "$k => $x"
What are effects?
last changed: 2024-07-01
next: Idiom # 114: Test deep equality