What to call a function that splits lists?

I want to write a function that splits lists in sublists according to which elements satisfy a given property p. My question is how to call a function. I will give examples in Haskell, but the same problem would occur in F # or ML.

split :: (a -> Bool) -> [a] -> [[a]]  --- split lists into list of sublists

The subnets combined are the source list:

concat (split p xss) == xs

Each subcomputer satisfies the property initial_p_only p, that is, (A) the subselection begins with an element that satisfies p- and therefore is not empty, and (B) no other elements satisfy p:

initial_p_only :: (a -> Bool) -> [a] -> Bool
initial_p_only p [] = False
initial_p_only p (x:xs) = p x && all (not . p) xs

To be exact,

all (initial_p_only p) (split p xss)

If the very first item in the source list does not satisfy p, the failure is broken.

This function must be called by something else split. What should I name?

+5
2

, , , breakBefore list-grouping.

Data.List.Grouping: http://hackage.haskell.org/packages/archive/list-grouping/0.1.1/doc/html/Data-List-Grouping.html

ghci> breakBefore even [3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6]
[[3,1],[4,1,5,9],[2],[6,5,3,5],[8,9,7,9,3],[2,3],[8],[4],[6],[2],[6]]
+12

- , "break", adamse. . ( , F #).

just breakBefore , :

breakBefore :: Eq a => a -> [a] -> [[a]] 

With - , , . a -> Bool, :

breakBeforeWith :: (a -> Bool) -> [a] -> [[a]]

, By ( group by, ):

breakBeforeBy :: Eq k => (a -> k) -> [a] -> [[a]]

, - , , , , - , . , F #, , (, sort, sortBy sortWith ).

, ( ).

+2

All Articles