From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: randomlooser@riseup.net Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH v1 1/6] docs/match: add pattern matching examples Date: Sat, 28 Jan 2023 20:10:44 +0100 Message-ID: <1f413ffbb8a33517bbe7366d6ffc1a569252922e.camel@riseup.net> References: <20230126185801.19064-1-blake@reproduciblemedia.com> <259ecd49-6635-9426-394e-0b8064472615@telenet.be> 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="36808"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Jan 28 22:05:06 2023 Return-path: Envelope-to: guile-devel@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 1pLsNm-0009K2-3C for guile-devel@m.gmane-mx.org; Sat, 28 Jan 2023 22:05:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLsNR-0006ox-UW; Sat, 28 Jan 2023 16:04:45 -0500 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 1pLqaE-0000gL-En for guile-devel@gnu.org; Sat, 28 Jan 2023 14:09:50 -0500 Original-Received: from mx0.riseup.net ([198.252.153.6]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLqaC-0007CM-RE for guile-devel@gnu.org; Sat, 28 Jan 2023 14:09:50 -0500 Original-Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx0.riseup.net (Postfix) with ESMTPS id 4P43sk03Wtz9sp4 for ; Sat, 28 Jan 2023 19:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1674932986; bh=k8L2kLUPSZO7ozqige4iSs57X/skK25LpVk9auC1ZvI=; h=Subject:From:To:Date:In-Reply-To:References:From; b=MxtzLOswG206EV/cby2EoaOouiGfslry3CY+zxMyJOIrbwjgE/OZvoJEv9A7W4wcq 1I4pr30uiBso2f+A0Ksmvav2zj1x9UmxQJhKep6yD581SoflzWU9x8ngUyNec8qlUo u6sVyvNEQ67NpkDAphrDPMr4702wkFt0SVA/EgeY= X-Riseup-User-ID: 278C26CF2E8F268A780DFC0651ED7AB7AC12EFE3282DACC71BFF30E4151C0B9A Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4P43sj2BVpz5vXb for ; Sat, 28 Jan 2023 19:09:44 +0000 (UTC) In-Reply-To: <259ecd49-6635-9426-394e-0b8064472615@telenet.be> Received-SPF: pass client-ip=198.252.153.6; envelope-from=randomlooser@riseup.net; helo=mx0.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 28 Jan 2023 16:04:39 -0500 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21653 Archived-At: Il giorno sab, 28/01/2023 alle 14.18 +0100, Maxime Devos ha scritto: >=20 >=20 > > +(define (english-base-ten->number name) > > +=C2=A0 (match name > > +=C2=A0=C2=A0=C2=A0 ('zero=C2=A0=C2=A0 0) > > +=C2=A0=C2=A0=C2=A0 ('one=C2=A0=C2=A0=C2=A0 1) > > +=C2=A0=C2=A0=C2=A0 ('two=C2=A0=C2=A0=C2=A0 2) > > +=C2=A0=C2=A0=C2=A0 ('three=C2=A0 3) > > +=C2=A0=C2=A0=C2=A0 ('four=C2=A0=C2=A0 4) > > +=C2=A0=C2=A0=C2=A0 ('five=C2=A0=C2=A0 5) > > +=C2=A0=C2=A0=C2=A0 ('six=C2=A0=C2=A0=C2=A0 6) > > +=C2=A0=C2=A0=C2=A0 ('seven=C2=A0 7) > > +=C2=A0=C2=A0=C2=A0 ('eight=C2=A0 8) > > +=C2=A0=C2=A0=C2=A0 ('nine=C2=A0=C2=A0 9))) > > + > > +(english-base-ten->number 'six) > > +@result{} 6 >=20 > This is a suboptimal example; this would be better done with 'case'. > I propose replacing it with another example, or adding a note that > one=20 > would normally use 'case' for this. The point of this example is not to proficiently program in scheme It is to introduce possibly naive people to pattern matching effectively The aim is to be didactic, there's no implication that this is idiomatic scheme I'd pay attention at the curse of knowledge that may be at play, here