Actually, I’m a little bit confused as well:
I thought I understood it but obviously didn’t
so I tried redoing the diagram but with one
set of arrows altered.
Am I right these should be different or do I
misinterprete the way atop is meant to work?

thanks

Am 29.03.20 um 03:36 schrieb ethiejiesa via Programming:
Raul Miller <[email protected]> wrote:
Another possible way to emphasize what's going on here might be to
split 'v' up into multiple instances (one for each cell) in the &
case. (Though, there, drawing a box around the 'v' part, to show the
scope of the verb and distinguish the definition from the application
-- possibly even backed up by another sentence or something? -- might
be even more important.)

Thanks,


Perhaps the disagreement stems from difference in experience.

I sympathize with Sergey's confusion. When first coming to J a few months ago, I 
was confused by the exact same diagram. It only started making sense for me once 
the ideas of rank/splitting/reassembly and & vs @ composition had already 
clicked.

So I feel like the diagram is a great illustration of the concepts but there is 
perhaps a need for some pedagogy that demonstrates the initial problem: What 
mechanical questions come up when trying to combine verbs? Which naturally 
leads to wanting the four composition primitives.

Is there a wiki page that already addresses this kind of thing? I might try 
writing one up and sharing it on Jgeneral anyway, in the off chance it fills a 
need.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
----------------------
mail written using NEO
neo-layout.org
\documentclass{standalone}

\usepackage[utf8]{luainputenc}
%\usepackage{uniinput}
%\usepackage{luamplib}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.geometric}
%\usepackage{hyperref}
%\usepackage{geometry}
%\usepackage{graphicx}
%\usepackage{enumerate}
\newcommand\todo[1]{%
\par
{\color{red} TODO: #1}
\par
}

\setlength\parindent{.pt}

\begin{document}

\begin{tikzpicture}[
  every node/.style={align=center,fill=white},
  text width=18mm,
  bs/.style={draw=blue,text width=17mm},
  rc/.style={draw=red,ellipse},
  rcr/.style={draw=red,ellipse,rotate=90},
  bo/.style={draw,very thick},
  wo/.style={text width=35mm},
  bi/.style={draw,very thick,text width=10mm},
  wide/.style={text width=30mm},
  ]
  \node [wide] at (0,13) {At (@:)};
  \node [wide] at (4,13) {Atop (@)};
  \node [wide] at (8,13) {Appose (\&:)};
  \node [wide] at (12,13) {Compose (\&)};
  \node [bo] (at) at (0,12) {result of @:};
  \node [bo] (atop) at (4,12) {result of @};
  \node [bo] (appose) at (8,12) {result of \&:};
  \node [bo] (compose) at (12,12) {result of \&};
  \node [bs] (atu) at (0,10) {Apply u to entire result of v};
  \node [rc] (atopc) at (4,10) {Collect results\\and add fill};
  \node [bs] (apposeu) at (8,10) {Apply u to entire result of v};
  \node [rc] (composec) at (12,10) {Collect results\\and add fill};
  \draw [->,blue] (atu) -- (at);
  \draw [->,blue] (apposeu) -- (appose);
  \draw [->,red] (atopc) -- (atop);
  \draw [->,red] (composec) -- (compose);
  \node [rc] (atc) at (0,7) {Collect results\\and add fill};
  \node [bs] (atopu) at (4,7) {Apply u to entire result of v};
  \node [rcr] (apposec7) at (7,7) {Collect results\\and add fill};
  \node [rcr] (apposec9) at (9,7) {Collect results\\and add fill};
  \node [bs] (composeu) at (12,7) {Apply u to entire result of v};
  \draw [->,red] (atc) -- (atu);
  \draw [->,blue] (atopu.north west) -- (atopc);
  \draw [->,blue] (atopu.north) -- (atopc);
  \draw [->,blue] (atopu.north east) -- (atopc);
  \node [wo] at (4,8.25) {result cells of u};
  \draw [->,red] (apposec7.east) -- (apposeu.-120);
  \draw [->,red] (apposec9.east) -- (apposeu.-60);
  \draw [->,blue] (composeu.north west) -- (composec);
  \draw [->,blue] (composeu.north) -- (composec);
  \draw [->,blue] (composeu.north east) -- (composec);
  \node [wo] at (12,8.25) {result cells of u};
  \foreach \shift in {0,4,7,9,11,13}
    \node [bs] (v\shift) at (\shift,4) {Apply v to each cell};
  \draw [->,blue] (v0.north west) -- (atc);
  \draw [->,blue] (v0.north) -- (atc);
  \draw [->,blue] (v0.north east) -- (atc);
  % NOTE: changed arrows here
  \foreach \dir in {60,90,120}
    \draw [->,blue] (v4.\dir) -- (atopu.-\dir);
  \foreach \hoff in {7,9} {
    \draw [->,blue] (v\hoff.north west) -- (apposec\hoff);
    \draw [->,blue] (v\hoff.north) -- (apposec\hoff);
    \draw [->,blue] (v\hoff.north east) -- (apposec\hoff);
  }
  \draw [->,blue] (v11.120) -- (composeu.-120);
  \draw [->,blue] (v11.90) -- (composeu.-110);
  \draw [->,blue] (v11.60) -- (composeu.-100);
  \draw [->,blue] (v13.120) -- (composeu.-80);
  \draw [->,blue] (v13.90) -- (composeu.-70);
  \draw [->,blue] (v13.60) -- (composeu.-60);

  \foreach \shift in {0,4,8,12}
    \node [wo] at (\shift,5) {result cells of v};
  \foreach \shift in {0,4,8,12} {
    \node [rcr] (sx\shift) at (-1+\shift,1.5) {Split x\\ into\\ cells};
    \node [rcr] (sy\shift) at (1+\shift,1.5) {Split y\\ into\\ cells};
    \node [bi] (xi\shift) at (-1+\shift,-.5) {[x]};
    \node [bi] (yi\shift) at (1+\shift,-.5) {\phantom[y\phantom]};
    \draw [->] (xi\shift) -- (sx\shift);
    \draw [->] (yi\shift) -- (sy\shift);
  }
  \foreach \shift in {0,4} {
    \draw [->,red] (sx\shift.20) -- (v\shift.-150);
    \draw [->,red] (sx\shift.east) -- (v\shift.-135);
    \draw [->,red] (sx\shift.-15) -- (v\shift.-100);
    \draw [->,red] (sy\shift.15) -- (v\shift.-80);
    \draw [->,red] (sy\shift.east) -- (v\shift.-45);
    \draw [->,red] (sy\shift.-20) -- (v\shift.-30);
  }
  \foreach \ll/\mm/\rr in {7/8/9, 11/12/13} {
    \foreach \dir in {-30,0,30} {
      \draw [->,red] (sx\mm.\dir) -- (v\ll.-\dir-90);
      \draw [->,red] (sy\mm.\dir) -- (v\rr.-\dir-90);
    }
  }
\end{tikzpicture}

\end{document}
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to