[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[potluck dish] attributed variables for minikanren

From: Stefan Israelsson Tampe
Subject: [potluck dish] attributed variables for minikanren
Date: Tue, 16 Feb 2016 14:54:35 +0100

I repost this as a separate thread, the code had been debugged and a few loopholes patched
since last anouncement.

Hey Guilers

My potluk contibution is tp implement attributed variables for minikanren ontop af the source written by  William E. Byrd.

You can find the source at

The source containes examples using attributed variables to implement =/= symbolo numbero absento freezeo and wheno

(define AttributeId  (make-attribute unify-fkn portray-fkn)

(unify-fkn var data val lam)
var is the varibale that is unified (not yet unified at the execution of this fkn) data is the data associated with AttributedId for variable var
and val is the value that var will be unified to and lam is a variable that can be bound to a predicate to be executed after the unification have
been taken.

(portray-fkn var data s)
Return a list of  representations of attribuete AttributedId with data data for variable var. s is the variable binding stack.

(get-attr var id data)
Get data associated with attributed id if no attribute exists fail

(put-attr var id data)
Put attributed data data of kind id to variable var.

New Examples
(wheno (cons test1 lam1) (cons test2 lam2) u1 u2 ...)
If u1 u2 ... is bound then before bounding test1 will by tried with no unification as a result and if success lam2 will be executed else the binding will fail
then the variable will be bound and test2 lam2 combo will be tried similarly, the conses can be repaced with #f to indicate a void semantics.

(freezeo u lam1 lam2)
before the binding of u lam1 will be tried and after the binding of u lam2 will be tried.

The rest of the constraints was implemented by other means before and is known please read the documentation by  William E. Byrd.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]