{
  "id": "fn-flow-compose",
  "dataComponent": "flow",
  "heading": {
    "title": "compose",
    "badges": [
      "Flow",
      "PARTIAL"
    ]
  },
  "synopsis": "Chains multiple transform functions from right-to-left, returning a single function that processes data when finally called.",
  "codeBlocks": [
    "extend(\"flow\")\n\n# 1) Basic usage with multiple transforms => right-to-left\nchain = flow:compose(\n  flow:trans(x => x * 10),\n  flow:trans(x => x + 1)\n)\n\n# chain => partial => we can call chain(...) with an InkIterator\nout = chain( ink(1,5) )\nres = flow:to_array(out)\n# => for each item in [1..4], step1 => x+1 => [2..5], step2 => x*10 => [20..50].\nsput(res)\n\n# 2) Possibly placeholders => fill them in future calls\np = flow:compose(\n  _,\n  flow:trans(x => x - 1)\n)\n\n# Then pass the missing transform later.\nfinalComp = p(flow:trans(x => x+100))\n\n# Now finalComp => we can call with ink(...) => items processed from right to left.\n"
  ],
  "notes": [
    "flow:compose(...) can take any number of function arguments. Each must be either a bridging or user function returning an InkTransform if you want to chain them. However, it does not strictly require them to be transforms; it composes the calls from right to left.",
    "If all arguments are real functions, it returns a final function. If placeholders or partial usage is detected, it returns a partial function waiting for the missing pieces.",
    "Once fully formed, calling the final composition with a single data value (like an InkIterator) passes that data through each function from right to left. The rightmost function is called first, then its result is fed into the next, etc."
  ]
}
