comp.lang.ada
 help / color / mirror / Atom feed
* Re: Char type verification
  2006-11-15 22:00 Char type verification KE
@ 2006-11-15 21:57 ` Georg Bauhaus
  2006-11-15 23:15   ` KE
  2006-11-15 23:23 ` Simon Wright
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 34+ messages in thread
From: Georg Bauhaus @ 2006-11-15 21:57 UTC (permalink / raw)


On Wed, 2006-11-15 at 14:00 -0800, KE wrote:
> Hi
> 
> Assume that I have the following C code:
> 
> #include <stdio.h>
> 
> #define uchar   unsigned char
> 
> 
> static uchar UCASE[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

This is the character range 'A' .. 'Z'.
You can simply write
  c in 'A' .. 'Z'
in any Boolean context where c is of type Character.

Or use Ada.Characters.Handling.Is_Upper(c), if you want
to include characters outside 7bit ASCII.

The C type char, which IIRC might start at -127 or
at 0, has an implementation defined representation,
and is a bit vague. The Ada standard frowns upon vague
things, hence Ada's character type does not have
theses issues. OTOH, for interfacing with C,
look at the standard package Interfaces.C.

For more general uses, there are standard packages
Ada.Strings.Maps, Ada.Strings.Maps.Constants,
Ada.Characters.Handling, and Ada.Characters.Latin_1.
There are all kinds of character predicates and
translation subprograms.

There are variants for Wide_Character, covering
the BMP of ISO 10646.

Ada 2005, in addition supports Unicode and related
subprograms.





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Char type verification
@ 2006-11-15 22:00 KE
  2006-11-15 21:57 ` Georg Bauhaus
                   ` (4 more replies)
  0 siblings, 5 replies; 34+ messages in thread
From: KE @ 2006-11-15 22:00 UTC (permalink / raw)


Hi

Assume that I have the following C code:

#include <stdio.h>

#define uchar   unsigned char


static uchar UCASE[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int _isupper(uchar c)
{
   return (c==UCASE[(c%'A')%26]);
}

int main(int argc, char *argv[])
{
    uchar c = (uchar) *argv[1];
    printf("_isupper('%c')? = %d\n",c,_isupper(c));

    return 0;
}

(I don't claim this is terribly safe, localizable, transparent, etc.
It's just practical within the confines of ASCII, and efficient since
it uses a table-lookup technique.)

Now, how would you convert this to Ada. As you can imagine, Ada
complains loudly with my fast and loose conversions of data types (char
to uchar, that to int, etc.)

(This is not some class assignment or anything. I'm a 40-something
coder new to Ada, and I'd like to see in how many different ways you
gentlemen will attempt to solve this.)

NB: The question's intent is, what would be the safest *and* the most
transparent way to marshall the details of this in Ada-95?

Thanks


K

P.S. Don't get bogged down with the printout details (using "printf"
and formatters, etc.). Just a plain output of the input character's
code and the result of the verification will do.




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 21:57 ` Georg Bauhaus
@ 2006-11-15 23:15   ` KE
  2006-11-16  4:48     ` Jeffrey R. Carter
  0 siblings, 1 reply; 34+ messages in thread
From: KE @ 2006-11-15 23:15 UTC (permalink / raw)


Dear George

Many thanks for your detailed answer. I'll most certainly make use of
your advice. However, if you look again, my question was not

- How can I verify whether a character is upper case

Nor was it

- Where, in the library hierarchies of Ada, can I find the character
handling routines

It was intended as "How do you translate this example to Ada? How would
you, as a presumably experienced Ada coder, do it? What hoops would we
jump through?

In other words, I wanted to see some Ada idioms in action to create a
transparent coding of this.

If you believe this simple exercise is not a productive use of your
time, though, I can understand.

Thanks again.


-- KE


Georg Bauhaus wrote:
[snip...]
>
> Or use Ada.Characters.Handling.Is_Upper(c), if you want
> to include characters outside 7bit ASCII.
>
> The C type char, which IIRC might start at -127 or
> at 0, has an implementation defined representation,
> and is a bit vague. The Ada standard frowns upon vague
> things, hence Ada's character type does not have
> theses issues. OTOH, for interfacing with C,
> look at the standard package Interfaces.C.
>
> For more general uses, there are standard packages
> Ada.Strings.Maps, Ada.Strings.Maps.Constants,
> Ada.Characters.Handling, and Ada.Characters.Latin_1.
> There are all kinds of character predicates and
> translation subprograms.
>
> There are variants for Wide_Character, covering
> the BMP of ISO 10646.
> 
> Ada 2005, in addition supports Unicode and related
> subprograms.




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 22:00 Char type verification KE
  2006-11-15 21:57 ` Georg Bauhaus
@ 2006-11-15 23:23 ` Simon Wright
  2006-11-15 23:33   ` KE
  2006-11-15 23:36 ` Adam Beneschan
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 34+ messages in thread
From: Simon Wright @ 2006-11-15 23:23 UTC (permalink / raw)


"KE" <koray.erkan@yahoo.com> writes:

Hmm, the trouble is that one just wouldn't!

