unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* How to convert r7rs module using include-library-declarations to Guile?
@ 2020-09-27 17:56 Felix Thibault
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Thibault @ 2020-09-27 17:56 UTC (permalink / raw)
  To: guile-user

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?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* How to convert r7rs module using include-library-declarations to Guile?
@ 2020-09-27 19:07 Felix Thibault
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Thibault @ 2020-09-27 19:07 UTC (permalink / raw)
  To: guile-user

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?



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-27 19:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 17:56 How to convert r7rs module using include-library-declarations to Guile? Felix Thibault
  -- strict thread matches above, loose matches on Subject: below --
2020-09-27 19:07 Felix Thibault

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).