Jun11-ta-session

· nulo's blog

Problems for Written

1pets = [['cat', 'henning', 10], ['dog', 'rock', 15], ['dog', 'scud', 90]]

Another problem to solve with the same dataset would be: #

1{ 'cat' => 1, 'dog' => 2 }

shallow vs. deep copy #

 1a1 = [1, 2, 3, [4, 5]]
 2a2 = a1.dup
 3a3 = a1.map do |el|
 4  el.dup
 5end
 6
 7p a1.object_id == a2.object_id
 8
 9a1.each_index do |idx|
10  p a1[idx].object_id == a2[idx].object_id
11end

other notes #