Skip to main content
deleted 7 characters in body
Source Link
hao
  • 486
  • 2
  • 8

There's a little-known function from Data.List called nub. It's particularly good for code golfing.

import Data.List
exactlyOneVowel :: String -> Bool
exactlyOneVowel = (== 1) . length . nub . sort . filter (`elem` "aeiouyAEIOUY")

I believe this satisfies all the constraints of the problem, and is unfortunately O(#characters ^ 2).

There's a little-known function from Data.List called nub. It's particularly good for code golfing.

import Data.List
exactlyOneVowel :: String -> Bool
exactlyOneVowel = (== 1) . length . nub . sort . filter (`elem` "aeiouyAEIOUY")

I believe this satisfies all the constraints of the problem, and is unfortunately O(#characters ^ 2).

There's a little-known function from Data.List called nub. It's particularly good for code golfing.

import Data.List
exactlyOneVowel :: String -> Bool
exactlyOneVowel = (== 1) . length . nub . filter (`elem` "aeiouyAEIOUY")

I believe this satisfies all the constraints of the problem, and is unfortunately O(#characters ^ 2).

added 107 characters in body
Source Link
hao
  • 486
  • 2
  • 8

There's a little-known function from Data.List called nub. It's particularly good for code golfing.

import Data.List
exactlyOneVowel :: String -> Bool
exactlyOneVowel = (== 1) . length . nub . sort . filter (`elem` "aeiouyAEIOUY")

I believe this satisfies all the constraints of the problem, and is unfortunately O(#characters ^ 2).

There's a little-known function from Data.List called nub. It's particularly good for code golfing.

import Data.List
exactlyOneVowel :: String -> Bool
exactlyOneVowel = (== 1) . length . nub . sort . filter (`elem` "aeiouyAEIOUY")

There's a little-known function from Data.List called nub. It's particularly good for code golfing.

import Data.List
exactlyOneVowel :: String -> Bool
exactlyOneVowel = (== 1) . length . nub . sort . filter (`elem` "aeiouyAEIOUY")

I believe this satisfies all the constraints of the problem, and is unfortunately O(#characters ^ 2).

Source Link
hao
  • 486
  • 2
  • 8

There's a little-known function from Data.List called nub. It's particularly good for code golfing.

import Data.List
exactlyOneVowel :: String -> Bool
exactlyOneVowel = (== 1) . length . nub . sort . filter (`elem` "aeiouyAEIOUY")