fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 100: Sort by a comparator
Idiom # 100: Sort by a comparator
See
programming-idioms.org
:
Code
items.sort c
What are effects?
Running Example
ex100 is items := [ "siebenundvierzig"; "elf"; "null"; "acht"; "fünfzehn" ] c (String, String) -> bool := a,b -> a.byte_length <= b.byte_length say (items.sort_by c) # passing the lambda directly to sort avoids # specifying its type: # say (items.sort_by (a,b -> a.byte_length <= b.byte_length))
What are effects?
last changed: 2024-07-01
next: NYI: Idiom # 101: Load from HTTP GET request into a string