By definition, the result of the last iteration of u^:(<_) y is equal
to the last result of u^:(<_) y

For example:

   (5 <. >:)^:(<_) 1
1 2 3 4 5

Here, there would be five evaluations of (5 <. >:)

   (5 <. >:) 1
2
   (5 <. >:) 2
3
   (5 <. >:) 3
4
   (5 <. >:) 4
5
   (5 <. >:) 5
5

The redundant evaluation would be a part of an infinite series of
equal values which is joined together as a single value (the first
of those).

That said, floating point numbers are compared using tolerant
equality. If that is a problem for you, you should set comparison
tolerance to zero (9!:19 at
http://www.jsoftware.com/help/dictionary/dx009.htm )

Thanks,

-- 
Raul


On Thu, Oct 27, 2016 at 11:59 AM, Xiao-Yong Jin <[email protected]> wrote:
>    c=:1 :'u y [n=:>:n'
>    f=:-:@(+1.3&%)
>    ":!.17 f c^:_[1.5 [n=:0
> 1.1401754250991381
>    n
> 5
>    ":!.17 f c^:(<_)[1.5 [n=:0
> 1.5 1.1833333333333333 1.140962441314554 1.1401756965342444 1.1401754250991702
>    n
> 5
>
> It seems that with ^:(<_), it did 5 iterations, but only the results of the 
> first 4 along with the original right argument(1.5), is returned.  If you 
> give it ^:(<5), the result of the 5th iteration is also not returned, 
> although it did it.  I know it is what the dictionary describes, but is there 
> a way to get the result of the last iteration when the boxed form is used 
> without applying the verb again?  It's useful when I have an costly verb and 
> want to get to the last result when a loose tolerant comparison is used.
>
>
> PS. a bug in j804 affects ^:(<_), so you need j805beta to try the above 
> sentences.
> ----------------------------------------------------------------------
> 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