[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/6] docs/match: add pattern matching examples
From: |
randomlooser |
Subject: |
Re: [PATCH v1 1/6] docs/match: add pattern matching examples |
Date: |
Sat, 28 Jan 2023 20:10:44 +0100 |
Il giorno sab, 28/01/2023 alle 14.18 +0100, Maxime Devos ha scritto:
>
>
> > +(define (english-base-ten->number name)
> > + (match name
> > + ('zero 0)
> > + ('one 1)
> > + ('two 2)
> > + ('three 3)
> > + ('four 4)
> > + ('five 5)
> > + ('six 6)
> > + ('seven 7)
> > + ('eight 8)
> > + ('nine 9)))
> > +
> > +(english-base-ten->number 'six)
> > +@result{} 6
>
> 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
> 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
- [PATCH v1 2/6] docs/match: rm unquote-splicing as it interferes with textinfo, (continued)
[PATCH v1 3/6] docs/match: add reverse nested list example, Blake Shaw, 2023/01/26
[PATCH v1 6/6] docs/match:style reviewing with pdf, adding newlines, Blake Shaw, 2023/01/26
[PATCH v1 4/6] docs/match: match-let* unwrap example, Blake Shaw, 2023/01/26
[PATCH v1 5/6] docs/fixup: @cindex was in the wrong place, Blake Shaw, 2023/01/26
Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Maxime Devos, 2023/01/28
- Re: [PATCH v1 1/6] docs/match: add pattern matching examples,
randomlooser <=
- Message not available
Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Maxime Devos, 2023/01/28
- Message not available
- Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Maxime Devos, 2023/01/29
- Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Blake Shaw, 2023/01/29
- Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Aleix Conchillo Flaqué, 2023/01/30
- Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Aleix Conchillo Flaqué, 2023/01/30
- Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Maxime Devos, 2023/01/30
- Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Aleix Conchillo Flaqué, 2023/01/30
Re: [PATCH v1 1/6] docs/match: add pattern matching examples + CoC, Maxime Devos, 2023/01/30