Joey K Tuttle wrote:
> iMg5:~ jkt$ cat /usr/local/bin/jfactor
> #!/usr/local/lib/j601/jconsole
> 3 : 0 ARGV
> stdout NL,~": q: ". >2{y
> exit 0
> )

On my system, NL gives me a value error, perhaps
you meant LF?

Also, personally I prefer to use echo rather than
stdout LF,~": (echo is simpler and seems more
robust in the context of array arguments).

And, of course, other stylistic differences are
possible.

I'd be tempted to write the above script as:

#!/usr/local/lib/j601/jconsole
3 :'echo q: 0 ".>y' 2}.ARGV
exit 0

Or, if I wanted errors to be indicated using
a return code, and wanted a more "featureful"
routine, I might instead do:

#!/usr/local/lib/j601/jconsole
9!:29]1[9!:27 'exit 1 [ echo 13!:12>a:'
echo q: ".;:inv 2}.ARGV
exit 0

(The first line provides an error message and an
exit code on hitting an error, and I changed the
second line to allow the use of arbitrary J
expressions rather than just numbers.)

(Of course other variations are possible...)

-- 
Raul


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to