# Question:Use of 'op' and 'nargs'. Why is the proc 'maximum' not working?

## Question:Use of 'op' and 'nargs'. Why is the proc 'maximum' not working?

Maple 7

The questions are in the initial documentation of Maple code below.  Again any help gratefully received.

restart:

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Question 1: on use of op.  In the program there are two similar lists
# LC_L and LC_L2, one using square brackets; the second round.   Can I use the op operator using round brackets?
#
# Question 2: The proc maximum is not producing any output.  What is nargs referring to?

# Why?  This proc I found in the Maple 7 documentation so why
# does it not give output?
#
# Functional operators.  Use of ->

# to find coords of rotated points.  No questions here – I
# intend using this on the letter A program in a recent post of # mine
#

# # # # # # # # # # # # # # # # # # # # # # # # # # # # #

with(plots):

with(plottools):

h:=6*sqrt(3):b:=6:w:=3:

#List of coord for letter L.  Two ways of writing:

# with square or round bracket

LC_L:=[[0,0],[0,h],[w,h],[w,w],[b,w],[b,0]]:

LC_L2:=[(0,0),(0,h),(w,h),(w,w),(b,w),(b,0)]:

endfor:=nops(LC_L):

for i from 1 to endfor do

printf("LC_L   Coord %d is (%5.3f , %5.3f) \n",i, LC_L[i][1], LC_L[i][2]);

printf("LC_L2  Coord %d is (%5.3f , %5.3f)\n\n",i,op(LC_L2[i][1]), op(LC_L2[i][2]));

#op(1,op(2,w))

end do;

l:=[6,9,4,1]:  #this list was added in by me

maximum := proc (l)  # ()  the l was added by me

local r, i;

r := args[1];

for i from 2 to nargs do

if args[i] > r then r := args[i] end if

end do;

#printf("  %d\n",r);

r

end proc:

#eval();

maximum(l);

﻿