> static uchar UCASE[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
>
> int _isupper(uchar c)
> {
>    return (c==UCASE[(c%'A')%26]);
> }

function Is_Upper (C : Character) return Boolean is
begin
   return C in 'A' .. 'Z';
end Is_Upper;

--S



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 23:23 ` Simon Wright
@ 2006-11-15 23:33   ` KE
  2006-11-16  4:52     ` Jeffrey R. Carter
  0 siblings, 1 reply; 34+ messages in thread
From: KE @ 2006-11-15 23:33 UTC (permalink / raw)


Thanks, Simon.

I understand that ".." is an operator that Ada coders are very fond of.
But what if the "UCASE" array was not a set of contiguous values from a
specific range?

In more general terms, how would we use a tested value as an index to a
lookup table to verify a property of that value from that table?

Not that this is necessarily a big deal.

Perhaps there's something about that Ada way that is grabbing me yet.
It should be obvious, but "obvious" in Latin means "overlooked."

Sorry for taking your time.


Thanks again
-- KE


Simon Wright wrote:
> "KE" <koray.erkan@yahoo.com> writes:
>
> Hmm, the trouble is that one just wouldn't!
>
> > static uchar UCASE[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
> >
> > int _isupper(uchar c)
> > {
> >    return (c==UCASE[(c%'A')%26]);
> > }
>
> function Is_Upper (C : Character) return Boolean is
> begin
>    return C in 'A' .. 'Z';
> end Is_Upper;
> 
> --S




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 22:00 Char type verification KE
  2006-11-15 21:57 ` Georg Bauhaus
  2006-11-15 23:23 ` Simon Wright
@ 2006-11-15 23:36 ` Adam Beneschan
  2006-11-15 23:55   ` KE
  2006-11-16  1:08 ` jimmaureenrogers
  2006-11-16  7:02 ` KE
  4 siblings, 1 reply; 34+ messages in thread
From: Adam Beneschan @ 2006-11-15 23:36 UTC (permalink / raw)


KE wrote:
> Hi
>
> Assume that I have the following C code:
>
> #include <stdio.h>
>
> #define uchar   unsigned char
>
>
> static uchar UCASE[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
>
> int _isupper(uchar c)
> {
>    return (c==UCASE[(c%'A')%26]);
> }
>
> int main(int argc, char *argv[])
> {
>     uchar c = (uchar) *argv[1];
>     printf("_isupper('%c')? = %d\n",c,_isupper(c));
>
>     return 0;
> }
>
> (I don't claim this is terribly safe, localizable, transparent, etc.
> It's just practical within the confines of ASCII, and efficient since
> it uses a table-lookup technique.)

Uhhhmmm.  It sounds like you've heard somewhere that doing a table
lookup always makes things efficient.  Sorry, no.  There are cases
where table lookups are superior to other ways of doing things.  This
is not one of them.  If you really wanted a table lookup here, it would
have been far better to set up an array indexed by all 256 characters
whose values were 1 or 0 (1 for the upper-case letters and 0 for the
rest), and just loaded the result from that array.  Even then, that
would be at best only marginally more efficient than c>='A' && c<='Z',
and probably less efficient on many processors.  The way you've coded
it is certainly less efficient, plus it's really hard to figure out
what it does.  I had to stare at it for a minute to convince myself it
was correct.

> Now, how would you convert this to Ada. As you can imagine, Ada
> complains loudly with my fast and loose conversions of data types (char
> to uchar, that to int, etc.)
>
> (This is not some class assignment or anything. I'm a 40-something
> coder new to Ada, and I'd like to see in how many different ways you
> gentlemen will attempt to solve this.)
>
> NB: The question's intent is, what would be the safest *and* the most
> transparent way to marshall the details of this in Ada-95?

The first bit of rethinking you need to do: In C, a character is just a
kind of integer; "signed char" is an integer that's normally in the
range -128..127, and "unsigned char" is an integer in the range 0..255,
and "char" can be either one if I recall correctly.  Also, 'A' is an
integer that means exactly the same thing as 65.

In Ada, the standard Character type is not an integer type; it's an
"enumeration" type.  The possible values of an object of an enumeration
type come from a list---in this case, a list of characters---but the
values are not integers.  To convert to and from integers, use the 'Pos
and 'Val attributes.  If C is a Character and N is an Integer,
   N := Character'Pos(C);
   C := Character'Val(N);
will do the conversions you want.

Georg pointed out a couple ways to implement "isupper".  I've already
mentioned that your implementation seems poor.  But assuming you wanted
to implement it in Ada exactly the same way as you did above, try
something like:

   function IsUpper (C : Character) return Boolean is
      UCASE : constant String := "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   begin
      return C = UCASE (UCASE'First + (Character'Pos(C) mod
Character'Pos('A')) mod 26);
   end IsUpper;

Note that arrays do not automatically begin at offset 0 (and String
types cannot begin at offset 0), which is why UCASE'First is added to
the index.

Note also that this function returns a Boolean, not an
Integer---Boolean is another enumeration type with values (FALSE,
TRUE).  To output this, you can use Boolean'Image(IsUpper(C)), which
outputs either FALSE or TRUE which is a lot nicer than 1 or 0 in my
opinion.

This isn't a complete translation of your program---I haven't gone into
how to get at the command-line arguments---but hopefully it will get
you started.

                     -- Adam




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 23:36 ` Adam Beneschan
@ 2006-11-15 23:55   ` KE
  2006-11-16  4:54     ` Jeffrey R. Carter
  0 siblings, 1 reply; 34+ messages in thread
From: KE @ 2006-11-15 23:55 UTC (permalink / raw)


Thanks Adam.

First of all, I'm grateful that you've gone to all that length to
explain to me that this is not the most efficient way to do this, etc.
etc. I am familiar with how the actual "isupper" standard function is
implemented, but I didn't want to clutter up the example with a huge
256-item array with 1s and 0s in it, making it even more obscure.
(Actually, the standard C library uses bit masking to signal different
character types, but I guess had I asked for that, I'd get the first
fascicule of the Ada standard from my valuable coder friends here :-D)

In other words, I wanted to keep things simple.

Still, I should be grateful since you're my first colleague in this
thread to show me:

> ... To convert to and from integers, use the 'Pos
> and 'Val attributes.  If C is a Character and N is an Integer,
>    N := Character'Pos(C);
>    C := Character'Val(N);
> will do the conversions you want.

and also to code the Ada counterpart of the function like so:

>
>    function IsUpper (C : Character) return Boolean is
>       UCASE : constant String := "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
>    begin
>       return C = UCASE (UCASE'First + (Character'Pos(C) mod
> Character'Pos('A')) mod 26);
>    end IsUpper;
>
> Note that arrays do not automatically begin at offset 0 (and String
> types cannot begin at offset 0), which is why UCASE'First is added to
> the index.

I am aware of these.

>
> Note also that this function returns a Boolean, not an
> Integer---Boolean is another enumeration type with values (FALSE,
> TRUE).

I am also aware of these, but I wanted to ignore those details as well.

>
> This isn't a complete translation of your program---I haven't gone into
> how to get at the command-line arguments---but hopefully it will get
> you started.
>

That wasn't the important part.

I guess since yours is the only example, I'll have to settle for it.

Many thanks. Appreciated.


-- KE




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 22:00 Char type verification KE
                   ` (2 preceding siblings ...)
  2006-11-15 23:36 ` Adam Beneschan
@ 2006-11-16  1:08 ` jimmaureenrogers
  2006-11-16  1:45   ` KE
  2006-11-16  7:02 ` KE
  4 siblings, 1 reply; 34+ messages in thread
From: jimmaureenrogers @ 2006-11-16  1:08 UTC (permalink / raw)


This is an awful piece of code because it must perform a number
of conversions between character and numeric values. Nonetheless,
I believe I have produced a transliteration of the C into Ada, with the
addition of dealing with the first character of each value on the
command
line, not just the first value.

--Assume that I have the following C code:

--#include <stdio.h>

--#define uchar   unsigned char

--static uchar UCASE[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

--int _isupper(uchar c)
--{
--   return (c==UCASE[(c%'A')%26]);

--}

--int main(int argc, char *argv[])
--{
--    uchar c = (uchar) *argv[1];
--    printf("_isupper('%c')? = %d\n",c,_isupper(c));

--    return 0;

--}

with Ada.Text_Io;
with Ada.Command_Line;

procedure Simulate_Uchar is
   type Uchar is mod 256;

   function Is_Upper(Item : in Uchar) return Boolean is
      subtype Char_Index is Positive range 1..26;
   begin
      return ((1 + Character'Pos(Character'Val(Positive(Item))) -
Character'Pos('A')) in Char_Index);
   end Is_Upper;
   Input : Character;
   U_Input : Uchar;
begin

   for N in 1..Ada.Command_Line.Argument_Count loop
      Input := Ada.Command_Line.Argument(N)(1);
      U_Input := Uchar(Character'Pos(Input));
      Ada.Text_Io.Put("Is_Upper(" & Uchar'Image(U_Input) & ")? = ");
      Ada.Text_IO.Put_Line(Boolean'Image(Is_Upper(U_Input)) );
   end loop;
end Simulate_Uchar;

Jim Rogers




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16  1:08 ` jimmaureenrogers
@ 2006-11-16  1:45   ` KE
  2006-11-16  2:15     ` jimmaureenrogers
                       ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: KE @ 2006-11-16  1:45 UTC (permalink / raw)



Thank you, Mr. Rogers.

jimmaureenrogers@worldnet.att.net wrote:
> This is an awful piece of code because it must perform a number
> of conversions between character and numeric values.

In the lowly, quick-and-dirty C world, most data is an integer of one
form or another, anyway, so you shouldn't be worried about that ;-]
...or at least about my "awfulness" as a coder.

I appreciate your code. It's the second attempt at a solution. I was
waiting for someone to define a subtype with a range, and you provided
that variation.

Seeing how many valid - although differentially elegant and/or
efficient - Ada ways of doing this exists was my aim, though I seem not
to have quite elicited enthusiasm.

Thanks again.

-- KE




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16  1:45   ` KE
@ 2006-11-16  2:15     ` jimmaureenrogers
  2006-11-16  2:42     ` Steve Whalen
  2006-11-16  9:36     ` Alex R. Mosteo
  2 siblings, 0 replies; 34+ messages in thread
From: jimmaureenrogers @ 2006-11-16  2:15 UTC (permalink / raw)


KE wrote:
> Seeing how many valid - although differentially elegant and/or
> efficient - Ada ways of doing this exists was my aim, though I seem not
> to have quite elicited enthusiasm.

I am not clear on your goals for this "competition".

It appears that you want a somewhat literal translation of the C
code, which is why you have rejected simply using the pre-defined
Is_Upper function.

The C example is particularly far away from an Ada solution that is
not merely attempting to write C code using Ada. Why do you want to
convert the command line input to an integer? It serves no practical
purpose in Ada.

Jim Rogers




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16  1:45   ` KE
  2006-11-16  2:15     ` jimmaureenrogers
@ 2006-11-16  2:42     ` Steve Whalen
  2006-11-16  9:36     ` Alex R. Mosteo
  2 siblings, 0 replies; 34+ messages in thread
From: Steve Whalen @ 2006-11-16  2:42 UTC (permalink / raw)


KE wrote:
...
>
> Seeing how many valid - although differentially elegant and/or
> efficient - Ada ways of doing this exists was my aim, though I seem not
> to have quite elicited enthusiasm.
...

Have you looked at the GNAT source code?

If you look into the routines inside GNAT that implement some of the
functions discussed, you should find a bunch of code that you can learn
from. The fact that that code is sitting there and implements some
routines very much like the one(s) you were asking about, may have
dampned enthusiam for people to spend time creating specific examples
for you.

I've found GNAT source code generally to be a really good source of
"how things can be done in Ada"... And there is a LOT of it, so just
browsing around in it is interesting.

Steve




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 23:15   ` KE
@ 2006-11-16  4:48     ` Jeffrey R. Carter
  2006-11-16 19:53       ` Adam Beneschan
  2006-11-16 23:30       ` Yves Bailly
  0 siblings, 2 replies; 34+ messages in thread
From: Jeffrey R. Carter @ 2006-11-16  4:48 UTC (permalink / raw)


KE wrote:
> 
> It was intended as "How do you translate this example to Ada? How would
> you, as a presumably experienced Ada coder, do it? What hoops would we
> jump through?

What this example does is output whether the 1st character of the 1st 
command-line argument is in the range 'A' .. 'Z'. In the Ada world, we 
tend to ignore the details of badly designed examples in poorly designed 
languages and simply implement the same functionality. Since there is no 
reason for your conversions and home-grown function, we're not going to 
waste effort translating them.

I've been using Ada since 1984. I'm a SW engineer, not a coder. But as 
an experienced Ada SW engineer, how I would do it would look something like

declare
    Arg : constant String := Ada.Command_Line.Argument (1);
    -- Presumably after making sure there is a 1st argument
begin
    Ada.Text_IO.Put_Line
       (Item => Boolean'Image (Arg (Arg'First) in 'A' .. 'Z') );
