rm-hull / infix

A Clojure library for expressing LISP expressions as infix rather than prefix notation
https://www.destructuring-bind.org/infix/
MIT License
106 stars 11 forks source link

Possibility of derivation/integrarion rules implementation? #32

Open vdikan opened 5 years ago

vdikan commented 5 years ago

Infix looks sophisticated yet simple. Are there plans or suggestions how to implement basic derivation/integration rules similar to those described in a text-book: https://github.com/norvig/paip-lisp/blob/master/docs/chapter8.md

Can you give a hint where to start?

rm-hull commented 5 years ago

No plans to slot that functionality into the infix library, but it looks interesting and I can see how you would use our $= to convert an infix expression into prefix, much like the definition in the book:

(defun infix->prefix (infix-exp)
  "Convert fully parenthesized infix-exp to a prefix expression"
  ;; Don't use this version for non-fully parenthesized exps!

I guess you would need to turn the simplifier (https://github.com/norvig/paip-lisp/blob/master/docs/chapter8.md#82-simplification-rules) into clojure-flavoured lisp as the first point.

However, one thing this library ought to do is to provide a mechanism to convert a prefix expression into infix. You would need that to implement the simplifier, I guess.

vdikan commented 5 years ago

Ok, I'll see to it. Thanks!