Hacker News new | past | comments | ask | show | jobs | submit login

The same thing in Clojure (untested):

(doseq [[a c] (zip ["dog" "cat" "bird"] ["brown" "black" "red"])] (print "See the " c a "?"))

Haskell:

mapM_ (\(a, c) -> putStrLn $ "See the " ++ c ++ " " ++ a ++ "?") (zip ["dog", "cat", "bird"] ["brown", "black", "red"])

edit: one can do way more complicated stuff with the list monad in Haskell and the very comprehensive core lib in Clojure; I'm sure even these examples can still be made a little bit shorter and more readable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: