[net.unix] how do you define a function?

ljdickey@watmath.UUCP (Lee Dickey) (05/31/84)

I am just learning about  apl\11  too.
I have not figured out how to use the file editing to define
a function, but I have learned that I can use the QuadFX to define
the function that you described.  I defined a character matrix
	2 3 rho 'F X+/X'
and did a QuadFX on it.  The function worked as I expected.
I did find, however, that the    
	minus scan
does not give the expected results.  The expression
	- \ 1 2 3
gives
	1 1 2
which has a sign wrong in the middle element.

An analogous problem exists with "divide scan".

-- 
  Lee Dickey, University of Waterloo.  (ljdickey@watmath.UUCP)
 	... {allegra, decvax} !watmath!ljdickey

todd@islenet.UUCP (Todd Ogasawara) (06/02/84)

I have

	a p l \ 1 1

by
     Ken Thompson, Ross Harvey, Douglas Lanam
up on a UNIX system.  The problem is as follows:  I cannot figure out how
to PROPERLY define an APL function.  The apl man page says the following:
---------------------from apl man page-----------------------------------
     Function definition is not what you would expect.  Functions
     are loaded from files.  The first line of the file is the
     function header, as you would expect it but with no del.
     The rest of the file is the lines of the function.  Lines
     are numbered, but there are no square brackets with line
     numbers.  If you say )READ FILE it will load the function in
     that file.  If you say )EX FILE it will put you in the edi-
     tor to change that file.  Upon exit, it will read the file
     in as though by )READ.
------------------------------------------------------------------------
Now, I am no APL wizard, but I do use APL on other systems and  I thought
I understood the differences described in the sentences above.  So, I wrote
the following test function:

		testfn x
		+/x

Although a ')fns' shows that 'testfn' is seen as a function, an attempt
to execute it by entering

	testfn 1 2 3

generates the following error message

	testfn [0]
	syntax

I tried placing line numbers (without brackets as stated in the man page)
in various places and that made things even worse.

I would really appreciate it if someone could please tell me exactly how
to define a function for a p l \ 1 1 properly.  Thanks in advance....

Todd Ogasawara -- University of Hawaii -- Dept. of Psychology
        { dual,vortex,ihnp4,uhpgvax }!islenet!todd