• R/O
  • HTTP
  • SSH
  • HTTPS

Thun: Commit

Interpreter and library.


Commit MetaInfo

Révision5d856bf444196b5570b0585108b99e26331dba10 (tree)
l'heure2021-11-29 08:03:47
AuteurSimon Forman <sforman@hush...>
CommiterSimon Forman

Message de Log

I think the real solution is to "not do that" as it were.

Unquoted symbols on the stack are verboten.

Change Summary

Modification

--- a/debugger.py
+++ b/debugger.py
@@ -35,7 +35,7 @@ expected_result = '[1 [2 [3 4 625 6] 7] 8]'
3535 expected_result_as_stack = text_to_expression(expected_result)
3636
3737
38-def test_expr(ds):
38+def test_expr(ds, e=expression):
3939 '''
4040 Run the test expression with the defs in ds.
4141 Return the resulting stack as a string or the
@@ -44,7 +44,7 @@ def test_expr(ds):
4444 D = dictionary.copy()
4545 D.update(ds)
4646 try:
47- stack, _, _ = joy((), expression, D)
47+ stack, _, _ = joy((), e, D)
4848 except Exception as err:
4949 return err
5050 return stack_to_string(stack)
@@ -202,9 +202,9 @@ del CD['unit']
202202 del CD['unswons']
203203 del CD['x']
204204
205-print(test_expr(CD))
206-for n in sorted(CD):
207- print(n)
205+##print(test_expr(CD))
206+##for n in sorted(CD):
207+## print(n)
208208 ## ?
209209 ## _step0
210210 ## _step1
@@ -217,7 +217,8 @@ for n in sorted(CD):
217217 ## step
218218 ## uncons
219219
220-
220+expr = text_to_expression('[[dip]] [uncons] trace')
221+print(test_expr(CD, e=expr))
221222
222223
223224
--- a/docs/Zipper.ipynb
+++ b/docs/Zipper.ipynb
@@ -541,18 +541,52 @@
541541 "source": []
542542 },
543543 {
544+ "cell_type": "markdown",
545+ "metadata": {},
546+ "source": [
547+ "Argh! It is inside `uncons` itself, isn't it!?"
548+ ]
549+ },
550+ {
544551 "cell_type": "code",
545- "execution_count": null,
552+ "execution_count": 1,
546553 "metadata": {},
547- "outputs": [],
548- "source": []
554+ "outputs": [
555+ {
556+ "name": "stdout",
557+ "output_type": "stream",
558+ "text": []
559+ }
560+ ],
561+ "source": [
562+ "clear"
563+ ]
564+ },
565+ {
566+ "cell_type": "code",
567+ "execution_count": 2,
568+ "metadata": {},
569+ "outputs": [
570+ {
571+ "name": "stdout",
572+ "output_type": "stream",
573+ "text": [
574+ "[Q] [dip dip infra dip infra dip infra]"
575+ ]
576+ }
577+ ],
578+ "source": [
579+ "[Q] [dip dip infra dip infra dip infra]"
580+ ]
549581 },
550582 {
551583 "cell_type": "code",
552584 "execution_count": null,
553585 "metadata": {},
554586 "outputs": [],
555- "source": []
587+ "source": [
588+ "uncons"
589+ ]
556590 },
557591 {
558592 "cell_type": "code",
@@ -563,6 +597,72 @@
563597 },
564598 {
565599 "cell_type": "code",
600+ "execution_count": 4,
601+ "metadata": {},
602+ "outputs": [
603+ {
604+ "name": "stdout",
605+ "output_type": "stream",
606+ "text": [
607+ "[Q] [dip dip infra dip infra dip infra]"
608+ ]
609+ }
610+ ],
611+ "source": [
612+ "[popdd roll< pop] inscribe"
613+ ]
614+ },
615+ {
616+ "cell_type": "code",
617+ "execution_count": 5,
618+ "metadata": {},
619+ "outputs": [
620+ {
621+ "name": "stdout",
622+ "output_type": "stream",
623+ "text": []
624+ }
625+ ],
626+ "source": [
627+ "clear"
628+ ]
629+ },
630+ {
631+ "cell_type": "code",
632+ "execution_count": 6,
633+ "metadata": {},
634+ "outputs": [
635+ {
636+ "name": "stdout",
637+ "output_type": "stream",
638+ "text": [
639+ "[Q] [dip dip infra dip infra dip infra]"
640+ ]
641+ }
642+ ],
643+ "source": [
644+ "[Q] [dip dip infra dip infra dip infra]"
645+ ]
646+ },
647+ {
648+ "cell_type": "code",
649+ "execution_count": 7,
650+ "metadata": {},
651+ "outputs": [
652+ {
653+ "name": "stdout",
654+ "output_type": "stream",
655+ "text": [
656+ "[Q] dip [dip infra dip infra dip infra]"
657+ ]
658+ }
659+ ],
660+ "source": [
661+ "uncons"
662+ ]
663+ },
664+ {
665+ "cell_type": "code",
566666 "execution_count": null,
567667 "metadata": {},
568668 "outputs": [],
Afficher sur ancien navigateur de dépôt.