🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.apl
Article #100

how do you define a function?

#100
From: Todd Ogasawara
Date: Sat, 02 Jun 1984 04:37
44 lines
2229 bytes
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
Technical Details
Message-ID: <444@islenet.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!akgua!sdcsvax!noscvax!uhpgvax!islenet!todd

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site islenet.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!akgua!sdcsvax!noscvax!uhpgvax!islenet!todd
From: todd@islenet.UUCP (Todd Ogasawara)
Newsgroups: net.lang.apl,net.unix
Subject: how do you define a function?
Message-ID: <444@islenet.UUCP>
Date: Sat, 2-Jun-84 00:37:47 EDT
Article-I.D.: islenet.444
Posted: Sat Jun  2 00:37:47 1984
Date-Received: Fri, 1-Jun-84 06:57:39 EDT
Organization: Islenet Inc., Honolulu
Lines: 44