Fixed bug in appN

while updating some Jupyter notebooks with the Joypy kernel.
This commit is contained in:
Simon Forman
2022-09-16 20:49:46 -07:00
parent 3d1dc6232e
commit b2a1f40155
7 changed files with 761 additions and 1707 deletions
+9 -5
View File
@@ -115,7 +115,7 @@ anamorphism ≡ [pop []] swap [dip swons] genrec
app1 ≡ grba infrst
app2 ≡ [grba swap grba swap] dip [infrst] cons ii
app3 ≡ 3 appN
appN ≡ [grabN] codi map disenstacken
appN ≡ [grabN] codi map reverse disenstacken
at ≡ drop first
@@ -307,9 +307,9 @@ def joy(stack, expression, dictionary):
'''
expr = push_quote(expression) # We keep a stack-of-stacks, see below.
while expr:
print(
f'{stack_to_string(stack)}{expr_to_string(expr)}'
)
## print(
## f'{stack_to_string(stack)} • {expr_to_string(expr)}'
## )
term, expr = next_term(expr)
if isinstance(term, Symbol):
try:
@@ -2226,12 +2226,16 @@ def times(stack, expr, dictionary):
return stack, expr, dictionary
def default_defs(dictionary):
Def.load_definitions(__doc__.splitlines(), dictionary)
if __name__ == '__main__':
import sys
J = interp if '-q' in sys.argv else repl
dictionary = initialize()
Def.load_definitions(__doc__.splitlines(), dictionary)
default_defs(dictionary)
try:
stack = J(dictionary=dictionary)
except SystemExit:
+1 -1
View File
@@ -11,7 +11,7 @@ anamorphism [pop []] swap [dip swons] genrec
app1 grba infrst
app2 [grba swap grba swap] dip [infrst] cons ii
app3 3 appN
appN [grabN] codi map disenstacken
appN [grabN] codi map reverse disenstacken
at drop first
average [sum] [size] cleave /
b [i] dip i