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: Wed, 10 Feb 2016 21:17:57 +0100 [thread overview]
Message-ID: <CAGua6m120J7x-j6d=Owfi1oHxUOuYdsGJyrBFg3R9QcrWovNwA@mail.gmail.com> (raw)
In-Reply-To: <87mvr8ood1.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 3021 bytes --]
Hi,
I will take on to introduce attributed variables (see swi prolog) to
minikanren. My hypothesis is that apart from the pure logical
constructs conde fresh and == all defined predicates can be constructed
with the attribute framework with no need to add extra stacks.
The idea is to maintain only two stacks S,A e.g. the normal variable stack
S and attributed stack A. All is mapping from variables
to values, for the attributed case there is no variable pointing to
variables, but resetting of values will be done and attributed value
is an assoc of type ((id1 . data1) ...) id1 contain a custom unification
predicate f : (f u v lam) that will execute before the unification of
u and v, and lam will be bound to either #f or a predicate to be executed
after the unification. The basic interface is simple. You have
(put-attr id var val) will put a new value val in attribute data for
identity id and variable var, if the attribute does not exist create a
new one first
(put-attr-last id var val) the same but in case a new attribute id will be
put last (use this for attributes that does not change values, this
is a bit more gc friendly for
attribute values that is created and then never change
(get-attr id var valout) fetch the attribute data for identity id and
variable var, if not an attributed variable of id, fail.
There will need to be a custom printer as well in order to have a nice
printout so there need to be a little framework for that. So from this
the plan is to make all other predicates needed to construct evalo.
The nice thing about this is that attributed variables is a way to
customize condition on variables. So one does not need to proliferate the
number
of stacks. But I tend to agree that the minikanren sources are really
minimalistic and probably the use of attributed variables will make the
code much more verbose. This will be my potluck contribution.
Regards
On Wed, Feb 10, 2016 at 11:23 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> Hello Guilers!
>
> As you may know, it’s that time of the year where we are all invited to
> prepare dishes and to bring them to the Guile birthday potluck. This
> has become a tradition to celebrate the release of Guile 2, which took
> place on Feb. 16th¹, 5 years ago!
>
> So the idea is that you hack up something with Guile, and next Tuesday,
> on the 16th, you share your hack with people on this mailing list.
>
> Here are the fine dishes that people brought in previous years:
>
> 2012: http://savannah.gnu.org/forum/forum.php?forum_id=7111
> 2013: http://savannah.gnu.org/forum/forum.php?forum_id=7509
> 2014: http://savannah.gnu.org/forum/forum.php?forum_id=7887
> 2015: https://lists.gnu.org/archive/html/guile-user/2015-02/threads.html
>
> Time to fire up a REPL and hack! :-)
>
> Thanks,
> Ludo’.
>
> ¹ https://lists.gnu.org/archive/html/guile-devel/2011-02/msg00173.html
>
>
[-- Attachment #2: Type: text/html, Size: 4768 bytes --]
next prev parent reply other threads:[~2016-02-10 20:17 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 [this message]
2016-02-13 14:36 ` Stefan Israelsson Tampe
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='CAGua6m120J7x-j6d=Owfi1oHxUOuYdsGJyrBFg3R9QcrWovNwA@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).