Re: inserting into vector

2010-08-26 Thread meb
(defn insert [v at el] (flatten (assoc v at [el (v at)])) You get a lazy seq back, so further operations are probably not as performant as they should be. But that would be as performant as a regular assoc for just that one operation. What you do from then on. Mark On Aug 26, 10:33 am, C

Re: inserting into vector

2010-08-26 Thread Chouser
On Thu, Aug 26, 2010 at 12:43 PM, David Nolen wrote: > On Thu, Aug 26, 2010 at 11:53 AM, Chouser wrote: >> >> On Thu, Aug 26, 2010 at 9:44 AM, Jon Seltzer >> wrote: >> > I know what assoc does: >> > >> > user=> (assoc [\a \b \c] 0 \d)  ;please extend to much larger vector >> > with index somewhe

Re: inserting into vector

2010-08-26 Thread David Nolen
On Thu, Aug 26, 2010 at 11:53 AM, Chouser wrote: > On Thu, Aug 26, 2010 at 9:44 AM, Jon Seltzer > wrote: > > I know what assoc does: > > > > user=> (assoc [\a \b \c] 0 \d) ;please extend to much larger vector > > with index somewhere in the middle > > [\d \b \c] > > > > but what if I want: > >

Re: inserting into vector

2010-08-26 Thread Chouser
On Thu, Aug 26, 2010 at 11:53 AM, Chouser wrote: > On Thu, Aug 26, 2010 at 9:44 AM, Jon Seltzer wrote: >> I know what assoc does: >> >> user=> (assoc [\a \b \c] 0 \d)  ;please extend to much larger vector >> with index somewhere in the middle >> [\d \b \c] >> >> but what if I want: >> >> user=> (

Re: inserting into vector

2010-08-26 Thread Chouser
On Thu, Aug 26, 2010 at 9:44 AM, Jon Seltzer wrote: > I know what assoc does: > > user=> (assoc [\a \b \c] 0 \d)  ;please extend to much larger vector > with index somewhere in the middle > [\d \b \c] > > but what if I want: > > user=> (assoc-x [\a \b \c] 0 \d)  ;is there an assoc-x > [\a \d \b \c

inserting into vector

2010-08-26 Thread Jon Seltzer
I know what assoc does: user=> (assoc [\a \b \c] 0 \d) ;please extend to much larger vector with index somewhere in the middle [\d \b \c] but what if I want: user=> (assoc-x [\a \b \c] 0 \d) ;is there an assoc-x [\a \d \b \c] I don't see a function that does this. I'm sure I'm missing it. I