From fe3ef88c4147c4188066873e570f56212ffeebfd Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Wed, 12 Jan 2022 19:12:16 +0000 Subject: Don't print variables that have just been assigned. They are shy --- apl9.h | 1 + eval.c | 1 + main.c | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) 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); } } -- cgit v1.2.3