end;

-- 
Jeff Carter
"From this day on, the official language of San Marcos will be Swedish."
Bananas
28



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 23:33   ` KE
@ 2006-11-16  4:52     ` Jeffrey R. Carter
  0 siblings, 0 replies; 34+ messages in thread
From: Jeffrey R. Carter @ 2006-11-16  4:52 UTC (permalink / raw)


KE wrote:
> 
> I understand that ".." is an operator that Ada coders are very fond of.
> But what if the "UCASE" array was not a set of contiguous values from a
> specific range?

Then it's simple to create an array of Boolean that is True for the 
appropriate values, and False elsewhere:

type Letter_Set is array (Character) of Boolean;

Is_Letter : constant Letter_Set :=
    ('A' .. 'Z' | 'a' .. 'z' => True, others => False);

Now

Is_Letter (C)

is equivalent to

C in 'A' .. 'Z' or C in 'a' .. 'z'

You can use a subtype if the values are contiguous, and you want to make 
the check repeatedly:

subtype Upper is Character range 'A' .. 'Z';

if C in Upper then ...

-- 
Jeff Carter
"From this day on, the official language of San Marcos will be Swedish."
Bananas
28



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 23:55   ` KE
@ 2006-11-16  4:54     ` Jeffrey R. Carter
  0 siblings, 0 replies; 34+ messages in thread
From: Jeffrey R. Carter @ 2006-11-16  4:54 UTC (permalink / raw)


KE wrote:
> 
> First of all, I'm grateful that you've gone to all that length to
> explain to me that this is not the most efficient way to do this, etc.
> etc. I am familiar with how the actual "isupper" standard function is
> implemented, but I didn't want to clutter up the example with a huge
> 256-item array with 1s and 0s in it, making it even more obscure.
> (Actually, the standard C library uses bit masking to signal different
> character types, but I guess had I asked for that, I'd get the first
> fascicule of the Ada standard from my valuable coder friends here :-D)

I trust I demonstrated in an earlier post that such an array, in Ada, 
doesn't have to clutter up the code.

> In other words, I wanted to keep things simple.

In which case, I have to wonder why you cluttered up your example with 
all the unnecessary conversions and stuff.

-- 
Jeff Carter
"From this day on, the official language of San Marcos will be Swedish."
Bananas
28



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-15 22:00 Char type verification KE
                   ` (3 preceding siblings ...)
  2006-11-16  1:08 ` jimmaureenrogers
@ 2006-11-16  7:02 ` KE
  2006-11-16 17:04   ` Dmitry A. Kazakov
  2006-11-16 22:43   ` Brian May
  4 siblings, 2 replies; 34+ messages in thread
From: KE @ 2006-11-16  7:02 UTC (permalink / raw)


I thank everyone for their posts. I consider this thread closed -- as
I've regretted posting it already.

I specifically thank Simon Wright and Steve Whalen for their civilized
attitude to help.

Special reward for being an utter smug jerk goes to Jeffrey Carter.

I believe I will not be bothering you or your newsgroup with any more
posts since most of you are obviously walking examples of perfection
and a gift to humanity. Ada is quite clearly not for an ordinary mortal
like myself.


Kind regards
-- KE




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16  1:45   ` KE
  2006-11-16  2:15     ` jimmaureenrogers
  2006-11-16  2:42     ` Steve Whalen
@ 2006-11-16  9:36     ` Alex R. Mosteo
  2 siblings, 0 replies; 34+ messages in thread
From: Alex R. Mosteo @ 2006-11-16  9:36 UTC (permalink / raw)


KE wrote:

> 
> Thank you, Mr. Rogers.
> 
> jimmaureenrogers@worldnet.att.net wrote:
>> This is an awful piece of code because it must perform a number
>> of conversions between character and numeric values.
> 
> In the lowly, quick-and-dirty C world, most data is an integer of one
> form or another, anyway, so you shouldn't be worried about that ;-]
> ...or at least about my "awfulness" as a coder.
> 
> I appreciate your code. It's the second attempt at a solution. I was
> waiting for someone to define a subtype with a range, and you provided
> that variation.
> 
> Seeing how many valid - although differentially elegant and/or
> efficient - Ada ways of doing this exists was my aim, though I seem not
> to have quite elicited enthusiasm.

You're getting quite some flak but you must understand that transliterating
C into Ada is one of the capital sins over here... You want it for learning
purposes but some people rather would prefer that you /unlearn/ the C
low-level tricks :)

Don't be taken back, this is a very friendly group...



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
@ 2006-11-16 16:01 Anh Vo
  0 siblings, 0 replies; 34+ messages in thread
From: Anh Vo @ 2006-11-16 16:01 UTC (permalink / raw)
  To: comp.lang.ada

It is not quite closed yet. You seem like a gentlemen with sharp knife
in the back. It is pleasure to exchange idea with the one who stays and
not worry about the one who left. Now, this thread is closed :-)

AV

>>> "KE" <koray.erkan@yahoo.com> 11/15/2006 11:02:57 PM >>>
I thank everyone for their posts. I consider this thread closed -- as
I've regretted posting it already.

I specifically thank Simon Wright and Steve Whalen for their civilized
attitude to help.

Special reward for being an utter smug jerk goes to Jeffrey Carter.

I believe I will not be bothering you or your newsgroup with any more
posts since most of you are obviously walking examples of perfection
and a gift to humanity. Ada is quite clearly not for an ordinary
mortal
like myself.




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16  7:02 ` KE
@ 2006-11-16 17:04   ` Dmitry A. Kazakov
  2006-11-16 22:43   ` Brian May
  1 sibling, 0 replies; 34+ messages in thread
From: Dmitry A. Kazakov @ 2006-11-16 17:04 UTC (permalink / raw)


On 15 Nov 2006 23:02:57 -0800, KE wrote:

> I thank everyone for their posts. I consider this thread closed -- as
> I've regretted posting it already.

Have you? My impression of this thread is that you have got quite
comprehensive answers.

> Ada is quite clearly not for an ordinary mortal like myself.

What makes you think so? Does

   Char in 'A'..'Z'

really appear as rocket science to a C programmer supposedly accustomed to
the stuff like

#define TOUPPER(c) ( c & ~('a' ^ 'A') )

?
-------------------------
"... We stopped when we got a clean compile on the following syntax:
for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("|"+(*u/4) %2); "

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16  4:48     ` Jeffrey R. Carter
@ 2006-11-16 19:53       ` Adam Beneschan
  2006-11-16 23:30       ` Yves Bailly
  1 sibling, 0 replies; 34+ messages in thread
From: Adam Beneschan @ 2006-11-16 19:53 UTC (permalink / raw)


Jeffrey R. Carter wrote:
> KE wrote:
> >
> > It was intended as "How do you translate this example to Ada? How would
> > you, as a presumably experienced Ada coder, do it? What hoops would we
> > jump through?
>
> What this example does is output whether the 1st character of the 1st
> command-line argument is in the range 'A' .. 'Z'. In the Ada world, we
> tend to ignore the details of badly designed examples in poorly designed
> languages and simply implement the same functionality. Since there is no
> reason for your conversions and home-grown function, we're not going to
> waste effort translating them.

Unfortunately, I'm not sure the OP actually cared about the
functionality.  After reading the interaction in this thread, I'm
beginning to think he really wanted to know about a certain Ada feature
or two (such as going between characters and integers), and threw
together a quick little example to try it out, and then ran into
problems and asked us for help, and all of us here assumed that the
little example *was* the functionality that the poster was trying to
accomplish.   I'm just saying this so that maybe next time an Ada
newcomer uses an example to ask a question, maybe we should try to see
what he's really asking.  Sure, he could have asked it better, but we
can't presume that someone who's new to this language is going to know
just how to ask questions about the language.

                            -- Adam




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16  7:02 ` KE
  2006-11-16 17:04   ` Dmitry A. Kazakov
@ 2006-11-16 22:43   ` Brian May
  1 sibling, 0 replies; 34+ messages in thread
