On Fri, 2012-08-31 at 03:40 -0700, Peter Taoussanis wrote:
> (foo) => {:x "x-default" :y "y-default}
>
>
> I.e. to merge the :or defaults over the :args binding?
Such behavior would be quite surprising; to see why, desugar :keys:
{x (expr-that-computes :x),
y (expr-that-computes :y),
z (expr-that-computes :z),
:or {x "x-default" y "y-default"} :merge-as args}
which treats bindings as having bidirectional flow; we bind a name to
the value of a keyword, rewriting in the other direction if the value
isn't present.
Instead,
> Rationale: one of the nice things of setting defaults via :or is that
> they're visible to callers via :arglists. This'd help make the process
> more convenient in the (relatively common) case where you'd like to
> preserve arbitrary args, but apply some defaults in a transparent way.
When you want this,
(let [{blah} (merge my-defaults kwargs)]
--
Stephen Compall
"^aCollection allSatisfy: [:each | aCondition]": less is better than
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en