merge
This commit is contained in:
commit
98cb552b38
3 changed files with 10 additions and 11 deletions
|
@ -301,7 +301,7 @@ evidence that a disjunction holds.
|
|||
We set the precedence of disjunction so that it binds less tightly
|
||||
than any other declared operator.
|
||||
\begin{code}
|
||||
infix 1 _⊎_
|
||||
infixr 1 _⊎_
|
||||
\end{code}
|
||||
Thus, `A × C ⊎ B × C` parses as `(A × C) ⊎ (B × C)`.
|
||||
|
||||
|
|
|
@ -389,7 +389,7 @@ simplify to the same term, and similarly for `inj₂ y`.
|
|||
We set the precedence of disjunction so that it binds less tightly
|
||||
than any other declared operator:
|
||||
```
|
||||
infix 1 _⊎_
|
||||
infixr 1 _⊎_
|
||||
```
|
||||
Thus, `A × C ⊎ B × C` parses as `(A × C) ⊎ (B × C)`.
|
||||
|
||||
|
|
|
@ -115,12 +115,11 @@ _++_ : ∀ {A : Set} → List A → List A → List A
|
|||
[] ++ ys = ys
|
||||
(x ∷ xs) ++ ys = x ∷ (xs ++ ys)
|
||||
```
|
||||
The type `A` is an implicit argument to append, making it a
|
||||
_polymorphic_ function (one that can be used at many types). The
|
||||
empty list appended to another list yields the other list. A
|
||||
non-empty list appended to another list yields a list with head the
|
||||
same as the head of the first list and tail the same as the tail of
|
||||
the first list appended to the second list.
|
||||
The type `A` is an implicit argument to append, making it a _polymorphic_
|
||||
function (one that can be used at many types). A list appended to the empty list
|
||||
yields the list itself. A list appended to a non-empty list yields a list with
|
||||
the head the same as the head of the non-empty list, and a tail the same as the
|
||||
other list appended to tail of the non-empty list.
|
||||
|
||||
Here is an example, showing how to compute the result
|
||||
of appending two lists:
|
||||
|
@ -658,7 +657,7 @@ Show
|
|||
|
||||
Show as a consequence of `foldr-++` above that
|
||||
|
||||
xs ++ ys ≡ foldr _∷_ ys xs
|
||||
xs ++ ys ≡ foldr _∷_ ys xs
|
||||
|
||||
|
||||
```
|
||||
|
@ -792,7 +791,7 @@ foldr-monoid _⊗_ e ⊗-monoid (x ∷ xs) y =
|
|||
In a previous exercise we showed the following.
|
||||
```
|
||||
postulate
|
||||
foldr-++ : ∀ {A : Set} (_⊗_ : A → A → A) (e : A) (xs ys : List A) →
|
||||
foldr-++ : ∀ {A : Set} (_⊗_ : A → A → A) (e : A) (xs ys : List A) →
|
||||
foldr _⊗_ e (xs ++ ys) ≡ foldr _⊗_ (foldr _⊗_ e ys) xs
|
||||
```
|
||||
|
||||
|
@ -1075,7 +1074,7 @@ data merge {A : Set} : (xs ys zs : List A) → Set where
|
|||
→ merge xs ys zs
|
||||
--------------------------
|
||||
→ merge xs (y ∷ ys) (y ∷ zs)
|
||||
```
|
||||
```
|
||||
|
||||
For example,
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue