partition :: (a -> Boolean) -> Array a -> Pair (Array a) (Array a)
See original GitHub issueHaskell provides partition
in Data.List, but it’s just one of many partition
functions. Can we generalize? The first step might be to accept any Foldable:
partition :: Foldable f => (a -> Boolean) -> f a -> Pair (Array a) (Array a)
Could we go one step further by parameterizing Array
in the return type? Would adding a Monoid constraint to f
be sufficient?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Three way partitioning of an array around a given range
Given an array and a range [lowVal, highVal], partition the array around the range such that array is divided in three parts.
Read more >Data.Array - purescript-arrays - Pursuit
Partition an array using a predicate function, creating a set of new arrays. One for the values satisfying the predicate function and one...
Read more >partition - Kotlin Programming Language
Splits the original array into pair of lists, where first list contains elements for which predicate yielded true , while second list contains...
Read more >Divide 2n array in n group in Java [closed] - Stack Overflow
Given an array of even length, and a pairwise validity test, I must partition the array elements into pairs that each pass the...
Read more >Determine whether an array can be divided into pairs with a ...
Explanation: Array can be divided into pairs {(2, 4), (9, 3), (1, 5)} where the sum of elements in each pair is divisible...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was imagining something like this:
Does this seem reasonable?
Ahhh…we want
tagBy
to be exclusive.