6 ms·
A mandatory smart-ass Haskell response import System.Environment (getArgs) main = do [str] <- getArgs putStrLn $ take 12 str
by edofic 11y ago
A mandatory smart-ass Haskell response
import System.Environment (getArgs)
main = do
[str] <- getArgs
putStrLn $ take 12 str
- nicolast 11y agoNow with more operators! import System.Environment (getArgs) main = putStrLn =<< take 12 . head <$> getArgs ;-)
- coldtea 11y agoWell, for smart-ass (and I know you meant it as a joke) is not very impressive. Don't do anything more than the others, and the syntax is not so great either.
- Veedrac 11y agoOn the contrary, his is the only one that crashes when more arguments than expected are passed. Hooray progress!
- joeyh 11y agoThe actual smart-ass haskell response is simply "take 12". The spec didn't specify this needed to be a impure shell command, so a pure function is obviously better.