picoLisp

Getting started

The author and maintainer is Alexander Burger? so the best starting point is his website. The picoLisp mailing list is a good source of information.

Useful documents

Alexander Burger?: ref | tut | app | faq | down | dbui | radical | mail

Henrik Sarvell?: blog

Konrad Zielinski?: blog

Randall Dow?: stuff

Some code

Jon Kleiser?: gl, china and other stuff

Randall Dow?: simple templating website generator

Tomas Hlavaty?: miniPicoLisp with FFI | gtk-server example

Libraries and other code

OpenGL: 2D and 3D computer graphics API. Jon Kleiser? wrote OpenGL bindings. Based on his code, miniPicoLisp with FFI generates most of the original OpenGL code and it should be quite easy to add more foreign functions.

Gtk: A cross-platform widget toolkit for creating graphical user interfaces. The prototype picoLisp binding is part of the miniPicoLisp with FFI. The code is not complete, however. You can create UI but it is not possible to connect signals as callbacks have not been implemented (yet). In the mean time, if you want to use Gtk with picoLisp, you can try using gtk-server. There is a very minimal gtk-server example available.

BuDDy: A Binary Decision Diagram Package. The picoLisp binding is part of the miniPicoLisp with FFI

Java: A programming language. picoLisp used to talk to Java but the code is now defunct.

Code snippets

GeoIP: Geographical IP look up.

trampoline: tail call optimisation, control flow

non-blocking: i/o and simple echo server

multimethods: multiple dispatch

ToDo put some useful stuff here instead of the things bellow

ToDo classes

ToDo gui

rewriteUrl

I cannot find the LAMBDA keyword in Pico Lisp

Because it isn't there. The reason is that it is redundant; it is equivalent to the quote function in all practical aspects, because there's no distinction between code and data in Pico Lisp, and quote returns the whole (unevaluated) argument list. If you insist on it, you can define your own lambda:

: (setq lambda quote)
-> 67293272
: ((lambda (X Y) (+ X Y)) 3 4)
-> 7
: (mapcar (lambda (X) (+ 1 X)) '(1 2 3 4 5))
-> (2 3 4 5 6)


Why do you use dynamic variable binding?

Dynamic binding is very powerful, because there is only one single, dynamically changing environment active all the time. This makes it possible (e.g. for program sniplets, interspersed with application data and/or passed over the network) to access the whole application context, freely, yet in a dynamically controlled manner. And (shallow) dynamic binding is the fastest method for a Lisp interpreter.

Lexical binding is more limited by definition, because each environment is deliberately restricted to the visible (textual) static scope within its establishing form. Therefore, most Lisps with lexical binding introduce "special variables" to support dynamic binding as well, and constructs like labels to extend the scope of variables beyond a single function.

In Pico Lisp, function definitions are normal symbol values. They

can be dynamically rebound like other variables. As a useful real-world example, take this little gem:

(de recur recurse
   (run (cdr recurse)) )

It implements anonymous recursion, by defining recur statically and recurse dynamically. Usually it is very cumbersome to think up a name for a function (like the following one) which is used only in a single place. But with recur and recurse you can simply write:

: (mapcar
   '((N)
      (recur (N)
         (if (=0 N)
            1
            (* N (recurse (- N 1))) ) ) )
   (1 2 3 4 5 6 7 8) )
-> (1 2 6 24 120 720 5040 40320)

Needless to say, the call to recurse does not have to reside in the same function as recur. Can you implement anonymous recursion so elegantly with lexical binding?


This page is linked from: trampoline picoWiki non-blocking multimethods closure Sandbox +RteField

Revisions: View source XHTMLV | RSSV

picoWiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively