Name a phobos function!

Dukc ajieskola at gmail.com
Mon Mar 15 20:50:22 UTC 2021


On Monday, 15 March 2021 at 16:37:08 UTC, Imperatorn wrote:
>
> Could it be named just split? Overload? 🤔

It would be a bad idea IMO to overload `split`, as that's 
`std.array` function that splits eagerly. Protoname `splitBy` 
splits lazily.

However, there is a possibility to overload `splitter` instead. 
Normally, with a binary predicate, it takes a separator element 
or a separator range, but if it took neither it could act as the 
protoname `splitBy`, by comparing adjacent elements.

Also it could perhaps have a default predicate like rest or the 
`splitter` binary predicates, so that 
`[1,2,3,3,4,5,5,6].splitter.equal([[1,2,3],[3,4,5],[5,6]])`.


More information about the Digitalmars-d mailing list