Conform!
cons and loop check type before number. Don't print '<- top'.
This commit is contained in:
parent
aacd9764fe
commit
5bccaff9f2
|
|
@ -682,9 +682,6 @@ def repl(stack=(), dictionary=None):
|
||||||
dictionary = {}
|
dictionary = {}
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
print()
|
|
||||||
print(stack_to_string(stack), '<-top')
|
|
||||||
print()
|
|
||||||
try:
|
try:
|
||||||
text = input('joy? ')
|
text = input('joy? ')
|
||||||
except (EOFError, KeyboardInterrupt):
|
except (EOFError, KeyboardInterrupt):
|
||||||
|
|
@ -695,6 +692,7 @@ def repl(stack=(), dictionary=None):
|
||||||
raise SystemExit from e
|
raise SystemExit from e
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
|
print(stack_to_string(stack))
|
||||||
except SystemExit as e:
|
except SystemExit as e:
|
||||||
raise SystemExit from e
|
raise SystemExit from e
|
||||||
except:
|
except:
|
||||||
|
|
@ -919,9 +917,10 @@ def loop(stack, expr, dictionary):
|
||||||
...
|
...
|
||||||
|
|
||||||
'''
|
'''
|
||||||
quote, flag, stack = get_n_items(2, stack)
|
quote, stack = get_n_items(1, stack)
|
||||||
isnt_bool(flag)
|
|
||||||
isnt_stack(quote)
|
isnt_stack(quote)
|
||||||
|
flag, stack = get_n_items(1, stack)
|
||||||
|
isnt_bool(flag)
|
||||||
if flag:
|
if flag:
|
||||||
expr = push_quote((quote, (S_loop, ())), expr)
|
expr = push_quote((quote, (S_loop, ())), expr)
|
||||||
expr = push_quote(quote, expr)
|
expr = push_quote(quote, expr)
|
||||||
|
|
@ -993,8 +992,9 @@ def cons(stack):
|
||||||
( https://en.wikipedia.org/wiki/Cons#Lists ).
|
( https://en.wikipedia.org/wiki/Cons#Lists ).
|
||||||
Its inverse operation is uncons.
|
Its inverse operation is uncons.
|
||||||
'''
|
'''
|
||||||
s0, a1, stack = get_n_items(2, stack)
|
s0, stack = get_n_items(1, stack)
|
||||||
isnt_stack(s0)
|
isnt_stack(s0)
|
||||||
|
a1, stack = get_n_items(1, stack)
|
||||||
return ((a1, s0), stack)
|
return ((a1, s0), stack)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue