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: Wed, 10 Feb 2016 21:17:57 +0100

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 <address@hidden> 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



reply via email to

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