WolframLang: Position of an Element

By Xah Lee. Date: . Last updated: .

Position Spec

A position is a list of integers that uniquely specify a part of expression.

For example, if we have

{a, {{b,c}, d}, e}

Index counting start at 1. Index 0 means the Head of Expression.

Get Element by Position Spec: Extract

Extract[expr, position]
return the part of expr at a given position. Extract
xx = {a, {{b,c}, d}, e};

Extract[ xx, {1} ] === a

Extract[ xx, {2} ] === {{b, c}, d}

Extract[ xx, {3} ] === e

Extract[ xx, {2, 1} ] === {b, c}

Extract[ xx, {2, 1, 1} ] === b

List