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,gmane.lisp.guile.devel Subject: Re: case source code Date: Tue, 13 Sep 2022 11:18:57 +0200 Message-ID: References: <603460d9-e0a3-b5d5-e38a-977dfbc20285@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40198"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user , guile-devel To: Taylan Kammer Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Sep 13 11:20:21 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 1oY25c-000AK9-Lo for guile-user@m.gmane-mx.org; Tue, 13 Sep 2022 11:20:20 +0200 Original-Received: from localhost ([::1]:60502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oY25b-00007U-Nf for guile-user@m.gmane-mx.org; Tue, 13 Sep 2022 05:20:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oY24Y-00006k-In; Tue, 13 Sep 2022 05:19:14 -0400 Original-Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]:42976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oY24V-000317-US; Tue, 13 Sep 2022 05:19:14 -0400 Original-Received: by mail-lf1-x135.google.com with SMTP id a3so7071415lfk.9; Tue, 13 Sep 2022 02:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=NLbtyaMjYTKXOrICzlJHwJF8sttsslUvZrjKQAVzlUs=; b=hZkL5v2D94wNufA0KSrsHPanJIPMOwiZDrhb7Rtrv2bkrlQBPcVWu9Q31BERUxcFvl R3kDw0YPoLh1kKtwerStqHIJMsi5wj9UcaaRDPkfqyo2o4JonM3spK3gxIX1tEXe3vfv d6SKmDRO6KO+WFvCETRQZDl+Km3qUJep5sW0e+rawbti/7qOH7Py96n//hhU1AKmiR2F OXBljmdJd7uO5vISeWY6tNDNvNitn2Eq580dtQN21MRpn7DDyCrjob4NE125CJNg58o0 bdaTMV09qwhAdQjO59hSHa5ExxE/QTLxhez09rrWmEnxaVQ4FN3bzKptzyhq5yKHAlpW yLUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=NLbtyaMjYTKXOrICzlJHwJF8sttsslUvZrjKQAVzlUs=; b=yVE5P5Pom1tMf6EKUYJM/OFLXGpnOBpBnZCUUMF8PRNQ3SM7mgqS6qVDVSoCB5AB9z eRKzGk/XZZG1LNT0K6D5QrgfjN5GKaFZTfxi0KmwP1zT2c+tQJuvgvhFcBebj1CvDILn FhdEU7KUcDMhEX+VddrbA2aQdRy9BGzzsC8nz5cGq4nFsoyaAgxVqm7YLwj2DSDu0457 UdyA2BZqn0MN7pVI1Cq/a8DjIKNNV5LpNFvrXL0dtXFxeul0MJUAzMqMHN1y6TyotsyV NqeE8nuJVqfaMrzBorzgRvpN4XibmfRD1m20zhAsE69r2FAaG6puEvfzcSHQQ8DhjN79 CNww== X-Gm-Message-State: ACgBeo0danE2YDYxD05GObPV3CweW0/Dh/X+E/XIXxqkck8uHvX+rIo4 1truPz/bPsA4lVN0477zT0ecdZKLfyUPZ5PKP1A= X-Google-Smtp-Source: AA6agR7F28/Ga9XvWitRcBpeL8Lqb20AyRaPi461MjMcrC0eWwlRgMtAiqqNSWzcuvVg3Uxq82nDdUQrqPnJNiQulnc= X-Received: by 2002:a05:6512:1154:b0:48b:3020:b29 with SMTP id m20-20020a056512115400b0048b30200b29mr9708026lfg.338.1663060748800; Tue, 13 Sep 2022 02:19:08 -0700 (PDT) In-Reply-To: <603460d9-e0a3-b5d5-e38a-977dfbc20285@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=damien.mattei@gmail.com; helo=mail-lf1-x135.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, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.lisp.guile.user:18587 gmane.lisp.guile.devel:21348 Archived-At: thanks, if just replaced the 'begin by 'let () to allow internal definitions but i haven't test it yet (finally no need in my code of define internal at this point) regards, Damien On Mon, Sep 12, 2022 at 10:47 AM Taylan Kammer wrote: > On 12.09.2022 09:42, Damien Mattei wrote: > > > > Hello, > > i can not find in the scheme community a definition of 'case in term of > macro as for when, unless,while,do... does anyone have it? > > thanks, > > Damien > > The RnRS often contain such definitions. The following is taken from > R7RS-small: > > (define-syntax case > (syntax-rules (else =3D>) > ((case (key ...) clauses ...) > (let ((atom-key (key ...))) > (case atom-key clauses ...))) > ((case key (else =3D> result)) > (result key)) > ((case key > (else result1 result2 ...)) > (begin result1 result2 ...)) > ((case key > ((atoms ...) result1 result2 ...)) > (if (memv key =E2=80=99(atoms ...)) > (begin result1 result2 ...))) > ((case key > ((atoms ...) =3D> result)) > (if (memv key =E2=80=99(atoms ...)) > (result key))) > ((case key > ((atoms ...) =3D> result) > clause clauses ...) > (if (memv key =E2=80=99(atoms ...)) > (result key) > (case key clause clauses ...))) > ((case key > ((atoms ...) result1 result2 ...) > clause clauses ...) > (if (memv key =E2=80=99(atoms ...)) > (begin result1 result2 ...) > (case key clause clauses ...)))) > > -- > Taylan > >