comp.lang.ada
 help / color / mirror / Atom feed
From: "Staszek Goldstein" <goldstei@math.uni.lodz.pl>
Subject: Re: output and digits
Date: Wed, 20 Apr 2005 21:53:23 +0200
Date: 2005-04-20T21:53:23+02:00	[thread overview]
Message-ID: <d46bvc$v7n$1@achot.icm.edu.pl> (raw)
In-Reply-To: wcc1x95361o.fsf@shell01.TheWorld.com

Uzytkownik "Robert A Duff" <bobduff@shell01.TheWorld.com> napisal w 
wiadomosci news:wcc1x95361o.fsf@shell01.TheWorld.com...

>> This works (if you correct it slightly to integer(character'pos('I')) - 
>> pos
>> gives a universal integer!), but changing the order does not seem nice in 
>> a
>> language like Ada...
>
> Oops.  Yeah, 'Pos is what you want.  But you don't need the conversion
> to Integer.

You are right, the representation clause accepts *any* integer type, even 
universal integers, nevertheless I had to add
for Roman_Digit'size use 8;

otherwise it complained that the two converted types have different sizes 
and gave no visible output.

> Actually, it makes no sense to do arithmetic on roman numerals.
> So if I were doing this, I would have two functions, for converting
> integers to/from roman numerals represented as Strings.
> You only need roman numerals for I/O.  All internal processing
> can be done in integers.

I totally agree with this point of view. If fact, my roman numerals were 
given as an example only,
in real life I had problems with output of DNA sequences, which is a more 
serious matter.
Nevertheless, I feel quite satisfied now, after learning so many nice 
solutions to the problem...

Staszek 





  reply	other threads:[~2005-04-20 19:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-18 22:04 output of enumeration types Staszek Goldstein
2005-04-18 22:35 ` Larry Kilgallen
2005-04-18 22:43   ` Staszek Goldstein
2005-04-18 23:35   ` Staszek Goldstein
2005-04-19  0:07     ` Stephen Leake
2005-04-19  0:43       ` Staszek Goldstein
2005-04-19  4:56         ` Martin Krischik
2005-04-19 18:57         ` Jeffrey Carter
2005-04-20  0:40           ` Staszek Goldstein
2005-04-20  1:38             ` Jeffrey Carter
2005-04-19  0:33     ` Larry Kilgallen
2005-04-19  0:51       ` Staszek Goldstein
2005-04-19 23:40         ` Stephen Leake
2005-04-20  0:17           ` Staszek Goldstein
2005-04-20  9:53             ` Dmitry A. Kazakov
2005-04-20 23:16             ` Stephen Leake
2005-04-19  0:59       ` Staszek Goldstein
2005-04-19  1:54 ` Robert A Duff
2005-04-19  3:03   ` Larry Kilgallen
2005-04-19 10:34   ` output and digits Staszek Goldstein
2005-04-20 13:56     ` Robert A Duff
2005-04-20 19:53       ` Staszek Goldstein [this message]
2005-04-19  3:04 ` output of enumeration types Steve
2005-04-19  7:31 ` Dmitry A. Kazakov
2005-04-19  7:49   ` Szymon Guz
2005-04-19  8:11     ` Dmitry A. Kazakov
2005-04-19 11:26     ` Marius Amado Alves
2005-04-19 12:56       ` Dmitry A. Kazakov
2005-04-19 13:57         ` Marius Amado Alves
2005-04-19 16:05       ` Larry Kilgallen
2005-04-19 17:55         ` Georg Bauhaus
2005-04-19 21:39           ` Florian Weimer
replies disabled

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