next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > The Macaulay2 language > hash tables > pairs

pairs -- list the pairs in a hash table

Description

pairs x -- makes a list of all key/value pairs (k,v) in a hash table x.

i1 : x = new HashTable from {a => 1, b => 2, c => 3}

o1 = HashTable{a => 1}
               b => 2
               c => 3

o1 : HashTable
i2 : pairs x

o2 = {(c, 3), (a, 1), (b, 2)}

o2 : List

Ways to use pairs :