File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,10 @@ Additions to existing modules
186186 ∈⇒≤product : All NonZero ns → n ∈ ns → n ≤ product ns
187187 concatMap-++ : concatMap f (xs ++ ys) ≡ concatMap f xs ++ concatMap f ys
188188 filter-≐ : P ≐ Q → filter P? ≗ filter Q?
189+
190+ partition-is-foldr : partition P? ≗ foldr (λ x → if does (P? x) then Product.map₁ (x ∷_)
191+ else Product.map₂ (x ∷_))
192+ ([] , [])
189193 ```
190194
191195* In ` Data.List.Relation.Unary.Any.Properties ` :
Original file line number Diff line number Diff line change @@ -1294,6 +1294,14 @@ module _ {P : Pred A p} (P? : Decidable P) where
12941294 ... | true = Product.map s≤s m≤n⇒m≤1+n ih
12951295 ... | false = Product.map m≤n⇒m≤1+n s≤s ih
12961296
1297+ partition-is-foldr : partition P? ≗ foldr
1298+ (λ x → if does (P? x) then Product.map₁ (x ∷_) else Product.map₂ (x ∷_))
1299+ ([] , [])
1300+ partition-is-foldr [] = refl
1301+ partition-is-foldr (x ∷ xs) with ih ← partition-is-foldr xs | does (P? x)
1302+ ... | true = cong (Product.map₁ (x ∷_)) ih
1303+ ... | false = cong (Product.map₂ (x ∷_)) ih
1304+
12971305------------------------------------------------------------------------
12981306-- _ʳ++_
12991307
You can’t perform that action at this time.
0 commit comments