Search code examples
lispschemechicken-scheme

Creating a db in chicken scheme


I would like to ask if it is possible to create a db in chicken scheme; something analogous to this:

http://www.gigamonkeys.com/book/practical-a-simple-database.html

If it is then what predicates do i have to read/search for? Should i use an egg? In the chicken wiki i have made search but have not found what i search. Is it just impossible to implement something like the above in scheme or it's done in a comletely different way?


Solution

  • It's possible, but you'll need to use another datatype.

    Unlike Common Lisp (which that book focuses on), Schemes don't have plists since they lack the :keyword package. You'll need to decide how to store your data, and that decision will affect how you have to construct your make- and select equivalents. For example, if you decide that alists are a good enough substitute, then getting a property from one of your records is going to look like

    (cdr (assoc foo record)) 
    

    rather than

    (getf :foo record)