From: Brian May @ 2006-11-16 22:43 UTC (permalink / raw)


>>>>> "KE" == KE  <koray.erkan@yahoo.com> writes:

    KE> I thank everyone for their posts. I consider this thread
    KE> closed -- as I've regretted posting it already.

I suspect a misunderstanding somewhere here. Possibly as a result of
the limitations in using email and not being able to see the persons
facial expressions.

Reading this thread I saw nothing but helpful answers and a
demonstration that different people will try to solve the same problem
in different ways.

I thank you for starting this thread and hope you will continue asking
more questions in the future.  This way I learn about Ada too.
-- 
Brian May <bam@snoopy.apana.org.au>



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16  4:48     ` Jeffrey R. Carter
  2006-11-16 19:53       ` Adam Beneschan
@ 2006-11-16 23:30       ` Yves Bailly
  2006-11-17  0:48         ` Jeffrey R. Carter
  2006-11-17 21:22         ` Char type verification Simon Wright
  1 sibling, 2 replies; 34+ messages in thread
From: Yves Bailly @ 2006-11-16 23:30 UTC (permalink / raw)


Jeffrey R. Carter wrote:
>> It was intended as "How do you translate this example to Ada? How would
>> you, as a presumably experienced Ada coder, do it? What hoops would we
>> jump through?
> 
> What this example does is output whether the 1st character of the 1st
> command-line argument is in the range 'A' .. 'Z'. In the Ada world, we
> tend to ignore the details of badly designed examples in poorly designed
> languages and simply implement the same functionality. Since there is no
> reason for your conversions and home-grown function, we're not going to
> waste effort translating them.

I'm very sorry Jeffrey, but I'm afraid you're missing the point. The given
example is no more than what it is : an example. There are plenty of ways
to know if a character is upper-case or not (what about the procedure
Is_Upper in the package Ada.Characters.Handling, by the way? did I missed
it in the replies?), and I'm quite sure Koray would have found most of them,
if not all (assuming it's possible).

As I understand it, the real question was : "having a list of contiguous
values of some type, how to know if a given value of that same type is
contained into the list". It's a kind of basic hashing: you can assume
to always be able to map your type's values to integers. So you can
replace "list of contiguous values" by "range of values".

So, here's my modest contribution. Don't bother to say it's overcomplex.

First create a generic package:
--8<-----8<-----8<-----8<-----8<-----8<-----8<---
generic
   type T is private;
   type H is range <>;
   with function Hash(val: in T) return H;
package P is
   function Is_In_Range(lower: in T;
                        upper: in T;
                        value: in T)
      return Boolean;
end P;
--8<-----8<-----8<-----8<-----8<-----8<-----8<---

The body performs the actual check of validity:
--8<-----8<-----8<-----8<-----8<-----8<-----8<---
package body P is

   function Is_In_Range(lower: in T;
                        upper: in T;
                        value: in T)
      return Boolean is
   begin
      return Hash(value) in Hash(lower)..Hash(upper);
   end Is_In_Range;

end P;
--8<-----8<-----8<-----8<-----8<-----8<-----8<---

And now use it in a test program:
--8<-----8<-----8<-----8<-----8<-----8<-----8<---
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
with P;
procedure Test is

   function To_Natural(c: in Character)
      return Natural is
   begin
      return Natural(Character'Pos(c));
   end To_Natural;

   package P_Char is new P(T => Character,
                           H => Natural,
                           Hash => To_Natural);
   c: Character;
begin
   c := Argument(1)(1);
   Put("Is_Upper('" & c & "') = ");
   Put_Line(Boolean'Image(P_Char.Is_In_Range('A', 'Z', c)));
end Test;
--8<-----8<-----8<-----8<-----8<-----8<-----8<---

Isn't Ada delightfull?  :-)

Regards,

-- 
(o< | Yves Bailly  : http://kafka-fr.net   | -o)
//\ | Linux Dijon  : http://www.coagul.org | //\
\_/ |                                      | \_/`



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16 23:30       ` Yves Bailly
@ 2006-11-17  0:48         ` Jeffrey R. Carter
  2006-11-17  1:59           ` Adam Beneschan
  2006-11-17 11:30           ` Stephen Leake
  2006-11-17 21:22         ` Char type verification Simon Wright
  1 sibling, 2 replies; 34+ messages in thread
From: Jeffrey R. Carter @ 2006-11-17  0:48 UTC (permalink / raw)


Yves Bailly wrote:
> 
> As I understand it, the real question was : "having a list of contiguous
> values of some type, how to know if a given value of that same type is
> contained into the list". It's a kind of basic hashing: you can assume
> to always be able to map your type's values to integers. So you can
> replace "list of contiguous values" by "range of values".

The real question was: "how would you convert this to Ada." This was 
then repeated as: "How do you translate this example to Ada?" Since the 
code presented determined whether a character was in 'A' .. 'Z', he 
should not be surprised to receive answers that used "in 'A' .. 'Z'".

I'm sorry, but I don't accept that someone who's able to write the 
example is unable to ask, "How do you convert a character to an 
integer?" or, "How do you determine if a value is in a range of values?" 
if that's what he really wanted to ask.

-- 
Jeff Carter
"Hello! Smelly English K...niggets."
Monty Python & the Holy Grail
08



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-17  0:48         ` Jeffrey R. Carter
@ 2006-11-17  1:59           ` Adam Beneschan
  2006-11-17 11:30           ` Stephen Leake
  1 sibling, 0 replies; 34+ messages in thread
From: Adam Beneschan @ 2006-11-17  1:59 UTC (permalink / raw)


Jeffrey R. Carter wrote:

> I'm sorry, but I don't accept that someone who's able to write the
> example is unable to ask, "How do you convert a character to an
> integer?"

If they don't yet understand that a character and an integer aren't the
same thing (as they are in C), I can understand how it might be
difficult to think of the right question.

                       -- Adam




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-17  0:48         ` Jeffrey R. Carter
  2006-11-17  1:59           ` Adam Beneschan
