Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!mach1!torn!howland.reston.ans.net!noc.near.net!uunet!s5!hui
From: hui@fid.morgan.com (Roger Hui)
Subject: Re: Links to subroutine packages
Message-ID: <1993Apr24.165640.11101@fid.morgan.com>
Organization: Morgan Stanley & Co., New York, NY
References: <1993Apr16.204840.23634@ll.mit.edu>
Date: Sat, 24 Apr 1993 16:56:40 GMT
Lines: 27

William Gilson wrote on 1993-04-16:

> Also, is there a less klugey way of entering multi-line definitions than 
> t=. 'blah blah'
> t=.t,'blah blah blah'?

I myself would do something like the following, if I must resort
to multi-line defns:

 Edit a text file, one line in the file per line in the defn, 
  without the quotes;
 Read the file into J; 
 Cut to separate into lines; 
 Define the function using : .  

Thus:

   read =. 1!:1
   cut  =. <;._2

   f1 =. (cut read <'file1') : ''                     NB. monad
   f2 =. '' : (cut read <'file2')                     NB. dyad
   f  =. (cut read <'file1') : (cut read <'file2')    NB. ambivalent

The above assumes that lines terminate in a single character 
(as in UNIX).  Lines in DOS text files terminate in two characters;
under DOS, cut=.<@}:;._2.
