PicoLisp is a programming language, or really a programming system, including a built-in database engine and a GUI system! It's simple and lightweight and encourages clean, concise code.
PicoLisp introductory overview
(+ 1 2 3) -> 6
(setq Foo (1 2 3)) Foo -> (1 2 3) (and Foo (reverse @) (cons 4 @)) -> (4 3 2 1)
(if (= 'this 'that) "This is that" "This isn't that") -> "This isn't that" (let (Foo "bar") (cond ((not Foo) "No foo for you") ((lst? Foo) (map 'my-list-function Foo)) ((= Foo "bar") "Foobar") "Nothing is true" ) ) -> "Foobar"
(de hello () (prin "Hello, world.") ) (hello) -> Hello, world. (de double (Number) (* 2 Number)) -> double (double 12) -> 24
(load "@lib/http.l" "@lib/xhtml.l")
Serve web pages
(load "@lib/http.l" "@lib/xhtml.l") (de hello-web () (html 0 "Hello Web" "@lib.css" NIL (<h1> NIL "Hello, web") (<p> NIL "This is my first PicoLisp website" ) ) ) (server 8080 "!hello-web")
Install on LinuxYou came here to play with another programming language, right? If you're using a Debian-based Linux (like Ubuntu or Mint), simply install it with:
$ sudo apt-get install picolispand check out the tutorial.
Otherwise, grab the latest version - [picoLisp.tgz] - unpack it, follow the instructions from the INSTALL file, and then check out the tutorial.
Install on Windows Sybsystem for Linux (WSL)See here: Install PicoLisp on Windows 10
Install on macOSIt is not possible to install picolisp on macOS, or even to build it without significant modifications to the code. The easiest way to access it on your machine is to install it on a lightweight Linux system and to remotely access it with ssh or similar solutions.
PicoLisp featuresMaybe you like to do a little research before diving in. In that case...
- An integrated database
- Awesome C / Java interop
- It's really simple
Integrated Distributed Database EngineBuild large, distributed databases with fewer headaches and fewer dependencies.
Database functionality is built into the core of the VM, making PicoLisp a language for querying and manipulating databases.
For that, PicoLisp includes a built-in application framework and Prolog engine so you can create, organize, inspect and change (and even build a fancy UI for) your data - all with a uniform and concise syntax.
And when it's time to scale, PicoLisp has you covered - creating networks of distributed databases is built into the core as well. It's simple and powerful, and makes few assumptions about your application architecture.
Native C calls and Java interopThe intention of PicoLisp is to avoid writing extensive libraries. So we give you easy, transparent access to all your favorite software.
Leverage any C library function, manipulate C data structures in memory, call lisp functions from your C code - all that interactively from the REPL.
# call the 'MD5' function from 'libcrypto.so' (let Str "The quick brown fox jumped over the lazy dog's back" (pack (mapcar '((B) (pad 2 (hex B))) (native "libcrypto.so" "MD5" '(B . 16) Str (length Str) '(NIL (16)) ) ) ) ) -> "E38CA1D920C4B8B8D3946B2C72F01680"
Interface directly to a running JVM, giving you dynamic access to everything Java.
# a simple Swing UI (let [Frame (java "javax.swing.JFrame" T "Bye-Frame") Button (java "javax.swing.JButton" T "OK") ] (java Frame 'add "South" Button) (java Button 'addActionListener (interface Button "java.awt.event.ActionListener" 'actionPerformed '((Ev) (bye)) ) ) (java Frame 'setSize 100 60) (java Frame 'setVisible T) )Now that's swingin' harder than a Charlie Parker record!
See the article Interfacing with Other Software for details.
SimplicityPicoLisp is easy to understand and adapt.
Beneath the surface of the language lies the PicoLisp virtual machine. At the lowest level, the VM operates on a single data structure - the cell.
+-----+-----+ | CAR | CDR | +-----+-----+A cell is just a pair of pointers, 'CAR' and 'CDR'.
All functions and data in the system are stored in cells, which simply point to each other to form arbitrarily complex structures.
From these cells, we contruct three base data types - Numbers, Symbols, and Lists - and from those, the rest of our universe.
So once you grok the underlying cell structure (which you pretty much already have), you just need to explore a small but powerful set of functions that do cool things with those cells.
It's that simple!
FlexibilityIt's lisp, afterall. It's a language best suited for reprogramming itself.
Into functional programming? Rock on. OOP? PicoLisp has an elegant, unobtrusive, totally optional object system. Explore a syntax of nested function calls, bend the language to the task at hand, metaprogram yourself to the moon. We'll help you build a rocket.
ExpressivenessPicoLisp programs are often much shorter than equivalent programs written in other languages. Examples of various programming tasks and their solutions can be found at rosettacode.org.
EfficiencyPicoLisp uses very little memory, on disk as well as in memory (heap space).
DownloadIf the following command makes sense for your setup, go ahead and run it.
$ sudo apt-get install picolispIf not, you'll have to build it from source. But that's easy, too!
Grab the tarball - [picoLisp.tgz] - unpack it, and follow the instructions from the INSTALL file.
Learn more - documentation overviewThe documentation page has many examples and tutorials to get you started.