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,32d9aa9d79729b31 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.220.230 with SMTP id pz6mr13307208pbc.3.1340634075502; Mon, 25 Jun 2012 07:21:15 -0700 (PDT) Path: l9ni18448pbj.0!nntp.google.com!news1.google.com!news.glorb.com!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: Any easy/build-in construct to extract submatrices from larger matrix? Date: Mon, 25 Jun 2012 09:21:12 -0500 Organization: Aioe.org NNTP Server Message-ID: References: <1xzo3825h9yt7$.45flobqwlel6.dlg@40tude.net> 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: 8bit Date: 2012-06-25T09:21:12-05:00 List-Id: On 6/25/2012 2:54 AM, J-P. Rosen wrote: > Le 25/06/2012 08:32, Nasser M. Abbasi a �crit : >> Ada is nice as it strongly typed and catches common errors. But >> it is not as 'expressive' I am afraid as I'd like for this >> sort of thing. >> >> In Mathematica for example, I do this whole operation in one line: >> >> --------------------------- >> Table[ReplacePart[A,{{i},{i,_},{_,j}}:>Sequence[]],{i,nRow},{j,nCol}]; >> --------------------------- >> >> That is all. This generates all submatrices from A as needed >> in this problem :) > Right. Now talk about readability... Ada is for long-lived programs, and > places readability over writability. Sure. I agree with readability. But do you really think a 40 or 50 lines lines function will be more readable and easier to understand and maintain than a 1 or 2 lines function? For me, the above Mathematica one line code is much more readable, and easier to understand. It uses patterns, yes, but _once_ one understands the syntax, and how to use patterns, it all becomes so clear, and logical, and actually easier to maintain and comprehend than a large function that does the same thing. btw, I am not even that good in Mathematica. Still learning it. There are Mathematica experts who would probably write the above in 1/2 the size :) regards, --Nasser