Lisp


This is not an article with some specific purpose, this is a ramble— to set down on e-paper the things I enjoy about a language that I enjoy! It starts where it starts and will stop at the end. Don't attempt to read anthing into this other than what is there; I am neither a language scholar or pedant, just a fan…

By way of a confession, I learned Lisp in order to help myself understand college level algebra! At the time I had just acquired a version of Lisp that ran on my 8085 microcomputer called MuLisp. To quote the (google translation of the) German Wikipedia

muLISP is a DOS -based commercial development environment for LISP and LISP its own version. It was 1979 by the company Soft Warehouse (Honolulu, Hawaii), in the meantime by Texas Instruments , was developed and purchased, for example, for CP/M sold. In 1982, it was by the then fledgling software company Microsoft and licensed for the IBM PC released. It subsequently became one of the most popular DOS-based LISP variants. The best known muLISP program is developed in DERIVE. As part of the development system muLISP is still available today.

The name derives from the Latin equivalent of one hand to the Greek mu μ, which stands on the Micro in time for the personal computer term microcomputer is common, and from the LISP programming language on the other.

muLISP included a graphical editor, a debugger, a window manager and of course, compiler and interpreter for muLISP. Today's 16-bit muLISP90 standard version is limited to 640 KB memory there (so-called conventional memory ), but there are also muLISP XM, the 32 - bit -development.

muLISP is not a Common LISP, there are libraries, the partial compatibility Interlisp Common Lisp to make or. Also, a CLOS implementation is available.

Notice that DERIVE is in bold— to emphasize that, that is what I was really after at the time. DERIVE was (and presumably is [ version 6.1 was the last; sadly it is now extinct]) a symbolic math package, capable of reducing complex mathematical expressions into their simplest form. Those who have had algebra should quickly be able to see why this would be seen as a 'good thing'(™)! Of course these days we have Stephen Wolfram's Mathematica for such mundane tasks, which can not only reduce abstruse equations, but allow you to typeset them as well!

All of which sort of fell by the wayside when I started to play with the language that came with the package. I've no idea of why, but Lisp fascinated me from the start— still does to this day for that matter. While some might be put off by the form of the language; all of those parenthesis and such, the prefix notation and so on. None of that seemed to bother me in the slightest. I've always pretty much ignored the details of how a language is put on paper or the screen. They are obviously important, but once learned you can pretty much concentrate on the important stuff— coding!

With Lisp, every thing is expressed as a function much like linear algebra; i.e. f(g(h())) &etc. This is part of why it is called a functional language I suppose. From the it gets better all the time encyclopedia, Wikipedia (Functional Programming):

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state.[1] Functional programming has its roots in lambda calculus, a formal system developed in the 1930s to investigate function definition, function application, and recursion. Many functional programming languages can be viewed as elaborations on the lambda calculus.

Here are a few examples taken from my own code to parse PGN files for chess:

;; @syntax (white-piece? <square>)
;; @param <square> which square of the board
;; @return true if piece is white
(define (white-piece? square)
  "white-piece?: is there a white piece on the square?"
  (= "w" (side square)))
;; @example
;; (white-piece? "e1")
;; => true
;; @syntax (black-piece? <square>)
;; @param <square> which square of the board
;; @return true if piece is black
(define (black-piece? square)
  "black-piece?: is there a black piece on the square?"
  (= "b" (side square)))
;; @example
;; (black-piece? "e1")
;; => nil
    

This particular dialect of Lisp, newLISP allows for a built-in form of documentation— all of the lines that begin with ';; @' are comment lines, but comment lines that are parse-able by utilities that produce useful HTML or PDF files for reference. It looks more or less like this:

white-piece?

syntax: (white-piece? square)
parameter: square - which square of the board

return: true if piece is white

example:
 (white-piece? "e1")
 => true
- § -

black-piece?

syntax: (black-piece? square)
parameter: square - which square of the board

return: true if piece is black

example:
 (black-piece? "e1")
 => nil
- § -

Getting back to the code again, how can you argue with something as simple as (define (white-piece? square)(= "w" (side square))) Even if you don't know Lisp, you can guess that this means that given a square as a parameter, return true or false that that square is a white square. Short simple and very much to the point. I could have defined black-piece? as the negation of white-piece? but chose to write it out since the difference in size was trivial and writing it out avoids an additional function call.


Lisp Articles


Lisp Links

With the exception of Allegro, all of these are open source and are free. Even Allegro offers what they call 'Allegro Express' which is also free.


 Page last touched:
Send e-mail to: hsmyers@gmail.com 


Validated by W3C