@ 2006-11-17 11:30           ` Stephen Leake
  2006-11-17 15:33             ` KE
  1 sibling, 1 reply; 34+ messages in thread
From: Stephen Leake @ 2006-11-17 11:30 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org> writes:

> The real question was: "how would you convert this to Ada." 

I find it very annoying when anyone other than the original poster
presumes to know what the real question is!

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-17 15:33             ` KE
@ 2006-11-17 15:10               ` Georg Bauhaus
  2006-11-17 18:30               ` Ludovic Brenta
                                 ` (2 subsequent siblings)
  3 siblings, 0 replies; 34+ messages in thread
From: Georg Bauhaus @ 2006-11-17 15:10 UTC (permalink / raw)


On Fri, 2006-11-17 at 07:33 -0800, KE wrote:

> The challenge was purposefully simple and messy so that you didn't get
> bogged down with the theoretical intricacies of a major one.
> 
> I guess this is not the way people use comp.lang.ada.

But this use will be most welcome. It might be just us not seeing
the real intent of the question (table lookup using character
positions, e.g.), because of the following.
 You might now know that on many occasions people have approached
Ada programmers and asked, by analogy, "How do I write Fortran 77
in Ada?" This can trigger some corrective rhetoric.
Much like a Pavlovian creature, an Ada programmer might react to
an example that just *looks* like one of these attempts to avoid
learning how to use the language in ways it was intended to be used.
Which is not the case here, as we know now.


-- Georg 





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-17 11:30           ` Stephen Leake
@ 2006-11-17 15:33             ` KE
  2006-11-17 15:10               ` Georg Bauhaus
                                 ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: KE @ 2006-11-17 15:33 UTC (permalink / raw)


Thanks everyone.

Just to settle this once and for all, let me clarify what was on my
mind.

--

For those who are still curious about this thread (and I believe they
shouldn't be since there's not much to see here folks, move on), let me
explain what I did. (Had some of you not read too much into my post, it
would have been obvious from the start, but "obvious" is Latin for
"overlooked.")

I just threw a quick and dirty example involving a very simple
operation (verifying a property, a letter's case) combined with some
not-so-transparent calculation (using modulo to locate an index)
combined with a common technique known for its usefulness (table
lookup).

It shouldn't have mattered as I was neither after a language war nor
intended to insult my fellow programmers with any arrogant and blind
belief in this or that language.

Nor was I trying to learn any specific "features." Rather, I was (and
am) trying to learn the LANGUAGE.

Here's an analogy to clarify that last point.

Suppose you want to learn a foreign language, say Dutch. Now the worst
way to start would be to pick up a grammar book. To be sure, the
grammar book can - and will - be useful all along, but only as a
*reference.* An equally naive method would be to pick up a
comprehensive dictionary and start from letter A. Again, the dictionary
will be your friend all along, but there's not much there other than
just columns of words.

The sensible first step is to buy a "teach yourself" book or to get
enrolled in a course.

So far so good. But still, textbooks will also get you only so far and
no further.

Sooner or later, you'll reach that stage which most language learners
dread: you'll have to pick up material actually written in that
language - newspapers, magazines, books, etc. - and start reading them.
Even worse, you'll be asked to speak and write, preferably with/to
someone whose native tongue is Dutch.

I wanted to see how Ada programmers with experience would approach a
simple, quick-and-dirty problem. It shouldn't be too difficult to
imagine that even for seemingly simple problems there are at least two
- and frequently more - solutions.

Another analogy: In a plastic arts academy, for instance, they throw
simple challenges at students to force them to think, to be inventive,
to look at objects differently. Even with your run-o-the-mill "nude"
model, there are umpteen ways of dealing with the figure.

I wanted to see how many different ideas you would suggest, how many
"aspects" of the problem you'd layer out and try to generalize, how
many "idiomatic" ways of coding would emerge.

Should I have challenged you to write the some avionics modules of the
new F-22 fighter? I don't even know a thing about avionics, other than
that it's a neologism. (I mean the word.) As Chancey Gardener from
'Being There' would say for "making a claim" (after being asked
repeatedly if he'll "make" one), "I don't even know what they [those
"avionic" thingies] look like." Between you and me, I only know... ehm,
"catatonics."

The challenge was purposefully simple and messy so that you didn't get
bogged down with the theoretical intricacies of a major one.

I guess this is not the way people use comp.lang.ada. Which is why I
dropped a resentful - and regrettably not too gallant - closing note.

--

This should settle this as I did not intend the thread to be much ado
about nothing.

Thanks for reading.



Good luck
-- KE

P.S. Jeff, I'd rather you not share your wisdom on my final words.
You're obviously too smart or experienced for me to handle. If this
thread looked like a total waste of your time from the beginning, then
why drop 4-5 long posts on how silly it is?




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-17 15:33             ` KE
  2006-11-17 15:10               ` Georg Bauhaus
@ 2006-11-17 18:30               ` Ludovic Brenta
  2006-11-18  2:29                 ` Brian May
  2006-11-17 19:45               ` Jeffrey R. Carter
       [not found]               ` <mQm7h.8782$ig4.3262@newsread2.news.pas.earthlink.net>
  3 siblings, 1 reply; 34+ messages in thread
From: Ludovic Brenta @ 2006-11-17 18:30 UTC (permalink / raw)


Koray Erkan writes:
> The challenge was purposefully simple and messy so that you didn't get
> bogged down with the theoretical intricacies of a major one.
>
> I guess this is not the way people use comp.lang.ada. Which is why I
> dropped a resentful - and regrettably not too gallant - closing note.

I think the incident is really a culture clash stemming from Ada's
nature as a high level language, its strictess, and its emphasis on
readability.

High level means that Ada allows you to think in terms of your problem
(uppercase and lowercase letters) rather than the solution (bit
patterns and bit masks).

Strictness means that a letter should not be mistaken for a number.

Emphasis on readability means that an experienced Ada programmer will
write a program that makes it very clear to the reader what the
problem is, and how the program solves it.

So, you came here and asked "how do I implement this in Ada?" and
experienced Ada programmers retorted, "but what is your problem?".  I
am not at all surprised that both sides failed to understand the
other.  This very newsgroup has countless examples along the lines of:

C programmer: What is the string terminator character in Ada?
Ada programmer: there is none because you don't need one.
C programmer: huh?

Lisp programmer: How do I keep track of a string's length in Ada?
Ada programmer: like all arrays, strings know their bounds and you can
query them using 'First, 'Last and 'Length.  But the bounds are
immutable.  If you want variable-length strings you need
Unbounded_String.
Lisp programmer: OK, thanks.  BTW, all objects are immutable in a
functional language :)

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-17 15:33             ` KE
  2006-11-17 15:10               ` Georg Bauhaus
  2006-11-17 18:30               ` Ludovic Brenta
