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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,95cb9cc00d809d62 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-28 13:34:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!nntp.clear.net.nz!news.clear.net.nz.POSTED!not-for-mail NNTP-Posting-Date: Thu, 28 Nov 2002 15:34:08 -0600 From: Craig Carey Newsgroups: comp.lang.ada Subject: Re: Reading a C record from socket - chicken / egg problem - now complete Date: Fri, 29 Nov 2002 10:33:48 +1300 Message-ID: References: <5ad0dd8a.0211230443.4b476252@posting.google.com> X-Newsreader: Forte Agent 1.9/32.560 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Organization: Customer of Mercury Telecommunications Ltd Cache-Post-Path: drone4.qsi.net.nz!unknown@tnt1-324.quicksilver.net.nz X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) X-Original-NNTP-Posting-Host: drone4-svc-skyt.qsi.net.nz X-Original-Trace: 29 Nov 2002 10:33:49 +1300, drone4-svc-skyt.qsi.net.nz NNTP-Posting-Host: 203.97.37.6 X-Trace: sv3-qnsLBd4JXvg+WxZZSomsVNgtmST1Fuvai1vS07qWYrNeVcoKe/k3v4fX/qjE7K+LYtPS4AM1+vC8IXF!uxVbMSGpmBnaQsUTaZELMsXQZogcU1ahjS+hZHJBhfM7YRgiBIXXd29/K2/bTgtFnpEhpwgKGnqX!pcC4tQ0= X-Complaints-To: abuse@clear.net.nz X-DMCA-Complaints-To: abuse@clear.net.nz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:31300 Date: 2002-11-29T10:33:48+13:00 List-Id: On 23 Nov 2002 04:43:33 -0800, wojtek@power.com.pl (Wojtek Narczynski) wrote: ... >Another question is: can I declare non-contiguous enumeration >subtypes, or only range x .. y? I've been unable to figure out how to The question could be a question about having Ada 95 improved so that it implements sets that are like ranges except less ordered. for X in X1 .. X5 | X10 .. X12 loop Ada.Text_IO.Put_Line (...'Image (K)); end loop; >declare non-contiguous subtype, so I guess this isn't allowable, but >why? How am I supposed to write a strong typing program if I am not >able to declare a type that clearly "exists" (in math sense)? For >example: > >-- Doesn't work > >type Animal is ( Pig, Dog, Fish ); >subtype Nice_Animal is Animal ( Pig, Dog ); >subtype Home_Animail is Animal ( Dog, Fish ); >subtype Eatable_Animal is Animal ( Pig, Fish ); > >In reality I wanted to declare subtypes of request type that don't >span a contiguous range. See the bottom of the message for a fragment of the 1-Nov-2002 proposal of Mr Jeffrey Carter that was posted to the Ada-Comment mailing list and that proposed that sets (arrays of Booleans) be added to Ada 95. Also at the bottom I quote a message of Robert I. Eachus that comments on adding sets (arrays of Booleans or bits), to Ada 95. Mr Carter wrote to Ada-Comment and asked for a package to be added. This Usenet proposal seems to require that the language be extended, and some of the commentators adverse to Mr Carters proposal considered that the Ada language could be extended. At this moment there seems to be no current ARG record showing that the discussion I write on had occurred -- i.e. these URLs do not mention the "Re: [Ada-Comment] Update to AI-302: Discrete set" thread topic: AI Summary page: http://www.ada-auth.org/AI-SUMMARY.HTML AI-302: data structures (adding linked lists or etc.): http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00302.TXT PS. Maybe a set feature would get its own AI number. Mr Brukhardt would know if an AI on sets is going to appear. I recently had to replace Booleans with real numbers in an attempt to get a numerical optimizer to run faster (that largely failed). Putting programming first and maths after that, sets ought be able to be not-ordered vectors over any type. Disordering an array wasn't said to clearly implied by implementation considerations. ---- >P.S. Another question, slightly offtopic, is there any server where I >could get posting access to this group? Currently I use Google Groups. If the ISP maybe provides access. Anyway, there is a search engine for opn public (port 119) Usenet servers, here: http://www.newzbot.com/ --- Additional Material --- At 2002-November-01 16:27 -0700 Friday, Jeffrey Carter wrote: | | Date: Fri, 01 Nov 2002 16:27:19 -0700 | From: Jeffrey Carter | To: ada-comment@ada-auth.org | List-Subscribe: | Subject: [Ada-Comment] Update to AI-302: Discrete set | Reply-To: "Ada-Comment List" | | !wording | | A.X.11 Discrete Set Handling | | The language-defined package Ada.Data_Structures.Set_Discrete provides a | generic package each of whose instances yields a limited private type | Handle and a set of operations. An object of a particular Set_Discrete | Handle type represents a set over a universe defined by the generic | discrete formal type Element. | | Static Semantics | | The library package Ada.Data_Structures.Set_Discrete has the following | declaration: | | generic | type Element is (<>); | package Ada.Data_Structures.Set_Discrete is ... | function "+" (Left : Handle; Right : Handle) return Handle; | function Union (Left : Handle; Right : Handle) return Handle | renames "+"; | Here is another comment that was added to the thread on sets. The thread died on 11 November 2002. I am guessing it might never show up in the AI's. Which could mean that many readers of comp.lang.ada would missed it. Also contributors to the thread seemed generally to more for the idea than against it. To hint at that possibility, here is a messages near the end of the communications that contribute to the AIs. I don't know what is happening. Mr Carter perhaps can write more on the topic. At 2002-November-10 19:42 -0500 Sunday, Robert I. Eachus wrote: Date: Sun, 10 Nov 2002 19:42:23 -0500 From: "Robert I. Eachus" To: Ada-Comment List Subject: Re: [Ada-Comment] Update to AI-302: Discrete set > There has been a lot of water over the dam in the last few days on this >subject, but let's not lose the baby with the bath water. There is an >operation on bit arrays which is very common, and some types of software >do quite a lot. That is exactly the First/Min operation discussed here. > You need to find the first set bit in a one or two dimensional bit >array, and do it fast. Some instruction set architectures have a find >first bit instruction or a test and set instruction that can >significantly improve these operations. > >For example, in the LALR parser generator on Multics, this operation was >needed in the optimization of the state tables. A two dimensional array >of from and to states was created, and optimizations were done such as >removing all unreachable states. (Not as silly as it seems, earlier >optimizations would combine identical states and bypass "empty" >productions with no asociated actions.) > >Initially the array was stored one bit per byte, and the performance was >reasonable. But then the size of the tables outgrew a single one >megabyte Multics segment. Adding multisegment support slowed things >down seriously. Using native Multics instructions to pack and unpack >bits was even slower. So Pat Prange and I rewrote the bit search code >to use the translate and test character manipulating instruction. This >instruction looks each byte up in a table, stops when it finds the first >non-zero table entry, and returns the offset in the array and table >entry. Of course, we created a table that had the first bit offset for >the corresponding byte, and it was trivial (one more instruction) to >generate the actual index of the first set bit. This code improved the >throughput for this pass by a factor of ten over the original >implementation. Not just the bit searches, but the performance of the >entire pass, in part because it allowed us to use less memory. (You can >do something similar on x86 with REPZ SCAS, but the termination >conditions are messier to sort out.) > >Another frequently needed operation on bit vectors is the population >count. The AMD Athlon Processor Code Optimization Guide spends several >pages, starting at page 136, on how to do an efficient population count >either of 32-bit words or of 64-bit MMX values. (The same code will >work on a Pentium 4, but I don't know if the 32-bit code is the most >efficient there due to its relatively slow integer shifts. I just >happen to have an Athlon XP that I use for number and bit crunching.) >See >http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/22007.pdf > > >So for me, a standard package that added these operations for bit >vectors would be a big win. Other than that the syntactic sugar that >converts a bit vector into a set is a total waste of time, at least for >me. Serious bit vector operations require these two operations, and it >is a pain to have to use low-level programming to do them right. > > >________________________________________________________ > >You have received this message because you subscribed to the ADA-COMMENT >mailing list. To leave the ADA-COMMENT list, send an email with >'leave ada-comment' in the body to listserv@ada-auth.org. For help >on the other commands available, send 'help ada-comment' to the same address. >Problems? Send mail to agent@ada-auth.org. > >