--- stack/stack.c 2002/02/12 23:16:56 1.73 +++ stack/stack.c 2002/02/12 23:59:05 1.74 @@ -606,10 +606,7 @@ pack->content.ptr= temp; pack->refcount= 1; - temp= malloc(sizeof(stackitem)); - temp->item= pack; - - push(env, temp); + push_val(env, pack); rev(env); } @@ -1144,6 +1141,8 @@ /* 'to' */ extern void to(environment *env) { int i, start, ending; + stackitem *temp_head; + value *temp_val; if((env->head)==NULL || env->head->next==NULL) { printerr("Too Few Arguments"); @@ -1163,17 +1162,23 @@ start= env->head->item->content.val; toss(env); if(env->err) return; - push_sym(env, "["); + temp_head= env->head; + env->head= NULL; if(ending>=start) { - for(i= start; i<=ending; i++) + for(i= ending; i>=start; i--) push_int(env, i); } else { - for(i= start; i>=ending; i--) + for(i= ending; i<=start; i++) push_int(env, i); } - pack(env); if(env->err) return; + temp_val= malloc(sizeof(value)); + temp_val->content.ptr= env->head; + temp_val->refcount= 1; + temp_val->type= list; + env->head= temp_head; + push_val(env, temp_val); } /* Read a string */