Skip to content

Fix/hyperpose variable arg#152

Merged
patham9 merged 2 commits into
trueagi-io:mainfrom
ermijeremy:fix/hyperpose-variable-arg
Apr 2, 2026
Merged

Fix/hyperpose variable arg#152
patham9 merged 2 commits into
trueagi-io:mainfrom
ermijeremy:fix/hyperpose-variable-arg

Conversation

@ermijeremy
Copy link
Copy Markdown
Contributor

Fix hyperpose to support variable/computed list arguments in translator

Description

Problem

hyperpose worked only when its argument was a literal list at translation time, e.g.:

(hyperpose (1 2 3))

but failed for variable/computed lists, e.g.:

(let $xs (1 2 3) (hyperpose $xs))

Root cause

In translator.pl, the hyperpose branch directly called build_hyperpose_branches(L, ...), which assumes L is already a concrete list during translation.

Fix

Updated translate_expr for HV == hyperpose to use two paths:

  1. Compile-time fast path (unchanged): if L is a nonvar list, keep existing branch compilation behavior.
  2. Runtime path (new): evaluate L first, then execute hyperpose_runtime(LV, Out) for variable/computed list arguments.

Added helper:

hyperpose_runtime(Exprs, Out) :-
    is_list(Exprs),
    concurrent_and(member(Expr, Exprs), eval(Expr, Out)).

For expressions like (let $xs (...) (hyperpose $xs)), the runtime helper iterates/evaluates each element concurrently, preserving hyperpose semantics.

Validation

  • !(test (collapse (hyperpose (x y z))) (x y z)) passes.
  • !(test (collapse (let $x (x y z) (hyperpose $x))) (x y z)) now passes.

@ermijeremy
Copy link
Copy Markdown
Contributor Author

@patham9 any review?

Copy link
Copy Markdown
Collaborator

@patham9 patham9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ermijeremy Well-done, and perfectly executed, thank you so much!!!

@patham9 patham9 merged commit 2696eb0 into trueagi-io:main Apr 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants