comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Tally
Date: Tue, 14 Jan 2020 18:22:36 +0200
Date: 2020-01-14T18:22:36+02:00	[thread overview]
Message-ID: <h8686dF8hukU1@mid.individual.net> (raw)
In-Reply-To: <3c6f1486-293d-4eb5-a379-279b108248d8@googlegroups.com>

On 2020-01-14 17:27, Gilbert Gosseyn wrote:
> Before I make long tests with access Types, declarations or  containers, I would like to get an advice on how to program in a simple and fast way the following, or get a hint to an existing program.
> 
> Example_Input: (2, 3, 8, 2, 2, 2, 7, 2, 3, 4, 8) ; -- variable Length
> 
> Output by function or procedure : ((2, 5), (3, 2), (8, 2), (7, 1), (4, 1));  -- unknown Length
> 
> -- tallies the elements in Input, listing all distinct elements together with their multiplicities
> 
> 
> Thank you
> 

Put the input numbers in a map container, keyed on the input number and 
giving the multiplicity so far of that number.

When the input ends, output the map.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

  reply	other threads:[~2020-01-14 16:22 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 ` Niklas Holsti [this message]
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                 ` Tally Brad Moore
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