diff --git a/Stdlib/Data/List/Base.juvix b/Stdlib/Data/List/Base.juvix index bc8d0900..de956180 100644 --- a/Stdlib/Data/List/Base.juvix +++ b/Stdlib/Data/List/Base.juvix @@ -165,6 +165,10 @@ head {A} (defaultValue : A) (list : List A) : A := | x :: _ := x | nil := defaultValue; +--- 𝒪(𝓃). Grabs the last element of the given ;List;. +last {A} : A -> List A -> A + | default := reverse >> head default; + syntax iterator any {init := 0; range := 1}; --- 𝒪(𝓃). Returns ;true; if at least one element of the ;List; satisfies the predicate.