Created
August 7, 2025 06:29
-
-
Save thelissimus/b8937b169cc0c093a569235c78de373b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def headOpt (xs : List α) : Option α := | |
| match xs with | |
| | x :: _ => some x | |
| | [] => none -- need to introduce `Option` to handle the empty list case | |
| def head (xs : List α) (h : xs ≠ []) : α := | |
| match xs with | |
| | x :: _ => x | |
| -- no need to handle empty list case as it is impossible |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment