Hi Xin,

If I understand your observation correctly (and clearly my first response 
showed I was not correct in my understanding of your original question), I 
would reply that J verbs can be written in an explicit style using control 
words such as if. else. while. etc that would allow you to analyze data in 
sequential chunks until a number of hits were recorded. The verb would not be 
invoked until you chose to employ it, and in that way the evaluation would be 
lazy. The previous replies of how to look at segments of the data to establish 
the frequency of hits would be useful to set the timing of when you wish the 
verb to be invoked.

I don't often use J in this way because I prefer the new ways of thinking that 
tacit, array style programming affords me, but J is flexible enough to become 
procedural if that is what you are wanting. 

I am way over my head in this reply so do not take it as in any way informed, 
although it may generate a much more informed response from others (which is 
what I really appreciate about the knowledgeable participants on this forum).

Cheers, bob

On 2011-10-12, at 9:02 AM, Zheng, Xin (NIH) [C] wrote:

> Thank you all for your excellent answers. So basically may I conclude that: 
> 1. For present there's no way for lazy evaluation in J; 2. For such task, I'd 
> better reshape my mind into J's way.
> 
> Best,
> Xin
> 
> -----Original Message-----
> From: Aai [mailto:agroeneveld...@gmail.com] 
> Sent: Wednesday, October 12, 2011 11:48 AM
> To: Programming forum
> Subject: Re: [Jprogramming] lazily look for label?
> 
> Variable label length string:
> 
> ]S=.;('label',":"0)&.>?~100
> label2label33label46label1label82label91label25 .......
> 
> Just a possibility to extract e.g. the first 6 labels:
> 
> 6{. (<;.1~'label'&E.) S
> ┌──────┬───────┬───────┬──────┬───────┬───────┐
> │label2│label33│label46│label1│label82│label91│
> └──────┴───────┴───────┴──────┴───────┴───────┘
> 
> 
> 
> Hallo Zheng, Xin (NIH) [C], je schreef op 12-10-11 16:34:
>> Hello all,
>> 
>>  'label' I.@E. 'label1label2label3' could give where the label starts in the 
>> string. If the string is very long or infinite, only limited sites, say the 
>> first 100 starting sites, are needed. How to do it?
>> 
>> Thank you,
>> 
>> Xin
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> -- 
> Met vriendelijke groet,
> =@@i
> 
> ----------------------------------------------------------------------
> 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