Pooh program example 03-table-any-kind-of-key.p

Test 03-table-any-kind-of-key.p

Source of programm

# table with any kind of keys

a = { [1,2,3] : 'a' , [2,3,4] : 'b', [3, 4, 5] : 'c', { 'a' : [1, 2, 3], 'b' : 'c' } : 'd' }

println( ~msg a{ [1, 2, 3] } )
println( ~msg a{ [2, 3, 4] } )
println( ~msg a{ [3, 4, 5] } )

println( ~msg a{  { 'a' : [1, 2, 3], 'b' : 'c' } } )
 

Standard output for 03-table-any-kind-of-key.p

a
b
c
d

Trace output for 03-table-any-kind-of-key.p

003|a = { [ 1 , 2 , 3]  : 'a' , [ 2 , 3 , 4]  : 'b' , [ 3 , 4 , 5]  : 'c' , { 'a' : [ 1 , 2 , 3]  , 'b' : 'c' } : 'd' }
005|println( ~msg a{[ 1 , 2 , 3] }:'a' )...
006|println( ~msg a{[ 2 , 3 , 4] }:'b' )...
007|println( ~msg a{[ 3 , 4 , 5] }:'c' )...
009|println( ~msg a{{ 'a' : [ 1 , 2 , 3]  , 'b' : 'c' }}:'d' )...