内涵性快乐(关于内部结构的串联性描述)—克里斯汀的万维网站

  • Intensional Programming Languages: Had a moment recently. Johannes Bader's website on tree calculus popularized work on intensional rewriting systems spearheaded by Dr. Barry Jay. They have developed variants like SF calculus, tree calculus, triage calculus, etc.
  • Joy: A concatenative programming language trying to capture its essence. It has a stack-based language or a system of rewriting rules. Syntax consists of zero or more commands (quotations or operators like dup, swap, pop, cat, quote, eval).

    • Stack-based Semantics: Each command has a specific behavior on the stack. For example, dup duplicates the top element, swap swaps the top two, pop removes the top, cat concatenates, quote wraps in quotation, and eval executes the top program.
    • Rewriting Semantics: The execution of a Joy program can be described by a sequence of rewrites. For example, [a] dup→\[a\] \[a\], [a] \[b\] swap→\[b\] \[a\], etc. Applying the leftmost rewrite gives a notion of “applicative order reduction” simulating stack-based semantics.
  • Making Joy Intensional: Joy is extensional and has no way to “take apart” a quotation. An intensional operator map was described by @olus2000 which maps over every element of a program applying an operator or a quotation. Another operator quota pops a single program and surrounds every command in it with a quotation.

    • Equivalence of map and quota: It was shown that these two operators can be expressed in terms of each other. To implement map, a way to distinguish dup from a quotation was found using quota to introspect.
  • Conclusions: Presented two operators map and quota for intensional programming in a concatenative language. quota is simple but complex to use, while map is easy to use but more complex. Each operator's behavior can be captured by the other, but in an intensional setting, equivalence is more complicated. These operators can be brought into richer languages with similar syntactic structures as long as they don't have variable binding. Dr. Jay's research also leans on conceptual simplification based on combinatory calculi.
  • Full Versions of Reductions: Encouraged readers to try implementing map in terms of quota and vice versa in real Joy code.
阅读 6
0 条评论