Erlang structs, Ruby structs

Posted by chetan
on Friday, November 09

Tuple is Hash

What hash is to ruby, tuple is to erlang
rcolors = {{:color=>"white", :hexcode=>"ffffff"}, 
           {:color=>"black", :hexcode=>"000000"}}
ecolors = {colors,
                  {white, ffffff},
                  {black, 000000}}.

List is Array

What array is to ruby, list is to erlang
rmix = %w(apple orange banana)
emix = [1+7,hello,2-2,{cost, apple, 30-20},3].

Comments

Leave a response