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:23:25 +0100 Message-ID: <054fa7ca9dc2a8345a89603dfe152f2ba511e18b.camel@riseup.net> References: <20230126185801.19064-1-blake@reproduciblemedia.com> <259ecd49-6635-9426-394e-0b8064472615@telenet.be> <1f413ffbb8a33517bbe7366d6ffc1a569252922e.camel@riseup.net> 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="37425"; 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:13 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 1pLsNs-0009VB-EL for guile-devel@m.gmane-mx.org; Sat, 28 Jan 2023 22:05:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLsNT-0006pK-Gq; Sat, 28 Jan 2023 16:04:47 -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 1pLqmS-0002iN-RI for guile-devel@gnu.org; Sat, 28 Jan 2023 14:22:30 -0500 Original-Received: from mx1.riseup.net ([198.252.153.129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLqmR-00010g-0v for guile-devel@gnu.org; Sat, 28 Jan 2023 14:22:28 -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 mx1.riseup.net (Postfix) with ESMTPS id 4P448K4JR5zDrRB for ; Sat, 28 Jan 2023 19:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1674933745; bh=3SNQQJ9Z9RC3iJSZ+UTZllalrbeZtaPxmjghPI4WruA=; h=Subject:From:To:Date:In-Reply-To:References:From; b=QCMBwgLNJqssKdiShht/w+7ufl6eCybruj79TBzWGn43E/uFJuWctE7WTN4I+LTwG 0815vahvsMbpSPTFgiDDAWFqO67Qyi1YVrv8LHUDzOwXl6/DfqCK1FZFK3TkuvdZrp VttUl50Kwy3NwBxn5nBiIPmZiBxlY8UlyoS5mA5U= X-Riseup-User-ID: 7F2486CAD34B43A29695D5DE897A727C0E6DB9E4EF8CD9564DD4B84ED4170AEC Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4P448J6XSKz5vXJ for ; Sat, 28 Jan 2023 19:22:24 +0000 (UTC) In-Reply-To: <1f413ffbb8a33517bbe7366d6ffc1a569252922e.camel@riseup.net> Received-SPF: pass client-ip=198.252.153.129; envelope-from=randomlooser@riseup.net; helo=mx1.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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:44 -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:21654 Archived-At: Il giorno sab, 28/01/2023 alle 20.10 +0100, randomlooser@riseup.net ha scritto: > 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. >=20 > The point of this example is not to proficiently program in scheme >=20 > It is to introduce possibly naive people to pattern matching > effectively >=20 > The aim is to be didactic, there's no implication that this is > idiomatic scheme >=20 > I'd pay attention at the curse of knowledge that may be at play, here >=20 I just missed the suggestion to add a note My bad Adding a note would be perfectly fine