Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!cs.utexas.edu!sdd.hp.com!usc!wupost!csus.edu!sfsuvax1.sfsu.edu!emclean
From: emclean@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Re: Questions of the Day
Message-ID: <1993Mar6.062420.17271@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
References: <1993Mar5.054012.11402@csi.uottawa.ca>
Date: Sat, 6 Mar 1993 06:24:20 GMT
Lines: 102

You write :

>Here's some stuff I can't get to work.
>
>a) p. - Polynomial.
>
>None of the polynomial "things" seem to work.
>
>The discussion ABOUT p. in the Dictionary shows examples of verbs that
>are equivalent to the different meanings of p.; I tried some of 'em
>successfully.  
>
>Unfortunately, I've been less successful with trying to actually use
>p.  Anybody got a working example?
>
  No. I am suprised you got anything to work.

  This feature and others like c. and n. are not yet implemented and
  are in listed as such in your status.doc file.  Interestingly, D 
  is not even in the 5.0 dictionary but it is fully implemented. 

>b) 0!:55 - Terminate Session
>
>Doesn't want to be recognized.  When I installed a readline interface
>that uses C-d as a delete key, it became rather difficult to terminate
>J sessions :-(.  I hacked in the classic )off command from APL, but
>that's not an ideal solution.
>
>I thought it might be a problem with my copy (6.2 compiled by myself
>for Atari ST), but tried it on the 386 version I got with my
>dictionary, and it didn't like 0!:55 either.
>
>It just returns the command as the result.
>

  Sounds strange.
  0!:55 ''
  works ok for me.
  If this doesn't work try :
  0!:55 ('')

>c) So what are 0: to 9: for, anyways?
>(Page 97, Dictionary/Intro)

>In playing with 'em, they DO act differently from 0 to 9; they must be
>good for SOMETHING, but what that something is, I can't figure out.
>

  Not sure what you mean.

  0: is a verb returning 0 as a result. Crudely speaking, for an
  atom one might type:
  (0: = ]) 
  for
  (0&=)

 Perhaps you mean 0:!k and 9!:k and not 0: ?

 0!:k is an *very* important family of verbs used to input files containing
 j source code and character tables into j interactively. See "An Intro to
 J" for examples.

 9!:k is used for setting the parameters for the environment you are
 working in. For example, if you are doing alot of functional programming
 you probably want to have the following command in your profile.js file:

 9!:3(5)

 This sets the default display for viewing verbs.

 It is nice for re-editing old verbs and creating new ones.

 Many of the 9!:k features are currently implemented in the PC
 version of J only.

<>
 You'll find the comprehensive documentation on 0!: and 9!: in the 
 xenos.doc file.  You won't find it in the dictionary.

>After all of these questions, I do have ONE nice idiom to offer up:  I
>came up with a nice way of getting an identity matrix:
>
>identity =. e. i.
>
>identity 5
>1 0 0 0 0
>0 1 0 0 0
>0 0 1 0 0
>0 0 0 1 0
>0 0 0 0 1
>

 Look at

 emmettsIdentity =. (=/ ])@i. 

 and compare which is faster and take less space :

 (6!:2 ; 7!:2) 'identity 1000'
 (6!:2 ; 7!:2) 'emmettsIdentity 1000'

 <'Emmett'
