comp.lang.ada
 help / color / mirror / Atom feed
From: sgb@erlang.praxis.co.uk (Stephen Bull)
Subject: Re: Help on deciding a data type.
Date: 1996/09/04
Date: 1996-09-04T00:00:00+00:00	[thread overview]
Message-ID: <ytc20gicxob.fsf@erlang.praxis.co.uk> (raw)
In-Reply-To: 322C50E0.167E@sdrc.com



Sreedhar Chintalapaty <Sreedhar.Chintalapaty@sdrc.com> writes:

   Is there a way to define some data type here that would let me 
   exploit the modular mathematics capability of Ada while at the same
   time having some representation for the * in the first entry? Or do
   I have to resort to definig it as, for instance

	   type Symbol is Integer range -1..N;

   and write my own methods to overload the multiplication and division
   functions?


I would suggest defining a record type with two fields: the first is a flag
indicating whether the second is a valid value:

type T is record
  Valid : Boolean;
  Value : Symbol;
end record;

-- 
-----------------------------------------------------------------------------
 Stephen Bull  Praxis Critical Systems  20 Manvers Street  BATH  BA1 1PX  UK
    +1225 444700 (switchboard)  +1225 739286 (direct)  +1225 739281 (fax)
-----------------------------------------------------------------------------
-- 
-----------------------------------------------------------------------------
 Stephen Bull  Praxis Critical Systems  20 Manvers Street  BATH  BA1 1PX  UK
    +1225 444700 (switchboard)  +1225 739286 (direct)  +1225 739281 (fax)
-----------------------------------------------------------------------------




  reply	other threads:[~1996-09-04  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-03  0:00 Help on deciding a data type Sreedhar Chintalapaty
1996-09-04  0:00 ` Stephen Bull [this message]
1996-09-05  0:00   ` Robert I. Eachus
replies disabled

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