Skip to content

Commit

Permalink
Store most recent repl value in '_'
Browse files Browse the repository at this point in the history
Just like python, the top-level '_' variable
holds the most recently printed value.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Dec 15, 2022
1 parent e80f0b5 commit f4c4718
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions snek-base.builtin
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ chr, 1
abs, 1
math.sqrt, 1
None, -2, SNEK_NULL
_, -2, 1
1 change: 1 addition & 0 deletions snek-gram.ll
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ command : @{ snek_print_val = snek_interactive; }@ stat
if (snek_abort)
return parse_return_error;
if (snek_print_val && !snek_is_null(p)) {
snek_id_store(SNEK_BUILTIN__, p);
snek_poly_print(stdout, p, 'r');
putchar('\n');
}
Expand Down

0 comments on commit f4c4718

Please sign in to comment.