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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,cef8cda5553209f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-18 07:48:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!demon!newsfeed.stueberl.de!news-mue1.dfn.de!news-fra1.dfn.de!news.tele.dk!not-for-mail Message-ID: <3D36D521.6010708@yahoo.com> Date: Thu, 18 Jul 2002 16:48:01 +0200 From: David Rasmussen User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020615 Debian/1.0.0-3 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Subtypes with Combined Ranges References: <3D36BD1F.9000101@yahoo.com> <3D36C643.6020703@nbi.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Organization: TDC Internet NNTP-Posting-Host: 195.215.62.2 X-Trace: 1027003680 dtext.news.tele.dk 16778 195.215.62.2 X-Complaints-To: abuse@post.tele.dk Xref: archiver1.google.com comp.lang.ada:27227 Date: 2002-07-18T16:48:01+02:00 List-Id: Jacob Sparre Andersen wrote: > David Rasmussen wrote: > >> An Ada-excercise reads as follows: >> >> 6.1 Write a program to count the number of occurrences of each letter >> of the alphabet typed as input at the keyboard. Using a subtype of >> Character as the index subtype of an array is a sensible way to do this. >> >> My first thought was to do this: >> subtype Alphabetical is Character range 'A'..'Z' | 'a'..'z'; > > > I think your problem is that you misunderstand the exercise. "The > alphabet" is just 'a' to 'z' and case insensitive. But since the > alphabet actually is 'a' to '�', and not just 'a' to 'z', the advise in > the exercise is inapropriate for other languages than English and Latin. > > I would assume that the alphabet considered by the user is a subset of > the type Character, but include all elements of type Character > (converted to lower case) in the histogram, and not worry about which > elements to show until printing out the histogram. > > Jacob That is of course one way to do it. But I understood the word "subtype" in the excercise, in the Ada sense of the word. So I wanted to actually make a subtype, and then declare an array with this type as index type. I can do that with the lowercase letters, of course, as long as we're talking about English or Latin. /David