Parentheses are the first thing any newcomer notices about Lisp program. This is something that put off many who does not want to learn the language just by looking at the syntax. However, If they think that there are too many parentheses, do they actually count them? Let's look at a fragment of java code:
Now, below is how equivalent Lisp code could look like (let it be in Clojure as an example)
public static void closeSocket(final Socket socket) { try { socket.close(); } catch (IOException e) { LOG.error("Error closing socket " + socket, e); } }Total: 14 braces and parentheses.
Now, below is how equivalent Lisp code could look like (let it be in Clojure as an example)
(defn closeSocket [^:Socket socket] (try (.close socket)
(catch IOException e (LOG/error (str "Error closing socket " socket) e)))))
Total: 14 braces and parentheses.
Now I would say that those who reject a language judging by it's syntax do not even look at syntax closely.
No comments:
Post a Comment