From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Abou Samra Newsgroups: gmane.lisp.guile.user Subject: Re: macro definition for continue and break Date: Sun, 4 Sep 2022 12:08:39 +0200 Message-ID: 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="15622"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 To: Damien Mattei , guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Sep 04 12:09:27 2022 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 1oUmZC-0003xZ-Rc for guile-user@m.gmane-mx.org; Sun, 04 Sep 2022 12:09:26 +0200 Original-Received: from localhost ([::1]:37870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUmZB-0005Aw-UJ for guile-user@m.gmane-mx.org; Sun, 04 Sep 2022 06:09:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUmYe-00059Y-SV for guile-user@gnu.org; Sun, 04 Sep 2022 06:08:53 -0400 Original-Received: from mout.kundenserver.de ([217.72.192.75]:51541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUmYd-0007b9-1N for guile-user@gnu.org; Sun, 04 Sep 2022 06:08:52 -0400 Original-Received: from [172.20.10.4] ([37.169.28.237]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.184]) with ESMTPSA (Nemesis) id 1MzQPe-1pHEPg2csq-00vShm; Sun, 04 Sep 2022 12:08:40 +0200 Content-Language: en-US In-Reply-To: X-Provags-ID: V03:K1:f31NAgmTxxYyJWlW1WUPZpRlEek6TTj9A+LVOu+lsBsN4/50xgp g4Mp4bxCBCVLk+bSz5iqDe1683oznU2VRuO+MG6eeSme6iOMGCi5g5hU/YTjWjZjssEDRQS 0HMdjq9DYhFKyJbTEZyQ2lO5etxTbhIVpJ/zmBN0VzCG0HEtMpi2gIlT+hnzmzI/02NMaOW D7HSocbU8KuK9vOXHrUKw== X-UI-Out-Filterresults: notjunk:1;V03:K0:ST8CVhEOOlM=:hDCfuaopwT1JUcFFnD8o+u cT18MmBua3DtqV4Q2EHMImTpqXmfuRRg6F45OP7ymIQBjanbb/tq6ZzM12oQsbovuVMBDp09h wYO+UK/zEqwN8vt2TMM62X21N0cEdugYjlhpbqfAHC6j6QN0d9O8BYGjunRDVn/7mnveqO7K/ PD+lB7+zpV39/YdOh5WwSFXHtyKj5uo9PiimZMKFkLwIR2MR3GMp+n3IMtwJlrfHLUO0FsrDw diCbi3TTesyvq5jAqSNoeaKutE7Z5jPz+U4PZjT0wKv1tT/NTsWv8VYsdYNsj3yHblcPS5HPl rzkStMcic7DZinkZ60bTiKScBhMh+efWDU/if28Opm23mW1+3/rFUWgjOwn198lo7zhR95W5P Tfv4TTmTqUldkCACWWPdRmPLjRSgfuYnARBhtSZi7DZlcDMY98eAALTOyfhMs6RZrCOCuK23F LGXLjVehlzrdFAdf0Dv4UBmaOxyyaI1y5aES60H8rGxBlowWg0zoLBtPajeg05Cr7Ripby2m9 nrIipuLKsp5SPb/9q4Q+lQLsGFWDJ2HYAjJ3mxtKDwKKVZt3Wvs96brC+dwa4ypWGjONOZDfa bnzV1bDz2VErd0G1Z8fwgc5oMI6gWiFz+yaGIinbIM8b5ChevIQgAu7JxgH73kOmmfTwXx+fb Qy2ZCKVzJHc2rCa9etOzMrN9XX7HBAxEsWePipjWBjGLyFZTIeSW9zoHOh1vAj0MmC7dfIeoo aiNfWKAbayENSz40fIvJ+HQRkMxUvsabh+UuGMGFpzWJnLI0NNhCXaRuXiBXd7PHnJ8AZ0RN Received-SPF: none client-ip=217.72.192.75; envelope-from=jean@abou-samra.fr; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.lisp.guile.user:18563 Archived-At: Le 04/09/2022 à 10:19, Damien Mattei a écrit : > my previous question ,clearly more, is : > (define-syntax for/bc > > (syntax-rules (continue break) > > ((_ (init test incrmt) b1 ...) > > (call/cc (lambda (break) > (let () > init > (let loop () > (when test > (call/cc (lambda (continue) b1 ...)) > incrmt > (loop))))))))) > > is there a way to make working this macro in a R6RS compatible way (i know > it is possible in Racket or with syntax features...) > > to avoid error: > (for/bc ({i <+ 0} {i < 5} {i <- {i + 1}}) > {x <+ 7} > (display x) > (newline) > (break)) > > ;;; :2:73: warning: possibly wrong number of arguments to `break' > 7 > ice-9/boot-9.scm:1685:16: In procedure raise-exception: > Wrong number of arguments to # > > Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. You seem to be mistaken about what the literals list in syntax-rules does. It enables literal matching in the pattern part, and only has an effect on the patterns. It does not make 'break' in the expanded body expand as an unhygienic identifier. It allows to recognize keywords, but not to introduce them. Yo  need to use datum->syntax for that. You're getting a break procedure from somewhere else: scheme@(guile-user)> (use-modules (srfi srfi-1)) scheme@(guile-user)> break $1 = # You seem to have corrected this mistake in your second post with a similar question, so I'll continue on that thread.