unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* [potluck dish] attributed variables for minikanren
@ 2016-02-16 13:54 Stefan Israelsson Tampe
  0 siblings, 0 replies; only message in thread
From: Stefan Israelsson Tampe @ 2016-02-16 13:54 UTC (permalink / raw
  To: guile-user@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1794 bytes --]

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 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

[-- Attachment #2: Type: text/html, Size: 2483 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-16 13:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 13:54 [potluck dish] attributed variables for minikanren Stefan Israelsson Tampe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).