4 ms·
I think the problem hovers around the idea of first class ness. In Clojure, I can use a function like '<' as a key in a hashmap. In Python, I can't. Because '<'
by nickbauman 10y ago
I think the problem hovers around the idea of first class ness. In Clojure, I can use a function like '<' as a key in a hashmap. In Python, I can't. Because '<' isn't a function, it's an operator in Python. First classedness has to do with non-complectedness. Python has operators and statements in addition to expressions. Clojure, because it's a Lisp, gets by with just expressions.
- BeetleB 10y agoActually, yes you can in Python - indirectly. Most of the usual operators can be imported as functions: from operator import lt will get you '<' as a function.
- nickbauman 10y agoBut I have to use lt as a key, I can't use <. Important difference, no? Writing a DSL is much easier with that difference.