[Jprogramming] Behaviour '=' dyad on boolean arrays
Roger Hui
rogerhui.canada at gmail.com
Tue Feb 2 23:35:28 UTC 2016
I don't think it's that significant. In 1=?s$2 the 1= is a no-op. It's
there possibly because:
- Muscle memory. In APL, in 1-origin, the 1= is needed to convert integers
to booleans.
- There's a lot of cut-and-paste in making the test scripts. Could have
been cut and pasted from somewhere else.
- Phrase of the moon.
If anyone knows, I should know (I wrote the test script), and I don't
know/remember.
On Tue, Feb 2, 2016 at 2:22 PM, Matthew Baulch <baulch.matt at gmail.com>
wrote:
> I've been reading the tests in the J engine source. Have learned quite a
> bit while doing so! Anyhow, I've become perplexed by one particular line.
>
> In the 'Boolean' section of the tests for 'x i. y' (test/gi.ijs), a random
> table is constructed with
>
> a=:1=?10 5$2
>
>
> My question is, why is a=:?10 5$2 not sufficient. Can someone tell be if
> these are equivalent, or if not, why?
>
>
> I should note that 1=?70$3 is used in the same file, and it's clear to me
> that '1=' affects the probability distribution for rolls over a domain
> larger than two, so it serves a purpose.
>
>
> Sorry if source would have been a better forum for this post. I'm not sure
> if this is an error in the test, or simply a deficiency in my understanding
> of J.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list