summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-12 19:12:16 +0000
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-12 19:12:16 +0000
commitfe3ef88c4147c4188066873e570f56212ffeebfd (patch)
treebe3a027f77f227f289cc86e4ad2098fd78acb27c
parent4f57c9aa1f319f093512d81c80ae6fe373e2bc4a (diff)
Don't print variables that have just been assigned. They are shy
-rw-r--r--apl9.h1
-rw-r--r--eval.c1
-rw-r--r--main.c3
3 files changed, 4 insertions, 1 deletions
diff --git a/apl9.h b/apl9.h
index f6c963c..30c5897 100644
--- a/apl9.h
+++ b/apl9.h
@@ -68,6 +68,7 @@ struct Function
struct Datum
{
datumTag tag;
+ int shy;
union {
Array *array;
Statement stmt;
diff --git a/eval.c b/eval.c
index 11809a8..afca940 100644
--- a/eval.c
+++ b/eval.c
@@ -213,5 +213,6 @@ assign(Datum left, Datum right)
left.symbol->undefined = 0;
if(left.symbol->value.tag == ArrayTag)
left.symbol->value.array->stranded = 0;
+ right.shy = 1;
return right;
} \ No newline at end of file
diff --git a/main.c b/main.c
index 784bc25..9e9dfa9 100644
--- a/main.c
+++ b/main.c
@@ -33,7 +33,8 @@ main(int argc, char *argv[])
else
print("ERROR: %S\n", errormsg);
}else{
- print("%S\n", ppdatum(*result));
+ if(result[0].shy == 0)
+ print("%S\n", ppdatum(*result));
free(result);
}
}