You also assume keys are comparable or that 'conj order' is retained, which
is often not true. Consider following map:
(your-dissoc {2 1, :a 1, "foo" 1, 'bar 1} 2)
=>
Vectors are indexed and maps are associative. These two concepts share some
functionalities (assoc, get), but are otherwise v
On Saturday, November 2, 2013 4:56:13 PM UTC-5, Jozef Wagner wrote:
>
> Problem is, when your proposed dissoc removes value from a vector, it
> shifts all larger keys. So dissoc would not only remove value at index
> position, but also change keys for pther values. And this is not what
> disso
Problem is, when your proposed dissoc removes value from a vector, it
shifts all larger keys. So dissoc would not only remove value at index
position, but also change keys for pther values. And this is not what
dissoc should do
user=> (map-indexed vector [:a :b :c :d])
([0 :a] [1 :b] [2 :c] [3
On Saturday, November 2, 2013 2:38:57 PM UTC-5, vra...@gmail.com wrote:
>
> (assoc some-vector 2 'x)
> ;=> [a b x d e]
> (dissoc some-vector 3) ;; proposed
> ;=> [a b d e]
>
Typo:
(assoc some-vector 2 'x)
;=> [a b x d e]
(dissoc some-vector 2) ;; proposed
;=> [a b d e]
--
--
You received thi
On Saturday, November 2, 2013 2:20:40 PM UTC-5, Ben wrote:
>
> So then (get (dissoc some-vector i) i) would be equivalent to (get
> some-vector (inc i))?
>
(def some-vector ['a 'b 'c 'd 'e])
(assoc some-vector 0 'x)
;=> [x b c d e]
(dissoc some-vector 0) ;; proposed
;=> [b c d e]
(assoc some
On Sat, Nov 2, 2013 at 11:51 AM, wrote:
>
>
>
> (dissoc ['a 'b 'c] 1)
>
> ;=> ['a 'c]
>
So then (get (dissoc some-vector i) i) would be equivalent to (get
some-vector (inc i))?
--
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fer
On Saturday, November 2, 2013 1:16:42 PM UTC-5, Andy Fingerhut wrote:
>
> What would you expect the return value of (dissoc ['a 'b 'c] 1) to be?
>
Hi Andy,
Thanks for your interest! This is the "ideal" behavior I would expect from
dissoc, for consistency with assoc:
(assoc ['a 'b 'c] 1 'x)
;
What would you expect the return value of (dissoc ['a 'b 'c] 1) to be?
On Sat, Nov 2, 2013 at 11:03 AM, wrote:
> I realize `dissoc` isn't implemented to work on vectors for technical
> reasons (such as explained on 1/13/11 here
> https://groups.google.com/forum/#!msg/clojure/Lx9ysZ4ndfw/E52rVTv
I realize `dissoc` isn't implemented to work on vectors for technical
reasons (such as explained on 1/13/11 here
https://groups.google.com/forum/#!msg/clojure/Lx9ysZ4ndfw/E52rVTvclMoJ ).
"It'd be nice" if it did as I still get surprised by this on occasion, it
feels like an inconsistency when u