Skip to content

Conversation

@codygman
Copy link

I'm guessing more will need to be done to get this merged, but I think it would be pretty useful.

@codygman codygman force-pushed the add-groupby-initial branch from 27ddd81 to 61b3968 Compare November 22, 2016 06:01
Copy link
Contributor

@Bodigrim Bodigrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not omit type signatures. They make code easier to read.


{-# INLINE groupBy #-}
groupBy k xs =
switchL []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point? Why not pattern-match immediately?

groupBy k [] = [] 
groupBy k (h : t) = ...

xs

-- | 'findIndexOrEnd' is a variant of findIndex, that returns the length
-- of the string if no element is found, rather than Nothing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it faster than fromMaybe len (findIndex p)?
I think it is better to pattern-match on result of findIndex in groupBy: if it's Nothing you do not need to make another recursive call.

@Shimuuar
Copy link
Contributor

Superseded by #427

@Shimuuar Shimuuar closed this Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants