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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9ce828272f314121 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.icp.pl!newsfeed.pionier.net.pl!news2.icm.edu.pl!not-for-mail From: "Staszek Goldstein" Newsgroups: comp.lang.ada Subject: output and digits Date: Tue, 19 Apr 2005 12:34:25 +0200 Organization: http://news.icm.edu.pl/ Message-ID: References: NNTP-Posting-Host: systemy230.toya.net.pl X-Trace: achot.icm.edu.pl 1113906958 2988 217.113.225.230 (19 Apr 2005 10:35:58 GMT) X-Complaints-To: abuse@icm.edu.pl NNTP-Posting-Date: Tue, 19 Apr 2005 10:35:58 +0000 (UTC) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Priority: 3 X-RFC2646: Format=Flowed; Original X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MSMail-Priority: Normal Xref: g2news1.google.com comp.lang.ada:10565 Date: 2005-04-19T12:34:25+02:00 List-Id: > You can convert a Roman_Digit to a Character via > Character'Value(Roman_Digit'Image(X)). You can write a function to > convert Roman_Number to String, using that in a loop. > That's not very efficient, but it avoids the tedious mentioning > of every Roman_Digit character in the conversion routine. This seems like a best idea so far... > By the way, "Roman_Digit" is a strange name -- in what sense are these > symbols "digits"? > This is not a strange name - it is a very good name. A completely disagree also with Dmitry's claim that there are only two digits in "VIII" - there are four. In Dmitry's sense something may be a digit or not depending on its position in the number (for example, in"MCM" the first 'M' is a digit, and the second not). Although nothing prevents us from adopting such a point of vue, it seems very unnatural."Numbers" are words over an alphabet consisting of digits as much as usual "words" are words over an alphabet consisting of letters. As such, digits may have no semantics. For example, "101" can denote number 101 and number 3, and many others. So the value of a string of digits depends on the way we interpret it. > type Roman_Digit is ('I','V','X','L','C','D','M'); > for Roman_Digit use ('I' => Character'('I')'val, > 'V' => ...); > > Then Unchecked_Conversion from Roman_Digit to Character will work. > Except that you then need to order the Roman_Digits in the same > order as in Character: "... is ('C', 'D', ..., 'X')". 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... Thanks to everybody, Staszek