@ 2006-11-17 19:45               ` Jeffrey R. Carter
       [not found]               ` <mQm7h.8782$ig4.3262@newsread2.news.pas.earthlink.net>
  3 siblings, 0 replies; 34+ messages in thread
From: Jeffrey R. Carter @ 2006-11-17 19:45 UTC (permalink / raw)


KE wrote:
> 
> P.S. Jeff, I'd rather you not share your wisdom on my final words.
> You're obviously too smart or experienced for me to handle. If this
> thread looked like a total waste of your time from the beginning, then
> why drop 4-5 long posts on how silly it is?

That's OK. Bieber has made the points I would have.

-- 
Jeff Carter
"Beyond 100,000 lines of code you
should probably be coding in Ada."
P. J. Plauger
26



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
       [not found]               ` <mQm7h.8782$ig4.3262@newsread2.news.pas.earthlink.net>
@ 2006-11-17 19:56                 ` Jeffrey R. Carter
       [not found]                   ` <omz7h.222$1s6.165@newsread2.news.pas.earthlink.net>
  0 siblings, 1 reply; 34+ messages in thread
From: Jeffrey R. Carter @ 2006-11-17 19:56 UTC (permalink / raw)


Dennis Lee Bieber wrote:
>>
> 	And none of those, to my knowledge, inflicts literal one-to-one
> constructs; they all tend to use common idiom's of the target language.
> Digging up 22 year old high-school French for example... "My name is
> xyz" is NOT translated into "moi appel est xyz", but rather to "je
> m'appel xyz" (literal "I my name xyz").

Literally, "My name is Xyz" would be "Mon nom est Xyz", and "Je 
m'appelle Xyz" is "I call myself Xyz."

> 	And, as mentioned above, the "problem" we saw upon reading your code
> was simply "identify if <input> is an uppercase character", and the
> solution to /that/ problem is the simple "x in 'A'..'Z'" structure.

Later he talked about checking for inclusion in a non-contiguous range, 
but never did he say anything about why he did odd things such as making 
unnecessary conversions.

Perhaps we should simply have said that there is no Obfuscated Ada contest.

-- 
Jeff Carter
"Beyond 100,000 lines of code you
should probably be coding in Ada."
P. J. Plauger
26



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-16 23:30       ` Yves Bailly
  2006-11-17  0:48         ` Jeffrey R. Carter
@ 2006-11-17 21:22         ` Simon Wright
  2006-11-17 23:59           ` Yves Bailly
  1 sibling, 1 reply; 34+ messages in thread
From: Simon Wright @ 2006-11-17 21:22 UTC (permalink / raw)


Yves Bailly <kafka.fr@laposte.net> writes:

> First create a generic package:
> --8<-----8<-----8<-----8<-----8<-----8<-----8<---
> generic
>    type T is private;
>    type H is range <>;
>    with function Hash(val: in T) return H;
> package P is
>    function Is_In_Range(lower: in T;
>                         upper: in T;
>                         value: in T)
>       return Boolean;
> end P;
> --8<-----8<-----8<-----8<-----8<-----8<-----8<---
>
> The body performs the actual check of validity:
> --8<-----8<-----8<-----8<-----8<-----8<-----8<---
> package body P is
>
>    function Is_In_Range(lower: in T;
>                         upper: in T;
>                         value: in T)
>       return Boolean is
>    begin
>       return Hash(value) in Hash(lower)..Hash(upper);
>    end Is_In_Range;
>
> end P;
> --8<-----8<-----8<-----8<-----8<-----8<-----8<---

I would have thought it would be a lot clearer if you required "<" say
instead of Hash. To me a hash is typically a pseudo-random conversion
of a private value to an integral type; if you want ordering, use
functions with ordering-related names!

Then you could say

   return not (upper < value) and then not (value < lower);

(I think! that's the third time I've rewritten that ...)

By the way, did you know you can have (library-level, even) generic
subprograms?

generic
   type T is private;
   type H is range <>;
   with function Hash(val: in T) return H;
function Is_In_Range(lower: in T;
                     upper: in T;
                     value: in T)
   return Boolean;



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-17 21:22         ` Char type verification Simon Wright
@ 2006-11-17 23:59           ` Yves Bailly
  0 siblings, 0 replies; 34+ messages in thread
From: Yves Bailly @ 2006-11-17 23:59 UTC (permalink / raw)


Simon Wright wrote:
> I would have thought it would be a lot clearer if you required "<" say
> instead of Hash. To me a hash is typically a pseudo-random conversion
> of a private value to an integral type; if you want ordering, use
> functions with ordering-related names!
> 
> Then you could say
> 
>    return not (upper < value) and then not (value < lower);
> 
> (I think! that's the third time I've rewritten that ...)

Well, I started by writing something like this (without the "and then",
just with "and"). However, the Hash function is required to return a
scalar, so I thought ordering was implied... but you're probably right.
 
> By the way, did you know you can have (library-level, even) generic
> subprograms?
> generic
>    type T is private;
>    type H is range <>;
>    with function Hash(val: in T) return H;
> function Is_In_Range(lower: in T;
>                      upper: in T;
>                      value: in T)
>    return Boolean;

Yes, I know this, I just wanted to provide an example of both a package
and of genericity. Again, you're right, it's just an alternative solution
to me. Maybe there are plenty others :-)

Regards,

-- 
(o< | Yves Bailly  : http://kafka-fr.net   | -o)
//\ | Linux Dijon  : http://www.coagul.org | //\
\_/ |                                      | \_/`



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Char type verification
  2006-11-17 18:30               ` Ludovic Brenta
@ 2006-11-18  2:29                 ` Brian May
  0 siblings, 0 replies; 34+ messages in thread
From: Brian May @ 2006-11-18  2:29 UTC (permalink / raw)


>>>>> "Ludovic" == Ludovic Brenta <ludovic@ludovic-brenta.org> writes:

    Ludovic> I think the incident is really a culture clash stemming
    Ludovic> from Ada's nature as a high level language, its
    Ludovic> strictess, and its emphasis on readability.

    Ludovic> High level means that Ada allows you to think in terms of
    Ludovic> your problem (uppercase and lowercase letters) rather
    Ludovic> than the solution (bit patterns and bit masks).

