On Wednesday, March 8, 2017 at 1:43:56 AM UTC+1, Evgenii Moiseenko wrote:
>
> I was wondering how the implementation of map-like data structure should
> look like in MiniKanren. I am writing an interpreter of imperative language
> in MiniKanren and I need a data structure to represent a mappings between
> variables and their values.
>
> Is there any code that implements that ?
>
I only manipulate map/dict/assoc in my database powered by minikanren
(microkanren actually).
The database is a set of map with different key and value, say:
AMIROUCHE = {name: amirouche, birtday: 42}
where name is a key and 42 a value
or
BLOG = {blog: hyperdev.fr, owner: ABCDEF}
To query for instance the birthdate of amirouche you do simply
(run * (birthday?)
(fresh amirouche??)
(fs:queryo amirouche? 'name "amirouche)
(fs:queryo amirouche? 'birthday birthday)))
To query the blog of amirouche (like joining a table in RDBMS
except here it's between maps) you follow the identifier:
(run * (blog?)
(fresh amirouche??)
;; match amirouche
(fs:queryo amirouche? 'name "amirouche)
;; match all his blogs
(fs:query blog? owner amirouche??)))
--
You received this message because you are subscribed to the Google Groups
"minikanren" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/minikanren.
For more options, visit https://groups.google.com/d/optout.