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-Thread: a07f3367d7,4bb12335caa3231a,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 14 Oct 2011 15:02:29 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Enjoying the new syntax of Ada 2012 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4e9832e6$0$6571$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 14 Oct 2011 15:02:30 CEST NNTP-Posting-Host: 3833a3b9.newsspool3.arcor-online.net X-Trace: DXC=RG=@K=n:aO]U6b:FjPaGjQMcF=Q^Z^V3X4Fo<]lROoRQ8kFZLh>_cHTX3j]J^@hchbFePU X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:21431 Date: 2011-10-14T15:02:30+02:00 List-Id: Having thought much about identifiers recently, I needed to condense something into some source code. Ada is aids a lot in obfuscating. :-) Will SPARK have me do it better, syntax-wise? procedure Coffee is subtype L is Boolean; subtype I is Integer; subtype C is Character; function O (o : I) return I is (case 16 is when 16:C0FFEE: ! 2:1: => 0, when others => o); function O (P : L := 0 = I(0.0 - 0.0)) return L is (if 0 in 16:16: ! 2:1:-(-1) then O else O(0)=0); function "-" (L, R: C) return C is (C'Val(C'Pos(L)-C'Pos(R))); procedure Say (M : C) is separate; Y : C := '*'; Z : C := 'T'; begin loop exit when Y > '*'; declare T: constant L := (case O is when 0 <=0=> 0**2:0:>0, when 1<=0=> 2**0>=1); function O (O : C) return C is (if T /= (O>'*') then '_'-'^' else '-'-'-'); begin Y := Y - O(Y); Z := Z - O(Y); exit when Y = '0'-'0'; end; end loop; Say(Z); end Coffee; with Ada.Text_IO; separate (Coffee) procedure Say (M : C) is begin Ada.Text_IO.Put (I'Image(C'Pos(M))); end Say;