Question: Print arguments of a function(procedure)

Hi,

This maybe a really simple question, I remember this is doable but couldnt find where the answer is.

Say I write a function to sum up all values in the list,

mysum:=proc(data::list)

return printf("The sum is %3.3f. ", sum(data[i],i=1..numelems(data)));

end proc;

 

and I use it like,

mysum(listA);

mysum(listB);

 

How would I print out a more informative string, like this:

"The sum of listA is %3.3f. "

"The sum of listB is %3.3f. "

 

Use "data", the input, as a string argument.

 

Thanks,

 

casper

Please Wait...