MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / uncurry_app

Function uncurry_app

examples/05_knuckledragger/python/lean_to_z3.py:58–66  ·  view source on GitHub ↗

Flatten nested ``Expr.app(f, x)`` into ``(head, [arg0, arg1, ...])``.

(expr: LeanInductiveValue)

Source from the content-addressed store, hash-verified

56
57
58def uncurry_app(expr: LeanInductiveValue) -> tuple[LeanInductiveValue, list[LeanInductiveValue]]:
59 """Flatten nested ``Expr.app(f, x)`` into ``(head, [arg0, arg1, ...])``."""
60 args: list[LeanInductiveValue] = []
61 cur = expr
62 while cur.ctor == "app":
63 args.append(cur._1) # arg
64 cur = cur._0 # fn
65 args.reverse()
66 return cur, args
67
68
69# ---------------------------------------------------------------------------

Callers 1

expr_to_z3Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected