From: Alex Shinn <alexshinn@gmail.com>
To: Stefan Israelsson Tampe <stefan.tampe@spray.se>
Cc: guile-devel@gnu.org
Subject: Re: Where the next effort in prolog will be and a cool match hack!!
Date: Mon, 13 Sep 2010 11:32:13 +0900 [thread overview]
Message-ID: <AANLkTi=Rfx7+dNP5A+jA-+o0V42ix-vA6MNCCCr2TA-L@mail.gmail.com> (raw)
In-Reply-To: <201009092315.02287.stefan.tampe@spray.se>
On Fri, Sep 10, 2010 at 6:15 AM, Stefan Israelsson Tampe
<stefan.tampe@spray.se> 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
next prev parent reply other threads:[~2010-09-13 2:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-09 21:15 Where the next effort in prolog will be and a cool match hack!! Stefan Israelsson Tampe
2010-09-10 8:50 ` Andy Wingo
2010-09-10 14:28 ` Andy Wingo
2010-09-13 2:32 ` Alex Shinn [this message]
2010-09-13 12:20 ` Ludovic Courtès
2010-09-13 18:45 ` Stefan Israelsson Tampe
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='AANLkTi=Rfx7+dNP5A+jA-+o0V42ix-vA6MNCCCr2TA-L@mail.gmail.com' \
--to=alexshinn@gmail.com \
--cc=guile-devel@gnu.org \
--cc=stefan.tampe@spray.se \
/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).