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