1. MLSNBN and transforms

Start with literal values, structural maps and lists, and one-level flattening.

sUTL · Guide · Reference · Examples

sUTL transforms JSON-shaped values into other JSON-shaped values. Its data model is MLSNBN: Map, List, String, Number, Boolean, Null.

Those are both sUTL's data and its program representation. A transform is not a string of source code: it is an MLSNBN value that a host program can store, generate, inspect, and evaluate.

Literal transforms

Numbers, booleans, and null evaluate to themselves:

4.2

Ordinary strings are also literal unless their prefix identifies compact builtin syntax.

Structural transforms

An ordinary map evaluates each value as a transform:

{
  "person": "^$.name",
  "active": true
}

Given {"name": "Ada"}, the result is:

{
  "person": "Ada",
  "active": true
}

Lists work the same way:

[1, "^$.value", 3]

Flattening a list

A list beginning with the exact marker "&&" evaluates its remaining items and flattens one level:

["&&", [1, 2], 3, [4, 5]]

Result:

[1, 2, 3, 4, 5]

This form is useful for conditional list construction and concatenation. It is not recursive flattening.

Calling the runner

Open the browser playground, enter the source and transform as JSON, and choose Run transform. The separate language site provides editable examples. Here in Everything, examples are readable code blocks; use the playground to execute them.

Next: Paths.

Continue learning

Guide contents · Language reference

Source

Adapted from the sUTL source material.

Back to sUTL · Software & Agents · All topics

View page as JSON