Skip to content

Commit

Permalink
cons is yielding, just not the right value
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-johnson-4 committed Jan 2, 2024
1 parent 139c2a9 commit ff466e7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/g.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,29 @@ fn compile_expr(helpers_ctx: &S, program_ctx: &S, e: &S) -> S {
let fx = tail(e);
let f = head(&fx);
let x = tail(&fx);
let xpg = compile_expr(helpers_ctx, program_ctx, &x);
let xpd = compile_expr(helpers_ctx, program_ctx, &x);
if head(&f).to_string() == "variable" {
let f_name = label_case( &tail(&f).to_string() );
let call = variable( &format!("\tcall {}\n", f_name) );
let prog = app(
head(&xpg),
head(&xpd),
call
);
s_cons(prog, tail(&xpg))
s_cons(prog, tail(&xpd))
} else {
unimplemented!("compile_expr: {}", e)
let fpd = compile_expr(helpers_ctx, program_ctx, &f);
let prog = ctx_eval_soft(helpers_ctx, &app(
variable("::yield-cons"),
app(
head(&fpd),
head(&xpd),
)
));
let data = app(
tail(&fpd),
tail(&xpd),
);
s_cons(prog, data)
}
} else if head(e).to_string() == "variable" {
yield_atom(helpers_ctx, &tail(e).to_string() )
Expand Down

0 comments on commit ff466e7

Please sign in to comment.