% only as a variable

This is a discussion on % only as a variable within the mumps forums in Programming Languages category; 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...

Go Back   Application Development Forum > Programming Languages > mumps

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 05-11-2008, 06:44 PM
Duke Normandin
Guest
 
Default % 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 uded this way, what is it doing?
--
Duke Normandin
Reply With Quote
  #2  
Old 05-12-2008, 01:05 AM
Maury Pepper
Guest
 
Default Re: % only as a variable

----- 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.

Reply With Quote
  #3  
Old 06-04-2008, 09:57 PM
Kevin O'Kane
Guest
 
Default Re: % only as a variable

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.


Reply With Quote
  #4  
Old 06-05-2008, 10:50 AM
Ed de Moel
Guest
 
Default Re: % only as a variable

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.
************************************************** ************
Reply With Quote
  #5  
Old 07-11-2008, 03:34 PM
David Hubball
Guest
 
Default Re: % only as a variable

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



Reply With Quote
  #6  
Old 07-13-2008, 01:01 PM
Rod Dorman
Guest
 
Default Re: % only as a variable

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
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:05 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.