comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: Subtypes with Combined Ranges
Date: Thu, 18 Jul 2002 15:44:35 +0200
Date: 2002-07-18T15:44:35+02:00	[thread overview]
Message-ID: <3D36C643.6020703@nbi.dk> (raw)
In-Reply-To: 3D36BD1F.9000101@yahoo.com

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
-- 
"Any, sufficiently complicated, experiment is 
indistinguishable from magic."




  parent reply	other threads:[~2002-07-18 13:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-18 13:05 Subtypes with Combined Ranges David Rasmussen
2002-07-18 13:15 ` Lutz Donnerhacke
2002-07-18 13:44 ` Jacob Sparre Andersen [this message]
2002-07-18 14:48   ` David Rasmussen
replies disabled

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