Skip to content

History / Fold

Revisions

  • #1367 The step of fold and fold_c may hold variants Fold and Fold_c say that the step, and the condition of fold_c, may be a function that holds variants, that the variant is chosen once, on the initial state, and that a later state that would choose another variant, or none, is an error. The applies-to lists accept a function whose variants each take two parameters (one for the condition), and say that a partial application of a function with variants is refused. The examples and their outcomes were run as fn_test_fold_variant.dms on a local Release build with the engine change of #1367; the pages were not rendered on geodms.nl.

    @MaartenHilferink MaartenHilferink committed Nov 16, 2026
  • #1365 Function bodies reach the subitems of body items Function-definition says that a body item that is the result of another function has the subitems that the function declares for its result, and a body item defined by fold those that its step declares, so that the body can read h/v; what the error for a misspelt subitem says; that a body item defined as instantiate G(args) is refused in a function that is applied as a value; and that a function defined inside another one sees the parameters and body items of the enclosing function with their subitems, as st/v and s/v, with an example. Fold says in one sentence that this holds for a body item that fold defines, and points to that example. The examples were run, and the message taken, on a local Release build of the engine with this change (fn_test_body_struct.dms); the pages were not rendered on geodms.nl.

    @MaartenHilferink MaartenHilferink committed Nov 16, 2026
  • #1347 Fold and Fold_c: repeat a step, also in a function body Two new pages describe the operators of GeoDMS 20.29.0 that repeat a step. Fold covers fold(domain, step, initial state), which applies a function once for each element of a unit, and instantiate fold(...), which makes the state after each step an item, also in a function body. Fold_c covers fold_c(step, condition, maxN, initial state), which applies the step while a condition holds and reports an error when it still holds after maxN steps, and says that with an attribute as the state the steps are calculated twice. The script on the page convex-hull-example-script now repeats its step with fold_c, as examples/convex_hull.dms does, and the paragraphs under it explain the step, the condition and the ceiling maxN. For_each and Function-definition point to fold and fold_c for a repeated step in a function body, Map lists Fold among its related pages, and the sidebar lists both pages under map.

    @MaartenHilferink MaartenHilferink committed Nov 14, 2026