If you're enjoying learning J, I would say it's certainly worth it. Many
of the ideas, like copy or the prefix operator, are incredibly powerful
tools you won't find anywhere else. And learning how these concepts work
in J will help you recognize when to use them in other languages, even
if they can't be written as easily.

But sometimes another paradigm--Fortran indices, in this case--is more
direct or even more powerful. I think it's important not to obscure or
make excuses for these cases. Doing so prevents us from moving the array
paradigm forward.

Marshall

On Fri, Feb 07, 2020 at 04:04:00PM +0100, Rudolf Sykora wrote:
> Dear Marshall and Henry,
> 
> 
> Marshall Lochbaum <[email protected]> writes:
> > Although a matrix product will execute faster, if I want to write tensor
> > code that is straightforward, and extends to multiple contracted axes, I
> > would transpose the contracted axes to the end and combine them with
> > (+/@:*"1).
> 
> This is exactly how I was thinking yesterday. But I could not make the
> shapes and ranks fit, and I gave up, and asked the question here,
> thinking that I must have been doing something really wrong... (That the
> problem at hand should be 'easy', especially in J.)
> 
> 
> > The idea with (|:~ 1 -.~ i.@(#@$)) is to get the list of indices for
> > ...
> 
> Thanks for the explanation. When I saw Henry's answer I was taken aback,
> but after some thought I now understand what is going on.
> 
> 
> > I think this is a weak point for J's array programming style. Just like
> > tacit code works well for small manipulations but gets confusing and
> > difficult as the number of arguments increases, J primitives like rank,
> > transpose, and inner product are excellent for a few axes, but don't
> > work so well when the number of axes increases and the ways they are
> > manipulated become more complicated. In J's defense, most programming
> > languages are pretty awful at this (how many times are you going to
> > write .map before you just give up?). But it's something that bothers
> > me. Sure, I can write a bunch of nested rank operators to do what I
> > want, but why is it so hard to just say which axes correspond to which?
> 
> Generally, I wonder whether trying J is worth it. It happened again that
> something one could write explicitly with ease in, say, fortran (the
> code would be more verbose, but straightforward), took me many hours to
> get working in J. I guess, pragmatically, it does not pay off, but, for
> the fun of it, it is interesting to see how far one can get. I love
> those little sniplets that can solve quite complex problems really
> succinctly.
> 
> 
> Thanks to both of you again,
> Ruda
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to