comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <bmoore.ada@gmail.com>
Subject: Re: Tally
Date: Thu, 16 Jan 2020 18:51:39 -0800 (PST)
Date: 2020-01-16T18:51:39-08:00	[thread overview]
Message-ID: <fedb17a1-576b-4a5a-b6fd-8eb5e5403cbe@googlegroups.com> (raw)
In-Reply-To: <lyblr3yr6a.fsf@pushface.org>

On Thursday, January 16, 2020 at 3:25:50 PM UTC-7, Simon Wright wrote:
> "Jeffrey R. Carter"  writes:
> 
> >>     Counts : constant Count_Maps.Map
> >>       := [for I in Input'Range
> >>             when (for all J in Input'First .. I - 1 => Input (I) /= Input (J))
> >>                use I =>
> >>                   [for K in Input'Range when Input (K) = Input (I)) => 1]
> >>                     'Reduce("+", 0)];
> >
> > This is getting close to write-only code.
> 
> Already there.

That'll be the challenge, I think. With more tools (and new ones) to work with, one hopes people will end up choosing the right tool for the job.
Some of the new tools are powerful, and there might be a tendency to want to use them, but a simpler tool can get the job done faster sometimes.

This example feels like using a big new table saw to slice bread, when a good 'ol bread knife can get it done faster and better.

Note that the simple loop accomplishes the task with a single pass through the date. The monster expression has 3 levels of nested loops, so hard to imagine it would beat the simple loop.

Brad

  reply	other threads:[~2020-01-17  2:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 15:27 Tally Gilbert Gosseyn
2020-01-14 16:22 ` Tally Niklas Holsti
2020-01-14 17:28   ` Tally Simon Wright
2020-01-15 11:52     ` Tally Simon Wright
2020-01-14 21:08 ` Tally Jeffrey R. Carter
2020-01-15  3:40   ` Tally Brad Moore
2020-01-15  9:03     ` Tally Simon Wright
2020-01-15 23:09       ` Tally Jere
2020-01-16 11:34         ` Tally Simon Wright
2020-01-16 15:35           ` Tally Brad Moore
2020-01-16 20:20             ` Tally Randy Brukardt
2020-01-16 22:03               ` Tally Jeffrey R. Carter
2020-01-16 22:00             ` Tally Jeffrey R. Carter
2020-01-16 22:25               ` Tally Simon Wright
2020-01-17  2:51                 ` Brad Moore [this message]
2020-01-17  3:08       ` Tally Brad Moore
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox