Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some quick tips. “intersperse ", " >>> mconcat” is “intercalate ", "”, and I would prefer “.” to “>>>”. Even though left-to-right composition reads better to me, right-to-left is the style.

Gratuitious pointfree version (imports omitted):

    go :: (Show k, Eq k) => Map k v -> Map k v -> String
    go = orNone . intercalate ", " . sort . map show .: (++) `on` keys
      where
      orNone [] = "<none>"
      orNone e = e
      f .: g = (f .) . g
      infixr 8 .:


Nice! I had (.) originally but reorganized it to compare better with the Clojure code. I really like (.:) and on though (which I'm always forgetting about).




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

Search: