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: [potluck dish] attributed variables for minikanren Date: Tue, 16 Feb 2016 14:54:35 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114b115e3b444a052be3796c X-Trace: ger.gmane.org 1455630909 14245 80.91.229.3 (16 Feb 2016 13:55:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Feb 2016 13:55:09 +0000 (UTC) To: "guile-user@gnu.org" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Feb 16 14:55:09 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 1aVg5h-0006sK-Au for guile-user@m.gmane.org; Tue, 16 Feb 2016 14:54:57 +0100 Original-Received: from localhost ([::1]:46174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVg5g-0005kI-MI for guile-user@m.gmane.org; Tue, 16 Feb 2016 08:54:56 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVg5P-0005hS-HR for guile-user@gnu.org; Tue, 16 Feb 2016 08:54:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVg5O-0004v3-4W for guile-user@gnu.org; Tue, 16 Feb 2016 08:54:39 -0500 Original-Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:37355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVg5N-0004up-QE for guile-user@gnu.org; Tue, 16 Feb 2016 08:54:38 -0500 Original-Received: by mail-wm0-x22a.google.com with SMTP id g62so153847182wme.0 for ; Tue, 16 Feb 2016 05:54:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=QO4r9VdymhmTtzLR3YBStyF3sNeYvC8YD9GmMJ2oVr4=; b=h4ebZiZ7jX/lNFztO+0NETfAnD9VOkP1//DsRSxH/Z1XfCLHJHgztaTdPqmpPwsx97 0ZNC0DmPrZiMP5EJDsw6SbIt8x+quRcS5IdybAyqsdUUeuQ/MRvrZ5Nd2s7hznldXd/R wL9+UYwGNNiK1K6i8Q1lyaoBJFhmlLk/Rr7lfpLcFQ9/G8/nKsHyGKAu2HE8hSXkiiPu E6qD3Pvx5p+o/yjvJjTJ8bw8KTOSXBs1XiZni61YnhdZ3jRPMD6L4dX0O2F4w5UQa91C oP6LfNT+JdGt/OC5MhME2pFd/gFhLAHI7XbcdCgWZm+0BCFAVlzYodBzAwIUdeilm150 N5mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=QO4r9VdymhmTtzLR3YBStyF3sNeYvC8YD9GmMJ2oVr4=; b=d2EtENTqpHeYMM5/BGeMEbzlknqVAMNVtUMAL8YmGZla31tUGLgSBVFd5hIF3mO/yk BUUofR+LHrj0tQIjTaJfMPYnIcblCcW5KKq6Wjh/wVbXsXalE3RXrUDPGxA2W8nh6BlK 0N4Y7XqhKB4hCN+fJdfSnAPv1JJLFrLc87/zRDx4tWCOPFU+DbxKAjJ5QEo2fmesrUCQ gDy6vTv/++bZWI4Qz8IKmVFu4akScJe4wXRAi0hcLtNDicHMAfOKdeW8F2gUbndtHVoF EhsEcjtTM2VTPRMe2AOWeti8qiarNIx8Hb297kq+N9n0GfSs7i/ecdjqNJH0kmZ3FI6G 8Pag== X-Gm-Message-State: AG10YOQAZUXgbKd7SNk6Hfd0GJSHzxhe6n46gPjMekdKQh8jDZ5+V6SGLFpmDzrBWwe16BYfdq5R84s0yd7h6g== X-Received: by 10.28.222.214 with SMTP id v205mr18009800wmg.92.1455630875048; Tue, 16 Feb 2016 05:54:35 -0800 (PST) Original-Received: by 10.27.187.196 with HTTP; Tue, 16 Feb 2016 05:54:35 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22a 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:12406 Archived-At: --001a114b115e3b444a052be3796c Content-Type: text/plain; charset=UTF-8 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 --001a114b115e3b444a052be3796c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I repost this as a separate thread, the code had been= debugged and a few loopholes patched
since last anouncement.


Hey Guilers

<= /div>
My potluk contibution is tp implement attributed variables for mi= nikanren ontop af the source written by=C2=A0=C2=A0William E. Byrd.

You can find the source at=C2=A0https://gitlab.com/tamp= e/attributed-minikanren

The source containes e= xamples using attributed variables to implement =3D/=3D symbolo numbero abs= ento freezeo and wheno

API
(define Attri= buteId =C2=A0(make-attribute unify-fkn portray-fkn)

(unify-fkn var data val lam)
var is the varibale that is unifie= d (not yet unified at the execution of this fkn) data is the data associate= d with AttributedId for variable var
and val is the value that va= r 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 =C2=A0re= presentations of attribuete AttributedId with data data for variable var. s= is the variable binding stack.

(get-attr var id d= ata)
Get data associated with attributed id if no attribute exist= s fail

(put-attr var id data)
Put at= tributed 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 wit= h 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 indicat= e a void semantics.

(freezeo u lam1 lam2)
before the binding of u lam1 will be tried and after the binding of u lam= 2 will be tried.

The rest of the constraints was i= mplemented by other means before and is known please read the documentation= by=C2=A0=C2=A0William E. Byrd.

Regards
Stefan

<= div>

--001a114b115e3b444a052be3796c--