Merged with upstream. Updated M (aka MUMPS) detection to use the new bayesian / samples method.

This commit is contained in:
Laurent Parenteau
2013-03-14 11:33:09 -04:00
472 changed files with 179182 additions and 1762 deletions

View File

@@ -0,0 +1,42 @@
;------------------------------------
; These first two routines illustrate
; the dynamic scope of variables in M
;------------------------------------
triangle1(x) ;;
set sum=0
for do quit:x'>1
. set sum=sum+x
. set x=x-1
quit sum
main1() ;;
set sum=1500
set x=6
write "sum before=",sum,!
set y=$$triangle1(x)
write "sum after=",sum,!
write "triangle of ",x," is ",y,!
quit
;------------------------------------
; These next two routines illustrate
; the use of the NEW command to make
; variables limited to the local scope
;------------------------------------
triangle2(x) ;;
new sum ; <-- HERE !!
set sum=0
for do quit:x'>1
. set sum=sum+x
. set x=x-1
quit sum
main2() ;;
set sum=1500
set x=6
write "sum before=",sum,!
set y=$$triangle2(x)
write "sum after=",sum,!
write "triangle of ",x," is ",y,!
quit