Good point - however not specific to Ada. So often I have been
requested by a client to implement a solution (whether network design,
programming, etc) that is inadequate or inefficient at solving the
problem. This is the best I can do either because I have not been told
what the problem is or because the client wants me to install their
solution as is in the quickest possible time.

In some cases this process has repeated numerous times until the
client gets fed up and goes to another vendor.

In this case I saw nothing wrong with the question or the answers -
there is always a chance no matter how precise you ask the question
that people will misunderstand or misread it. In which case you can
either ignore the answers that don't answer your question or correct
any misunderstandings.

Had we responded with the translation from C, other people reading
this thread may have left with the misunderstanding that Ada doesn't
have any simple way of determining if a character is uppercase or not.
-- 
Brian May <bam@snoopy.apana.org.au>



^ permalink raw reply	[flat|nested] 34+ messages in thread

* OT: French Idioms (was Re: Char type verification)
       [not found]                   ` <omz7h.222$1s6.165@newsread2.news.pas.earthlink.net>
@ 2006-11-19  2:19                     ` Jeffrey R. Carter
  2006-11-19  9:04                       ` Dmitry A. Kazakov
  0 siblings, 1 reply; 34+ messages in thread
From: Jeffrey R. Carter @ 2006-11-19  2:19 UTC (permalink / raw)


Dennis Lee Bieber wrote:
>>
> 	Okay... I did say 22 year old HS course <G> As I recall the first
> page of the textbook basically inflicted
> 
> 	Bonjour, je m'appelle Danielle
> 
> upon the students, only explaining it as "hello, my name is Danielle".
> Which again could reflect idioms... After all, if someone introduced
> themselves with "Hello, I call myself Danielle" my mind would be going
> "... and what do others call you?" (after all, online, and at FurCon's,
> I "call myself" Wulfraed... but that is not my legal name)

That's the idiomatic translation. When I consider the literal 
translation, I always wonder the same thing. Of course, when I hear a 
song that says, "You get the best of my love," I always wonder who gets 
the rest.

I find the French reflexive verbs interesting. When I'm thinking in 
French (which I don't do much anymore), they make perfect sense. The 
literal translations, though, are meaningless. For example, the French 
equivalent of "I brush my hair" is "Je me brosse les cheveux". 
Literally, that means, "I brush myself the hairs."

I wonder what the Francophones who frequent c.l.a make of all this.

-- 
Jeff Carter
"Sheriff murdered, crops burned, stores looted,
people stampeded, and cattle raped."
Blazing Saddles
35



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: OT: French Idioms (was Re: Char type verification)
  2006-11-19  2:19                     ` OT: French Idioms (was Re: Char type verification) Jeffrey R. Carter
@ 2006-11-19  9:04                       ` Dmitry A. Kazakov
  0 siblings, 0 replies; 34+ messages in thread
From: Dmitry A. Kazakov @ 2006-11-19  9:04 UTC (permalink / raw)


On Sun, 19 Nov 2006 02:19:00 GMT, Jeffrey R. Carter wrote:

> Dennis Lee Bieber wrote:
>>>
>> 	Okay... I did say 22 year old HS course <G> As I recall the first
>> page of the textbook basically inflicted
>> 
>> 	Bonjour, je m'appelle Danielle
>> 
>> upon the students, only explaining it as "hello, my name is Danielle".
>> Which again could reflect idioms... After all, if someone introduced
>> themselves with "Hello, I call myself Danielle" my mind would be going
>> "... and what do others call you?" (after all, online, and at FurCon's,
>> I "call myself" Wulfraed... but that is not my legal name)
> 
> That's the idiomatic translation. When I consider the literal 
> translation, I always wonder the same thing. Of course, when I hear a 
> song that says, "You get the best of my love," I always wonder who gets 
> the rest.

The most outrageous is German "Ich bedanke mich," which literally it is "I
thank myself," but is used to say "I thank you." (:-))
 
> I find the French reflexive verbs interesting. When I'm thinking in 
> French (which I don't do much anymore), they make perfect sense. The 
> literal translations, though, are meaningless. For example, the French 
> equivalent of "I brush my hair" is "Je me brosse les cheveux". 
> Literally, that means, "I brush myself the hairs."

http://en.wikipedia.org/wiki/Reflexive_verb

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2006-11-19  9:04 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-15 22:00 Char type verification KE
2006-11-15 21:57 ` Georg Bauhaus
2006-11-15 23:15   ` KE
2006-11-16  4:48     ` Jeffrey R. Carter
2006-11-16 19:53       ` Adam Beneschan
2006-11-16 23:30       ` Yves Bailly
2006-11-17  0:48         ` Jeffrey R. Carter
2006-11-17  1:59           ` Adam Beneschan
2006-11-17 11:30           ` Stephen Leake
2006-11-17 15:33             ` KE
2006-11-17 15:10               ` Georg Bauhaus
2006-11-17 18:30               ` Ludovic Brenta
2006-11-18  2:29                 ` Brian May
2006-11-17 19:45               ` Jeffrey R. Carter
     [not found]               ` <mQm7h.8782$ig4.3262@newsread2.news.pas.earthlink.net>
2006-11-17 19:56                 ` Jeffrey R. Carter
     [not found]                   ` <omz7h.222$1s6.165@newsread2.news.pas.earthlink.net>
2006-11-19  2:19                     ` OT: French Idioms (was Re: Char type verification) Jeffrey R. Carter
2006-11-19  9:04                       ` Dmitry A. Kazakov
2006-11-17 21:22         ` Char type verification Simon Wright
2006-11-17 23:59           ` Yves Bailly
2006-11-15 23:23 ` Simon Wright
2006-11-15 23:33   ` KE
2006-11-16  4:52     ` Jeffrey R. Carter
2006-11-15 23:36 ` Adam Beneschan
2006-11-15 23:55   ` KE
2006-11-16  4:54     ` Jeffrey R. Carter
2006-11-16  1:08 ` jimmaureenrogers
2006-11-16  1:45   ` KE
2006-11-16  2:15     ` jimmaureenrogers
2006-11-16  2:42     ` Steve Whalen
2006-11-16  9:36     ` Alex R. Mosteo
2006-11-16  7:02 ` KE
2006-11-16 17:04   ` Dmitry A. Kazakov
2006-11-16 22:43   ` Brian May
  -- strict thread matches above, loose matches on Subject: below --
2006-11-16 16:01 Anh Vo

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