>> SC =: 3 : '(3 3$4>i.5) ,./^:2@(*/)^:y ,.1' > > SC confuses me. I would have thought that > > (3 3$4>i.5) (*/)^:y ,.1
The left operand of the power operator ^: is ,./^:2@(*/) . > I claim the examples in my message unambiguously specify the extended H > problem. More details (and solutions) can be found in > http://code.jsoftware.com/wiki/Essays/Extended_H > > So the result should be a matrix in which each entry is either a number, > a "-" or "|", or ""? Each element of the matrix is a - or a | or an o ("oh") or a blank. J has more merits than just being free. On Fri, Dec 1, 2017 at 9:13 PM, Dabrowski, Andrew John <[email protected] > wrote: > On 12/01/2017 01:20 AM, Roger Hui wrote: > > Cantor =: 3 : ', 1 0 1 */^:y ,1' > > SC =: 3 : '(3 3$4>i.5) ,./^:2@(*/)^:y ,.1' > Nice! The first algorithm can easily be implemented in Mathematica with > > cantor2[n_] := Nest[Flatten@Outer[Times, #, {1, 0, 1}] &, {1}, n] > > Mathematica also allows many solutions to a problem. > > I don't want to sound like a shill for Mathematica, but it's a great > package with a great ecosystem; it's just obscenely expensive. J might > be a nice free alternative. > > SC confuses me. I would have thought that > > (3 3$4>i.5) (*/)^:y ,.1 > > would produce a noun of rank 2y+2, and that each application of ,./ > would reduce the rank by 1, so we would have to apply it 2y times; yet > you only apply it twice. > > > > Recursive solutions using the Mathematica ReplaceAll (/.) idea are also > > possible, using indexing ({): > > > > Cantor1=: 3 : 'if. 0=y do. ,1 else. ,(Cantor1 y-1){0,:1 0 1 end.' > > SC1 =: 3 : 'if. 0=y do. ,.1 else. ,./^:2 (SC1 y-1){0,:3 3$4>i.5 end.' > > > > Checking that they give the same results: > > > > (Cantor -: Cantor1)"0 i.8 > > 1 1 1 1 1 1 1 1 > > (SC -: SC1)"0 i.8 > > 1 1 1 1 1 1 1 1 > > > > I claim the examples in my message unambiguously specify the extended H > > problem. More details (and solutions) can be found in > > http://code.jsoftware.com/wiki/Essays/Extended_H > > > So the result should be a matrix in which each entry is either a number, > a "-" or "|", or ""? > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
