[Haskell-beginners] can this be made shorter?
Felipe Almeida Lessa
felipe.lessa at gmail.com
Wed May 29 21:44:35 CEST 2013
Well, you could use:
null . dropWhile (`elem` "./")
On Wed, May 29, 2013 at 4:38 PM, Emmanuel Touzery <etouzery at gmail.com> wrote:
> i want to know if a string contains only "." and "/" characters.
> i do something like that:
> null . dropWhile (\c -> c == '.' || c == '/')
> now it's a shame, because if I wanted only to check for "." then I would
> null . dropWhile (=='.')
> afaik in scala you can say:
> null . dropWhile (_ == '.' || _ == '/')
> which is a bit more compact than the haskell...
> I was thinking to use "and" but I'm not sure it would end up being
> Any idea? Or I am trying too hard to make it compact?
> Beginners mailing list
> Beginners at haskell.org
More information about the Beginners