Does the "Rule" function actually supports list syntax. ie. using "[ ]"
Don't think about it as "list syntax". The double square brackets, [[]]
, is just syntactic sugar. It's just a convenient alternative to Part
. Part
is just a normal "function" that can be applied to any expression.
Rohit showed you how to inline the selection function. The Last
function that it uses is very common. Other useful "destructuring" functions are Head
, First
, Most
, Rest
, and Part
. Part
has some interesting features, including things similar to Python's slice function.
When filtering/searching lists, Select
, Cases
, and Position
are frequently used. Reorganizing lists can be done with GroupBy
and GatherBy
.
That's just the tip of the iceberg.