Dotted pair operator .=>

I just realized today that it is possible to create a dict with .=>:

julia> Dict(['a', 'b', 'c'] .=> 1:3)
Dict{Char,Int64} with 3 entries:
  'a' => 1
  'c' => 3
  'b' => 2

Dotted syntax for pairs: this made my day!

8 Likes

You can also make ranges with Chars, so :wink:

julia> Dict('a':'z' .=> 1:26)
Dict{Char,Int64} with 26 entries:
  'n' => 14
  'f' => 6
  'w' => 23
  'd' => 4
  'e' => 5
  'o' => 15
  'h' => 8
  'j' => 10
  'i' => 9
  'k' => 11
  'r' => 18
  's' => 19
  't' => 20
  'q' => 17
  'y' => 25
  'a' => 1
  'c' => 3
  'p' => 16
  'm' => 13
  ⋮   => ⋮
8 Likes