logoalt Hacker News

jaspingrobus • yesterday at 5:07 PM • 0 replies • view on HN

I think you can do this in Clojure:

  (defn greet
    ([] "Hello!")
    ([name] (str "Hello, " name "!"))
    ([name title] (str "Hello, " title " " name "!")))
Which one could argue is cleaner for multiple arguments, but you can't pattern match on arguments themselves this way (but you can using multimethod)