Raul,

As usual, instant help: to my nightly prayers I will add the hope that I never 
take you for granted.

Fold!  Yes.  Of course.  I’ve read about fold but never tried it…but when I put 
in one of the examples I got a nonce error

   z =: u F:. v y
not found: 
/private/var/mobile/Containers/Data/Application/8C177CA5-F2BD-49C0-AE12-95A58065F82F/Documents/j/addons/dev/fold/foldr.ijs
|nonce error
|   z=:u     F:.v y
   
…which confuses me since the documentation states that 9.01 has it (though the 
execution of u and v was reversed in 9.02).

   JVERSION
Engine: j903/j64/iOS
beta-k: GPL3/2021-10-15T01:07:05
Platform: iOS/iPadOS
Version: 901.1 49
Installer: App Store
Contact: www.jsoftware.com
   
Looks like it might be an iPad quirk.

To your point about restructuring the design—hmm.  Yes.  Once I know that the 
first n coordinates fail f, they’ll never again succeed, so I can safely 
discard them from consideration in subsequent passes (of which there may be 
many).  That all by itself may represent a significant savings.  There are 
probably other optimizations but first…I need a solution that works slowly.

Thanks again.

Ed

Sent from my iPad

> On Oct 21, 2022, at 11:29 AM, Raul Miller <rauldmil...@gmail.com> wrote:
> 
> This sounds like a terminated fold.
> 
> Something like
> https://wiki.jsoftware.com/wiki/Vocabulary/fcap#How_should_I_define_u_and_v.3F
> ... maybe 0 ]F..(_2 Z: f@[) coords
> 
> (That said, you probably want to restructure your description a bit so
> that you can get a useful result from all of this work.)
> 
> I hope this helps,
> 
> -- 
> Raul
> 
> 
>> On Fri, Oct 21, 2022 at 12:19 PM Ed Gottsman
>> <edward.j.gotts...@gmail.com> wrote:
>> 
>> Hi.  I’m blanking on something basic and research isn’t helping.  When the 
>> blindingly obvious solution is revealed I will blame a combination of sleep 
>> deprivation and senescence.
>> 
>> I’ve got a long list of coordinates ordered by desirability.  I want to 
>> invoke f (a custom script) with each coordinate in turn.  f may return 0 
>> (failure), in which case I want to invoke it again with the next coordinate. 
>>  When f (eventually) returns 1, I want to terminate—the remainder of the 
>> coordinates should not be processed.  (Note that the very first invocation 
>> of f may return 1.)
>> 
>> This *almost* feels like ^: in its Do While form.  Almost.  It also feels 
>> like SCs around list operations (though they seem to be limited to 
>> primitives).
>> 
>> Help.
>> 
>> Many thanks.
>> 
>> Ed
>> 
>> Sent from my iPad
>> ----------------------------------------------------------------------
>> 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

Reply via email to