-
Notifications
You must be signed in to change notification settings - Fork 7
Destructuring
Giorgio Garofalo edited this page Dec 11, 2024
·
1 revision
Destructuring is the operation that splits an element into its bare components. For instance, a pair has two components, while a generic iterable has many.
If the called function supports destructuring and the target type is destructurable, the operation is performed on the element's components rather than the element itself.
The following functions currently support destructuring:
The following types are destructurable:
- Iterable
- Dictionary (as it is adapted to an iterable of pairs)
For instance, when iterating via .foreach
, if the elements are yet other iterables, using more than 1 lambda parameter lets the element be destructured into its components.
In the following example we define a Dictionary and iterate over its destructured key-value components:
.var {x}
.dictionary
- a: 1
- b: 2
- c: 3
.foreach {.x}
key value: <!-- 2 lambda parameters, one per pair component -->
**.key** has value **.value**
- Syntax of a function call
- Declaring functions
- Dynamic typing
- Localization
- Including other Quarkdown files
- Importing external libraries
- Document metadata
- Theme
- Page format
- Page margin content
- Page counter
- Automatic page break
- Numbering
- Table of contents
- Stacks (row, column, grid)
- Align
- Container
- Box
- Collapsible
- Whitespace
- String
- Number
- Markdown content
- Boolean
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic