1. 7
  1.  

  2. 7

    I don’t see why this had to be implemented in C++ when you’re already working with a Lisp. The nice thing with Lisp is that the macro system allows for stuff like this to be added.

    Examples, CL: https://github.com/mrcdr/polisher and https://www.cliki.net/ugly-tiny-infix-macro

    Scheme even has a SRFI dedicated to this: https://srfi.schemers.org/srfi-105/srfi-105.html

    1. 2

      LispE is described as a pretty minimal LISP, so it may not have macros; I didn’t find any mention of them when I skimmed the language description.

      I’m wondering if this could be applied to concatenative (Forth-like) languages. I have a toy one I’m working on, that I might do some syntactic experiments with.

        1. 1

          LispE is described as a pretty minimal LISP, so it may not have macros

          Then that should probably be implemented as soon as possible, at least much sooner than infix operator features.

          I’m wondering if this could be applied to concatenative (Forth-like) languages

          If you’re referring to infix operators, it seems to be possible: https://arduino-forth.com/article/FORTH_exemples_convertInfixToPostfix

        2. 1
          1. 1

            because with macros you cannot easily handle operator precedence

            1. 1

              But it has already been done in the examples I’ve showed.

              Anyways, whatever. I would implement the entire thing in Lisp from the ground up, like SBCL has done, but judging from your codebase it looks like you have a strong preference for C. I won’t argue with you any further, but I urge you to explore Lisp itself a bit before taking the C route.

              1. 1

                You don’t even need macros, you can write an metacircular interpreter that can be switched to infix or postfix notation. Changing how a lisp is interpreted is the whole point of a lisp.

                1. 1

                  Ah, I’m showing my ignorance it seems.

                  I haven’t had the ability to explore metacircular evaluators yet, but I am excited to see they are a topic of SICP which I am currently reading. Do you know any other introductions to the topic?

                  Changing how a lisp is interpreted is the whole point of a lisp.

                  This in particular is what piqued my interest, as I love Lisp but don’t have any experience “changing how it’s interpreted”.

                  1. 1

                    Reading the documentation of racket is probably the best place to start. It is the lisp that I would advise anyone starting off to look at. It feels like python felt in the early 00s.

                    1. 1

                      Thanks for the tip, I’ll check it out.

              2. 1

                actually, there is a macro implemtation: defmacro (see https://github.com/naver/lispe/wiki/6.1-Description-of-methods-and-operators#defmacro)

                1. 1

                  Why was this implemented in C instead of in terms of a macro then?