I spent some time describing the application.  You can also think of the 
application as search every web page on every ipv4 until the first interesting 
thing is found.  Maybe I care about a 2nd interesting thing, maybe I don't.  
But I'd like to see the first before I ask for another, and the approach of 
finding them all and then returning the first is not practical.

The explicit version I provided is not unworkable.  I was hoping that there is 
a version with {. and $:@:}.


----- Original Message -----
From: Raul Miller <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Saturday, November 16, 2013 8:56:03 PM
Subject: Re: [Jprogramming] repeatuntil and repeat while tacit definitions      
possible?

   ({~ 1 i.~ 6 < ]) +: 2 1 3 2 4 5 2
8
   ({.~ 1 i.~ 6 < ]) +: 2 1 3 2 4 5 2
4 2 6 4

Now you might argue that this is not the same thing. But it is the same result.

It's just faster to compute this way. And, ok, I understand that speed
is not necessarily desirable. But I think in this case you might want
to just use a different language.

-- 
Raul


On Sat, Nov 16, 2013 at 6:51 PM, Pascal Jasmin <[email protected]> wrote:
> its not the same...
>
> notice how both functions return fewer elements than are in y.
>
>     +:  repeatuntil (6 < ]) 2 1 3 2 4 5 2
>  8
>     +:  repeatwhile (6 < ]) 2 1 3 2 4 5 2
>  4 2 6 4
>
>
> I'd guess I need @. and $:
>
>
> ----- Original Message -----
> From: km <[email protected]>
> To: "[email protected]" <[email protected]>
> Cc:
> Sent: Saturday, November 16, 2013 6:06:06 PM
> Subject: Re: [Jprogramming] repeatuntil and repeat while        tacit   
> definitions     possible?
>
> The third shaded paragraph tells how to do a while loop with ^:
>
> --Kip Murray
>
> Sent from my iPad
>
>> On Nov 16, 2013, at 4:34 PM, Pascal Jasmin <[email protected]> wrote:
>>
>> I do.
>>
>> ^: either applies to y if v returns true, or returns y.
>>
>> what I want is to stop application once v u y is true, and return the last u 
>> y.
>>
>> The application is searching for a unique (or non existing) value across 
>> multiple locations, but once it is found, stop looking.
>>
>> I tried something with {. to feed locations one at a time, and then $:@:}. 
>> as the keep looking instruction, but I may not understand $: well enough.
>>
>>
>>
>>
>> ----- Original Message -----
>> From: R.E. Boss <[email protected]>
>> To: [email protected]
>> Cc:
>> Sent: Saturday, November 16, 2013 4:54:30 PM
>> Subject: Re: [Jprogramming] repeatuntil and repeat while tacit    
>> definitions    possible?
>>
>> Are you aware of http://www.jsoftware.com/help/dictionary/d202v.htm ?
>>
>>
>> R.E. Boss
>>
>> (Add your info to http://www.jsoftware.com/jwiki/Community/Demographics )
>>
>>
>>> -----Original Message-----
>>> From: [email protected] [mailto:programming-
>>> [email protected]] On Behalf Of Pascal Jasmin
>>> Sent: zaterdag 16 november 2013 21:32
>>> To: [email protected]
>>> Subject: [Jprogramming] repeatuntil and repeat while tacit definitions
>>> possible?
>>>
>>> 2 conjunctions with monad only versions shown for simplicity
>>>
>>> repeatuntil =: 2 : 'for_i. y do. if. v"_ s =. u i do. s break. end. end.'
>>>
>>> repeatwhile =: 2 : 0
>>> out =. i.0
>>> for_i. y do. if. v"_ s =. u i do. out break. else. out =. out , s  end.
>> end.
>>> )
>>>
>>>    +:  repeatuntil (6 < ]) 2 1 3 2 4 5 2
>>> 8
>>>    +:  repeatwhile (6 < ]) 2 1 3 2 4 5 2
>>> 4 2 6 4
>>>
>>> both short circuit based on finding an exit condition.  I'd be surprised
>> that a
>>> tacit version is possible, but maybe through scan '/' and ^: ?
>>>
>>> I understand that the example is silly overkill, but the main application
>> is for
>>> repeatuntil is searching in many locations sorted by the likelihood of
>> finding it
>>> in a location.
>>> ----------------------------------------------------------------------
>>> 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
>
> ----------------------------------------------------------------------
> 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