unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Felix Thibault <fthibault1969@gmail.com>
To: guile-user@gnu.org
Subject: How to convert r7rs module using include-library-declarations to Guile?
Date: Sun, 27 Sep 2020 13:56:53 -0400	[thread overview]
Message-ID: <CAGyWG1vikepzBUGnFRQZsjsMk8LtWx-zFy6B_C65aRPcAbso8A@mail.gmail.com> (raw)

I am working on a pattern-matcher that exports all of its auxiliary syntax ($
*** =.. *.. get! etc., a modified version of Alex Shinn's syntax).

It works in Guile, and I'm trying to refactor it to use srfi-206, but if I
try to import (only (srfi srfi-206 all) $ *** =.. etc) with just the names
changed in guile-3 I get:

source expression failed to match any pattern in form (())

If I simplify (srfi srfi-206 all) to:

(define-library (srfi srfi-206 all)
  (include-library-declarations "all-exports.scm")
  (import (guile))
  (begin
    (define-syntax define-identifier-syntax-parameter
      (syntax-rules ()
       ((_ name e)
       (define-syntax name
         (syntax-rules ()
         ((_ . _) e))))))
    (define-syntax define-auxiliary-syntax
      (syntax-rules ()
        ((_ name)
(define-identifier-syntax-parameter name
    (syntax-error "invalid use of auxiliary syntax" name))))))
(include "all-definitions.scm"))

I get:

definition in expression context ... for form
 ((define-syntax define-identifier-syntx-parameter ...))

So I tried putting that module in Guile form:

(define-module (srfi srfi-206 all))
  (include-from-path "srfi/srfi-206/all-exports.scm")
  (import (guile))
    (define-syntax define-identifier-syntax-parameter
      (syntax-rules ()
       ((_ name e)
                (define-syntax name
               (syntax-rules ()
                ((_ . _) e))))))
    (define-syntax define-auxiliary-syntax
      (syntax-rules ()
               ((_ name)
         (define-identifier-syntax-parameter name
          (syntax-error "invalid use of auxiliary syntax" name)))))
(include-from-path "srfi/srfi-206/all-definitions.scm")

and it loaded, but it didn't work: all the tests on the module that fail
when the pattern-matcher doesn't recognize the renamed auxiliary syntax
failed. Like

(match '(1 2 2 2) ((a (? number? b) ...) b)) ERROR

(match '(1 (2 2 2)) ((a (? number? b) ...) b)) => (2)

Is there a way to convert this module to Guile-2 and Guile-3 as it is now?


             reply	other threads:[~2020-09-27 17:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 17:56 Felix Thibault [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-09-27 19:07 How to convert r7rs module using include-library-declarations to Guile? Felix Thibault

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=CAGyWG1vikepzBUGnFRQZsjsMk8LtWx-zFy6B_C65aRPcAbso8A@mail.gmail.com \
    --to=fthibault1969@gmail.com \
    --cc=guile-user@gnu.org \
    /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).