aboutsummaryrefslogtreecommitdiff
path: root/model.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'model.cpp')
-rw-r--r--model.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/model.cpp b/model.cpp
index 85d4e04..564aa74 100644
--- a/model.cpp
+++ b/model.cpp
@@ -84,8 +84,13 @@ string EvalObj::ext_repr() {
if (obj)
{
*(++top_ptr) = obj->get_repr_cons();
- if (hash.count((*top_ptr)->ori))
- *top_ptr = new ReprStr("#inf#");
+ EvalObj *ptr = (*top_ptr)->ori;
+ if (ptr)
+ {
+ if (hash.count(ptr))
+ *top_ptr = new ReprStr("#inf#");
+ else hash.insert(ptr);
+ }
}
else
{
@@ -100,8 +105,13 @@ string EvalObj::ext_repr() {
if (obj)
{
*(++top_ptr) = obj->get_repr_cons();
- if (hash.count((*top_ptr)->ori))
- *top_ptr = new ReprStr("#inf#");
+ EvalObj *ptr = (*top_ptr)->ori;
+ if (ptr)
+ {
+ if (hash.count(ptr))
+ *top_ptr = new ReprStr("#inf#");
+ else hash.insert(ptr);
+ }
}
else *top_ptr = new ReprStr((*top_ptr)->repr);
}
@@ -401,13 +411,17 @@ EvalObj *PromObj::get_mem() { return mem; }
void PromObj::feed_mem(EvalObj *res) { mem = res; }
-bool is_list(Pair *ptr) {
+bool make_exec(Pair *ptr) {
if (ptr == empty_list) return true;
EvalObj *nptr;
for (;;)
if ((nptr = ptr->cdr)->is_pair_obj())
- ptr = TO_PAIR(nptr);
+ {
+ ptr->next = TO_PAIR(nptr);
+ ptr = ptr->next;
+ }
else break;
+ ptr->next = NULL;
return ptr->cdr == empty_list;
}