case lambda_ident:
if((*body)->data.identifier.binding == binding){
lambda_free(*body);
- *body = target;
- target->refcount++;
+ *body = copy(target);
}
break;
case lambda_abs:
if(lhs(t)->data.abstraction.strict)
lambda_reduce(&rhs(t), total, true);
- if(lhs(t) == rhs(t)){
- lhs(t)->refcount--;
- rhs(t) = copy(rhs(t));
- }
-
//In this abstraction we substitute the result with the rhs
lambda_print(*total, *t);
lambda_beta(lhs(t), &lhs(t)->data.abstraction.expr, rhs(t), *total);
- struct lambda *newt = lhs(t)->data.abstraction.expr;
- lhs(t)->data.abstraction.expr->refcount++;
+ struct lambda *newt = copy(lhs(t)->data.abstraction.expr);
lambda_free(*t);
*t = newt;
- printf("\nβ -> ");
+ printf("β -> ");
return true;
}
} else if ((*t)->which == lambda_abs) {