Evaluate right to left (K style)
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
Rechercherichtung
Start with the infix pass in im-parse.mts and the evaluator in imp-eval.mts, then trace how modifyNoun and strands run parts-of-speech steps. Read the chained-infix tests in imp-tests.org and prim-tests.org; preserve unevaluated [ ] blocks and their parse rules. Done means both example expressions produce 13 22 31, the comma case no longer fails, tests and docs reflect the new rule, and the PR explains comma behavior and changed expected outputs.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Decision (Michal, 2026-11-09)
The default evaluator of implish must evaluate right to left, as in K. Implish stays a Logo-like language. Blocks inside [ ] are not evaluated. They can have their own parse rules.
Note: you read the code left to right, but the evaluator runs it right to left. Each verb takes everything to its right as its right argument.
Why
Today the evaluator reads infix verbs left to right with no precedence. This gives wrong results that are hard to see:
a: 1 + ! 3 ; rev a + 10 * a
This gives 13 24 33. The parser reads it as ((rev a) + 10) * a. The user wanted rev a + (10 * a), which is 13 22 31.
A second bug is in comma threading. This line fails with "expected number or vector, got: LST":
a: 1 + ! 3 ; rev a , + 10 * a
The comma takes the whole [set ; rev] list as its left argument. It must take only the clause next to it.
What to change
- Change the infix pass in im-parse.mts and the evaluator in imp-eval.mts so that a dyad takes the whole expression to its right as its right argument.
- Do the same in the code that runs the parts-of-speech steps (modifyNoun and strands).
- Keep [ ] blocks unevaluated. Keep their own parse rules.
- Decide what the comma does under the new rule. Write the answer in the PR. The line
a: 1 + ! 3 ; rev a , + 10 * amust not fail. - Keep the
.|token free. Michal may use it later as a pipeline operator (like |> in Elixir). Do not add it now. - Update every test in imp-tests.org and prim-tests.org that chains infix verbs. Explain each changed expected output in the PR.
- Update the front page example (rev 1 2 3 + 10 20 30) so that it still shows something clear.
- Update docs/evaluator.md and CLAUDE.md. They now say "left-to-right" and "no precedence".
Not in this issue
- The b4 port (PR #3) follows in a second PR, after the TypeScript behavior is stable.
- No deploy. Michal merges. A deploy uses the script from PR #7.
Order of work
This change goes first, on top of main. The open PRs (#3, #7, #12 to #15, #18, #19) are rebased on it after it merges.
Done when
- Both lines at the top of this issue give 13 22 31.
- All tests pass.
- Docs match the new rule.
- The PR follows the tangentcode PR standards (draft while working, MinBot check, Codex rounds, a screenshot for UI changes).
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6
- Forks
- 1
- Ø Merge
- 3 Min.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus tangentcode/implish
-
Error and multi-line string values don't show as loadable textEvtl. vergeben @tangentstorm hat das vor 32 Tagen übernommen. Offenapproved follow-up
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
tangentcode/implish#17 ·
-
Quoted lists lose their quote when shownEvtl. vergeben @tangentstorm hat das vor 32 Tagen übernommen. Offenapproved follow-up
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
tangentcode/implish#16 ·
-
Dict show: comma after symbol-valued key changes the key on reloadEvtl. vergeben @tangentstorm hat das vor 32 Tagen übernommen. Offenapproved follow-up
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 30/100
tangentcode/implish#11 ·
-
String literal escape sequences are not decodedEvtl. vergeben @tangentstorm hat das vor 32 Tagen übernommen. Offenapproved follow-up
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 30/100
tangentcode/implish#10 ·
-
x/y/z bindings not restored when a function body throwsEvtl. vergeben @tangentstorm hat das vor 32 Tagen übernommen. Offenapproved follow-up
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 25/100
tangentcode/implish#9 ·
Alle Issues in tangentcode/implish
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
MTES-MCT/monitorenv#3257 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
salesforce/sa11y#1022 ·
-
area/web platform/ios type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
anomalyco/opencode#67504 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Kartographer map markers lose their geo: link on non-English wikisEvtl. vergeben @playlikeboy hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
openzim/mwoffliner#3014 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Report: Bloomberg HTOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag