From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_FROM_MTA_HEADER autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 126597,23dc0b4a2cfbd315,start X-Google-Attributes: gid126597,public X-Google-ArrivalTime: 1982-11-04 00:13:21 PST Message-ID: Newsgroups: net.lang.ada Path: utzoo!decvax!harpo!ihps3!ixn5c!inuxc!pur-ee!uiucdcs!mcdaniel X-Path: utzoo!decvax!harpo!ihps3!ixn5c!inuxc!pur-ee!uiucdcs!mcdaniel From: uiucdcs!mcdaniel Date: Thu Nov 4 03:13:20 1982 Subject: What's wrong with this package? - (nf) X-Google-Info: Converted from the original B-News header Posted: Tue Nov 2 20:26:35 1982 Received: Thu Nov 4 03:13:20 1982 Date: 1982-11-04T03:13:20+00:00 List-Id: #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)