Closed bakul closed 5 years ago
Unfortunately, this does not appear to be a regression. (Regressions are often easier to fix.) I checked the status of kona using a commit made on June 23, 2011 and got the same result.
Both of these work:
(2 2# 1 2 3 4) ,' (2 2# 5 6 7 8)
(1 2 5 6
3 4 7 8)
1 2 ,' 5 6
(1 5
2 6)
Somewhere, the transition between the 2 steps fails:
(2 2# 1 2 3 4) ,'' (2 2# 5 6 7 8)
((,[5;];,[6;])
(,[7;];,[8;]))
Will try to find that transition.
Both of these cases are arguably simpler, but have a similar problem in Kona. Note that (in the 1st case) Kona yields both an incorrect data structure, and incorrect numbers.
$ rlwrap -n ./k
kona \ for help. \\ to exit.
1 +'' 2 2 # 1 2 3 4
((+[1;];+[2;])
(+[3;];+[4;]))
+'' 2 2 # 1 2 3 4
((+[1;];+[2;])
(+[3;];+[4;]))
Of the above, only 1 case is valid in k2.8
$ rlwrap -n ./k
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
\ for help. \\ to exit.
1 +'' 2 2 # 1 2 3 4
(2 3
4 5)
+'' 2 2 # 1 2 3 4
valence error
+'' 2 2 # 1 2 3 4
^
> \
The second expression should be +:''2 2#1 2 3 4
to get rid of the valence error and then it works the same way in k and kona.
After the commit titled: "partial fix for issue 539": These 2 cases work:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a: 2 2 # 1 2 3 4
5 +'' a
(6 7
8 9)
5 ,'' a
((5 1
5 2)
(5 3
5 4))
This case is still broken (but differently):
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a: 2 2 # 1 2 3 4
a ,'' a
((1 2 1
3 4 2)
(1 2 3
3 4 4))
Another case that still fails, but differently: before the commit "partial fix for issue 539":
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a:1 2
a ,' a
(1 1
2 2)
a ,'' a
(,[1;];,[2;])
a ,''' a
(,[1;];,[2;])
After the commit:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a: 1 2
a ,' a
(1 1
2 2)
a ,'' a
((1 1
2 1)
(1 2
2 2))
a ,''' a
(,[1;];,[2;])
In k2.8
$ rlwrap -n ./k
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
\ for help. \\ to exit.
a: 1 2
a ,' a
(1 1
2 2)
a ,'' a
(1 1
2 2)
a ,''' a
(1 1
2 2)
In k 1,1
== 1,'1
== 1,'...'1
== 1 1
. In general this is true for any verb. Given x
f
E y
, where f
is a dyad and E is one or more '
(that is, each), once x
and y
become scalars, further each adverbs should be thrown away.
After commit titled "fix more of issue 539" this works:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a: 2 2 # 1 2 3 4
a ,'' a
((1 1
2 2)
(3 3
4 4))
Still need to fix the "throw away" of excessive "each" adverbs
The case in which a scalar is on the right is also still broken:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a: 2 2 # 1 2 3 4
a +'' 5
+[5;]
a ,'' 5
,[5;]
After commit "fix: scalar on right (issue 539)", this works:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a: 2 2 # 1 2 3 4
a +'' 5
(6 7
8 9)
Oops: This is still broken:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a: 2 2 # 1 2 3 4
a ,'' 5
(1 2 5
3 4 5)
After commit "issue 539: fix scalar on right (with join)", this works:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a: 2 2 # 1 2 3 4
a ,'' 5
((1 5
2 5)
(3 5
4 5))
Still not right. Try
a:(1 2;3 4)
a,'''a
This should be identical to a,''a
I believe that your example is a case where extra "each" instances need to be "thrown away". Another example:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
1 , 2
1 2
1 ,' 2
1 2
1 ,'' 2
Segmentation fault (core dumped)
After the commit "fix 539: some of the extra each examples", both of the examples above work. Leaving this issue open for a while, as there are probably other examples that faill.
$ rlwrap -n ./k
kona \ for help. \\ to exit.
a:(1 2;3 4)
a,'''a
((1 1
2 2)
(3 3
4 4))
1,'2
1 2
1,''2
1 2
1,'''2
1 2
Here's an example that still fails:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
"a","b"
"ab"
"a",'"b"
"ab"
"a",''"b"
Segmentation fault (core dumped)
After commit "fix 539: extend coverage to float, char & symbol" all of these work:
$ rlwrap -n ./k
kona \ for help. \\ to exit.
"a" ,'' "b"
"ab"
`a ,'' `b
`a `b
1.1 ,'' 2.2
1.1 2.2
This should yield