Thanks everyone for answers!
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from th
On 9 March 2010 22:58, Rick Moynihan wrote:
> There a parity between this and clojure.contrib.seq-utils/flatten
> (which doesn't work with maps)... So how about this lazy non stack
> consuming alternative?
>
> (defn leaves [m]
> (filter
> (complement map?)
> (rest (tree-seq map? #(vals %)
>
On 9 March 2010 08:09, Meikel Brandmeyer wrote:
> Hi,
>
> On Mar 8, 2:59 pm, Luka wrote:
>
>> (defn leafs [m]
>> (loop [vs (vals m), accum []]
>> (if (empty? vs)
>> accum
>> (let [v (first vs)]
>> (if (map? v)
>> (recur (rest vs) (into accum (leafs v)))
>>
On Mar 9, 12:09 am, Meikel Brandmeyer wrote:
> How about this?
>
> (defn leafs
> ...
This should be leaves, not leafs, right? Another one of those weird
irregular English plurals.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this gro
On 8 Mar 2010, at 13:59, Luka wrote:
> Other thing I would like to ask is how can I see what is different in
> 40 github clones of clojure.contrib without clicking on every clone?
Either:
1. Use the github network browser:
http://github.com/richhickey/clojure-contrib/network
(use left/ri
Hi, I actually wrote a sort of counterpart to leafs a while back:
(defn- rmap
"Implementation core for map-at-levels."
[func obj lvls lvl]
(let [children-mapped (if (coll? obj)
(for [c obj]
(rmap func c lvls (inc lvl)))
Hi,
On Mar 8, 2:59 pm, Luka wrote:
> (defn leafs [m]
> (loop [vs (vals m), accum []]
> (if (empty? vs)
> accum
> (let [v (first vs)]
> (if (map? v)
> (recur (rest vs) (into accum (leafs v)))
> (recur (rest vs) (conj accum v)))
How about this?
(
> true (update-in m (butlast v) #(dissoc % (last v))
No need for an unnamed function:
true (update-in m (butlast v) dissoc (last v))
Regards,
Tim.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo
I'm aware of clojure-dev group, but being new to clojure, i thought I
should start here first.
These are two methods I've needed in my project and I didn't found
better way to accomplish these tasks. First function returns vector of
leaf nodes in a map, and second dissociates in nested map. First
q