Talk:Essays/Distributed Apply

From J Wiki
Jump to navigation Jump to search

Undocumented construct

The phrase <@(+/`(>./)`(<./)) uses an undocumented construct. An alternative is:

   gd=: ('@' <@; <)@,"0
   (<'<') gd (+/`(>./)`(<./))
┌───────────────┬────────────────┬────────────────┐
│┌─┬───────────┐│┌─┬────────────┐│┌─┬────────────┐│
││@│┌─┬───────┐│││@│┌─┬────────┐│││@│┌─┬────────┐││
││ ││<│┌─┬───┐││││ ││<│┌─┬────┐││││ ││<│┌─┬────┐│││
││ ││ ││/│┌─┐│││││ ││ ││/│┌──┐│││││ ││ ││/│┌──┐││││
││ ││ ││ ││+││││││ ││ ││ ││>.││││││ ││ ││ ││<.│││││
││ ││ ││ │└─┘│││││ ││ ││ │└──┘│││││ ││ ││ │└──┘││││
││ ││ │└─┴───┘││││ ││ │└─┴────┘││││ ││ │└─┴────┘│││
││ │└─┴───────┘│││ │└─┴────────┘│││ │└─┴────────┘││
│└─┴───────────┘│└─┴────────────┘│└─┴────────────┘│
└───────────────┴────────────────┴────────────────┘
   (i.3 2) ((<'<') gd (+/`(>./)`(<./))) dapply i.3 5
┌─────────┬─────────┬─────────┐
│0 1 2 3 4│5 6 7 8 9│4 4 4 4 4│
│1 2 3 4 5│5 6 7 8 9│5 5 5 5 5│
└─────────┴─────────┴─────────┘

-- Roger Hui DateTime(2006-10-18T23:19:29Z)

Out of date

This Essay is now out of date. The construct m@ and its relatives have been decomitted.

Roger's gd is a verb, and so cannot substitute for @ et. al., which are conjunctions. For a conjunction that emuates and extends the distributive power of pre-J6 @, see doog. That paper presents several utilities relevant to this essay, including several alternatives to dappl.

To bring this Essay up to date with J601c with the minimal changes, in the sentence <@(+/`|.`(|."1)) dapply i.3 5 the @ should be replaced with At from from the doog script.

However, if no one has any objections, I intend to rewrite this Essay (using doog). I note that there's no attribution for this Essay.

-- Dan Bron <<DateTime(2007-01-18T15:19:19Z)>>