# scroll past some code to get the vibe! (dm save> (Win) # from the picolisp clone of vi (when (: file) (unless (=T (car (info @))) (if (sys "CCRYPT" (: key)) (pipe (out '("ccrypt" "-e" "-ECCRYPT") (mapc prinl (: text)) ) (out (: file) (echo)) ) (out (: file) (mapc prinl (: text))) ) ) (=: dirt (: undo)) (for (This *CmdWin (setq This (: next))) (status) ) (when (: syms) (and (find ext? @) (pico~dbSync)) (in (: file) (while (and (setq "*X" (read)) (atom @)) (unless (= (val "*X") (setq "*V" (read))) (set "*X" "*V") ) (until (= '(=======) (setq "*K" (read))) (unless (= (get "*X" "*K") (setq "*V" (read))) (put "*X" "*K" "*V") ) ) ) ) (when (find ext? (: syms)) (commit 'pico~upd) (syms> This (: syms)) ) ) ) (on *StatNm) )
FeaturesThe following features make PicoLisp a pleasant language to work with:
- An integrated database
- Awesome C / Java interop
- Effortless Scripting
An Integrated DatabaseDatabase functionality is built into the core, 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.
When it's time to scale, PicoLisp has you covered - create and query remote databases as needed with the standard library. It's simple and powerful, and makes few assumptions about your application architecture.
Awesome C / Java interopLeverage any C library function, manipulate C data structures in memory, even call Lisp functions from C code.
# 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 for 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!
Effortless ScriptingPicoLisp provides powerful primitives for many common tasks. Manage connections and streams, pipe data to and from external programs, run tasks in parallel - all with ease! Here's a script which extracts the name, date and size of the latest official PicoLisp release from the download page and prints it to standard output:
#!/usr/bin/picolisp /usr/lib/picolisp/lib.l (load "@lib/misc.l" "@lib/http.l") (use (@Date @Name @Size) (when (match '(@Date ~(chop " - <a href=\"") @Name "\"" ">" @Name ~(chop "</a> (") @Size ) (client "software-lab.de" 80 "down.html" (from "Release Archive") (from "<li>") (till ",") ) ) (prinl @Name) (prinl @Date " -- " @Size) ) ) (bye)
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.
FlexibilityIt's a Lisp, afterall - a language capable of 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.
on LinuxThe easiest way is to grab a (slightly outdated) package from your system, e.g.
$ sudo apt install picolispThe best way is to grab the latest version - [pil21.tgz] - unpack it, and follow the instructions from the INSTALL file.
on Windows Subsystem for Linux (WSL)See here: Install PicoLisp on Windows 10
on macOSInstalling PicoLisp on MacOS is now possible too, as Pil21 is based on LLVM (and no longer on Gnu ASM).
An alternative repository provides code that can be built on macOS with the following instructions.