From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Tally Date: Tue, 14 Jan 2020 18:22:36 +0200 Organization: Tidorum Ltd Message-ID: References: <3c6f1486-293d-4eb5-a379-279b108248d8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net L9Qgb+qAjqvUpOLGVFOPawiMpMRA86hN1h67JDdHb+NHxoRsu+ Cancel-Lock: sha1:sylAARLfybXVB2sBGC3HORWUwIo= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 In-Reply-To: <3c6f1486-293d-4eb5-a379-279b108248d8@googlegroups.com> Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:57839 Date: 2020-01-14T18:22:36+02:00 List-Id: 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 . @ .