BTW, if I'm not mistaken, your dict_to_vec function can be written as just
collect(values(d)).
On Tuesday, September 1, 2015 at 9:47:47 AM UTC-4, ami...@gmail.com wrote:
>
> Exactly what I needed, thanks a lot.
>
Exactly what I needed, thanks a lot.
On Tue, Sep 1, 2015 at 9:39 AM, wrote:
> Hi,
>
> I want to be able to convert vectors to dictionaries and the other way
> round. I have coded these two functions:
>
> function vec_to_dict(v, ll)
> d = Dict()
> assert(length(v) == length(ll))
> for i = 1:length(v)
> d[ll[i]] =
Hi,
I want to be able to convert vectors to dictionaries and the other way
round. I have coded these two functions:
function vec_to_dict(v, ll)
d = Dict()
assert(length(v) == length(ll))
for i = 1:length(v)
d[ll[i]] = v[i]
end
return d
end
function dict_to_vec(d)