Maybe sth like that
(defn assoc-in-maybe-creating [coll keys creator-fns value] ...)
so it can be used:
(assoc-in-maybe-creating
[ {:a (sorted-map :X 1, :Y 2, :Z 3)
:c (sorted-map :X 1, :Z 3)}
{:b (sorted-map :X 1, :Y 2, :Z 3)}
{:f (sorted-map :X 1, :Y 2)}]
[0 :b :X]
[vector
Some "Thinking out loud" here...
My last concern with assoc-in & arrays has to do with how it is
currently used for maps. The way it creates elegant nested structures
is nice, and it requires very little understanding of the current
structure of the map.
However, assoc-in has a few more constrai
On Fri, Jan 29, 2010 at 9:40 AM, Chouser wrote:
> On Fri, Jan 29, 2010 at 8:44 AM, Rich Hickey wrote:
>> On Fri, Jan 22, 2010 at 8:57 AM, Chouser wrote:
>>> On Thu, Jan 21, 2010 at 10:11 PM, Sean Devlin
>>> wrote:
Sometimes you don't want assoc-in to create a hash-map. Sometimes you
On Fri, Jan 29, 2010 at 8:53 AM, Sean Devlin wrote:
> The following doesn't currently work:
>
> user=> (assoc [] 1 :a)
> #
>
But this does:
user=> (assoc [] 0 :a)
[:a]
> So I say this should be map only.
I don't think so.
> Also, what do you mean by your question "Where would the default go"
On Fri, Jan 29, 2010 at 8:44 AM, Rich Hickey wrote:
> On Fri, Jan 22, 2010 at 8:57 AM, Chouser wrote:
>> On Thu, Jan 21, 2010 at 10:11 PM, Sean Devlin
>> wrote:
>>> Sometimes you don't want assoc-in to create a hash-map. Sometimes you
>>> wish it could create a sorted map.
>>>
>>> Just finishe
The following doesn't currently work:
user=> (assoc [] 1 :a)
#
So I say this should be map only. Granted, assoc-in already has this
issue.
Also, what do you mean by your question "Where would the default go"?
I don't understand what you're getting at yet.
Sean
On Jan 29, 8:44 am, Rich Hickey
On Fri, Jan 22, 2010 at 8:57 AM, Chouser wrote:
> On Thu, Jan 21, 2010 at 10:11 PM, Sean Devlin
> wrote:
>> Sometimes you don't want assoc-in to create a hash-map. Sometimes you
>> wish it could create a sorted map.
>>
>> Just finished working on something with Alexy Khrabrov & Chouser on
>> IR
On Thu, Jan 21, 2010 at 10:11 PM, Sean Devlin wrote:
> Sometimes you don't want assoc-in to create a hash-map. Sometimes you
> wish it could create a sorted map.
>
> Just finished working on something with Alexy Khrabrov & Chouser on
> IRC, and the three of us are wondering if the result might be