comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Enjoying the new syntax of Ada 2012
Date: Fri, 14 Oct 2011 15:02:29 +0200
Date: 2011-10-14T15:02:30+02:00	[thread overview]
Message-ID: <4e9832e6$0$6571$9b4e6d93@newsspool3.arcor-online.net> (raw)

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;



             reply	other threads:[~2011-10-14 13:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14 13:02 Georg Bauhaus [this message]
2011-10-14 13:05 ` Enjoying the new syntax of Ada 2012 Georg Bauhaus
2011-10-14 22:14   ` Jerry
2011-10-14 13:18 ` okellogg
2011-10-15 13:15   ` Peter C. Chapin
2011-10-17  8:53 ` Egil Høvik
replies disabled

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