The verb j. is an interesting beast. From an upcoming paper:
2.6 Should it be a Primitive?
APL has a large number of primitive functions, each denoted by a symbol
(§6). How does one decide whether a function should be primitive? There
does not exist a decision procedure which answers this question, an
indication that language design is more an art than a science. For
example, the dialect J has the scalar function j. defined by {⍺←0 ⋄
⍺+⍵×0j1}¨; that is, a scalar function whose monadic definition is ⍵×0j1 and
whose dyadic definition is ⍺+⍵×0j1. (The APL numeric constant ajb is a + b
× √−1 or a + ib in conventional mathematical notation.) If complex numbers
are in the language, would you specify this as a primitive? A possible
answer [Hui 2016c, §8]:
Complex numbers can be constructed as ordered pairs of real numbers,
similar to how integers can be constructed as ordered pairs of natural
numbers and rational numbers as ordered pairs of integers. For complex
numbers, j. plays the same role as - for integers and ÷ for rational
numbers.
We don’t know that this is *the* answer; Iverson designed the primitive and
it was implemented without further discussion. We should have asked him
about it.
On Sun, Mar 15, 2020 at 10:36 PM Joey K Tuttle <[email protected]> wrote:
> There are many in my memory (but sometimes not as clear as they once were)
> having started being wowed by them more than 50 years ago.... One that I
> proudly remember was a response from The Hui that he was wowed by my
> response to a forum question asking how to calculate the distance from
> origin of coordinates to a set of xy points -
>
> I suggested keeping the xy pairs in a 2 by n table - e.g.
>
> ] xy=. _10 + ? 2 10$50
> 8 25 27 27 2 24 22 8 12 24
> 23 26 _4 14 _1 19 29 35 39 12
> j./xy
> 8j23 25j26 27j_4 27j14 2j_1 24j19 22j29 8j35 12j39 24j12
> NB. and to calculate the desired distances -
> | j./xy
> 24.35159132 36.06937759 27.29468813 30.41381265 2.236067977 30.61045573
> 36.40054945 35.90264614 40.80441153 26.83281573
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm