Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #299: The data on your hard drive is out of balance.


comp / comp.lang.scheme / Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought

SubjectAuthor
* (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtHenHanna
`* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
 +* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
 |+* Re: Parenthesis Pileup (was Re: (Mastermind) puzzle (with 3 digits) -- ...)Lawrence D'Oliveiro
 ||`- Re: Parenthesis Pileup (was Re: (Mastermind) puzzle (with 3 digits) -- ...)Kaz Kylheku
 |`- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtKaz Kylheku
 `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
  +- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
  +* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
  |`* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
  | `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
  |  +- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtGeorge Neuner
  |  `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
  |   `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
  |    +* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
  |    |`* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
  |    | `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
  |    |  `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
  |    |   `- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
  |    `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtKaz Kylheku
  |     `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtNuno Silva
  |      +- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
  |      `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtHenHanna
  |       `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
  |        `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtHenHanna
  |         `- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
  `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtAndreas Eder
   +- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
   +* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtLawrence D'Oliveiro
   |`* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtGeorge Neuner
   | `* Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtPaul Rubin
   |  `- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtGeorge Neuner
   `- Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code SoughtB. Pym

Pages:12
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
From: George Neuner
Newsgroups: comp.lang.scheme
Organization: i2pn2 (i2pn.org)
Date: Sat, 2 Mar 2024 03:52 UTC
References: 1 2 3 4 5 6 7
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: gneuner2@comcast.net (George Neuner)
Newsgroups: comp.lang.scheme
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
Date: Fri, 01 Mar 2024 22:52:54 -0500
Organization: i2pn2 (i2pn.org)
Message-ID: <ga75uipsif5lpgs60ib7702fcat4u4k55c@4ax.com>
References: <urh3vu$2br0h$1@dont-email.me> <urjq6t$31cu6$1@dont-email.me> <87edcxegiu.fsf@nightsong.com> <87zfvi5ipv.fsf@eder.anydns.info> <urtg3s$1egu1$1@dont-email.me> <3hj4uite1hn3eemhlmt7sga5o0rdu66hl4@4ax.com> <874jdpegka.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="530449"; mail-complaints-to="usenet@i2pn2.org";
posting-account="h5eMH71iFfocGZucc+SnA0y5I+72/ecoTCcIjMd3Uww";
User-Agent: ForteAgent/8.00.32.1272
X-Spam-Checker-Version: SpamAssassin 4.0.0
View all headers

On Fri, 01 Mar 2024 14:24:37 -0800, Paul Rubin
<no.email@nospam.invalid> wrote:

>George Neuner <gneuner2@comcast.net> writes:
>> Named Let is not a binding construct - it's a looping construct.
>> See 11.16
>
>Thanks, I wonder if that is something relatively recent (i.e. arrived
>between r4rs and r6rs). It is kind of ugly and I'm used to seeing
>nested defines. Maybe there are some situations where the named let is
>more convenient. Or maybe I can get used to it.
>
>Part of the idea of Guile was to be the execution engine for various
>other languages that would get transpiled to Scheme, but idk if that
>went anywhere.

Named Let was formally added to Scheme in R5RS, but it was recognized
as being a legal variant at least as far back as R3RS.

=======================

R3RS [4.2.4 Iteration]:
R4RS [4.2.4 Iteration]:

:

(let <variable> <bindings> <body>) syntax

Some implementations of Scheme permit a variant on the
syntax of let called \named let" which provides a more
general looping construct than do, and may also be used
to express recursions.

Named let has the same syntax and semantics as ordinary
let except that <variable> is bound within <body> to
a procedure whose formal arguments are the bound vari-
ables and whose body is <body>. Thus the execution of
hbodyi may be repeated by invoking the procedure named
by <variable>.

(let loop ((numbers '(3 -2 1 6 -5))
(nonneg '())
(neg '()))
(cond ((null? numbers) (list nonneg neg))
((>= (car numbers) 0)
(loop (cdr numbers)
(cons (car numbers) nonneg)
neg))
((< (car numbers) 0)
(loop (cdr numbers)
nonneg
(cons (car numbers) neg)))))
==> ((6 1 3) (-5 -2))

=======================

R5RS [4.2.4 Iteration]:

:

(let <variable> <bindings> <body>) library syntax

“Named let” is a variant on the syntax of let which pro-
vides a more general looping construct than do and may
also be used to express recursions. It has the same syn-
tax and semantics as ordinary let except that <variable>
is bound within <body> to a procedure whose formal argu-
ments are the bound variables and whose body is <body>.
Thus the execution of <body> may be repeated by invoking
the procedure named by <variable>.

:

=======================

Unfortunately I don't have any references older than R3RS.

George

Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
From: Nuno Silva
Newsgroups: comp.lang.scheme, comp.lang.lisp
Organization: A noiseless patient Spider
Date: Sun, 3 Mar 2024 09:23 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!.POSTED.2001:818:dc66:5e00:202:44ff:fe9c:2638!not-for-mail
From: nunojsilva@invalid.invalid (Nuno Silva)
Newsgroups: comp.lang.scheme,comp.lang.lisp
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
Date: Sun, 03 Mar 2024 09:23:02 +0000
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <us1faq$2dsg1$1@dont-email.me>
References: <urh3vu$2br0h$1@dont-email.me> <urjq6t$31cu6$1@dont-email.me>
<87edcxegiu.fsf@nightsong.com> <urlonm$3ep9p$2@dont-email.me>
<871q8xe4xj.fsf@nightsong.com> <uroa8p$3lu2$2@dont-email.me>
<8734tcta9j.fsf@nightsong.com> <urqs1c$q9h9$2@dont-email.me>
<20240229162403.123@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="2001:818:dc66:5e00:202:44ff:fe9c:2638";
logging-data="2552321"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
View all headers

On 2024-03-01, Kaz Kylheku wrote:

> On 2024-02-29, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>> On Wed, 28 Feb 2024 15:54:48 -0800, Paul Rubin wrote:
>>
>>> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>>>
>>>> Why would that be better?
>>>
>>> You are trying to handle N digits and your algorithm does O(N**2)
>>> comparisons. Ok, I guess the whole search strategy is impractical if N
>>> is larger than just a few, and in traditional Mastermind N=4, so maybe
>>> that isn't an issue.
>>
>> “Premature optimization is the root of all evil.”
>> -- variously attributed to Tony Hoare or Donald Knuth
>
> Pinning it down more precisely at this stage would be premature
> attribution.

I sometimes feel that this specific sentence from Knuth's quote might be
being used as a way to discourage even thinking about optimization, when
the intent of the whole quote might be actually the opposite: yes, there
are places where it doesn't bring much benefit to optimize, but there
are also the parts where it *does*.

"We should forget about small efficiencies, say about 97% of the
time: premature optimization is the root of all evil. Yet we should
not pass up our opportunities in that critical 3%."

But I'll read the whole thing when I can, at this point I'm not even
sure I've read this before or not...

https://dl.acm.org/doi/10.1145/356635.356640

--
Nuno Silva
(not reading comp.lang.scheme, just comp.lang.lisp)

Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
From: Lawrence D'Oliv
Newsgroups: comp.lang.scheme, comp.lang.lisp
Organization: A noiseless patient Spider
Date: Sun, 3 Mar 2024 20:05 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.scheme,comp.lang.lisp
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code
Sought
Date: Sun, 3 Mar 2024 20:05:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <us2l76$2ltj3$4@dont-email.me>
References: <urh3vu$2br0h$1@dont-email.me> <urjq6t$31cu6$1@dont-email.me>
<87edcxegiu.fsf@nightsong.com> <urlonm$3ep9p$2@dont-email.me>
<871q8xe4xj.fsf@nightsong.com> <uroa8p$3lu2$2@dont-email.me>
<8734tcta9j.fsf@nightsong.com> <urqs1c$q9h9$2@dont-email.me>
<20240229162403.123@kylheku.com> <us1faq$2dsg1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 3 Mar 2024 20:05:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1df16df39307445c7cddc792d9e0afb1";
logging-data="2815587"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183ARnaIIiyRwj5AkO0FUAl"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:uDvAwOENr4mgwyaspC4GT3/2ZwE=
View all headers

On Sun, 03 Mar 2024 09:23:02 +0000, Nuno Silva wrote:

> yes, there are places where it doesn't bring much benefit to optimize,
> but there are also the parts where it *does*.

The point being, you determine those by actually running benchmarks on
your code. Programmers who assume they know which parts need speeding up a
priori are often surprised to discover they’re wrong.

Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
From: HenHanna
Newsgroups: comp.lang.scheme, comp.lang.lisp
Organization: novaBBS
Date: Sun, 3 Mar 2024 22:56 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: HenHanna@dev.null (HenHanna)
Newsgroups: comp.lang.scheme,comp.lang.lisp
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
Date: Sun, 3 Mar 2024 22:56:25 +0000
Organization: novaBBS
Message-ID: <31ee5ecaf0edef2a085326ac998363d8@www.novabbs.com>
References: <urh3vu$2br0h$1@dont-email.me> <urjq6t$31cu6$1@dont-email.me> <87edcxegiu.fsf@nightsong.com> <urlonm$3ep9p$2@dont-email.me> <871q8xe4xj.fsf@nightsong.com> <uroa8p$3lu2$2@dont-email.me> <8734tcta9j.fsf@nightsong.com> <urqs1c$q9h9$2@dont-email.me> <20240229162403.123@kylheku.com> <us1faq$2dsg1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="731526"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$EoNSD32wmpLlsolVqUGqmOLiBYH/kkG0iKfceh3YZhLqxzV./wX.i
X-Rslight-Posting-User: 5a1f1f09909a70d7ae18ae9af00e018f83ece577
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Face: P#KeQ)CUdd!==@fw~Ms1=,Hb`IWtb6:Mw)x3B=H1BfNC\lz?Nb&)M9}$>?'X7l;CuB}utlJ=PHsRBSG6X>dYZ$[>P]$~+`>@V6$t}hTLoQ7XC~W\>:`B3ALU]SH;d(\MEc}znW8m}-ma&yPFkJ2@KSQrz=!Y;><;6a>z6N+mt`ClCt.PAE<o+B$qjwejZSZ,w]^;vrdl24z5(pm={l,F10qRDF
View all headers

sum ( i != j and a == b for i, a in enumerate(candidate)
for j, b in enumerate(answer) )

--------- i certainly enjoyed seeing this code. Thanks for sharing it!

it's written in a [functional] or [mathematical] or "comprehensive" style.

Nuno Silva wrote:

> On 2024-03-01, Kaz Kylheku wrote:

>> On 2024-02-29, Lawrence D'Oliveiro <ldo@nz.invalid> wrote: .....

>>>
>>> “Premature optimization is the root of all evil.”
>>> ----- variously attributed to Tony Hoare or Donald Knuth

and not Perlis?

>> Pinning it down more precisely at this stage would be premature attribution.

> I sometimes feel that this specific sentence from Knuth's quote might be
> being used as a way to discourage even thinking about optimization, when
> the intent of the whole quote might be actually the opposite: yes, there
> are places where it doesn't bring much benefit to optimize, but there
> are also the parts where it *does*.

Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
From: Lawrence D'Oliv
Newsgroups: comp.lang.scheme, comp.lang.lisp
Organization: A noiseless patient Spider
Date: Sun, 3 Mar 2024 23:27 UTC
References: 1 2 3 4 5 6 7 8 9 10 11
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.scheme,comp.lang.lisp
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code
Sought
Date: Sun, 3 Mar 2024 23:27:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <us3103$2of1i$1@dont-email.me>
References: <urh3vu$2br0h$1@dont-email.me> <urjq6t$31cu6$1@dont-email.me>
<87edcxegiu.fsf@nightsong.com> <urlonm$3ep9p$2@dont-email.me>
<871q8xe4xj.fsf@nightsong.com> <uroa8p$3lu2$2@dont-email.me>
<8734tcta9j.fsf@nightsong.com> <urqs1c$q9h9$2@dont-email.me>
<20240229162403.123@kylheku.com> <us1faq$2dsg1$1@dont-email.me>
<31ee5ecaf0edef2a085326ac998363d8@www.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 3 Mar 2024 23:27:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ebd4c9541601cb1e1312dcde6a0cb96a";
logging-data="2898994"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DqYZMQ7V2om0mu7iohwg1"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:KP0iEhIayUdkZQbr73LAfZCJspM=
View all headers

On Sun, 3 Mar 2024 22:56:25 +0000, HenHanna wrote:

> it's written in a [functional] or [mathematical] or
> "comprehensive" style.

Yup, I like writing functional constructs in primarily-procedural
languages. It’s better than trying to work in supposedly pure-functional
languages.

Python also uses the term “comprehension” for certain uses of that kind of
construct.

> and not Perlis?

I like another quote of his: “There are two ways to write error-free
programs; only the third one works.”

Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
From: HenHanna
Newsgroups: comp.lang.scheme, comp.lang.lisp
Organization: novaBBS
Date: Mon, 4 Mar 2024 10:30 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder6.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: HenHanna@dev.null (HenHanna)
Newsgroups: comp.lang.scheme,comp.lang.lisp
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
Date: Mon, 4 Mar 2024 10:30:26 +0000
Organization: novaBBS
Message-ID: <ec96ca8d22ac4bbba9baf649a89c97a1@www.novabbs.com>
References: <urh3vu$2br0h$1@dont-email.me> <urjq6t$31cu6$1@dont-email.me> <87edcxegiu.fsf@nightsong.com> <urlonm$3ep9p$2@dont-email.me> <871q8xe4xj.fsf@nightsong.com> <uroa8p$3lu2$2@dont-email.me> <8734tcta9j.fsf@nightsong.com> <urqs1c$q9h9$2@dont-email.me> <20240229162403.123@kylheku.com> <us1faq$2dsg1$1@dont-email.me> <31ee5ecaf0edef2a085326ac998363d8@www.novabbs.com> <us3103$2of1i$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="781049"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Face: P#KeQ)CUdd!==@fw~Ms1=,Hb`IWtb6:Mw)x3B=H1BfNC\lz?Nb&)M9}$>?'X7l;CuB}utlJ=PHsRBSG6X>dYZ$[>P]$~+`>@V6$t}hTLoQ7XC~W\>:`B3ALU]SH;d(\MEc}znW8m}-ma&yPFkJ2@KSQrz=!Y;><;6a>z6N+mt`ClCt.PAE<o+B$qjwejZSZ,w]^;vrdl24z5(pm={l,F10qRDF
X-Rslight-Site: $2y$10$kyrH5g3Hpc0pcENAaZmIzeltYkt2efYrwOtEHWJXEqFJLtQv7nOkm
X-Rslight-Posting-User: 5a1f1f09909a70d7ae18ae9af00e018f83ece577
X-Spam-Checker-Version: SpamAssassin 4.0.0
View all headers

Lawrence D'Oliveiro wrote:

> On Sun, 3 Mar 2024 22:56:25 +0000, HenHanna wrote:

>> it's written in a [functional] or [mathematical] or "comprehensive" style.

> Yup, I like writing functional constructs in primarily-procedural
> languages. It’s better than trying to work in supposedly pure-functional
> languages.

> Python also uses the term “comprehension” for certain uses of that kind of construct.

>> and not Perlis?

> I like another quote of his: “There are two ways to write error-free
> programs; only the third one works.”

i love it.... i thought it must be THE most enigmatic of his quotes, but...

https://www.cs.yale.edu/homes/perlis-alan/quotes.html

38. Structured Programming supports the law of the excluded middle. --------- ??????????

39. Re graphics: A picture is worth 10K words - but only those to describe the picture. Hardly any sets of 10K words can be adequately described with pictures.

40. There are two ways to write error-free programs; only the third one works.

41. Some programming languages manage to absorb change, but withstand progress. -------- For example?????

42. You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN.

43. In software systems, it is often the early bird that makes the worm. ---------- meaning, ...that introduces the BUG ?

44.Sometimes I think the only universal in the computing field is the fetch-execute cycle.

Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
From: Lawrence D'Oliv
Newsgroups: comp.lang.scheme, comp.lang.lisp
Organization: A noiseless patient Spider
Date: Mon, 4 Mar 2024 21:04 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.scheme,comp.lang.lisp
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code
Sought
Date: Mon, 4 Mar 2024 21:04:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <us5d1c$3besu$2@dont-email.me>
References: <urh3vu$2br0h$1@dont-email.me> <urjq6t$31cu6$1@dont-email.me>
<87edcxegiu.fsf@nightsong.com> <urlonm$3ep9p$2@dont-email.me>
<871q8xe4xj.fsf@nightsong.com> <uroa8p$3lu2$2@dont-email.me>
<8734tcta9j.fsf@nightsong.com> <urqs1c$q9h9$2@dont-email.me>
<20240229162403.123@kylheku.com> <us1faq$2dsg1$1@dont-email.me>
<31ee5ecaf0edef2a085326ac998363d8@www.novabbs.com>
<us3103$2of1i$1@dont-email.me>
<ec96ca8d22ac4bbba9baf649a89c97a1@www.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 4 Mar 2024 21:04:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ebd4c9541601cb1e1312dcde6a0cb96a";
logging-data="3521438"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195enVB6A9cy8J/TZ6v81tR"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:RrFZ9LUU4zbsc6U7bumR4NUQBwg=
View all headers

On Mon, 4 Mar 2024 10:30:26 +0000, HenHanna wrote:

> 41. Some programming languages manage to absorb change, but withstand
> progress. -------- For example?????

PHP being the obvious one. It manages to copy features from other
languages (initially Perl, currently Python) without quite understanding
how they’re supposed to work, and so completely botching them.

> 42. You can measure a programmer's perspective by noting his attitude on
> the continuing vitality of FORTRAN.

That was the first language I learned, even before I got my hands on a
computer, back in the day. I have been through so many others since then,
I thought Fortran had had its day.

But have you looked at the specs for Fortran-90 onwards? It has gone free-
format. It has proper control constructs, so you can write entire programs
without statement labels at all. It has local variables and recursion. It
has structured types and something resembling object orientation. (OK, so
pointers might still be a bit clunky.)

And above all, it has “coarrays”, for partitioning work among the nodes of
a massively parallel supercomputer. If you want proof that Fortran is
still relevant to the modern computing era, this is it.

Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
From: B. Pym
Newsgroups: comp.lang.scheme
Organization: A noiseless patient Spider
Date: Sun, 26 May 2024 08:11 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (B. Pym)
Newsgroups: comp.lang.scheme
Subject: Re: (Mastermind) puzzle (with 3 digits) -- Elegant (readable) code Sought
Date: Sun, 26 May 2024 08:11:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <v2uqqu$3b7ev$1@dont-email.me>
References: <urh3vu$2br0h$1@dont-email.me> <urjq6t$31cu6$1@dont-email.me> <87edcxegiu.fsf@nightsong.com> <87zfvi5ipv.fsf@eder.anydns.info>
Injection-Date: Sun, 26 May 2024 10:11:11 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8a141804df277ee017ff79d46698b570";
logging-data="3513823"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180DDaE9RGkcE9UWid9Vhd+"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:o1rN5F3gDb2YKg/b2ZzazZIC3ks=
View all headers

On 3/1/2024, Andreas Eder wrote:

> I would write it without the second define using a named let:
>
> (define (range n)
> (let go ((n n) (a '()))
> (if (< n 0)
> a
> (go (1- n) (cons n a)))))

Looks good.

Using "do":

(define (range n)
(do ((i n (- i 1))
(a '() (cons i a)))
((< i 0) a)))

Using "unfold-right" in Gauche Scheme:

(use srfi-1)

Gauche doesn't have "1-".

(define (1- n) (- n 1))

(define (range n) (unfold-right negative? values 1- n))

(range 9)
===>
(0 1 2 3 4 5 6 7 8 9)

Pages:12

rocksolid light 0.9.8
clearnet tor