Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

99 Elm Problems/Problem 1/Solutions

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Solution 1: Recursive search for the last element myLast list = case list of [] -> Nothing [a] -> Just a b::c -> myLast c Solution 2: Reverse and take the head myLast = List.reverse >> List.head Solution 3: Using List.foldl myLast = List.foldl (\x _ -> Just x) Nothing