Le mardi 13 mai 2014 à 00:39 -0400, Stefan Karpinski a écrit :
I'm not sure that map! on a Set makes sense. The behavior of map! is
that it replaces each element of a collection with a transformed value
of that element. Implicit in that is that there is a notion of
position – a place where the
On Tue, May 13, 2014 at 5:38 AM, Milan Bouchet-Valat nalimi...@club.frwrote:
IMHO map! isn't very helpful for Sets not because there's no order, but
because it doesn't replace elements in the same memory slot, like it would
in an array.
I didn't actually say anything about order, but rather
Le mardi 13 mai 2014 à 09:34 -0400, Stefan Karpinski a écrit :
On Tue, May 13, 2014 at 5:38 AM, Milan Bouchet-Valat
nalimi...@club.fr wrote:
IMHO map! isn't very helpful for Sets not because there's no
order, but because it doesn't replace elements in the same
memory
Thinking about it, map! could be implemented by creating and filling in a
new Set, then moving the underlying members back to the original Set.
It's kinda kludgy, and wouldn't be any more efficient, but it would allow
for a convenient and uniform interface.
Thoughts?
Andrew, I'll reiterate that
Wouldn't it be faster to copy all the elements of the set into an array,
empty the set, and then fill the modified values back?
kl. 21:03:47 UTC+2 tirsdag 13. mai 2014 skrev Kevin Squire følgende:
Thinking about it, map! could be implemented by creating and filling in a
new Set, then moving
Yes, that seems better.
On Tue, May 13, 2014 at 3:16 PM, Ivar Nesje iva...@gmail.com wrote:
Wouldn't it be faster to copy all the elements of the set into an array,
empty the set, and then fill the modified values back?
kl. 21:03:47 UTC+2 tirsdag 13. mai 2014 skrev Kevin Squire følgende:
So this would involve adding a map method to base/set.jl?
On Tuesday, May 13, 2014 3:03:47 PM UTC-4, Kevin Squire wrote:
Andrew, I'll reiterate that a pull request would be very welcome. I think
you would find the Set functionality rather self contained, and the map
function implementation
Yes, that's right.
On Tue, May 13, 2014 at 3:31 PM, Andrew Dabrowski unhandya...@gmail.comwrote:
So this would involve adding a map method to base/set.jl?
On Tuesday, May 13, 2014 3:03:47 PM UTC-4, Kevin Squire wrote:
Andrew, I'll reiterate that a pull request would be very welcome. I
I'm not sure that would be better. rehash() will be called as soon as you
start inserting elements, because more than 3/4 of the elements will have
been deleted.
On Tue, May 13, 2014 at 12:20 PM, Stefan Karpinski ste...@karpinski.orgwrote:
Yes, that seems better.
On Tue, May 13, 2014 at
I see that map and map! do not play nice with Sets. Are there plans to
improve the situation, or should I learn to live with it?
`map` seems to work for me:
julia a = Set([1,2,3])
Set{Int64}({2,3,1})
julia map(x-2x, a)
3-element Array{Any,1}:
4
6
2
Can you give an example where it doesn't?
`map!` wouldn't give you any benefit in working with Sets in Julia. The
values in sets are inserted into a hash table, and since
I'm not sure that map! on a Set makes sense. The behavior of map! is that
it replaces each element of a collection with a transformed value of that
element. Implicit in that is that there is a notion of position – a place
where the original element was and where the transformed value can go. In a
12 matches
Mail list logo