In the example I provided (v is {:), why did it not return 23 then?
Is the spec that (item u result) is new result for next iteration, but (v@) 
transforms the accumulated results for fold multiple, or the last result for 
fold single?
    On Wednesday, August 28, 2019, 03:54:15 p.m. EDT, Henry Rich 
<[email protected]> wrote:  
 
 No, in v@u/ y the result of v is passed to the next iteration, while in 
u F.: v y the result of u is passed.

Z: can be used only within Fold.

Better documentation is in thw works.

Henry Rich

On 8/28/2019 1:26 PM, 'Pascal Jasmin' via Beta wrote:
>  some observations,
> the x parameter is very powerful because it can be of different shape than 
> items of y.
> "u/ y is equivalent to u F.: ] y"
> it appears that more generally, v@u/ y is equivalent to u F.: v y
>
> [`(_2 Z: 1:)@.(5 < -) F:. {: p: i.20
>
> 3 5 7 11 13 17 19 23
>
> This makes all of the definitions/cases of Z: more useful, but initial 
> description can lead the reader to assume v@:(u/) is the equivalent.
> Could z: be used in 2&(u//) to break when something is found or is special 
> code for 2&(1 i.~ u//) all that is needed?
>
>
>      On Tuesday, August 27, 2019, 11:06:48 p.m. EDT, Henry Rich 
><[email protected]> wrote:
>  
>  Documentation is in the works.
>
> Z: can be called from v if you like.
>
> _1&Z: makes sense if the computation that follows it is costly.
>
> Henry Rich
>
> On 8/27/2019 10:42 PM, 'Pascal Jasmin' via Beta wrote:
>> documentation needs a lot of attention.
>> https://code.jsoftware.com/wiki/System/Interpreter/Requests#Fold_.28strawman.29
>>
>>
>> I think all references for Z: should refer to u verb?  Would Z: ever be 
>> called in v verb?  _1&Z: makes no sense.
>> As a simple example, find first prime whose next prime is greater than 5 
>> higher?
>>
>> [`(_2 Z: 1:)@.(5 < -) F.. ] p: i.20
>>
>> 23
>>
>>
>>
>> [`(_2 Z: 1:)@.(5 < -) F:. ] p: i.20  NB. multiple version that builds list 
>> and stops on condition.
>>
>> 3 5 7 11 13 17 19 23
>>
>> How might you get the first prime whose previous neighbour is less than 5 
>> higher? (29)
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ---
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> ----------------------------------------------------------------------
> 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
  
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to