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,1c1a139977eee854 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-20 10:11:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc01.gnilink.net.POSTED!3b3add26!not-for-mail Message-ID: <3CC1A135.7020505@bellatlantic.net> From: Alan Reynolds User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0rc1) Gecko/20020417 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Case statement and Integers. References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 20 Apr 2002 17:11:07 GMT NNTP-Posting-Host: 68.47.133.196 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc01.gnilink.net 1019322667 68.47.133.196 (Sat, 20 Apr 2002 13:11:07 EDT) NNTP-Posting-Date: Sat, 20 Apr 2002 13:11:07 EDT Xref: archiver1.google.com comp.lang.ada:22822 Date: 2002-04-20T17:11:07+00:00 List-Id: Hi Chris, It would seem that you need to review the RM (or course notes) concerning the use of the "case" statement and what constitutes a valid alternative ("when =>"). What's appropriate here is to use an "if ... then ... elsif ... then ... else ... end if" statement. If "left_swap" and "right_swap" are indices similar to "j" then you simply provide "numbers(left_swap)" and "numbers(right_swap)" as arguments to "swap". This brings back fond memories of my 2nd quarter comp. sci. class assignment to implement the "quicksort" algorithm in Pascal. Keep working on it. Have fun, Al Wannabe h4x0r wrote: > I have a statement like this... > > case numbers(j) is > when numbers(j) < pivot => swap(left_swap, right_swap); > -- If the number is less than the pivot, swap it with the number > -- to the right of the Pivot; > when numbers(j) > pivot => swap(right_swap, left_swap); > -- If the number is greater than the pivot, then do the opposite of the > -- above. > when numbers(j) = pivot => null; > when others => null; > end case; > > Now, it's pretty obvious whats wrong here. The swap procedure is > expecting an Integer, and instead it's getting a boolean value due to the > '>', '<', and '=>' operators. > > Whats the proper way to indicate to the compiler that I want to send > the numbers indexed by "left_swap" and "right_swap" to the swap procedure > rather than the results of the boolean test in the case statement? > > Thanks for your patience. > > Chris