comp.lang.ada
 help / color / mirror / Atom feed
From: "Samuel T. Harris" <u61783@gsde.hou.us.ray.com>
Subject: Re: enumration using integers?
Date: Fri, 20 Apr 2001 10:52:06 -0500
Date: 2001-04-20T10:52:06-05:00	[thread overview]
Message-ID: <3AE05B26.7954A22A@gsde.hou.us.ray.com> (raw)
In-Reply-To: 3ADFC797.7D2D537D@emw.ericsson.se

Sven Nilsson wrote:
> 
> Ted Dennison wrote:
> >
> > It understands perfectly what you want. It just won't allow you to do that. :-)
> 
> I knew it! The machines are revolting!! Well, this machine is gonna be
> playing Britney Spears MP3's the whole day... Take that you ungreatful
> piece of ...
> >
> > The next obvious question is *why* do you want to do this? What are you trying
> > to accomplish with an enumeration of integers?
> >
> 
> Right. I want to have a type containing certain integers that I can use
> in calculations. Something like this:
> 
>   type Distance is (10, 15, 20, 37);

The 37 is a real kicker.
It it had been 35 and included 25 and 30, then perhaps ...

type distance is delta 5.0 range 10.0..35.0;
for delta'small use 5.0;

(I believe that is correct off the top of my head).

I've never used a fixed point type to represent an
equi-distance set of integers, but I guess it would
work.

>   Dist : Distance := 15;
>   Result : Integer := 0;
> begin
>   Result := Some_Formula * Dist; -- And perhaps a typecast if need be.
> 
> I could do that in other ways, for instance as suggested by Marc and
> Philip, but that's not really the issue. I wanted to know if I could
> magically write something to make my type-construct legal. Which I
> probably can't. *sob*
> 
> -Sven

-- 
Samuel T. Harris, Principal Engineer
Raytheon, Aerospace Engineering Services
"If you can make it, We can fake it!"



      parent reply	other threads:[~2001-04-20 15:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-19 10:58 enumration using integers? Sven Nilsson
2001-04-19 12:42 ` Marc A. Criley
2001-04-19 13:02 ` Philip Anderson
2001-04-19 14:50 ` Ted Dennison
2001-04-20  5:22   ` Sven Nilsson
2001-04-20 13:57     ` Ted Dennison
2001-04-20 14:35       ` Sven Nilsson
2001-04-20 15:50         ` Keith Thompson
2001-04-20 18:18         ` Ted Dennison
2001-04-20 15:52     ` Samuel T. Harris [this message]
replies disabled

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