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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5e54ec0ce937978 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!newsfeed.utanet.at!newsfeed01.chello.at!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: String literals and wide_string literals - how? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1177063665.093083.241580@e65g2000hsc.googlegroups.com> <1177099260.665252.323030@l77g2000hsb.googlegroups.com> Date: Fri, 20 Apr 2007 22:41:35 +0200 Message-ID: NNTP-Posting-Date: 20 Apr 2007 22:40:24 CEST NNTP-Posting-Host: 9704d3ce.newsspool3.arcor-online.net X-Trace: DXC=3GSSf7_ImX;_A0jCfgHO6>McF=Q^Z^V384Fo<]lROoR1Fl8W>\BH3Y2le=RdK?]1F;DNcfSJ;bb[5IRnRBaCdN`;WD7<`o6;16nDOTP=4c7 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:15174 Date: 2007-04-20T22:40:24+02:00 List-Id: On 20 Apr 2007 13:01:00 -0700, Adam Beneschan wrote: > On Apr 20, 12:16 pm, "Randy Brukardt" wrote: > >> Now throw in some operator overloading: >> >> function "+" (Left, Right : Roman_Numeral) return Roman_Numeral; >> >> and you can work solely in Roman_Numerals. > > It would be an interesting challenge to write this function---without > cheating. That is, without resorting to converting the operands to > regular integers, adding them the normal way, and converting the > result back. No, no, no. Do it the way the Romans would have had to > do it. Might make for a good programming exercise. Not that hard, Ada has loop in reverse. I think that for summation, even one character look-ahead is not actually needed (for IV, IX, XL etc stuff). One should postpone flushing the last "decimal" place before recognizing the next one, so that gone astray I, X, C could be subtracted from it. > And then, if someone gets this right, tell them to implement "*". Romans used abacus for that, they cheated! (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de