-[1 [2 [3 4 625 6] 7] 8] -- pass
-[1 [2 [3 4 625 6] 7] 8] ? pass
-[1 [2 [3 4 625 6] 7] 8] && pass
-[1 [2 [3 4 625 6] 7] 8] ++ pass
-[1 [2 [3 4 625 6] 7] 8] || pass
-[1 [2 [3 4 625 6] 7] 8] !- pass
-[1 [2 [3 4 625 6] 7] 8] <{} pass
-[1 [2 [3 4 625 6] 7] 8] <<{} pass
-[1 [2 [3 4 625 6] 7] 8] abs pass
-[1 [2 [3 4 625 6] 7] 8] anamorphism pass
-[1 [2 [3 4 625 6] 7] 8] app1 pass
-[1 [2 [3 4 625 6] 7] 8] app2 pass
-[1 [2 [3 4 625 6] 7] 8] app3 pass
-[1 [2 [3 4 625 6] 7] 8] appN pass
-[1 [2 [3 4 625 6] 7] 8] at pass
-[1 [2 [3 4 625 6] 7] 8] average pass
-[1 [2 [3 4 625 6] 7] 8] b pass
-[1 [2 [3 4 625 6] 7] 8] binary pass
-[1 [2 [3 4 625 6] 7] 8] ccccons pass
-[1 [2 [3 4 625 6] 7] 8] ccons pass
-[1 [2 [3 4 625 6] 7] 8] clear pass
-[1 [2 [3 4 625 6] 7] 8] cleave pass
-[1 [2 [3 4 625 6] 7] 8] clop pass
-[1 [2 [3 4 625 6] 7] 8] codi pass
-[1 [2 [3 4 625 6] 7] 8] codireco pass
-[1 [2 [3 4 625 6] 7] 8] dinfrirst pass
-[1 [2 [3 4 625 6] 7] 8] dipd pass
-[1 [2 [3 4 625 6] 7] 8] disenstacken pass
-[1 [2 [3 4 625 6] 7] 8] down_to_zero pass
-[1 [2 [3 4 625 6] 7] 8] drop pass
-[1 [2 [3 4 625 6] 7] 8] dupd pass
-[1 [2 [3 4 625 6] 7] 8] dupdd pass
-[1 [2 [3 4 625 6] 7] 8] dupdip pass
-[1 [2 [3 4 625 6] 7] 8] dupdipd pass
-[1 [2 [3 4 625 6] 7] 8] enstacken pass
-[1 [2 [3 4 625 6] 7] 8] flatten pass
-[1 [2 [3 4 625 6] 7] 8] fork pass
-[1 [2 [3 4 625 6] 7] 8] fourth pass
-[1 [2 [3 4 625 6] 7] 8] gcd pass
-[1 [2 [3 4 625 6] 7] 8] genrec pass
-[1 [2 [3 4 625 6] 7] 8] grabN pass
-[1 [2 [3 4 625 6] 7] 8] grba pass
-[1 [2 [3 4 625 6] 7] 8] hypot pass
-[1 [2 [3 4 625 6] 7] 8] ifte pass
-[1 [2 [3 4 625 6] 7] 8] ii pass
-[1 [2 [3 4 625 6] 7] 8] infra pass
-[1 [2 [3 4 625 6] 7] 8] infrst pass
-[1 [2 [3 4 625 6] 7] 8] make_generator pass
-[1 [2 [3 4 625 6] 7] 8] mod pass
-[1 [2 [3 4 625 6] 7] 8] neg pass
-[1 [2 [3 4 625 6] 7] 8] not pass
-[1 [2 [3 4 625 6] 7] 8] nulco pass
-[1 [2 [3 4 625 6] 7] 8] nullary pass
-[1 [2 [3 4 625 6] 7] 8] of pass
-[1 [2 [3 4 625 6] 7] 8] pam pass
-[1 [2 [3 4 625 6] 7] 8] pm pass
-[1 [2 [3 4 625 6] 7] 8] popd pass
-[1 [2 [3 4 625 6] 7] 8] popdd pass
-[1 [2 [3 4 625 6] 7] 8] popop pass
-[1 [2 [3 4 625 6] 7] 8] popopop pass
-[1 [2 [3 4 625 6] 7] 8] popopd pass
-[1 [2 [3 4 625 6] 7] 8] popopdd pass
-[1 [2 [3 4 625 6] 7] 8] product pass
-[1 [2 [3 4 625 6] 7] 8] quoted pass
-[1 [2 [3 4 625 6] 7] 8] range pass
-[1 [2 [3 4 625 6] 7] 8] range_to_zero pass
-[1 [2 [3 4 625 6] 7] 8] reco pass
-[1 [2 [3 4 625 6] 7] 8] rest pass
-[1 [2 [3 4 625 6] 7] 8] reverse pass
-[1 [2 [3 4 625 6] 7] 8] roll> pass
-[1 [2 [3 4 625 6] 7] 8] roll< pass
-[1 [2 [3 4 625 6] 7] 8] rollup pass
-[1 [2 [3 4 625 6] 7] 8] rolldown pass
-[1 [2 [3 4 625 6] 7] 8] rrest pass
-[1 [2 [3 4 625 6] 7] 8] run pass
-[1 [2 [3 4 625 6] 7] 8] second pass
-[1 [2 [3 4 625 6] 7] 8] shift pass
-[1 [2 [3 4 625 6] 7] 8] shunt pass
-[1 [2 [3 4 625 6] 7] 8] size pass
-[1 [2 [3 4 625 6] 7] 8] spiral_next pass
-[1 [2 [3 4 625 6] 7] 8] split_at pass
-[1 [2 [3 4 625 6] 7] 8] split_list pass
-[1 [2 [3 4 625 6] 7] 8] sqr pass
-[1 [2 [3 4 625 6] 7] 8] stackd pass
-[1 [2 [3 4 625 6] 7] 8] step_zero pass
-[1 [2 [3 4 625 6] 7] 8] sum pass
-[1 [2 [3 4 625 6] 7] 8] swapd pass
-[1 [2 [3 4 625 6] 7] 8] swons pass
-[1 [2 [3 4 625 6] 7] 8] swoncat pass
-[1 [2 [3 4 625 6] 7] 8] tailrec pass
-[1 [2 [3 4 625 6] 7] 8] take pass
-[1 [2 [3 4 625 6] 7] 8] ternary pass
-[1 [2 [3 4 625 6] 7] 8] third pass
-[1 [2 [3 4 625 6] 7] 8] tuck pass
-[1 [2 [3 4 625 6] 7] 8] unary pass
-[1 [2 [3 4 625 6] 7] 8] uncons pass
-[1 [2 [3 4 625 6] 7] 8] unit pass
-[1 [2 [3 4 625 6] 7] 8] unquoted pass
-[1 [2 [3 4 625 6] 7] 8] unswons pass
-[1 [2 [3 4 625 6] 7] 8] while pass
-[1 [2 [3 4 625 6] 7] 8] x pass
-step failed!
-[1 [2 [3 4 625 6] 7] 8] _step0 pass
-[1 [2 [3 4 625 6] 7] 8] _step1 pass
-[1 [2 [3 4 625 6] 7] 8] _stept pass
-[1 [2 [3 4 625 6] 7] 8] times pass
-[1 [2 [3 4 625 6] 7] 8] _times0 pass
-[1 [2 [3 4 625 6] 7] 8] _times1 pass
-[1 [2 [3 4 625 6] 7] 8] _timest pass
-[1 [2 [3 4 625 6] 7] 8] map pass
-[1 [2 [3 4 625 6] 7] 8] _map? pass
-[1 [2 [3 4 625 6] 7] 8] _mape pass
-[1 [2 [3 4 625 6] 7] 8] _map0 pass
-[1 [2 [3 4 625 6] 7] 8] _map1 pass
-[1 [2 [3 4 625 6] 7] 8] _map2 pass
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • [[] ccons] step i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] • step i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] • [_step0] x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • _step0 i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • _step1 [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • [?] dipd roll< [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] [?] • dipd roll< [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • ? [[] ccons] [_step0] roll< [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • dup bool [[] ccons] [_step0] roll< [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [dip dip infra dip infra dip infra] • bool [[] ccons] [_step0] roll< [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] true • [[] ccons] [_step0] roll< [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] true [[] ccons] • [_step0] roll< [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] true [[] ccons] [_step0] • roll< [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] true • [popopop] [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] true [popopop] • [_stept] branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] true [popopop] [_stept] • branch i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • _stept i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • [uncons] dipd [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] [uncons] • dipd [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • uncons [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • [first] [rest] cleave [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [first] • [rest] cleave [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [first] [rest] • cleave [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [first] [rest] • fork popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [first] [rest] • [i] app2 popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [first] [rest] [i] • app2 popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[first] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] • infra first [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [first] • i [[dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] swaack first [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • first [[dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] swaack first [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] dip • [[dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] swaack first [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] dip [[dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] • swaack first [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [dip [dup mul] [1 [2 [3 4 25 6] 7] 8]] • first [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] dip • [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] dip [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] • [i] infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+[1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] dip [[rest] [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] [i] • infra first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [rest] • i [dip [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] swaack first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • rest [dip [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] swaack first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip infra dip infra dip infra] • [dip [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] swaack first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip infra dip infra dip infra] [dip [dip dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] • swaack first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] dip [[dip infra dip infra dip infra] [dup mul] [1 [2 [3 4 25 6] 7] 8]] • first popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] dip [dip infra dip infra dip infra] • popdd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] dip [dip infra dip infra dip infra] • [pop] dipd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] dip [dip infra dip infra dip infra] [pop] • dipd [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • pop dip [dip infra dip infra dip infra] [[] ccons] [_step0] [dupdipd] dip x i
+ [1 [2 [3 4 25 6] 7] 8] [dup mul] • dip [dip infra dip infra dip infra] [[] ccons] [_step0] [dupdipd] dip x i
+ • dup mul [1 [2 [3 4 25 6] 7] 8] [dip infra dip infra dip infra] [[] ccons] [_step0] [dupdipd] dip x i
+-------------------------------------------------------------------------
+not enough values to unpack (expected 2, got 0)
+?
+_step0
+_step1
+_stept
+cleave
+fork
+grba
+infrst
+popdd
+step
+uncons
'[1 [2 [3 4 25 6] 7] 8]'
'[dup mul]'
'[dip dip infra dip infra dip infra]'
- '[[] ccons] step i'
+## '[[] ccons] step i'
# to trace replace last line above with:
- # '[[[] ccons] step i]'
- # 'trace'
+ '[[[] ccons] step i]'
+ 'trace'
)
expected_result = '[1 [2 [3 4 625 6] 7] 8]'
# The problem is that it works with the built-ins:
-print(test_expr({}))
+##print(test_expr({}))
# Results:
# [1 [2 [3 4 625 6] 7] 8]
#
# But not with the definitions:
-print(test_expr(defs))
+##print(test_expr(defs))
# Results:
# not enough values to unpack (expected 2, got 0)
# one-at-a-time to the dictionary and see if any one of
# them breaks it.
-for def_name in defs:
- stack_str = test_expr({def_name: defs[def_name]})
- if stack_str != expected_result:
- print(def_name, 'failed!')
- print(stack_str)
+# Only the defs that shadow the built-ins could be the problem:
+candidates = set(dictionary) & set(defs)
+
+##for def_name in candidates:
+## stack_str = test_expr({def_name: defs[def_name]})
+## if stack_str != expected_result:
+## print(def_name, 'failed!')
+## print(stack_str)
# Results:
# step failed!
}
for name in ('?', 'dupdipd', 'popopop'):
step_defs[name] = defs[name]
-print(sorted(step_defs))
-print(test_expr(step_defs))
+##print(sorted(step_defs))
+##print(test_expr(step_defs))
# Results:
# [1 [2 [3 4 625 6] 7] 8]
#
# So it's not step by itself, it's some combination of defintions
# that is causing the bug.
+
+its_is_probably_not = set('''
+ dipd roll< uncons
+'''.split())
+
+sus_defs = {
+ def_name: defs[def_name]
+ for def_name in defs
+ if (def_name in candidates
+ or def_name in step_defs)
+ and def_name not in its_is_probably_not
+ }
+##print()
+##print(test_expr(sus_defs))
+
+d = step_defs.copy()
+d['uncons'] = defs['uncons']
+d['cleave'] = defs['cleave']
+d['fork'] = defs['fork']
+
+##print(test_expr(d))
+
+CD = {
+ name: defs[name]
+ for name in candidates
+ }
+CD.update(step_defs)
+CD['codi'] = defs['codi']
+CD['swapd'] = defs['swapd']
+CD['cleave'] = defs['cleave']
+CD['fork'] = defs['fork']
+CD['grba'] = defs['grba']
+CD['infrst'] = defs['infrst']
+
+##print(test_expr(CD))
+
+##print(sorted(CD))
+# [++, --, '?', _step0, _step1, _stept, abs, app1, app2, app3, at, b, ccons, clear, 'cleave', 'codi', dipd, disenstacken, drop, dupd, dupdd, dupdip, 'dupdipd', 'fork', fourth, genrec, 'grba', ii, infra, 'infrst', map, mod, neg, not, pm, popd, popdd, popop, popopd, popopdd, 'popopop', rest, reverse, roll<, roll>, rolldown, rollup, rrest, second, shunt, step, step_zero, sum, 'swapd', swons, take, third, times, tuck, uncons, unit, unswons, x]
+
+del CD['++']
+del CD['--']
+##del CD['?']
+##del CD['_step0']
+##del CD['_step1']
+##del CD['_stept']
+del CD['abs']
+del CD['app1']
+del CD['app2']
+del CD['app3']
+del CD['at']
+del CD['b']
+del CD['ccons']
+del CD['clear']
+##del CD['cleave'] # <-- dep
+del CD['codi']
+del CD['dipd']
+del CD['disenstacken']
+del CD['drop']
+del CD['dupd']
+del CD['dupdd']
+del CD['dupdip']
+del CD['dupdipd']
+##del CD['fork'] # <-- dep
+del CD['fourth']
+del CD['genrec']
+##del CD['grba'] # <-- dep
+del CD['ii']
+del CD['infra']
+##del CD['infrst'] # <-- dep
+del CD['map']
+del CD['mod']
+del CD['neg']
+del CD['not']
+del CD['pm']
+del CD['popd']
+##del CD['popdd'] # <-- !!!!!
+del CD['popop']
+del CD['popopd']
+del CD['popopdd']
+del CD['popopop']
+del CD['rest']
+del CD['reverse']
+del CD['roll<']
+del CD['roll>']
+del CD['rolldown']
+del CD['rollup']
+del CD['rrest']
+del CD['second']
+del CD['shunt']
+##del CD['step'] # <-- !!!!!
+del CD['step_zero']
+del CD['sum']
+del CD['swapd']
+del CD['swons']
+del CD['take']
+del CD['third']
+del CD['times']
+del CD['tuck']
+##del CD['uncons'] # <-- popopop !?
+del CD['unit']
+del CD['unswons']
+del CD['x']
+
+print(test_expr(CD))
+for n in sorted(CD):
+ print(n)
+## ?
+## _step0
+## _step1
+## _stept
+## cleave
+## fork
+## grba
+## infrst
+## popdd
+## step
+## uncons
+
+
+
+
+
+##print()
+##print(set(dictionary) & set(defs))