Does the following snippet show the intended behavior?
user=> (def not-nil? (complement nil?))
> #'user/not-nil?
> user=> (defn f [x] (match [x] [{:a (ma :guard not-nil?)}] ma :else
> :no-match))
> #'user/f
> user=> (f {:a 1})
> 1
> user=> (f {:b 1})
> nil
> user=> (f {:a nil})
> :no-match
> user
You can start here http://clojuredocs.org/clojure_core/clojure.core/group-by
it should be pretty easy to get it working from there.
On Tuesday, February 4, 2014 4:06:14 PM UTC-5, Thomas wrote:
>
> Hi all,
>
> I was wondering how I can convert the following data structure to the one
> below:
>
>
Hello all,
For various reasons, and despite the convenience of anonymous functions,
I'd like to have a proper positional parameter binding partial function
application. (Actually,
I'd like to have by-name parameter binding, but that's another story.)
For example, the following seems to work:
(
Clojure documentation only talks about
:or followed by a map (from http://clojure.org/special_forms ):
> Also optionally, an *:or* key in the binding form followed by another
> map may be used to supply default values for some or all of the keys if
> they are not found in the init-expr:
>
> (l