{"path":"/sutl/guide/mlsnbn-and-transforms","content":{"title":"1. MLSNBN and transforms","summary":"Start with literal values, structural maps and lists, and one-level flattening.","body":"[sUTL](/sutl) · [Guide](/sutl/guide) · [Reference](/sutl/reference) · [Examples](/sutl/examples)\n\nsUTL transforms JSON-shaped values into other JSON-shaped values. Its data\nmodel is **MLSNBN**: Map, List, String, Number, Boolean, Null.\n\n- maps with string keys\n- lists\n- strings\n- numbers\n- booleans\n- null\n\nThose are both sUTL's data and its program representation. A transform is not a\nstring of source code: it is an MLSNBN value that a host program can store,\ngenerate, inspect, and evaluate.\n\n## Literal transforms\n\nNumbers, booleans, and null evaluate to themselves:\n\n```json\n4.2\n```\n\nOrdinary strings are also literal unless their prefix identifies compact\nbuiltin syntax.\n\n## Structural transforms\n\nAn ordinary map evaluates each value as a transform:\n\n```json\n{\n  \"person\": \"^$.name\",\n  \"active\": true\n}\n```\n\nGiven `{\"name\": \"Ada\"}`, the result is:\n\n```json\n{\n  \"person\": \"Ada\",\n  \"active\": true\n}\n```\n\nLists work the same way:\n\n```json\n[1, \"^$.value\", 3]\n```\n\n## Flattening a list\n\nA list beginning with the exact marker `\"&&\"` evaluates its remaining items\nand flattens one level:\n\n```json\n[\"&&\", [1, 2], 3, [4, 5]]\n```\n\nResult:\n\n```json\n[1, 2, 3, 4, 5]\n```\n\nThis form is useful for conditional list construction and concatenation. It is\nnot recursive flattening.\n\n## Calling the runner\n\nOpen the [browser playground](https://sutl-bronzearch.house-of-ur.com/playground/), enter the source and\ntransform 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.\n\nNext: [Paths](/sutl/guide/paths).\n\n## Continue learning\n\n[Guide contents](/sutl/guide) · [Language reference](/sutl/reference)\n\n## Source\n\nAdapted from [the sUTL source material](https://github.com/emlynoregan/sutllang-site/blob/e59ecafd364848cd71a1d18ce74cdf67f2f69328/content/guide/01-mas-and-transforms.md).\n\n[Back to sUTL](/sutl) · [Software & Agents](/topics/software-and-agents) · [All topics](/guide)","author":"Emlyn O'Regan"}}