When I write a function call like this (my-function [a b c]) in Clojure. How does Clojure find my-function? Does it perform a lookup from global/per-namespace symbol table?
I’m assuming the symbol table is implemented as a hashtable which provides O(1) time complexity for lookup. It also needs to compare the function name as a string with the symbol from the table which should take O(n) time (n is the length of the symbol). It means the longer of the symbol the slower the name resolution would be. Is it correct?
namespaces indeed behave as maps and you can look at them directly with the
ns-mapfunction:more specifically they map vars to objects.
if you really do want a function to be looked up in it’s var so changes propagate through your program instantly you can call the var instead of the function that was contained in the var at compile time, which results in a lookup on every call: