guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] add language/wisp to Guile?


From: Maxime Devos
Subject: Re: [PATCH] add language/wisp to Guile?
Date: Thu, 16 Feb 2023 12:30:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0



On 16-02-2023 09:03, Dr. Arne Babenhauserheide wrote:

Maxime Devos <maximedevos@telenet.be> writes:
+         ;; allow using "# foo" as #(foo).
+         (read-hash-extend #\# (λ (chr port) #\#))

That's a rather Wisp-specific extension, but it appears you are
extending things globally.  Instead, I propose extending it
temporarily, with the undocumented '%read-hash-procedures' fluid.

I tried the spec-example, but it didn’t work for me.

Assuming that with 'spec-example', you meant

  (parameterize ((%read-hash-procedures/parameter
                   `((#\# ,(λ (chr port) #\#))
                     ,@(%read-hash-procedures/parameter))))
    [...]):

I forgot to place a '.' between #\# and ,(λ ...).

Do you mean using it similar to this test?

   (pass-if "R6RS/SRFI-30 block comment syntax overridden"
     ;; To be compatible with 1.8 and earlier, we should be able to override
     ;; this syntax.
     (with-fluids ((%read-hash-procedures (fluid-ref %read-hash-procedures)))
       (read-hash-extend #\| (lambda args 'not))
       (fold (lambda (x y result)
               (and result (eq? x y)))
             #t
             (read-string "(this is #| a comment)")
             `(this is not a comment))))

That appears to me a valid (and slightly simpler and more robust) way of doing things, yes.

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]