I can reproduce this error, though I don't understand it.
After defining ktour and kmoves from the essay, I get this error:
ktour 8
|length error in kmoves, executing dyad #
|x is a list of 8 values but y has 6 items
| (*./"1 t e.i.y) <@#"1 y#.t
But enabling suspension and inspecting the data, I see this:
ktour 8
$ y#.t
64 8
$ (*./"1 t e.i.y)
64 8
I'm not sure where the "6 items" in the error message comes from. (I
could speculate, but that would be just blind guessing.)
Thanks,
--
Raul
On Tue, Jan 17, 2023 at 11:58 AM Brian Schott <[email protected]> wrote:
>
> I am finding a "length error" in the `kmoves` monad at the following link.
>
> https://code.jsoftware.com/wiki/Essays/Knight%27s_Tour
>
> Below is an excerpt of my jconsole session. The error is NOT created if I
> split the failing code expression up as you can see at the very bottom.
>
> kmoves=: 3 : 0
> t=. (>,{;~i.y) +"1/ _2]\2 1 2 _1 1 2 1 _2 _1 2 _1 _2 _2 1 _2 _1
> (*./"1 t e. i.y) <@#"1 y#.t
> )
> kmoves 8
> |length error: kmoves
> | (*./"1 t e.i.y) <@#"1 y#.t
> load'debug'
> dbss'kmoves 1'
> dbr 1
> kmoves 8
> |stop: kmoves
> | (*./"1 t e.i.y)<@#"1 y#.t
> |kmoves[1]
> (*./"1 t e.i.y);&$ y#.t
> ┌────┬────┐
> │64 8│64 8│
> └────┴────┘
> datatype (*./"1 t e.i.y)
> boolean
> datatype y#.t
> integer
>
> l=.(*./"1 t e.i.y)[r=. y#.t
>
> $l <@#"1 r NB. no error here, though
>
> 64
> JVERSION
> Engine: j903/j64/darwin
> Release-b: commercial/2022-01-28T04:11:24
> Library: 9.03.08
> Platform: Darwin 64
> Installer: J903 install
> InstallPath: /users/brian/j903
> Contact: www.jsoftware.com
>
> --
> (B=) <-----my sig
> Brian Schott
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm