1. 28

  2. 4

    Can someone explain to me what ‘a purely symbolic LISP’ means in this context please?

    1. 12

      I usually take that to mean lack of numerical tower or types other than symbol and cons. Sometimes though it does include a string, closure or similar primitive types.

      1. 6

        The only data types are the atom (symbol) and the pair/list. T is true and NIL is false.

        checks out

      2. 6

        Lisp was designed in the 1950’s. Back then, computers were mainly giant calculators. They worked with numbers. Lisp worked with any kinds of data that could be represented and transformed with its primitives such as atoms and lists. They called this computing on symbols vs just numbers.

        The book that explained it to me with examples is Paradigms of AI Programming. It’s free here. Chapter 1, Introduction to Lisp, gives you a simple example followed by an explanation of symbolic computing. Im sure you’ll find other stuff in it interesting, too. :)

        1. 2

          OK I understand what a symbol is in the LISP context but “purely symbolic” was my question. I think the answer as someone else stated was that there are very few data types in this LISP and it’s mostly just symbols, numbers and strings.

          1. 2

            There are no numbers or arithmetic in Kilo LISP. I wonder if these could be added without exceeding the 64KB limit?

            1. 2

              You can implement numbers and arithmetic in Kilo LISP:

              * (load 'klsrc)
              * (load 'src//nmath)
              * (times '(1 2 3) '(4))
              (4 9 2)
      3. 3

        On a side note from the project’s page:

        It does not use any stdio functions and compiles to a static executable of 29K bytes using SubC, 13K bytes using Turbo C, and 512K bytes using GCC (LOL).

        It’s impressive how much stuff gcc adds to a final executable, and I don’t mean it for good. Back on track, Kilo LISP looks very interesting, and I might give it an enthusiastic go at some point.

        1. 5

          It’s mostly glibc, not gcc itself. Building it with musl-gcc gets a 41kb static executable.

          1. 2

            You are right, thanks for correcting me. Nevertheless, it is indeed a big fat binary, considering what it does and how tiny Kilo LISP is when compiled against other libraries, as you already pointed out.

            1. 1

              That could make an interesting docker container.

              1. 1

                Alpine Linux uses musl, and it’s the base distro in many containers because the base install of Alpine is (relatively) very small.

          2. 2

            This is incredible, bookmarked so I can tinker later.

            1. 1

              That is beautiful.

              1. 1

                It’s cool, but why the heck can’t you have the - character be part of a symbol without escaping? From a glance at the source I can’t find a reason.

                1. 1

                  Look at rdsym() and symbolic()

                  1. 1

                    I did. They test for isalpha(c) || isdigit(c) || '/' != c. No reason you couldn’t add a comparison to - to the check as well.

                    1. 2

                      add it and see what breaks, if nothing maybe try and submit a pull request.