Why is there no splitBy in the list module?

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Jul 12 10:54:04 EDT 2006

Christian Maeder <maeder at tzi.de> wrote:

> The other versions (not ignoring a final delimiter and deleting all
> empty lists) are desirable, too. Are there any suggestions for
> canonical names? The implementations could be hidden (and more
> efficient) then (by avoiding to traverse a list twice).

Surely list deforestation should take care of the efficiency question?

> splitFields 'a' "baaba" -> ["b", "", "b", ""]
> splitLines  'a' "baaba" -> ["b", "", "b"]
> splitWords  'a' "baaba" -> ["b", "b"]

Did you mean this?

  splitFields 'a' "baaba" -> ["b", "", "", "b", ""]
  splitLines  'a' "baaba" -> ["b", "", "", "b"]
  splitWords  'a' "baaba" -> ["b", "b"]


More information about the Libraries mailing list