3 ms·
I don't have much experience in CL, but I started to really like the fact that clojure is Lisp 1. When I have a hash map "client", I can use all three: (get cl
by radu_floricica 17y ago
I don't have much experience in CL, but I started to really like the fact that clojure is Lisp 1. When I have a hash map "client", I can use all three:
(get client :phone)
(:phone client)
(client :phone)
It takes some getting used to, but I already came to expect (and enjoy) that any symbol I use can be a function.
- jimbokun 17y agoI also think that reading lots of "funcall"s makes the intent of the code less readily apparent.
- utx00 17y agoit is definitely more verbose and uglier. but in practice it does not seem to be a problem. for instance, comparing to arc, if you had notfn for ~, and testify, you could write all as: (defun all (test seq) (funcall (notfn #'some) (complement (testify test)) seq)) doesn't seem that bad.
- utx00 17y agoin cl, you can use defsetf to almost do the same. as a matter of fact, taking a cue from arc, you can write a macro like: (defmacro deftable (name) `(progn (defparameter ,name (make-hash-table)) (defun ,name (k) (gethash k ,name)) (defsetf ,name (k) (v) `(setf (gethash ,k ,',name) ,v)))) now you can do: (deftable client), which creates the hashtable, and then (client 'phone) will retrieve the value, (setf (client 'phone) '4444444) will set the value.