
18 Jul
2012
18 Jul
'12
3:39 a.m.
I can think of two cases where I'd want something like this. One is manipulating file extensions, where I'd want to use System.FilePath.splitExtension or something like that anyway. The other is suffix stripping for text processing, where I'd want to use a trie to match a whole lot of possible suffixes.
For what it's worth, there are a lot of other cases (outside of file path handling) in which I've found it useful.
I also have 'rdrop' and 'rdropWhile' and 'rstrip' in my stdlib, and use them regularly, if not frequently, along with List.isSuffixOf. Yes, they're inefficient for long lists and hang on infinite ones, but there are still lots of short lists out there.