This is a perfectly reasonable thing to want, and in fact has already been
implemented in Julia 0.4-dev:
julia> Dict(zip("abc","123"))
Dict{Char,Char} with 3 entries:
'b' => '2'
'c' => '3'
'a' => '1'
On Friday, December 26, 2014 12:15:07 AM UTC-5, Ronald L. Rivest wrote:
>
> Since the Dict constructor accepts an array of pairs, I expected
> it to also accept the output from zip. So
> Dict(zip("abc","123"))
> should produce
> [ 'a'=>'1', 'b'=>'2', 'c'=>'3' ]
> but instead it breaks:
> ERROR: `Dict{K,V}` has no method matching
> Dict{K,V}(::Zip2{ASCIIString,ASCIIString})
>
> The fix I could figure out seems to be to use collect
> Dict(collect(zip("abc","123")))
> but this feels rather inelegant...
>
> Have I missed something, or perhaps this is a feature that should be added?
>
> Cheers,
> Ron
>
>
>