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=2.0 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,33c05cfcb26839d1,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.193.129 with SMTP id ho1mr22168885pbc.8.1340184561673; Wed, 20 Jun 2012 02:29:21 -0700 (PDT) Path: l9ni71880pbj.0!nntp.google.com!news2.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: nice features in Ada 2012, expressions Date: Wed, 20 Jun 2012 04:29:16 -0500 Organization: Aioe.org NNTP Server Message-ID: Reply-To: nma@12000.org NNTP-Posting-Host: KdJUrTuvv3Zv/s8pPxNluw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-06-20T04:29:16-05:00 List-Id: I was looking at Ada 2012 expressions http://www.adacore.com/uploads/technical-papers/Ada2012_Rationale_Chp2_expressions.pdf and I really like what I see. Ada is becoming more expressive now, with less code, which I think is a good thing(TM). It is getting almost as short as Matlab now (but with the strong type build-in) Given a matrix A, and I want to find if all elements in the matrix are say positive, then in Matlab I would write -------------------- B = all(A(:)>0) In ada 2012 it is B := (for all e of A => e>0); -------------------- and if I want to find if there is at least one value > 0 then in Matlab I would write ---------------------- B = any(A(:)>0) and in Ada 2012 B := (for some e of A => e>0); ----------------------- I think this is nice. I am not sure yet, since I do not know much about Ada 2012, if I can use this new iterator form if A was a standard array variable, or if it will work only if A was a 'container' variable? i.e. if A above was just variable of type like 'A_type is array(integer) of float' I hope it will work on standard arrays and not just on collections so I can use it this form more. I think these are the type of improvements needed in Ada to make it more popular and more used. Real practical and useful things. I am looking forward for the 2012 gnat to try it out. --Nasser