Picolisp
This article is an orphan, as few or no other articles link to it. Please introduce links to this page from related articles; suggestions are available. (January 2010) |
This article may not meet the general notability guideline. Please help to establish notability by adding reliable, secondary sources about the topic. If notability cannot be established, the article is likely to be merged, redirected, or deleted. (January 2010) |
PicoLisp is an open source Lisp dialect. It runs on Linux and other POSIX-compliant systems.
Features
Its fundamental principle is "simplicity". It restricts itself to a single internal data type (cell), without giving up flexibility and expressive power. On the language level, it supports just three data types (numbers, symbols and lists), constructed from internal cells.
Because the only non-atomic data type is the linked list, many interoperable functions exist that concentrate on list processing. As a result, PicoLisp programs are often more succinct - and at the same time faster - than those of other interpreted languages (see "Examples" below). Functions are free from the restrictions that would be imposed by a compiler, and can so accept arbitrary types and numbers of arguments. Macros are needed only in rare cases.
A special feature is the intrinsic database functionality. Persistent symbols are first-class objects, they are loaded from database files automatically when accessed, and written back when modified. Applications are written using a class hierarchy of entities and relations.
Furthermore: Prolog engine and database queries, distributed databases, inlining of C language functions and native C function calls, child process management, interprocess communication, Browser GUI, internationalization.
History
Originally developed on the Apple Macintosh in the 1980s, and used in commercial application development since then. It was soon ported to MS-DOS and SCO Unix, and used mainly on Linux since 1993. Database functionality was added in the mid-1990s.
While the first versions were written in a mix of C and Assembly language, a first rewrite from scratch was done in 1999 completely in C. That version was released 2002 under the GNU GPL license.
In 2009 the 64-bit version was released, another rewrite, this time written in a generic assembler which in turn is implemented in PicoLisp.
Examples
The following program implements the "Fannkuch" benchmark, as described in the http://shootout.alioth.debian.org/u64q/benchmark.php?test=fannkuch Alioth Benchmark Suite:
#!bin/picolisp lib.l (let (N (format (opt)) Lst (range N 1) L Lst M) (recur (L) # Permute (if (cdr L) (do (length L) (recurse (cdr L)) (rot L) ) (let I 0 # For each permutation (and (ge0 (dec (30))) (prinl (reverse Lst))) (for (P (copy Lst) (> (car P) 1) (flip P (car P))) (inc 'I) ) (setq M (max I M)) ) ) ) (prinl "Pfannkuchen(" N ") = " M) (bye) )
This shows how expressive and succinct a PicoLisp program can be, compared to other contributions on the Alioth site.
In contrast to the stand-alone script above, this is how it looks as a function definition:
(de fannkuch (N) (let (Lst (range 1 N) L Lst Max) (recur (L) # Permute (if (cdr L) (do (length L) (recurse (cdr L)) (rot L) ) (zero N) # For each permutation (for (P (copy Lst) (> (car P) 1) (flip P (car P))) (inc 'N) ) (setq Max (max N Max)) ) ) Max ) )
Execution speed is of course lower than that of most compiled languages,about 18 minutes on a 1.0 GHz Athlon; it should be less on Alioth's Intel Q6600 machine. As that is a quad-core, it could be sped up by a factor of four by using a parallelized version:
(de fannkuch (N) (let (Res (need N) Lst (range 1 N) L Lst Max) (for (R Res R (cdr R)) (later R (let L (cdr Lst) (recur (L) # Permute (if (cdr L) (do (length L) (recurse (cdr L)) (rot L) ) (zero N) # For each permutation (for (P (copy Lst) (> (car P) 1) (flip P (car P))) (inc 'N) ) (setq Max (max N Max)) ) ) Max ) ) (rot Lst) ) (wait NIL (full Res)) (apply max Res) ) )
External links
- PicoLisp Home
- Latest Version (immediate download)
- Download page
- Reference manual
- First Glance
- #picolisp IRC channel
- Mailing list archive
- ohloh project page
References
- Paper A Radical Approach to Application Development (PDF)
- c't Magazine Database contest results (in German)
- Lambda the Ultimate 2007 A Case for Minimalist Interpreters?
- John Fremlin's blog PicoLisp takes the performance crown?
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...
- Pages with broken file links
- Orphaned articles from January 2010
- Articles with invalid date parameter in template
- All orphaned articles
- Articles with topics of unclear notability from January 2010
- All articles with topics of unclear notability
- Lisp programming language family
- Dynamically-typed programming languages