Your code has several unclearities/problems.
Why do you create and store a new Symbol in the property and then set it's
value to the value you want to store?
Why don't you just store the value in the property?
(Like (put *DB k v) for kv-add)
Why do you set the value of the first symbol to "Root" ?
If you want to get the complete property list of any symbol (internal or in the
DB) just call 'getl on it
Ursprüngliche Nachricht
Von: [email protected]
Gesendet: 16. April 2019 16:42
An: [email protected]
Antworten: [email protected]
Betreff: Re: Database question
Hi Alex,
Does this look reasonable? I tried to implement key-value store/get. I am not
sure how to enumerate all the keys though.
(pool "test.db")
(set *DB "ROOT")
(de kv-add (k v)
(let nv (new T)
(set nv v)
(put *DB k nv)
(commit)))
(de kv-get (k)
(val (get *DB k)))
Regards,
Kashyap
On Sun, Apr 14, 2019 at 1:58 PM C K Kashyap <[email protected]> wrote:
Thanks Alex!
Regards,
Kashyap
On Sun, Apr 14, 2019 at 1:20 PM Alexander Burger <[email protected]> wrote:
On Sun, Apr 14, 2019 at 12:54:19PM -0700, C K Kashyap wrote:
> Is the builtin database in picolisp tied to OOP? The documentation seems to
> indicate it.
Not necessarily. The DB consists of three independent layers.
Persistent "external" symbols are the base. They are directly in the core
language. They are used to implement b-trees, and in addition - and on top of
those - the entity and relation objects (only those are OOP).
> Is there a way I could use the DB to just accrue immutable
> facts (just like Clojure Datomic works)?
Just create external symbols (with 'new' without a class), and store stuff into
their values and property lists.
> Is there a non-OOP sample that I could use as a starting point?
The tutorial at https://software-lab.de/doc/tut.html#ext
☺/ A!ex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe
PԔ � &j)m����X�����zV�u�.n7