Arc Forumnew | comments | leaders | submitlogin
3 points by jsgrahamus 2840 days ago | link | parent

I work with MUMPS as my work programming language. Assuming you had an array of 10 numbers, to get the sum you would do something like this:

  F I=1:1:10 S ARR(I)=I   ; Stores 1-10 in array ARR
  S SUM=0
  F I=1:1:10 S SUM=SUM+ARR(I)
  W !,SUM                 ; Writes sum
In Klong you would do as follows: arr::1+!10 :" Initializes list arr with values of 1-10" .p(+/arr) :" .p() prints and +/arr sums all elements of the list"

I always thought that MUMPS was terse, but for certain things at least, it doesn't hold a candle to Klong. Of course, I thought Minnesota was green until I saw Wisconsin. And now I live in Washington state.



3 points by jsgrahamus 2837 days ago | link

Fixing the formatting.

I work with MUMPS as my work programming language. Assuming you had an array of 10 numbers, to get the sum you would do something like this:

  F I=1:1:10 S ARR(I)=I   ; Stores 1-10 in array ARR
  S SUM=0
  F I=1:1:10 S SUM=SUM+ARR(I)
  W !,SUM                 ; Writes sum
In Klong you would do as follows:

  arr::1+!10 :" Initializes list arr with values of 1-10"   
  .p(+/arr) :" .p() prints and +/arr sums all elements of the list"
I always thought that MUMPS was terse, but for certain things at least, it doesn't hold a candle to Klong. Of course, I thought Minnesota was green until I saw Wisconsin. And now I live in Washington state.

-----