-
-
Notifications
You must be signed in to change notification settings - Fork 226
Destructuring
Giorgio Garofalo edited this page Apr 25, 2025
·
9 revisions
Destructuring is the operation that splits a lambda parameter into its bare components. For instance, a pair has two components, while a generic iterable has many.
The following types are destructurable:
-
Iterable(includingPair) -
Dictionary(as an iterable of pairs)
A value is destructured into N components if all the following conditions are met:
- Its type is destructurable;
- The lambda expects a single argument (such as
.foreach); -
N > 1lambda parameters are supplied.
When the lambda argument is destructured, the operation is performed on its components rather than the element itself.
In the following example we define a Dictionary and iterate over its destructured key-value components:
.var {mydictionary}
.dictionary
- a: 1
- b: 2
- c: 3
.foreach {.mydictionary}
key value: <!-- 2 lambda parameters = each pair is destructured into its 2 components -->
**.key** has value **.value**
- Figures
- Image size
- TeX formulae
- Table caption
- Code caption
- Decorative headings
- Alerts (quote types)
- Quotation source
- Cross-references
- Page breaks
- Text symbols (text replacement)
- Emojis
- Document metadata
- Theme
- CSS
- Fonts
- Page format
- Page margin content
- Page counter
- Persistent headings
- Automatic page break
- Numbering
- Paragraph style
- Caption position
- Table of contents
- Bibliography
- Footnotes
- Stacks (row, column, grid)
- Container
- Align
- Float
- Figure
- Clip
- Box
- Collapsible
- Landscape
- Whitespace
- Variables
- Optionality
- Math
- Conditional statements
- Loops
- Let
- Destructuring
- String manipulation
- Table manipulation: sorting, computing, and more
- Table generation
- String
- Number
- Markdown content
- Boolean
- None
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic
- Paper: abstract, definitions, theorems, and more