I think the real solution is to "not do that" as it were.
Unquoted symbols on the stack are verboten.
This commit is contained in:
parent
89550cdd5f
commit
5d856bf444
13
debugger.py
13
debugger.py
|
|
@ -35,7 +35,7 @@ expected_result = '[1 [2 [3 4 625 6] 7] 8]'
|
|||
expected_result_as_stack = text_to_expression(expected_result)
|
||||
|
||||
|
||||
def test_expr(ds):
|
||||
def test_expr(ds, e=expression):
|
||||
'''
|
||||
Run the test expression with the defs in ds.
|
||||
Return the resulting stack as a string or the
|
||||
|
|
@ -44,7 +44,7 @@ def test_expr(ds):
|
|||
D = dictionary.copy()
|
||||
D.update(ds)
|
||||
try:
|
||||
stack, _, _ = joy((), expression, D)
|
||||
stack, _, _ = joy((), e, D)
|
||||
except Exception as err:
|
||||
return err
|
||||
return stack_to_string(stack)
|
||||
|
|
@ -202,9 +202,9 @@ del CD['unit']
|
|||
del CD['unswons']
|
||||
del CD['x']
|
||||
|
||||
print(test_expr(CD))
|
||||
for n in sorted(CD):
|
||||
print(n)
|
||||
##print(test_expr(CD))
|
||||
##for n in sorted(CD):
|
||||
## print(n)
|
||||
## ?
|
||||
## _step0
|
||||
## _step1
|
||||
|
|
@ -217,7 +217,8 @@ for n in sorted(CD):
|
|||
## step
|
||||
## uncons
|
||||
|
||||
|
||||
expr = text_to_expression('[[dip]] [uncons] trace')
|
||||
print(test_expr(CD, e=expr))
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -540,12 +540,53 @@
|
|||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Argh! It is inside `uncons` itself, isn't it!?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": []
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[Q] [dip dip infra dip infra dip infra]"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"[Q] [dip dip infra dip infra dip infra]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"source": [
|
||||
"uncons"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
|
|
@ -556,10 +597,69 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[Q] [dip dip infra dip infra dip infra]"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"[popdd roll< pop] inscribe"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": []
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[Q] [dip dip infra dip infra dip infra]"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"[Q] [dip dip infra dip infra dip infra]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[Q] dip [dip infra dip infra dip infra]"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"uncons"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
|
|
|
|||
Loading…
Reference in New Issue