Interpreter and library.
Révision | 4ed8ccc07d04f3e49654e75d66df903571d73237 (tree) |
---|---|
l'heure | 2021-11-29 06:14:07 |
Auteur | ![]() |
Commiter | Simon Forman |
I narrowed down the bug.
https://todo.sr.ht/~sforman/thun-der/15
Gotta quote your symbols if you put them on the stack, eh?
@@ -1,115 +1,60 @@ | ||
1 | -[1 [2 [3 4 625 6] 7] 8] -- pass | |
2 | -[1 [2 [3 4 625 6] 7] 8] ? pass | |
3 | -[1 [2 [3 4 625 6] 7] 8] && pass | |
4 | -[1 [2 [3 4 625 6] 7] 8] ++ pass | |
5 | -[1 [2 [3 4 625 6] 7] 8] || pass | |
6 | -[1 [2 [3 4 625 6] 7] 8] !- pass | |
7 | -[1 [2 [3 4 625 6] 7] 8] <{} pass | |
8 | -[1 [2 [3 4 625 6] 7] 8] <<{} pass | |
9 | -[1 [2 [3 4 625 6] 7] 8] abs pass | |
10 | -[1 [2 [3 4 625 6] 7] 8] anamorphism pass | |
11 | -[1 [2 [3 4 625 6] 7] 8] app1 pass | |
12 | -[1 [2 [3 4 625 6] 7] 8] app2 pass | |
13 | -[1 [2 [3 4 625 6] 7] 8] app3 pass | |
14 | -[1 [2 [3 4 625 6] 7] 8] appN pass | |
15 | -[1 [2 [3 4 625 6] 7] 8] at pass | |
16 | -[1 [2 [3 4 625 6] 7] 8] average pass | |
17 | -[1 [2 [3 4 625 6] 7] 8] b pass | |
18 | -[1 [2 [3 4 625 6] 7] 8] binary pass | |
19 | -[1 [2 [3 4 625 6] 7] 8] ccccons pass | |
20 | -[1 [2 [3 4 625 6] 7] 8] ccons pass | |
21 | -[1 [2 [3 4 625 6] 7] 8] clear pass | |
22 | -[1 [2 [3 4 625 6] 7] 8] cleave pass | |
23 | -[1 [2 [3 4 625 6] 7] 8] clop pass | |
24 | -[1 [2 [3 4 625 6] 7] 8] codi pass | |
25 | -[1 [2 [3 4 625 6] 7] 8] codireco pass | |
26 | -[1 [2 [3 4 625 6] 7] 8] dinfrirst pass | |
27 | -[1 [2 [3 4 625 6] 7] 8] dipd pass | |
28 | -[1 [2 [3 4 625 6] 7] 8] disenstacken pass | |
29 | -[1 [2 [3 4 625 6] 7] 8] down_to_zero pass | |
30 | -[1 [2 [3 4 625 6] 7] 8] drop pass | |
31 | -[1 [2 [3 4 625 6] 7] 8] dupd pass | |
32 | -[1 [2 [3 4 625 6] 7] 8] dupdd pass | |
33 | -[1 [2 [3 4 625 6] 7] 8] dupdip pass | |
34 | -[1 [2 [3 4 625 6] 7] 8] dupdipd pass | |
35 | -[1 [2 [3 4 625 6] 7] 8] enstacken pass | |
36 | -[1 [2 [3 4 625 6] 7] 8] flatten pass | |
37 | -[1 [2 [3 4 625 6] 7] 8] fork pass | |
38 | -[1 [2 [3 4 625 6] 7] 8] fourth pass | |
39 | -[1 [2 [3 4 625 6] 7] 8] gcd pass | |
40 | -[1 [2 [3 4 625 6] 7] 8] genrec pass | |
41 | -[1 [2 [3 4 625 6] 7] 8] grabN pass | |
42 | -[1 [2 [3 4 625 6] 7] 8] grba pass | |
43 | -[1 [2 [3 4 625 6] 7] 8] hypot pass | |
44 | -[1 [2 [3 4 625 6] 7] 8] ifte pass | |
45 | -[1 [2 [3 4 625 6] 7] 8] ii pass | |
46 | -[1 [2 [3 4 625 6] 7] 8] infra pass | |
47 | -[1 [2 [3 4 625 6] 7] 8] infrst pass | |
48 | -[1 [2 [3 4 625 6] 7] 8] make_generator pass | |
49 | -[1 [2 [3 4 625 6] 7] 8] mod pass | |
50 | -[1 [2 [3 4 625 6] 7] 8] neg pass | |
51 | -[1 [2 [3 4 625 6] 7] 8] not pass | |
52 | -[1 [2 [3 4 625 6] 7] 8] nulco pass | |
53 | -[1 [2 [3 4 625 6] 7] 8] nullary pass | |
54 | -[1 [2 [3 4 625 6] 7] 8] of pass | |
55 | -[1 [2 [3 4 625 6] 7] 8] pam pass | |
56 | -[1 [2 [3 4 625 6] 7] 8] pm pass | |
57 | -[1 [2 [3 4 625 6] 7] 8] popd pass | |
58 | -[1 [2 [3 4 625 6] 7] 8] popdd pass | |
59 | -[1 [2 [3 4 625 6] 7] 8] popop pass | |
60 | -[1 [2 [3 4 625 6] 7] 8] popopop pass | |
61 | -[1 [2 [3 4 625 6] 7] 8] popopd pass | |
62 | -[1 [2 [3 4 625 6] 7] 8] popopdd pass | |
63 | -[1 [2 [3 4 625 6] 7] 8] product pass | |
64 | -[1 [2 [3 4 625 6] 7] 8] quoted pass | |
65 | -[1 [2 [3 4 625 6] 7] 8] range pass | |
66 | -[1 [2 [3 4 625 6] 7] 8] range_to_zero pass | |
67 | -[1 [2 [3 4 625 6] 7] 8] reco pass | |
68 | -[1 [2 [3 4 625 6] 7] 8] rest pass | |
69 | -[1 [2 [3 4 625 6] 7] 8] reverse pass | |
70 | -[1 [2 [3 4 625 6] 7] 8] roll> pass | |
71 | -[1 [2 [3 4 625 6] 7] 8] roll< pass | |
72 | -[1 [2 [3 4 625 6] 7] 8] rollup pass | |
73 | -[1 [2 [3 4 625 6] 7] 8] rolldown pass | |
74 | -[1 [2 [3 4 625 6] 7] 8] rrest pass | |
75 | -[1 [2 [3 4 625 6] 7] 8] run pass | |
76 | -[1 [2 [3 4 625 6] 7] 8] second pass | |
77 | -[1 [2 [3 4 625 6] 7] 8] shift pass | |
78 | -[1 [2 [3 4 625 6] 7] 8] shunt pass | |
79 | -[1 [2 [3 4 625 6] 7] 8] size pass | |
80 | -[1 [2 [3 4 625 6] 7] 8] spiral_next pass | |
81 | -[1 [2 [3 4 625 6] 7] 8] split_at pass | |
82 | -[1 [2 [3 4 625 6] 7] 8] split_list pass | |
83 | -[1 [2 [3 4 625 6] 7] 8] sqr pass | |
84 | -[1 [2 [3 4 625 6] 7] 8] stackd pass | |
85 | -[1 [2 [3 4 625 6] 7] 8] step_zero pass | |
86 | -[1 [2 [3 4 625 6] 7] 8] sum pass | |
87 | -[1 [2 [3 4 625 6] 7] 8] swapd pass | |
88 | -[1 [2 [3 4 625 6] 7] 8] swons pass | |
89 | -[1 [2 [3 4 625 6] 7] 8] swoncat pass | |
90 | -[1 [2 [3 4 625 6] 7] 8] tailrec pass | |
91 | -[1 [2 [3 4 625 6] 7] 8] take pass | |
92 | -[1 [2 [3 4 625 6] 7] 8] ternary pass | |
93 | -[1 [2 [3 4 625 6] 7] 8] third pass | |
94 | -[1 [2 [3 4 625 6] 7] 8] tuck pass | |
95 | -[1 [2 [3 4 625 6] 7] 8] unary pass | |
96 | -[1 [2 [3 4 625 6] 7] 8] uncons pass | |
97 | -[1 [2 [3 4 625 6] 7] 8] unit pass | |
98 | -[1 [2 [3 4 625 6] 7] 8] unquoted pass | |
99 | -[1 [2 [3 4 625 6] 7] 8] unswons pass | |
100 | -[1 [2 [3 4 625 6] 7] 8] while pass | |
101 | -[1 [2 [3 4 625 6] 7] 8] x pass | |
102 | -step failed! | |
103 | -[1 [2 [3 4 625 6] 7] 8] _step0 pass | |
104 | -[1 [2 [3 4 625 6] 7] 8] _step1 pass | |
105 | -[1 [2 [3 4 625 6] 7] 8] _stept pass | |
106 | -[1 [2 [3 4 625 6] 7] 8] times pass | |
107 | -[1 [2 [3 4 625 6] 7] 8] _times0 pass | |
108 | -[1 [2 [3 4 625 6] 7] 8] _times1 pass | |
109 | -[1 [2 [3 4 625 6] 7] 8] _timest pass | |
110 | -[1 [2 [3 4 625 6] 7] 8] map pass | |
111 | -[1 [2 [3 4 625 6] 7] 8] _map? pass | |
112 | -[1 [2 [3 4 625 6] 7] 8] _mape pass | |
113 | -[1 [2 [3 4 625 6] 7] 8] _map0 pass | |
114 | -[1 [2 [3 4 625 6] 7] 8] _map1 pass | |
115 | -[1 [2 [3 4 625 6] 7] 8] _map2 pass | |
1 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • [[] ccons] step i | |
2 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] • step i | |
3 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] • [_step0] x i | |
4 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • x i | |
5 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • _step0 i | |
6 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • _step1 [popopop] [_stept] branch i | |
7 | + [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 | |
8 | + [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 | |
9 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • ? [[] ccons] [_step0] roll< [popopop] [_stept] branch i | |
10 | + [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 | |
11 | + [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 | |
12 | + [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 | |
13 | + [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 | |
14 | + [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 | |
15 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] true • [popopop] [_stept] branch i | |
16 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] true [popopop] • [_stept] branch i | |
17 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] true [popopop] [_stept] • branch i | |
18 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] [[] ccons] [_step0] • _stept i | |
19 | + [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 | |
20 | + [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 | |
21 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] [dip dip infra dip infra dip infra] • uncons [[] ccons] [_step0] [dupdipd] dip x i | |
22 | + [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 | |
23 | + [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 | |
24 | + [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 | |
25 | + [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 | |
26 | + [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 | |
27 | + [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 | |
28 | + [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 | |
29 | + [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 | |
30 | + [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 | |
31 | + [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 | |
32 | + [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 | |
33 | + [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 | |
34 | + [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 | |
35 | + [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 | |
36 | +[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 | |
37 | + [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 | |
38 | + [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 | |
39 | + [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 | |
40 | + [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 | |
41 | + [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 | |
42 | + [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 | |
43 | + [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 | |
44 | + [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 | |
45 | + [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 | |
46 | + [1 [2 [3 4 25 6] 7] 8] [dup mul] • dip [dip infra dip infra dip infra] [[] ccons] [_step0] [dupdipd] dip x i | |
47 | + • dup mul [1 [2 [3 4 25 6] 7] 8] [dip infra dip infra dip infra] [[] ccons] [_step0] [dupdipd] dip x i | |
48 | +------------------------------------------------------------------------- | |
49 | +not enough values to unpack (expected 2, got 0) | |
50 | +? | |
51 | +_step0 | |
52 | +_step1 | |
53 | +_stept | |
54 | +cleave | |
55 | +fork | |
56 | +grba | |
57 | +infrst | |
58 | +popdd | |
59 | +step | |
60 | +uncons |
@@ -24,11 +24,11 @@ expression = text_to_expression( | ||
24 | 24 | '[1 [2 [3 4 25 6] 7] 8]' |
25 | 25 | '[dup mul]' |
26 | 26 | '[dip dip infra dip infra dip infra]' |
27 | - '[[] ccons] step i' | |
27 | +## '[[] ccons] step i' | |
28 | 28 | |
29 | 29 | # to trace replace last line above with: |
30 | - # '[[[] ccons] step i]' | |
31 | - # 'trace' | |
30 | + '[[[] ccons] step i]' | |
31 | + 'trace' | |
32 | 32 | ) |
33 | 33 | |
34 | 34 | expected_result = '[1 [2 [3 4 625 6] 7] 8]' |
@@ -52,14 +52,14 @@ def test_expr(ds): | ||
52 | 52 | |
53 | 53 | # The problem is that it works with the built-ins: |
54 | 54 | |
55 | -print(test_expr({})) | |
55 | +##print(test_expr({})) | |
56 | 56 | |
57 | 57 | # Results: |
58 | 58 | # [1 [2 [3 4 625 6] 7] 8] |
59 | 59 | # |
60 | 60 | # But not with the definitions: |
61 | 61 | |
62 | -print(test_expr(defs)) | |
62 | +##print(test_expr(defs)) | |
63 | 63 | |
64 | 64 | # Results: |
65 | 65 | # not enough values to unpack (expected 2, got 0) |
@@ -70,11 +70,14 @@ print(test_expr(defs)) | ||
70 | 70 | # one-at-a-time to the dictionary and see if any one of |
71 | 71 | # them breaks it. |
72 | 72 | |
73 | -for def_name in defs: | |
74 | - stack_str = test_expr({def_name: defs[def_name]}) | |
75 | - if stack_str != expected_result: | |
76 | - print(def_name, 'failed!') | |
77 | - print(stack_str) | |
73 | +# Only the defs that shadow the built-ins could be the problem: | |
74 | +candidates = set(dictionary) & set(defs) | |
75 | + | |
76 | +##for def_name in candidates: | |
77 | +## stack_str = test_expr({def_name: defs[def_name]}) | |
78 | +## if stack_str != expected_result: | |
79 | +## print(def_name, 'failed!') | |
80 | +## print(stack_str) | |
78 | 81 | |
79 | 82 | # Results: |
80 | 83 | # step failed! |
@@ -88,11 +91,135 @@ step_defs = { | ||
88 | 91 | } |
89 | 92 | for name in ('?', 'dupdipd', 'popopop'): |
90 | 93 | step_defs[name] = defs[name] |
91 | -print(sorted(step_defs)) | |
92 | -print(test_expr(step_defs)) | |
94 | +##print(sorted(step_defs)) | |
95 | +##print(test_expr(step_defs)) | |
93 | 96 | |
94 | 97 | # Results: |
95 | 98 | # [1 [2 [3 4 625 6] 7] 8] |
96 | 99 | # |
97 | 100 | # So it's not step by itself, it's some combination of defintions |
98 | 101 | # that is causing the bug. |
102 | + | |
103 | +its_is_probably_not = set(''' | |
104 | + dipd roll< uncons | |
105 | +'''.split()) | |
106 | + | |
107 | +sus_defs = { | |
108 | + def_name: defs[def_name] | |
109 | + for def_name in defs | |
110 | + if (def_name in candidates | |
111 | + or def_name in step_defs) | |
112 | + and def_name not in its_is_probably_not | |
113 | + } | |
114 | +##print() | |
115 | +##print(test_expr(sus_defs)) | |
116 | + | |
117 | +d = step_defs.copy() | |
118 | +d['uncons'] = defs['uncons'] | |
119 | +d['cleave'] = defs['cleave'] | |
120 | +d['fork'] = defs['fork'] | |
121 | + | |
122 | +##print(test_expr(d)) | |
123 | + | |
124 | +CD = { | |
125 | + name: defs[name] | |
126 | + for name in candidates | |
127 | + } | |
128 | +CD.update(step_defs) | |
129 | +CD['codi'] = defs['codi'] | |
130 | +CD['swapd'] = defs['swapd'] | |
131 | +CD['cleave'] = defs['cleave'] | |
132 | +CD['fork'] = defs['fork'] | |
133 | +CD['grba'] = defs['grba'] | |
134 | +CD['infrst'] = defs['infrst'] | |
135 | + | |
136 | +##print(test_expr(CD)) | |
137 | + | |
138 | +##print(sorted(CD)) | |
139 | +# [++, --, '?', _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] | |
140 | + | |
141 | +del CD['++'] | |
142 | +del CD['--'] | |
143 | +##del CD['?'] | |
144 | +##del CD['_step0'] | |
145 | +##del CD['_step1'] | |
146 | +##del CD['_stept'] | |
147 | +del CD['abs'] | |
148 | +del CD['app1'] | |
149 | +del CD['app2'] | |
150 | +del CD['app3'] | |
151 | +del CD['at'] | |
152 | +del CD['b'] | |
153 | +del CD['ccons'] | |
154 | +del CD['clear'] | |
155 | +##del CD['cleave'] # <-- dep | |
156 | +del CD['codi'] | |
157 | +del CD['dipd'] | |
158 | +del CD['disenstacken'] | |
159 | +del CD['drop'] | |
160 | +del CD['dupd'] | |
161 | +del CD['dupdd'] | |
162 | +del CD['dupdip'] | |
163 | +del CD['dupdipd'] | |
164 | +##del CD['fork'] # <-- dep | |
165 | +del CD['fourth'] | |
166 | +del CD['genrec'] | |
167 | +##del CD['grba'] # <-- dep | |
168 | +del CD['ii'] | |
169 | +del CD['infra'] | |
170 | +##del CD['infrst'] # <-- dep | |
171 | +del CD['map'] | |
172 | +del CD['mod'] | |
173 | +del CD['neg'] | |
174 | +del CD['not'] | |
175 | +del CD['pm'] | |
176 | +del CD['popd'] | |
177 | +##del CD['popdd'] # <-- !!!!! | |
178 | +del CD['popop'] | |
179 | +del CD['popopd'] | |
180 | +del CD['popopdd'] | |
181 | +del CD['popopop'] | |
182 | +del CD['rest'] | |
183 | +del CD['reverse'] | |
184 | +del CD['roll<'] | |
185 | +del CD['roll>'] | |
186 | +del CD['rolldown'] | |
187 | +del CD['rollup'] | |
188 | +del CD['rrest'] | |
189 | +del CD['second'] | |
190 | +del CD['shunt'] | |
191 | +##del CD['step'] # <-- !!!!! | |
192 | +del CD['step_zero'] | |
193 | +del CD['sum'] | |
194 | +del CD['swapd'] | |
195 | +del CD['swons'] | |
196 | +del CD['take'] | |
197 | +del CD['third'] | |
198 | +del CD['times'] | |
199 | +del CD['tuck'] | |
200 | +##del CD['uncons'] # <-- popopop !? | |
201 | +del CD['unit'] | |
202 | +del CD['unswons'] | |
203 | +del CD['x'] | |
204 | + | |
205 | +print(test_expr(CD)) | |
206 | +for n in sorted(CD): | |
207 | + print(n) | |
208 | +## ? | |
209 | +## _step0 | |
210 | +## _step1 | |
211 | +## _stept | |
212 | +## cleave | |
213 | +## fork | |
214 | +## grba | |
215 | +## infrst | |
216 | +## popdd | |
217 | +## step | |
218 | +## uncons | |
219 | + | |
220 | + | |
221 | + | |
222 | + | |
223 | + | |
224 | +##print() | |
225 | +##print(set(dictionary) & set(defs)) |