comp.lang.ada
 help / color / mirror / Atom feed
* What's wrong with this package? - (nf)
@ 1982-11-04  3:13 uiucdcs!mcdaniel
  0 siblings, 0 replies; 2+ messages in thread
From: uiucdcs!mcdaniel @ 1982-11-04  3:13 UTC (permalink / raw)


#N:uiucdcs:28500001:000:2395
uiucdcs!mcdaniel    Nov  2 20:13:00 1982

I don't understand why I'm getting errors in the following code. Nobody
here understands Ada, and my book and the manual indicate that this 
should work, so I'm at my wit's end. I can't think of anything to do but
to ask the net. (Errorless code and comments have been deleted.
The compiler is the non-certified "ida" cross-compiler for the Intel 432).
    1    -- generic package SET_OF 
    2    -- purpose: to provide set handling facilities.
    3    -- Parameters: 
    4    --    BASE: the base type of the set (the type of the set's elements).
    5    --          Must be a discrete type (integer, enumeration, etc.).
   22   generic
   23       type BASE is ( <> );
   24   package SET_OF is
   25       type SET is private;
   26       type LIST is array(NATURAL range <>) of BASE;
   27            -- I'd like to make LIST private or even limited private,
   28            -- but the full type declaration cannot declare an 
   29            -- unconstrained array type. (sigh)
   30       EMPTY, FULL: constant SET;
   34       function "+" (X, Y: SET) return SET;
   35       function "*" (X, Y: SET) return SET;
   36       function "-" (X, Y: SET) return SET;
   40   private
   41       type SET is array(BASE) of BOOLEAN;
   42       EMPTY: constant SET := (SET'RANGE => FALSE);
   43       FULL : constant SET := (SET'RANGE => TRUE );
   44   end SET_OF;
   46   package body SET_OF is
   61       function "+" (X, Y: SET) return SET is
   62       begin
   63           return "or" (X, Y);
                       1
ERROR 1: Too few components: in dimension#1
   64       end "+";
   65       function "*" (X, Y: SET) return SET is
   66       begin
   67           return X and Y;
                         1
ERROR 1: Too few components: in dimension#1
   68       end "*";
   69       function "-" (X, Y: SET) return SET is
   70       begin
   71           return X xor Y;
                         1
ERROR 1: Too few components: in dimension#1
   72       end "-";
   91   end SET_OF;
What am I doing wrong (if anything)?
Also: can anyone devise a generic package to perform these boolean vector
operations (using whatever parameters are needed)? Mail me any
answers to either question and I'll summarize the results to the net,
if it's of general interest.
                                 Tim McDaniel

                                      (. . . pur-ee!uiucdcs!mcdaniel)




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

* Re: What's wrong with this package? - (nf)
@ 1982-11-04  4:47 cmcl2!tihor
  0 siblings, 0 replies; 2+ messages in thread
From: cmcl2!tihor @ 1982-11-04  4:47 UTC (permalink / raw)


#R:uiucdcs:28500001:cmcl2:15900001:000:140
cmcl2!tihor    Nov  3 20:15:00 1982

I just ran this through NYU ADA/Ed and it produced no error messages. 
I couldn't spot any problems with those constructs as used off hand.




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

end of thread, other threads:[~1982-11-04  4:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1982-11-04  4:47 What's wrong with this package? - (nf) cmcl2!tihor
  -- strict thread matches above, loose matches on Subject: below --
1982-11-04  3:13 uiucdcs!mcdaniel

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