comp.lang.ada
 help / color / mirror / Atom feed
From: "Anders Wirzenius" <anders.wirzenius@pp.qnet.fi>
Subject: Re: string operations
Date: Tue, 21 Nov 2000 06:30:43 GMT
Date: 2000-11-21T06:30:43+00:00	[thread overview]
Message-ID: <nEoS5.32$xg.1219@read2.inet.fi> (raw)
In-Reply-To: 8vbfns$do2$1@nnrp1.deja.com


"Robert Dewar" <robert_dewar@my-deja.com> wrote in message
news:8vbfns$do2$1@nnrp1.deja.com...
> In article <WE7S5.239$rj6.8595@read2.inet.fi>,
>   "Anders Wirzenius" <anders.wirzenius@pp.qnet.fi> wrote:
> > To me the example would have been even more revealing if
> > the Put statement had been written
> > Put(Character'Val(Character'Pos ('0') + N mod 10));
>
>
> Odd ... addition is after all commutative, can you explain why
> in this case a+b is clearer than b+a
>
> I personally prefer the form I had, because from an algorithmic
> point of view it is N mod 10 that is important, and
> the Character'Pos is a minor detail for keeping the types
> right ...

Ok. As i wrote, the example deals with both the algoritm of recursion and
the string handling.
I just emphasized the string handling more than as "a minor detail".  :-)

By the way. I hope miss Margit played a little with the example, as I did,
and switched the order of the statements in the procedure.

Anders





  reply	other threads:[~2000-11-21  6:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-18  0:00 string operations Margit Gut
2000-11-18  0:00 ` Jeff Carter
2000-11-19  0:00 ` Robert Dewar
2000-11-20  0:00   ` Anders Wirzenius
2000-11-20  0:00     ` Robert Dewar
2000-11-21  6:30       ` Anders Wirzenius [this message]
2000-11-24  0:00         ` Margit Gut
2000-11-24  0:00         ` Margit Gut
  -- strict thread matches above, loose matches on Subject: below --
2000-11-24  0:00 String operations Margit Gut
replies disabled

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