WolframLang: Association to List

By Xah Lee. Date: . Last updated: .

To List of Rules

Normal[asso]

convert assoc to a List of Rules .

Normal

xx = Association[ a -> 3, b -> 2 ];
Normal[ xx ] === {a -> 3, b -> 2 }

Get All Keys

Keys[asso]

return a list of the keys.

Keys

xx = Association[ a -> 3, b -> 2 ];

Keys[ xx ] === {a, b}

Get All Values

Values[asso]

return a list of the values.

Values

xx = Association[ a -> 3, b -> 2 ];

Values[ xx ] === {3, 2}

Get Values by Pattern Matching on Values

Cases

return a list of values by matching Pattern

Cases

xx = Association[ 1 -> a, 2 -> b, 3 -> 33, 4 -> 44 ];

Cases[ xx, _Integer ] === {33, 44}

WolframLang: Association (Key Value List)