on beta g
10 timespacex '(0 {:: ]) ,1'
1.53889e_6 1728
10 timespacex '(0 >@{ ]) 1'
7.12448e_7 1088
10 timespacex '(0 >@{ ]) ,1'
7.97941e_7 1536
similar results with adverb form.
50 timespacex '(0 (&({::))(@:])) 1 2'
1.50469e_6 224050 timespacex '0(&(>@{))(@:]) 1 2'
1.3394e_6 1920
________________________________
From: Henry Rich <[email protected]>
To: [email protected]
Sent: Wednesday, September 19, 2018 1:38 PM
Subject: Re: [Jprogramming] should 0 {:: scalar return that scalar instead of
being a length error?
I modified {:: some time back to handle the case where x is a scalar or
has boxes that contain scalars, and I'm pretty sure that's the fastest
way to extract a single box's contents.
Henry Rich
On 9/19/2018 1:32 PM, 'Pascal Jasmin' via Programming wrote:
> My main motivation for the proposal is related to a favorite adverb:
>
> Y =: (&({::))(@:])
>
> but it turns out that
>
> X =: (&(>@{))(@[)
>
> is faster and has the convenience of easily selecting multiple items from
> what is usually a record format for either argument, as well as not failing
> on a scalar argument.
> so >@{ is a better {:: for many common applications.
>
> ________________________________
> From: Raul Miller <[email protected]>
> To: Programming forum <[email protected]>
> Sent: Wednesday, September 19, 2018 11:31 AM
> Subject: Re: [Jprogramming] should 0 {:: scalar return that scalar instead of
> being a length error?
>
>
>
> If we're going to talk about composites, and unboxing the first item,
> I would imagine that things like >@{. should be considered.
>
> Note that this approach has another advantage - we don't have to worry
> about whether the word to its left is numeric (which can happen if
> this verb gets used in an adverbial or conjunctive context).
>
> Thanks,
>
---
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