File tree 2 files changed +12
-0
lines changed
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
186
186
∈⇒≤product : All NonZero ns → n ∈ ns → n ≤ product ns
187
187
concatMap-++ : concatMap f (xs ++ ys) ≡ concatMap f xs ++ concatMap f ys
188
188
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
+ ([] , [])
189
193
```
190
194
191
195
* 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
1294
1294
... | true = Product.map s≤s m≤n⇒m≤1+n ih
1295
1295
... | false = Product.map m≤n⇒m≤1+n s≤s ih
1296
1296
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
+
1297
1305
------------------------------------------------------------------------
1298
1306
-- _ʳ++_
1299
1307
You can’t perform that action at this time.
0 commit comments