Closed gitonthescene closed 2 years ago
Here's a different example which works in tio:
t:10 5 5#(10*5*5) _draw 2
{&/+x,+x}'t
Further, this doesn't work in tio, but I'm not sure why:
t:10 5 5#(10*5*5) _draw 2
{|/&/+x,+x}'t
This works as a workaround, though:
t:10 5 5#(10*5*5) _draw 2
{|/(&)/+x,+x}'t
FWIW, this was all while trying to get the day 4 problem from AoC2021 to work in kona.
[EDIT: I decided to follow my own advice and run git bisect on this last which seemed more straightforward to test. With the attached file to test, I found the first bad rev]
$ git bisect good; make; ./k bug.k
69bf768555e74059fc21e26f44092a779082517a is the first bad commit
commit 69bf768555e74059fc21e26f44092a779082517a
Author: Tom Szczesny <tom@localhost.localdomain>
Date: Sun Sep 1 23:37:25 2019 -0400
fix #521: Recursive call overrides earlier data
src/kx.c | 9 +++++++--
src/tests.c | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)
make: Nothing to be done for `all'.
kona \ for help. \\ to exit.
(0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0)
$
I'll run git bisect on the bug in the original post now...
With the commit that I will make now:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
data:"\n"\1_"
> fs-end
> he-DX
> fs-he
> start-DX
> pj-DX
> end-zg
> zg-sl
> zg-pj
> pj-he
> RW-he
> fs-DX
> pj-RW
> zg-RW
> start-pj
> he-WI
> zg-he
> pj-fs
> start-RW"
data:"\n"\1_"
> start-A
> start-b
> A-c
> A-b
> b-d
> A-end
> b-end"
data:d,|:'d:(`$')'"-"\'data
data:data@&~|/{x=data[;y]}.'+(`end`start;!2)
lg:.+(`end,l;1,97>_ic'*:'$:'l:?data[;0])
sn[l]:~lg[l]
mp:.+(`end,?data[;0];(,()),data[;1]@=:data[;0])
f:{:[(#y)=n:y?x;1;(#y)=1+n;1;(#y)=1+n+(n _1_ y)?x]}
p:,,`start
c:{,/{:[`end=*x;:(,x)];n:mp[*x];(n@&lg[n]|(#x)=x?/:n),\:x}'x}
#(c)/p
10
c p
(`A `start
`b `start)
1(c)/p
(`A `start
`b `start)
2(c)/p
(`c `A `start
`b `A `start
`end `A `start
`d `b `start
`end `b `start
`A `b `start)
t:10 5 5#(10*5*5) _draw 2
{&/+x,+x}'t
(0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0)
t:10 5 5#(10*5*5) _draw 2
{|/&/+x,+x}'t
1 1 0 0 1 0 0 1 0 0
t:10 5 5#(10*5*5) _draw 2
{|/(&)/+x,+x}'t
0 0 0 0 1 0 1 0 0 0
Trying to solve AoC day12 with Kona and spotting more differences between kona on the command line and with tio which I assume means there's been a regression.
The following code produces no output from the command line, but does with tio:
Narrowing it down a bit something goes wrong during the recursion:
Also, I seem not to be able to use the function c:
[EDIT: I ran git bisect on this with the attached file. (suffix changed)]
day12.k.txt