From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alex Shinn Newsgroups: gmane.lisp.guile.devel Subject: Re: Where the next effort in prolog will be and a cool match hack!! Date: Mon, 13 Sep 2010 11:32:13 +0900 Message-ID: References: <201009092315.02287.stefan.tampe@spray.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1284345735 14749 80.91.229.12 (13 Sep 2010 02:42:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Sep 2010 02:42:15 +0000 (UTC) Cc: guile-devel@gnu.org To: Stefan Israelsson Tampe Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Sep 13 04:42:14 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ouyzl-0003PF-LO for guile-devel@m.gmane.org; Mon, 13 Sep 2010 04:42:14 +0200 Original-Received: from localhost ([127.0.0.1]:40871 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ouyzk-0001nO-AK for guile-devel@m.gmane.org; Sun, 12 Sep 2010 22:42:12 -0400 Original-Received: from [140.186.70.92] (port=37104 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuyzY-0001lU-7c for guile-devel@gnu.org; Sun, 12 Sep 2010 22:42:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ouyq7-0005m6-8O for guile-devel@gnu.org; Sun, 12 Sep 2010 22:32:16 -0400 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:51942) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ouyq7-0005ly-4R for guile-devel@gnu.org; Sun, 12 Sep 2010 22:32:15 -0400 Original-Received: by wwb24 with SMTP id 24so6182382wwb.30 for ; Sun, 12 Sep 2010 19:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=6Sjk09xaYRIsoesy//tqEAHAOgLcoyTyI/pfmP8fpOU=; b=fYSXUbCl87eJqXhnA1L7C7MjTy1twisa2f8IQvHZ3hzwLtZp8YZFfmjQC3hLRqEBds 4fve6AJ9kA6mSCnLoZPz3upvaGYFeXUVb8W9g8IaIL8X5w++xk7ZKbPLD5A0Q3/WXjEF c7vx0pS/daMbXj/2CpJM45TLdlnvzTEvbIRSo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=fxTNMTMgqETb21UH5Rku38Xtw2aAa514AKlCZhRlVhHPEAET7WswzGELPekbACV/f7 36H+FrGhtU5Ceah6sFkXWgMt5BQG/wT/JMlSbqoZtijjcilCehHmCdjBkYZhGjU0vU4c yI00Ww5qFhXEc1D8VS5wj+cnvK/IybVmnrR5g= Original-Received: by 10.227.132.211 with SMTP id c19mr500880wbt.226.1284345133806; Sun, 12 Sep 2010 19:32:13 -0700 (PDT) Original-Received: by 10.216.235.103 with HTTP; Sun, 12 Sep 2010 19:32:13 -0700 (PDT) In-Reply-To: <201009092315.02287.stefan.tampe@spray.se> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10909 Archived-At: On Fri, Sep 10, 2010 at 6:15 AM, Stefan Israelsson Tampe wrote: > > I just wanted to share some ideas that come to my mind to churn the prolog > into something more useful. Have you played with schelog and kanren? > So I have been trying to rework Shins hygienic version if ice-9 match so that > it can be used as a backbone for it. [That's "Shinn" with two n's.] > ;; defining xmatch utility - this just will use match but automatically fill in > ;; the header and make sure to use correct syntactic environment. > ;; (make-phd-matcher name phd abs) > ;; defaults is to use (*car ...), - means usual match will be done by (car ...) > ;; we also tell the matcher to use a set of abstractions with appropriate > ;; variables to bind to. xmatch will be anaphoric though. Right, a limitation of Wright's syntax is that "match" itself isn't extensible, so to build on it you need to define syntax which defines new pattern matchers. The default matcher in Racket is extensible by dispatching on the first symbol in each list, so a pair is (cons a b) and a list would be (list a b c). This is slightly more verbose, and looks like how you would generate the data rather than its actual structure, but at least is extensible. It would be possible to build on Wright's syntax with a single hook, e.g. patterns of the form (extended-match match-dispatcher data ...) possibly abbreviated (: match-dispatcher data ...) where `match-dispatcher' is an extension macro following some CPS API. A kludge, but perhaps better than redefining a matcher for every extension. -- Alex