guile-user
[Top][All Lists]
Advanced

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

Re: Potluck time!


From: Stefan Israelsson Tampe
Subject: Re: Potluck time!
Date: Sat, 13 Feb 2016 15:36:39 +0100

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 https://gitlab.com/tampe/attributed-minikanren

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

API
(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.

Regards
Stefan



reply via email to

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