Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!cs.utexas.edu!sun-barr!ames!elroy.jpl.nasa.gov!jato!csi!sam
From: sam@csi.jpl.nasa.gov (Sam Sirlin)
Subject: Re: J explicit def'n result?
Message-ID: <1992Sep16.173647.24842@csi.jpl.nasa.gov>
Originator: sam@kalessin
Sender: usenet@csi.jpl.nasa.gov (Network Noise Transfer Service)
Nntp-Posting-Host: kalessin
Organization: Jet Propulsion Laboratory, Pasadena, CA
References:  <qmdbms.716615108@gsusgi1.gsu.edu>
Date: Wed, 16 Sep 1992 17:36:47 GMT
Lines: 46


In article <qmdbms.716615108@gsusgi1.gsu.edu>, qmdbms@gsusgi2.gsu.edu (Brian Schott) writes:
...
|> am not getting such errors in the cooked up example, but I do
|> not understand what is going on and suspect that the misunder--
|> standing is related to the real errors I get on my real jobs.
|> --------------------------
|> 
|>    t
|> z=: i. 5
|> S z     
|>    S
|> +---+-++
|> |z-2|:||
|> +---+-++

I think you got 
+------+-++
|y. - 2|:||
+------+-++
but this doesn't change the ideas here.

|>     ". t
|>  0  1 2 3 4
|> _2 _1 0 1 2
|> -----------------------------   
|> Where does the 0 1 2 3 4 come from?

From z. You're using execute here, which executes the characters and
(apparently) given a matrix argument catenates the results. Seems
logical. For example try (given z above)
   ". 3 1$'z'
0 1 2 3 4
0 1 2 3 4
0 1 2 3 4
 
I think what you wanted was a function instead, which returns as it's
value the value on the last line executed:
   ta=. t : ''
   ta 0
_2 _1 0 1 2

-- 
Sam Sirlin
Jet Propulsion Laboratory         sam@kalessin.jpl.nasa.gov

