From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: equality of syntax objects Date: Mon, 20 May 2024 13:42:15 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24195"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon May 20 13:43:03 2024 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 1s91Pz-00064Z-05 for guile-user@m.gmane-mx.org; Mon, 20 May 2024 13:43:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s91PU-0001Zg-TP; Mon, 20 May 2024 07:42:32 -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 1s91PT-0001ZR-Le for guile-user@gnu.org; Mon, 20 May 2024 07:42:31 -0400 Original-Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s91PR-0006Gq-Lq for guile-user@gnu.org; Mon, 20 May 2024 07:42:31 -0400 Original-Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-79476195696so123566485a.0 for ; Mon, 20 May 2024 04:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716205347; x=1716810147; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=c9mznYYcjsLln95vEQpLGaGAN6YK3nowHYbV+1DViyM=; b=Pl/cKKqe/a6HatXhB8PNzVpolSkLs5zfVRy9fZUZe3O0lltVi1/kHTmq4GNqll85tb U6jSYwV5Thsc5IPuFEqX1zLGISSNLJQEdG6Sr5yZNoi33dymZgiuQC5HuPj1SJ8Mbuvg heNUYjbd0XgxjXSStGhTBKe9fY/ujTpktNeoSs9w14zMOcfG4hxz7BAuICMbiDiAdA/Z bQ6Mt2w7UVr9yOZxfQO8oOB1aXYjMZ/+rjnL2I9yb3gFhBFeAE6Z71jxSH/U65bEFGqq XlgleCg9kfmOrt6TdWbQkHApXeGF6GVp59Up5onrWKFhroOLdUuQRhvHOFTyIWSOJMzO M+ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716205347; x=1716810147; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=c9mznYYcjsLln95vEQpLGaGAN6YK3nowHYbV+1DViyM=; b=BvbF3GnmgJrsGEM31eCxS97+J8obLHz3Ow21zkRcVRkz4NKR9CT5IOHMzOTdV/2AGZ ZVKKRrwGRs+UH+ZXre8ZG6fNxBY1lwYCKhCW1GDFzyC0Bmd+Z8yuqUosQig0v9oh9JYx ZvajUE/REPdjQAOIh64yiFIZ7FzLGiSOdhbeGl+wfZ3sCno/uIx4X2JlwDZzxaLI5HWx CJMSPRZVmtT/1r/OS7W2odLYlwDd+zWdxviV3vV3mOOnNTJ8MAOiIMmSzSzDqhrLWH44 GMWkNYVWMfx6wEujgY9UNtIEDAq3cr2//YUge1RN47J+LTShXucdk3v9OhMaMwDfSzGq bjVA== X-Gm-Message-State: AOJu0Yyv2pxkJs58TKcxyeY2bAMg10qpVCAIbq3zcpLZKi9JmL6Ig6Py 2y90SPQHx6qzEx/9vWcb7V4eaqNg/R4XqMWr98foXNYxS5zf9kRhPvzPoVmgdDRMOISgjmkQMAt 4tJoTQYl6kKR/QyZ1HCZm8061NkXtTLrPPik= X-Google-Smtp-Source: AGHT+IFHmkxTkt0sD9rH3onXosOcJIYSHmPtIFk9uMALPpWaLPW8HOcMmtih5XDbgxwzSk4HufZITBEdqRnGmtsMyt8= X-Received: by 2002:a05:620a:459f:b0:792:ce0e:ded0 with SMTP id af79cd13be357-792ce0ee07cmr3071377585a.52.1716205346479; Mon, 20 May 2024 04:42:26 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=damien.mattei@gmail.com; helo=mail-qk1-x732.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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:19661 Archived-At: hello, i want to check the equality of two syntax objects. i wrote this macro: (define (check-syntax=? obj1 obj2) (display "check-syntax=? : obj1 =") (display obj1) (newline) (display "check-syntax=? : obj2 =") (display obj2) (newline) (define rv (and (identifier? obj1) ;(syntax? obj1) (identifier? obj2) ;(syntax? obj2) (free-identifier=? obj1 obj2))) (display "check-syntax=? : rv =") (display rv) (newline)(newline) rv) What works: if i have expt (exponentiation) , the same procedure used and checked from to different files, i have this output in debug when doing some processing, note i think it is important to focus on the filenames of the syntax object also: when computing {1 + 2 expt 3} gives right result: 9 note that this computation requires operator precedence analysis doing on the syntax by the process... debug output include: check-syntax=? : obj1 =# check-syntax=? : obj2 =# check-syntax=? : rv =#t now i change expt by overloading itself by one of my macro: (overload-existing-operator expt expt (number? number?)) i will not explain what is the overloading algorithm here and why i overload expt.(in summary to allow n-arity with exponential such as {2 ** 3 ** 4} or {2 expt 3 expt 4} But note that expt is still working,even in infix guile mode: scheme@(guile-user)> {2 expt 3} $2 = 8 and is now an n-arity operator: scheme@(guile-user)> {2 expt 3 expt 4} $6 = 2417851639229258349412352 scheme@(guile-user)> (expt 2 3 4) $7 = 2417851639229258349412352 (and with evaluation from right to left as by convention for expt ,which is different for operator such as + or - or * and / that are evaluated from left to right) but that is of little importance with the current problem. expt looks now like that: scheme@(guile-user)> expt $3 = # new-funct is an inner function created by overloading process. and : scheme@(guile-user)> #'expt $4 = # syntax looks like the original expt , no problem with that. now the ouput in debug,after overloading expt: on the calculus: {1 + 2 expt 3} note that this computation again requires operator precedence analysis doing on the syntax by the process... check-syntax=? : obj1 =# check-syntax=? : obj2 =# check-syntax=? : rv =#f and the result 3 is wrong .(calculus has been truncated to first value 3 at rightmost as computation with expt goes from right to left but that is of no concern with the problem again) What i understand is even if obj1 and obj2 display the same in the output debug,the expt definition has changed and the checking is not only about litteral syntax but also with an hidden environment or context. That seems normal about syntax in all scheme. But i want ,for this point , only to manipulate "mathematic" syntax here. I have a few simple or complex idea for solution , some not really pretty and i ask opinion for solving this problem? just what i need is a way to find equal the expt even if it has been modified, only from a litteral point of view here. regards, damien