ohua-dev/ohua-jvm-integration

[Feature] Nested Destructuring

Opened this issue · 1 comments

Extend the ALang creation int the adapter to support nested destructuring in lets and algos.

(defalgo myalgo [input [destructured-input]]
  (let [[a [b c]] (some/sfn)]
    ...)

This should be transformed into

(defalgo myalgo [input input_0]
  (let [[destructured-input] (ohua.lang/id input_0)
        [a b_0] (some/sfn)
        [b c] (ohua.lang/id b_0)]
    ...)

It turns out at least for algos this does currently work up to one nesting level.

Aka

(algo [ [x y] z] ...)

Becomes

Lambda ["x", "y"] $ Lambda "z" ...

But we also want this for lets and deeper nesting levels