Skip to content

Commit

Permalink
add head function
Browse files Browse the repository at this point in the history
  • Loading branch information
simvux committed Dec 14, 2024
1 parent 896f26b commit a2be4c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions luminapath/std/list/lib.lm
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ pub fn sortBy f list as fn(a, a -> Ordering), [a] -> [a] =
then sortBy #f new
else new

pub fn head list as [a] -> a =
match list
| [x : _] -> x
| [] -> io:crash "attempted to get head of empty list"

// TODO: Considder splitting equality out from Compare
// (Eq + Ordering)
//
Expand Down

0 comments on commit a2be4c9

Please sign in to comment.