From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: Re: 2 macros in one expression Date: Sat, 15 Apr 2023 06:49:30 -0700 Message-ID: <4187fdcf-5bee-8e9d-3ec1-19cc55e36fc3@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39696"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Apr 15 15:50:18 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pngID-000ACH-PS for guile-user@m.gmane-mx.org; Sat, 15 Apr 2023 15:50:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pngHc-0008B5-2m; Sat, 15 Apr 2023 09:49:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pngHa-00089Q-Oo for guile-user@gnu.org; Sat, 15 Apr 2023 09:49:38 -0400 Original-Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pngHY-0003D0-TA for guile-user@gnu.org; Sat, 15 Apr 2023 09:49:38 -0400 Original-Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4ec816d64afso1903187e87.1 for ; Sat, 15 Apr 2023 06:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681566574; x=1684158574; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=2ulYB3WQij9xQcOQSNUGqKe2ViK7SxWuo0w/flZgLfM=; b=HiNesbar8vt60x0hWxl0wJEeqkrnasIDrmbCwYN8MTBHmve2dobnayzUdcrvOR9Yqx Hs5y+x7lOMnQQfr+g4pdTADF/Jg3Lg9rfYTu/MvpZ2zHtqFvwbSmORVXCtpq/3eL30Qb Heij3i8bn/6p5cRBkkNQMoepgrT0UB50I29xapYxwS1gEinq1Phw8mdF/5Zd4wkt6tph 6pv88dmCLCnECVvDQVX9FMLpjAIThhINTIB9vQW1eaSf7701bsV2vqlafL34XTEA2eAG +ty9AAe/wzf4i4ONintvokFtnNfKRTyrViUqrMadtmi8f2Z6hoebOorvwq3Y2IRoD/si w+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681566574; x=1684158574; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=2ulYB3WQij9xQcOQSNUGqKe2ViK7SxWuo0w/flZgLfM=; b=LE3LcabAdEaOTm3O4lv0Rkj+yONo/T4PqhqBoDqJ2eWJ1U/ol2OahzI/YXdlBG5qm0 P/uLMz50QyNwamQcivYc//yds6fqF7ESaXstZ/bAAfPzIJR3sO3eEq4+gF/F3LvSdQVh 35miAy6LfLkEQZJ4iXMawg52+2ld1rYzI3DlSssnDUCkWVniot39BnutVjozF71b9gg5 ZdfzAQmQpEunuuNy54AmHCcPy3j1hK4J81SfR1GyZdg7M6aqsqR00WMOzXNawlqIiM7U aAfcjq5RF+YEM2Q1CiMVG4+/Mya4ISBXEYEiDNFVvCl23Ti3fd+qxMNpolPw4K17/9TE uxzA== X-Gm-Message-State: AAQBX9fOCB8OOmDk0zkpbNXuHNVwJtSdgFXnt+S0CFdUD8+39kiiPAP6 SFxk+QD6iyOC9ptzYyThK80OLGLXfTI= X-Google-Smtp-Source: AKy350aN8V+RUlCRdqTeSlmn62EEPIdxlP2b2VorP132Bje4mewRFitdYiPUlljE0jLUBf8LRWE3ow== X-Received: by 2002:ac2:532c:0:b0:4eb:e8e:4139 with SMTP id f12-20020ac2532c000000b004eb0e8e4139mr655658lfh.2.1681566573782; Sat, 15 Apr 2023 06:49:33 -0700 (PDT) Original-Received: from [192.168.2.157] (64-52-138-37.championbroadband.com. [64.52.138.37]) by smtp.gmail.com with ESMTPSA id o9-20020a05651238a900b004eb0c18efc2sm1289074lft.221.2023.04.15.06.49.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Apr 2023 06:49:33 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=matt.wette@gmail.com; helo=mail-lf1-x130.google.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, NICE_REPLY_A=-2.346, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18962 Archived-At: Did you try using the following? (define-syntax $nfx$ (syntax-rules (<-) ((... On 4/14/23 4:02 AM, Damien Mattei wrote: > hello, > > i have 2 macros used in one expression like this: > scheme@(guile-user)> (define i 2) > scheme@(guile-user)> {i <- i + 1} > and i got this error: > While compiling expression: > Syntax error: > unknown location: source expression failed to match any pattern in form <- > > i use SRFI-105 so : > '{i <- i + 1} expand in: > ($nfx$ i <- i + 1) > > and i'm expecting $nfx$ to be called but none of this happens: > scheme@(guile-user)> ($nfx$ i <- i + 1) > While compiling expression: > Syntax error: > unknown location: source expression failed to match any pattern in form <- > > it seems to be the <- macro and i do not understand why? > > any idea? > > macros are defined like this for the beginning: > ;; from file assignment.scm > (define-syntax <- > > (syntax-rules () > ;; special form like : (<- ($bracket-apply$ T 3) ($bracket-apply$ T 4)) > > ;; one dimension array, example: {a[4] <- 7} > ;; $bracket-apply$ is from SRFI 105 bracket-apply is an argument of > the macro > ((_ (bracket-apply container index) expr) > > .... > > ;; from file scheme-infix.scm > (define-syntax $nfx$ > (syntax-rules () > > ((_ ident opspecial term1 op term2) (cond ((or (equal? (quote > opspecial) (quote <-)) (equal? (quote opspecial) (quote ←))) > (begin > (display "$nfx$") (newline) > (opspecial ident (op term1 term2)))) ;; {ident <- {term1 op term2}} > > ... > > > it is in a module like this: > > (define-module (Scheme+) > > #:use-module (growable-vector) > #:use-module (srfi srfi-69) ;; Basic hash tables > #:use-module (srfi srfi-31) ;; rec > #:export ($nfx$ def $bracket-apply$ <- ← -> → <+ ⥆ +> ⥅ declare $ & condx > <> ≠ ** ⇜ ⇝ repeat) > #:replace (do when unless)) > > > > (include-from-path "def.scm") > (include-from-path "array.scm") > (include-from-path "set-values-plus.scm") > (include-from-path "apply-square-brackets.scm") > (include-from-path "assignment.scm") > (include-from-path "declare.scm") > (include-from-path "condx.scm") > (include-from-path "block.scm") > (include-from-path "not-equal.scm") > (include-from-path "exponential.scm") > (include-from-path "while-do-when-unless.scm") > (include-from-path "repeat-until.scm") > (include-from-path "scheme-infix.scm") > > if it can help. > > Regards, > Damien