Open djcoin opened 11 years ago
this behavior is actually consistent with mutable Array.delete
. You could filter out undefined
elements for the cost of O(n) like:
im.array([1,2,3]).dissoc(0).filter(function(e) {return e != undefined}).toJSON(); // [ 2, 3 ]
First, thanks for your library !
Well, then i'm having a hard time using arrays. Here are so crucial points that I think I did not quite get how immutable arrays are supposed to work :
array's length the array length is not correct, eg:
And "im.array([1, 2]).dissoc(0).get(0)" does not work (undefined). So in my code for example I'm not able to pick values one by one until the array is finished as I don't know how to check for emptyness.
dissoc array.dissoc leaves a "hole", eg:
Thanks for any insights
A bunch of test
Using a simple immutable array [ 5, 6 ]: