you can iterate over a dict
julia> methods(map)
... lots of methods
map(f::Union(Function,DataType),iters...) at abstractarray.jl:1264
which will return a tuple of (key, value)
julia> map( kv -> kv, {1=>"foo", 2=>"bar"})
2-element Array{Any,1}:
(2,"bar")
(1,"foo")
since you can map over arbitrary number of iterables.
julia> let d = {1=>"foo", 2=>"bar"}
map( (k, v) -> (k, v), keys(d), values(d))
end
2-element Array{Any,1}:
(2,"bar")
(1,"foo")
On Wednesday, February 12, 2014 10:35:02 PM UTC-5, Fil Mackay wrote:
>
>
> On Saturday, September 14, 2013 12:52:00 AM UTC+10, Stefan Karpinski wrote:
>>
>> Here's an example:
>>
>> julia> filter!((k,v)->isa(k,Number), {1=>"foo","bar"=>2})
>> {1=>"foo"}
>>
>
> Hi Stefan, do you have an equivalent map/map!() example for Dict? I can't
> see direct Dict support - maybe there's another way?
>
>