Elijah - That was it. Thanks. I was thrown off by NuVoc's description of 4 T. as "A box or array of boxes". I wasn't sure what to pass so I assumed I'd pass the various thread ids boxed... It would be more clear I think if it said "A pyx or array of pyxes" - https://code.jsoftware.com/wiki/Vocabulary/tcapdot#dyadic. I'm not comfortable updating the wiki with this recommendation unless others agree.
On Sun, Apr 10, 2022 at 9:24 PM Elijah Stone <[email protected]> wrote: > You want 4 T. foo, I expect. You have to say which pyx it is that you > want the status of. > > On Sun, 10 Apr 2022, Joe Bogner wrote: > > > On Sat, Apr 9, 2022 at 3:04 PM Henry Rich <[email protected]> wrote: > > > >> > >> A pyx looks on the outside like any other box. You can pass it as an > >> argument. But as soon as you look inside it, your thread is blocked > >> until the task producing the pyx's value has completed. Then you see the > >> value, and your thread continues. > > > > > > > > This is an exciting addition to J. The pyx design is elegant. I recently > > spent some time studying R's implementation of futures, which is built > upon > > delayedAssign[1]. The semantics of R futures are similar - querying a > value > > of a non-resolved future will block the call[2]. > > R futures support checking to see if the future is resolved (or pyx in > this > > case) with a resolved() function > > > > Is this supported in 4 T. ? Admittedly, I could not figure out how to > call > > 4. T and have it produce a result. NuVoc seems to suggest that 4 T. can > be > > used to check on the status of pyxs but I'm not sure I'm interpreting it > > correctly. > > 0 T. '' > > foo =: {{echo ('done waiting ',(": y), ' seconds') [ (6!:3) y}} t.'' 5 > > 4 T. '' > > 4 T. <"0 i.2 > > > > done waiting 5 seconds > > > > I was thinking 4. T. '' would show something? > > > > I saw the test case while researching this and it looks similar and this > > works: > > > > > > 1 - > > > https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/delayedAssign > > 2 - > https://github.com/HenrikBengtsson/future/blob/develop/R/future.R#L27 > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
