sorry

lrA =: 1 : '5!:5 < ''u''' 

lr =: 3 : '5!:5 < ''y'''
lrX =: 1 : ('''('', u lrA , '') '' , lr y';':';'''('', (lr x) , '') ('' , u lrA 
, '') '' , lr y') 


tsA =: lrX((,&'/sec '@":@%@(6!:2) , ,&'MB'@":@(%&1000000)@(7!:2)@:])@:) 
tsfX =: 1 : 'u [ [: 1!:2&2@:timespacex u lrX'




----- Original Message -----
From: Raul Miller <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Wednesday, May 13, 2015 6:14 PM
Subject: Re: [Jprogramming] a neat way to time things or dissect

Without a definition for lrA your definition for lrX can't even parse.

And I, for one, have not memorized all your previous posts.

Might be fun though?

Thanks,

-- 
Raul


On Wed, May 13, 2015 at 5:33 PM, 'Pascal Jasmin' via Programming
<[email protected]> wrote:
> an adverb that will produce a string of is verb argument bound to its x 
> and/or y arguments.
> the string can be executed with ". timex, dissect, or any other function that 
> takes a linear expression as a parameter.
>
> lrX =: 1 : ('''('', u lrA , '') '' , lr y';':';'''('', (lr x) , '') ('' , u 
> lrA , '') '' , lr y')
>
>
>   (2;3;4) + each lrX < 3 4 NB. returns string.
> (2;3;4) (+&.>) <3 4
>
> this is convenient in that once you have a working expression, you can make a 
> string of it by simply placing lrX to the right of the verb phrase.  While 
> quote at begining and end doesn't seem an afront to laziness, you don't have 
> to double quote strings.
>
> to time the expression (note dyadic use of timex),
>   (2;3;4) + each lrX(10&timespacex@:) < 3 4
> 3.36e_6 3200
>
>
> or make a shorthand with your favorite timing formattings.
>
> tsA =: lrX((,&'/sec '@":@%@(6!:2) , ,&'MB'@":@(%&1000000)@(7!:2)@:])@:)
>
>   (2;3;4) + each tsA < 3 4
> 240385/sec 0.0032MB
>
> Here is a tool that creates timings as a side effect which means that you can 
> time just part of an expression, or multiple parts:
>
>
> tsfX =: 1 : 'u [ [: 1!:2&2@:timespacex u lrX'
>
>
>   'x' ,~ tsfX each (;: 'ap b c') ,&": each tsfX  (2;3;4) + each tsfX < 3 4
> 4.8e_6 3200
> 1.056e_5 5888
> 1.92e_6 2176
> 1.92e_6 2176
> 1.92e_6 2176
> ┌──────┬─────┬─────┐
> │ap5 6x│b6 7x│c7 8x│
> └──────┴─────┴─────┘
>
>
> timing printouts are from right to left invocations.  The last one produces 3 
> timings because it was placed inside the each adverb.  Memory use tends to be 
> overstated compared to traditional timespacex if very large data inputs are 
> used (the data is fully linearized and then parsed).  Time I believe includes 
> the parsing time of a noun, but not the calculation time of building that 
> noun.
>
> tsfX executes expressions twice (once by timex, and once to get result)
>
> lrX (dissect @:) is an adverb that can also more easily apply dissect to part 
> of an expression to avoid quoting and cursor movements.
> ----------------------------------------------------------------------
> 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