DEV Community

Discussion on: Daily Challenge #184 - Form the Minimum

Collapse
 
craigmc08 profile image
Craig McIlwrath

Haskell. Also works for empty lists, returns 0.

import Data.List (nub, sort)
import Data.Maybe (fromMaybe) 
import Text.Read (readMaybe) 

minVal :: [Int] -> Int
minVal = fromMaybe 0 . readMaybe . concatMap show . sort . nub 
Collapse
 
not_jffrydsr profile image
@nobody

this is why Haskell scares me :o
that looks like Overlord Wizardry compared
to Clojure