thoran
(thoran@thoran.com)
1
That should have probably read:
m = [:a => 'a'] # m is for map. I could go for this term too as it
has brevity.
=> [:a => 'a']
m[0]
=> [:a => 'a'] # m remains as an associative array.
m[:a]
=> 'a' # and m becomes an explicit hash.
m[0]
=> {:a => 'a'} # m becomes an associative array.
or
=> [:a => 'a'] # conversion before or after?
m[:a]
=> 'a' # m becomes a hash again.
m[[0]]
=> 'a' # m becomes an associative array.
HAL_9000
(HAL 9000)
2
thoran@thoran.com wrote:
That should have probably read:
m = [:a => 'a'] # m is for map. I could go for this term too as it
has brevity.
=> [:a => 'a']
m[0]
=> [:a => 'a'] # m remains as an associative array.
m[:a]
=> 'a' # and m becomes an explicit hash.
m[0]
=> {:a => 'a'} # m becomes an associative array.
or
=> [:a => 'a'] # conversion before or after?
m[:a]
=> 'a' # m becomes a hash again.
m[[0]]
=> 'a' # m becomes an associative array.
Again, interesting... but what if your keys are integers? Or arrays?
Hal