lean4-htt/tests/lean/run/infix_paren.lean
Leonardo de Moura f4ebd38ce3 feat(frontends/lean/builtin_exprs): improve infix paren notation
After this commit, `(+)` is notation for (add) instead of `(fun x y, add x y)`.
This change is relevant when defining type class instances such as

```lean
instance semigroup_to_is_associative [semigroup α] : is_associative α (*) :=
⟨mul_assoc⟩
```
2017-04-27 12:33:33 -07:00

32 lines
526 B
Text

open list
#eval filter (< 10) [20, 5, 10, 3, 2, 14, 1]
#eval qsort (λ x y, x < y) [20, 5, 10, 3, 2, 14, 1]
#eval foldl (+) 0 [1, 2, 3]
example : foldl (+) 0 [3, 4, 1] = 8 :=
rfl
example : foldl (*) 2 [3, 4, 1] = 24 :=
rfl
#check (+) 1 2
example : (+) 1 2 = 3 :=
rfl
example : (*) 3 4 = 12 :=
rfl
example : (++) [1,2] [3,4] = [1,2,3,4] :=
rfl
example : (++) [1,2] [3,4] = [1,2] ++ [3,4] :=
rfl
/-
(-) is rejected since we have prefix notation for -
-/
example : list.foldr (::) [] [1, 2, 3, 4] = [1, 2, 3, 4] :=
rfl