I can reproduce your result here on my beta-7:
{: (0 # ,) 3 + 0 $. 4 + i.3
3
{. (0 # ,) 3 + 0 $. 4 + i.3
3
{. (0 {. ,) 3 + 0 $. 4 + i.3
3
{. (0 {. ,) 3 + 0 $. i.3
3
This does, though, give us a way of satisfying people who wanted a
mechanism for specifying the fill value for an array.
That said, playing with this, I found a way of crashing J:
(,: 0 $. i.)@>3 4
FYI,
--
Raul
On Thu, Nov 9, 2017 at 9:50 PM, robert therriault <[email protected]> wrote:
> Raul,
>
> You have a newer beta than I do? Is there no end to your wizardry!
>
> But, I see the same thing now that I am updated to the commercial version of
> j806
>
> JVERSION
> Engine: j806/j64/darwin
> Release: commercial/2017-11-06T10:20:33
> Library: 8.06.09
> Platform: Darwin 64
> Installer: J806 install
> InstallPath: /users/bobtherriault/j64-806
> Contact: www.jsoftware.com
> numeric=: 0 = 0 {.@{. ,
> numeric 4+0 $.i.3
> 0
> numericM=: monad : '0 -: 0{ , 1{. 0#y'
> numericM 4+0 $.i.3
> 0
>
> But then I noticed something that I hadn't known about sparse arrays and
> their sparse characters
>
> numeric 0 $. 4 + i.3
> 1
> numericM 0 $. 4 + i.3
> 1
> 3 $. 0 $. 4 + i.3 NB. Sparse character displayed using 3 $. y is 0 after
> sparse array is first created
> 0
> 3 $. 3 + 0 $. 4 + i.3 NB. Sparse character changes if entire array is
> changed later
> 3
> (0 # ,) 3 + 0 $. 4 + i.3 NB. Empty
> {: (0 # ,) 3 + 0 $. 4 + i.3 NB. result comes from updated sparse character
> 3
>
> I think that this is what breaks numeric and numericM, but there is always
> more to know
>
> s=: (0 # ,) 3 + 0 $. 4 + i.3
> s NB. Empty array
> {:s NB. now we know the 3 comes from the sparse character
> 3
> (1,{:) s NB. makes sense
> 1 3
> (1,{.) s NB. turns out first of empty is sparse character as well
> 1 3
> s -: 0$0 NB. s is empty, right?
> 1
> ((0$0),{.) s NB. empty and integer is list
> 3
> (s,{.) s NB. this displays like 0 $ 0
> $(s,{.) s NB. but has a shape of 1
> 1
>
> It turns out it this is what an empty sparse array looks like. It has zero
> non-sparse entries.
>
>
> Cheers, bob
>
>
>> On Nov 9, 2017, at 12:56 PM, Raul Miller <[email protected]> wrote:
>>
>> I'm using Beta-7, where you are using Beta-6.
>>
>> That might be the issue?
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm