fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 240: Sort 2 lists together
Idiom # 240: Sort 2 lists together
See
programming-idioms.org
:
Code
sort list b based on the sorting of list a
Code input
s := a.zip b x,y->(x,y) .sort_by (x,y -> x.0 <= y.0) a := s.map v->v.0 b := s.map v->v.1
What are effects?
Running Example
Code input
ex240 is a0 := [ "siebenundvierzig", "elf", "null", "acht", "fünfzehn" ] b0 := [ "47", "11", "0", "8", "15" ] s := a0.zip b0 x,y->(x,y) .sort_by (a,b -> a.0 <= b.0) a1 := s.map v->v.0 b1 := s.map v->v.1 say a1 say b1
What are effects?
last changed: 2025-05-13
next: NYI: Idiom # 241: Yield priority to other threads