WolframLang: Association to List

By Xah Lee. Date: . Last updated: .

To List of Rules

Normal[assoc]
convert assoc to a List of Rules . Normal
xx = Association[ a -> 3, b -> 2 ];

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

Get All Keys

Keys[assoc]
return a list of the keys. Keys
xx = Association[ a -> 3, b -> 2 ];

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

Get All Values

Values[assoc]
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 Pairs)

WolframLang in Depth

Basics

Comment, Print

String

Arithmetic

List

Expression, Atom, Head

Boolean

Conditional

Variable

Loop

Data Structure

Function

Pattern Matching

Advanced

Shell Tasks

Misc