I created a ticket http://dev.clojure.org/jira/browse/CLJ-1508
2014-08-18 11:02 GMT+08:00 dennis zhuang killme2...@gmail.com:
I think that adding a :p option to destructuring would be great:
(let [ {:keys [a b c] :p {a a-p}} params]
(if a-p
(println a)
(println a is
I don't think that a :p feature is necessary, since all you need to do to
emulate it is a
(:baz all-keys) to know if the user explicitly specified it. I.e. I think
the capability is already present in adequate form but the documentation on
map destructuring could be improved.
On Sun, Aug 17,
Yep, it's an optional syntax sugar.
Indeed, you should use (contains? all-keys :baz) to check if :baz is
present in options. If :baz is present but it's value is nil,then (:baz
all-keys) returns nil too.
2014-08-18 18:57 GMT+08:00 Dave Tenny dave.te...@gmail.com:
I don't think that a :p
Well, it took me a while to perhaps get what you were telling me here.
In my case I I had something like
(defn foo [ {:keys [bar ... more keys ...] :or {bar 1}} ] ...)
and I wanted to know whether the user had explicilty invoked foo with :bar.
What wasn't clear to me was that :as solved this
I think that adding a :p option to destructuring would be great:
(let [ {:keys [a b c] :p {a a-p}} params]
(if a-p
(println a)
(println a is not exists.)))
2014-08-17 20:05 GMT+08:00 Dave Tenny dave.te...@gmail.com:
Well, it took me a while to perhaps get what you were
If you destructure the parameters like this:
(defn f [ {:as a-map}] ...)
You can use map primitives on a-map. But you can also supply defaults here.
On Jun 20, 2014 2:14 PM, Dave Tenny dave.te...@gmail.com wrote:
What is the commonly accepted technique for declaring/using 'supplied-p'
type
What is the commonly accepted technique for declaring/using 'supplied-p'
type lambda list functionality in clojure?
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html
I have some clojure functions with a large number of keywords and various
defaults, I want to