Functional Programming in PicoLisp
Tags: functional, programming
Published: 2021-10-01 08:23:36

### Welcome to my blog!

Nice to meet you. I'm Mia, and in this blog, I would like to introduce to you a very interesting small programming language, **PicoLisp**. 

I started to play around in it recently, and one of the key points is that it is super minimalistic. It really helps you to *understand* what is going on internally, which is usually not the case in high-level languages like JavaScript. 

As a Lisp dialect, it also supports functional paradigms which allows elegant and transparent code after you got used to the syntax.

As the first step, I plan to build up a concise and structured beginner's level course with a lot of examples and code analysis.  This blog is for readers who already have some basic programming experience, but I want to keep the threshold as low as possible. The important thing is that you are curious and open for new concepts and ideas. I guess it will also be helpful if you don't *hate* math, since there will be a lot of examples from the [Euler Project](https://projecteuler.net/) and [Rosetta Code Project](https://rosettacode.org/) because I personally like these a lot. 😄

Let's go!

--------------------------

### About PicoLisp

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. As you might guess, it belongs to the family of lisp languages.

**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. A cell is just a pair of pointers, 'CAR' and 'CDR'.

![cell.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629025805785/0XjaXH765.png)

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 construct 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! 


**Fact sheet:**
- Designed by: Alexander Burger
- First appeared: 1988
- Stable release: 21.6 / 27 June 2021 (at time of writing)
- Typing discipline: dynamic
- Implementation language: LLVM, PicoLisp
- Platforms: LLVM 64-bit
- OS: POSIX
- License: MIT

--------------------------

### A short history of PicoLisp  

-  In the 1980s, PicoLisp began development on the Macintosh. Since 1993, it was used mainly on Linux. 
- In 2009, the 64-bit version was released. In December 2010, a Java version named Ersatz PicoLisp was released.
- In 2015, the PilOS was announced - **The PicoLisp Operating System**, a minimal prototype based on the modification of PilMCU targeting embedded applications. It runs on standard x86-64 PC hardware, directly off the BIOS and includes all the features of 64-bit PicoLisp. **In principle, it works as its own operating system.** 
- 2016, development of **PilBox ("PicoLisp Box")** – a generic **Android app** allowing to write apps in pure PicoLisp – was started. It is still being developed and maintained. 
- In 2021, pil21 was released, which is also the core of PilBox. pil21 is the current main development focus.

### Why yet another Lisp dialect?

The answer is: Because it is beautiful, efficient, and fun. 

However, PicoLisp should **not** be confused with Common Lisp, as there are substantial differences in design and philosophy. 

![lisp_cycles.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629025310386/O2FaVNaXB.png)https://xkcd.com/297/

--------------------------

### Got interested? This is how to learn PicoLisp!

Check out the "PicoLisp for beginners"-series, which I will start from tomorrow, or follow the [documentation](https://picolisp.com/wiki/?Documentation) for installation guidelines.

There is also a small but vibrant community around the picolisp ecosystem in IRC, mailing list in bi-weekly conferences. New members are always welcome. Check the websites for more information.

--------------------------

## Sources
- https://en.wikipedia.org/wiki/PicoLisp  
- https://software-lab.de/doc/tut.html  
- https://picolisp.com/wiki/  
- cartoon by https://xkcd.com/297/