From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: Re: Potluck time!
Date: Sat, 13 Feb 2016 15:36:39 +0100 [thread overview]
Message-ID: <CAGua6m0MDear06wPOfW3-6jgnkk=BcwN+pMFuWdQDHy+zpFHwQ@mail.gmail.com> (raw)
In-Reply-To: <87mvr8ood1.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1677 bytes --]
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: 2209 bytes --]
next prev parent reply other threads:[~2016-02-13 14:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 10:23 Potluck time! Ludovic Courtès
2016-02-10 17:35 ` Christopher Allan Webber
2016-02-10 20:17 ` Stefan Israelsson Tampe
2016-02-13 14:36 ` Stefan Israelsson Tampe [this message]
2016-02-13 20:32 ` Stefan Israelsson Tampe
2016-02-16 13:28 ` [potluck dish] the module (potluck struct) Matt Wette
2016-02-16 13:30 ` [potluck dish] the module (potluck regexc) Matt Wette
2016-02-16 13:45 ` [potluck dish] the (potluck struct) module Matt Wette
2016-02-16 13:53 ` Matt Wette
2016-05-08 9:59 ` Nala Ginrut
2016-05-08 14:34 ` Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGua6m0MDear06wPOfW3-6jgnkk=BcwN+pMFuWdQDHy+zpFHwQ@mail.gmail.com' \
--to=stefan.itampe@gmail.com \
--cc=guile-user@gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).