You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
universe u v
variable {α : Type u} {β : Type v}
defList.foldr? (f : α → α → α) : List α → Option α
| [] => none
| a :: as =>
match foldr? f as with
| none => some a
| some b => some (f a b)
#guard [13, 12, 3, 6].foldr? (min · ·) = some 3
#guard [1, 2, 3, 4].foldr? (· + ·) = some 10
#guard ([] : List Nat).foldr? (max · ·) = none
そもそもfoldとOptionの組み合わせで書けるのか?
The text was updated successfully, but these errors were encountered: