Introduction to the PicoLisp Database

Search for a command to run...

No comments yet. Be the first to comment.
In our previous post, we introduced how to utilize Discrete Event Simulation (DES) in PicoLisp. Now, let's explore another application: a railroad model simulation that includes tracks and trains. The visualization is ASCII-based, so feel free to unl...

The Dining Philosophers

In this post, we will introduce the concept of co-routines and how they are handled in PicoLisp. This will be the foundation for the subsequent posts on Discrete Event Simulation and finally a couple of examples, including an ASCII model railway simu...

One of the many nice things of PicoLisp is that it comes with a built-in database. This makes it easy to collect and store our own data, for example via a mobile app. But not all data is best represented in tables and lists: sometimes a colorful litt...

In the last two posts, we have built a little app that shows the current location and displays the nearest ice cream shops: https://picolisp-explored.com/an-openstreetmap-app-written-in-picolisp-pt-1 https://picolisp-explored.com/an-openstreetmap-ap...

We have now covered the basics of frontend- and backend development in PicoLisp. To get the full stack, we still need one more thing: the database!
First of all let's clarify some terms that are important to understand the theory and documentation.
We go one step back to the Concepts and Data Types of PicoLisp. There we said that there are three data types: Lists, Numbers and Symbols.
What we didn't mention yet was that the symbols can be distinguished into four types: NIL, internal, transient and external. All four symbol types are on the same hierarchy level:
cell
|
+-----------+-----------+
| | |
Number Symbol Pair
|
|
+--------+-----------+-----------+
| | | |
NIL Internal Transient External
Let's discuss the four types quickly.
NIL is a special symbol which exists exactly once and is used for various purposes (we have seen many of them already) - like representing an empty list or a boolean "false". External symbol names are surrounded by braces ({}) and have their location information (disk file and block offset) directly coded into the symbol names. The symbol name cannot be directly controlled by the programmer, and there cannot be two identical symbol names at the same time.
Like the other data types, also external symbols have a characteristic tag bit so that the interpreter recognizes them.
External symbols are on the same hierarchy level als internal symbols which means they are first-class data types: They can be treated just like any other object we have covered so far (passed around, returned from functions and so on). Unlike internal symbols, the external symbols still exist after the parent process is stopped. This is called persistence.
Enough for the theory - so how is that related to the PicoLisp database?
Besides that PicoLisp has external symbols as first-class data types, it also has a built-in framework that allows a close mapping of the application data structure to the database.
The PicoLisp database framework supports several database paradigms:
Usually records (i. e. symbols) in the database are objects derived from the pre-defined class +Entity. Entities can have relationships that define the model, like for example:
We will see many examples of this in the next posts. It will be helpful to know the basics of OOP in PicoLisp as we will see many of the OOP syntax and principles there.
Source: The PicoLisp database vs. ORMs.
The application layer and database layer in PicoLisp are on the same layer, which means there is no "translation system" in between. This has several advantages:
In the next couple posts, we will discuss show the syntax and structure and work through a small example. We will also need to take a look into Prolog and its PicoLisp version "pilog".
After that we will return to the Web Application tutorial to complete the To-Do App to a full-stack example with user authentification and more.
The Picolisp database vs. ORMS
https://software-lab.de/doc/ref.html#dbase
https://www.mongodb.com/databases/what-is-an-object-oriented-database