Commit 6b36f4e8 authored by Chris Müller's avatar Chris Müller
Browse files

eval_values returns a list in a wrong order

Fix list generation from org_cherry_eval_values for avoiding
a list reverse at the end of this operation.
parent f6310763
......@@ -45,17 +45,20 @@ org_cherry_eval_define(struct org_cherry_environment* env, struct org_cherry_val
static struct org_cherry_value*
org_cherry_eval_values(struct org_cherry_environment* env, struct org_cherry_value* values)
{
struct org_cherry_value* list = org_cherry_emptylist;
struct org_cherry_value* val;
struct org_cherry_value* begin = org_cherry_list_cons(org_cherry_eval(env, HEAD(values)), org_cherry_emptylist);
struct org_cherry_value* prev = begin;
struct org_cherry_value* head;
values = TAIL(values);
while(!IS_NULL(values)) {
val = org_cherry_eval(env, HEAD(values));
head = org_cherry_list_cons(org_cherry_eval(env, HEAD(values)), org_cherry_emptylist);
TAIL(prev) = head;
prev = head;
values = TAIL(values);
list = org_cherry_list_cons(val, list);
}
return list;
return begin;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment