Re: Breaking hygiene with syntax-rules?

2023-08-11 Thread Walter Lewis
Hi Jean, You could just turn that into a syntax-case macro, use gensym to generate the names, and insert them using with-syntax or quasisyntax. Yes, this is what I ended up doing before I saw your other reply. By the way, I'm rather confused as to why you deem this caching useful. A priori,

Re: Breaking hygiene with syntax-rules?

2023-08-11 Thread Walter Lewis via General Guile related discussions
Sorry I typed that code offhand and it had some mistakes; should be: (use-modules (srfi srfi-9) (system foreign)) (define-syntax define-ffi-wrapper (syntax-rules () ((_ size name wrap unwrap predicate to-pointer from-pointer) (begin (define-record-type name

Re: Breaking hygiene with syntax-rules?

2023-08-11 Thread Walter Lewis via General Guile related discussions
Hi Jean, On 8/11/23 4:00 AM, Jean Abou Samra wrote: This is a known limitation in Guile. Please read https://www.gnu.org/software/guile/manual/html_node/Hygiene-and-the-Top_002dLevel.html I expect that you would be able to fix your macro by using (define binding-you-want-to-report   (let ((pri

Breaking hygiene with syntax-rules?

2023-08-10 Thread Walter Lewis via General Guile related discussions
Hi guile, Consider this program: (define-syntax unhygienic (syntax-rules () ((_ the-pair fetch) (begin (define the-head (car the-pair)) (define (fetch) the-head) (unhygienic '(1) fetch1) (unhygienic '(2) fetch2) (fetch1) ;; => 2 It seems that the second call to u

Re: Extensible effects in Guile

2021-03-08 Thread Walter Lewis
Ludovic Courtès writes: I found it to be a super clear and inspiring read, nicely demystifying this topic. Thanks! Ludo’. Thank you, Ludo, it's good to hear. I sometimes feel I am not explaining things correctly at all, and it's a difficult topic. Walter

Re: Extensible effects in Guile

2021-03-08 Thread Walter Lewis
Walter Lewis writes: Attached is a literate org-mode file which implements an "extensible effects" system in Guile. Extensible effects was first implemented in Haskell by Oleg Kiselyov and others[1], and as far as I know has not been attempted in Scheme. It defines a metala

Re: Guile Potluck 2021 Deadline

2021-03-07 Thread Walter Lewis
Mike Gran writes: Thanks everyone for the amazing submissions. So what's next? Tomorrow, a list of all the entrants. Then, keep your eye on planet.gnu.org (via lcinexile.blogspot.com) where we'll blog about the entries. And then a big wrap-up once we've made it to the end. Please give other

Extensible effects in Guile (Guile Potluck 2021)

2021-03-06 Thread Walter Lewis
Greetings, Guile, Sincere apologies for the late entry. It's like my school days all over again... Attached is a literate org-mode file which implements an "extensible effects" system in Guile. Extensible effects was first implemented in Haskell by Oleg Kiselyov and others[1], and as far