| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Sorry! but here goes with another dumb noob question. From some Mumps literature that I've been able to garner from the Internet, I've seen a standalone % used as a variable, yet never being used thereafter, e.g., zmain for i=0:1:10 do .. for j=1:1:10 do ... set ^A(i,j)=5 set %=$zzCentroid(^A,^B) for i=1:1:10 write ^B(i),! When % is uded this way, what is it doing? -- Duke Normandin |
|
#2
| |||
| |||
| ----- Original Message ----- From: "Duke Normandin" <dukeofperl@ml1.net> Sent: Sunday, May 11, 2008 5:44 PM Subject: % only as a variable > Sorry! but here goes with another dumb noob question. > > From some Mumps literature that I've been able to garner from the > Internet, I've seen a standalone % used as a variable, yet never > being used thereafter, e.g., > > zmain > for i=0:1:10 do > . for j=1:1:10 do > .. set ^A(i,j)=5 > set %=$zzCentroid(^A,^B) > for i=1:1:10 write ^B(i),! > > When % is used this way, what is it doing? > -- > Duke Normandin First of all, there's nothing special about % as a variable -- it's no different than x or I. In this example, % is used as a dummy to receive whatever value is returned by the $zzCentroid function, but that value is of no interest in this example. This function computes a centroid vector from an array. The input array is named by the first parameter and the output vector is named by the second parameter. In standard Mumps, this might be done as: DO zzCentroid("^A","^B") and thus, not have to worry about a returned value. The example you found is from O'Kane's MUMPS Compiler, and that is not standard Mumps. For one thing, it does not support DO with parameters. |
|
#3
| |||
| |||
| As a small note, there is no Mumps standard. When the MDC died, the standard died, many years ago. What commercial vendors still exist have all added and modified their offerings in many ways, even to changing the name. In our case, we've moved in the direction of a scripting language for text processing applications and internet active server pages. See: http://www.cs.uni.edu/~okane/source/ISR/isr.html ----------------------------------------------------- Printed copies of the manual are available at: http://www.lulu.com/content/2012905 The Linux/Cygwin distro is at: http://www.cs.uni.edu/~okane/source/MUMPS-MDH/ Look for the highest rev of mumpscompiler-XX.X.src.tar.gz (currently 10.12). An executable Windows interpreter is also at this site named mumps.exe. ----------------------------------------------------- With regard to calling subroutines with arguments, the Mumps Compiler supports same: user@acer cat aa.mps zmain for i=0:1:10 do . for j=1:1:10 do .. set ^A(i,j)=5 do $zzCentroid(^A,^B) for i=1:1:10 write ^B(i),! user@acer mumpsc aa.mps Compiling from Mumps source ... The Mumps Compiler 10.00 Jun 4 2008 Translating ./aa.mps to C++: 6 lines of Mumps; 370 lines of C++ generated using mpsglobal_native file system Compiling generated C++ code... Info: resolving _pcre_free by linking to __imp__pcre_free (auto-import) user@acer aa 5 5 5 5 5 5 5 5 5 5 user@acer On Mon, 12 May 2008 00:05:02 -0500, Maury Pepper wrote: > ----- Original Message ----- > From: "Duke Normandin" <dukeofperl@ml1.net> Sent: Sunday, May 11, 2008 > 5:44 PM > Subject: % only as a variable > > >> Sorry! but here goes with another dumb noob question. >> >> From some Mumps literature that I've been able to garner from the >> Internet, I've seen a standalone % used as a variable, yet never being >> used thereafter, e.g., >> >> zmain >> for i=0:1:10 do >> . for j=1:1:10 do >> .. set ^A(i,j)=5 >> set %=$zzCentroid(^A,^B) >> for i=1:1:10 write ^B(i),! >> >> When % is used this way, what is it doing? -- >> Duke Normandin > > First of all, there's nothing special about % as a variable -- it's no > different than x or I. In this example, % is used as a dummy to receive > whatever value is returned by the $zzCentroid function, but that value > is of no interest in this example. This function computes a centroid > vector from an array. The input array is named by the first parameter > and the output vector is named by the second parameter. > > In standard Mumps, this might be done as: DO zzCentroid("^A","^B") and > thus, not have to worry about a returned value. The example you found > is from O'Kane's MUMPS Compiler, and that is not standard Mumps. For one > thing, it does not support DO with parameters. |
|
#4
| |||
| |||
| Kevin O'Kane wrote: > As a small note, there is no Mumps standard. When > the MDC died, the standard died, many years ago. There is no ANSI standard for MUMPS anymore. There still is an ISO standard for MUMPS. It was most recently re-affirmed in January 2005. see http://www.iso.org/iso/iso_catalogue...csnumber=29268 Officially, the MDC still exists. Being the Secretary of the Committee, I am well aware that there have been no meetings since September 1998, so I would not exactly call it "alive"... Ed de Moel -- ************************************************** ************ This electronic mail transmission contains confidential and/or privileged information intended only for the person(s) named. Any use, distribution, copying or disclosure by another person is strictly prohibited. ************************************************** ************ |
|
#5
| |||
| |||
| Hi all As a complete novice to Mumps I would say who cares if there is a Mumps standard or not?! as long as it keeps the basic elements that are most powerful about it. I've probably just fallen out with everyone now but thats just me. But regarding the Do statement, if program are organised well from the outset and well documented who needs to pass parameters? as long as they are not used to comflict with other variables of the same name. The problem is that generally companies, in practice, do not document their programs from the beginning very well so when people leave and new programmers start, they take cautions by doing parameter passing and using the NEW statement too much. Is that not happens in practice? But as I said if we call documented every variable before we use it then who needs to be able to pass parameters? Saying that I prefer MSM Mumps so then I have all the options open and its what my company uses. (I'm not biassed very much?!) But I could be persuaded differently if Kev O'Kane could quickly get his Mumps version working seemlessly in Windows without silly Cygin (now I've fallen out with more programmers---aaaahhhh!!!). Cheers for now Have a nice weekend all David |
|
#6
| |||
| |||
| In article <60105ace-2c9c-426c-9d42-836cbb7bca4c@e39g2000hsf.googlegroups.com>, David Hubball <davidhubball@talktalk.net> wrote: >As a complete novice to Mumps I would say who cares if there is a >Mumps standard or not?! as long as it keeps the basic elements that >are most powerful about it. If you've written an application on one implementation and you (or someone else) would like to run it on a different implementation you'd probably care. >But regarding the Do statement, if program are organised well from the >outset and well documented who needs to pass parameters? as long as >they are not used to comflict with other variables of the same name. As an example, suppose you bought or wrote a set of functions that did various matrix operations. If each function only operated on specific variable names (well documented or not) your code would be sprinkled with a plethra of MERGE commands as you shuffled data around to setup the variables. Also consider that functions have parameters too. Are you suggesting that functions don't need parameters? >The problem is that generally companies, in practice, do not document >their programs from the beginning very well so when people leave and >new programmers start, they take cautions by doing parameter passing >and using the NEW statement too much. Is that not happens in practice? I find that subroutines and functions are a lot easier to reuse without unexpected side effects if its clear to see what parameters they expect and protect any scratch variables needed. >But as I said if we call documented every variable before we use it >then who needs to be able to pass parameters? I for one (and I suspect many others) were quite happy when parameter passing became part of Standard M[UMPS]. -- -- Rod -- rodd(at)polylogics(dot)com |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.