From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.user Subject: Re: Potluck time! Date: Wed, 10 Feb 2016 21:17:57 +0100 Message-ID: References: <87mvr8ood1.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0116094e3695c8052b7021e6 X-Trace: ger.gmane.org 1455135494 16256 80.91.229.3 (10 Feb 2016 20:18:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Feb 2016 20:18:14 +0000 (UTC) Cc: "guile-user@gnu.org" To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Feb 10 21:18:13 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aTbDI-0006wT-Fi for guile-user@m.gmane.org; Wed, 10 Feb 2016 21:18:12 +0100 Original-Received: from localhost ([::1]:42737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTbDH-0004YQ-JV for guile-user@m.gmane.org; Wed, 10 Feb 2016 15:18:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTbD5-0004Xy-UO for guile-user@gnu.org; Wed, 10 Feb 2016 15:18:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTbD4-0003rs-Cp for guile-user@gnu.org; Wed, 10 Feb 2016 15:17:59 -0500 Original-Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:37819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTbD4-0003rE-1e; Wed, 10 Feb 2016 15:17:58 -0500 Original-Received: by mail-wm0-x231.google.com with SMTP id g62so42570480wme.0; Wed, 10 Feb 2016 12:17:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Ww7bgHqlsJLuGLX6GimpkT+FTQVGLat0Nrfiyjf73Lc=; b=cWYGM4ive67AbjD73gYICPUInSmJW64aSldr6URiI/mQa+Rhj64DY4fX7djgwrgsE3 A8cIxC+sPGtHS9TxQgjSqt5rdpLultUs08EbDaT7Sstp6VcYeHM8tvP+NSmTg+JXJ6Mi bEc02jStIjcl9dZjZ4QUf0eU/3tE1yFcYLdGbFQ8EbLC0xegTDqhMaTi/PmDdIGlnrMO T6lmsZ5qFJVXYW9ZDuz7q1WPhi9IRWQblZ3zmESzFmEkkppHEE/Sb+947Mzwz/HSO0mV l2+2NF/5UwspOyCrww1G6ys24/6qafkFbhQGPiwjMa6ZmiS7UDn60qPJHAHTRpix0SFC V21Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Ww7bgHqlsJLuGLX6GimpkT+FTQVGLat0Nrfiyjf73Lc=; b=HqYvqR4BQBI6q7kx4j9kbq3H+hmBpM0hEQCAFiaaSxBIgtWsx4ooXoiT9LYUQTxs8A MaYQ/G56PJC1A2iUPpzozTLxrPfXqWqL3OygL/QAcKZC9dJO6dugCYpdltD+WYvjTNI4 0nAUG55cdg3sz9FDZU2woH7wiEo8amh3YZDfkeHb3uLnlAgx6IEYojtkPc9X43Ji0MUr YGlUMe/k+3A2sZvBAH0NTyvnn1voWTlouYqy4SH5tPBSCq5IuVxfibqSNVhWqyLnuWYW QO3/M4BJwmcaviZJ8FOhh91mvNvS/54gQKmyxI+8tDnpUvghXe9lVZsp0qNrTlwpCe7v e/nw== X-Gm-Message-State: AG10YOQxyr2JWPEbw+8RIV8h9wmt1FWCdODLHdbc3nUUJoXiX9Ig920AdVd79UkutgE1NeZopWKkm3o0XsefMg== X-Received: by 10.194.118.164 with SMTP id kn4mr49320306wjb.130.1455135477108; Wed, 10 Feb 2016 12:17:57 -0800 (PST) Original-Received: by 10.27.187.196 with HTTP; Wed, 10 Feb 2016 12:17:57 -0800 (PST) In-Reply-To: <87mvr8ood1.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::231 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:12386 Archived-At: --089e0116094e3695c8052b7021e6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 =3D=3D 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=C3=A8s wrote= : > Hello Guilers! > > As you may know, it=E2=80=99s that time of the year where we are all invi= ted 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=C2=B9, 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=3D7111 > 2013: http://savannah.gnu.org/forum/forum.php?forum_id=3D7509 > 2014: http://savannah.gnu.org/forum/forum.php?forum_id=3D7887 > 2015: https://lists.gnu.org/archive/html/guile-user/2015-02/threads.htm= l > > Time to fire up a REPL and hack! :-) > > Thanks, > Ludo=E2=80=99. > > =C2=B9 https://lists.gnu.org/archive/html/guile-devel/2011-02/msg00173.ht= ml > > --089e0116094e3695c8052b7021e6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I will take on to= introduce attributed variables (see swi prolog) to minikanren. My hypothes= is is that apart from the pure logical
constructs conde fresh and =3D=3D all defined predicates can be construct= ed with the attribute framework with no need to add extra stacks.

The i= dea 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 pointi= ng to variables, but resetting of values will be done and attributed value<= /div>
is an assoc of type ((id1 . data1) ...= ) id1 contain a custom unification predicate f : (f u v lam) that will exec= ute 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) =C2=A0will put a new value val in att= ribute data for identity id and variable var, if the attribute does not exi= st create a=C2=A0
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0new one first
(put-at= tr-last id var val) the same but in case =C2=A0a new attribute id will be p= ut last (use this for attributes that does not change values, this=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0is a bit more gc friendly for attribute values that is = created and then never change

(get-attr id var valout) =C2=A0fetch the = attribute data for identity id and variable var, if not an attributed varia= ble of id, fail.

There will need to be a custom printer as well in ord= er 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 i= s that attributed variables is a way to customize condition on variables. S= o one does not need to proliferate the number
of stacks. But I tend to agree that the minikanren sources are real= ly minimalistic and probably the use of attributed variables will make the<= /div>
code much more verbose. This will be m= y potluck contribution.

Regards
<= br>
On Wed, Feb 10, 2016 at 11:23 AM, Ludovic Cou= rt=C3=A8s <ludo@gnu.org> wrote:
Hello Guilers!

As you may know, it=E2=80=99s that time of the year where we are all invite= d to
prepare dishes and to bring them to the Guile birthday potluck.=C2=A0 This<= br> has become a tradition to celebrate the release of Guile 2, which took
place on Feb. 16th=C2=B9, 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:

=C2=A0 2012: http://savannah.gnu.org/forum/fo= rum.php?forum_id=3D7111
=C2=A0 2013: http://savannah.gnu.org/forum/fo= rum.php?forum_id=3D7509
=C2=A0 2014: http://savannah.gnu.org/forum/fo= rum.php?forum_id=3D7887
=C2=A0 2015: https://lists.gnu.org= /archive/html/guile-user/2015-02/threads.html

Time to fire up a REPL and hack!=C2=A0 :-)

Thanks,
Ludo=E2=80=99.

=C2=B9 https://lists.gnu.org/arc= hive/html/guile-devel/2011-02/msg00173.html


--089e0116094e3695c8052b7021e6--