kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

Missed valence error #553

Closed tavmem closed 4 years ago

tavmem commented 4 years ago

"... whenever Each is applied to the monad of a primitive verb ... the monadic case must be made explicit by modifying the verb with colon."

In k2.8:

$ rlwrap -n ./k
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
\ for help. \\ to exit.

  #:' (1 2; 3 4 5)
2 3
  #' (1 2; 3 4 5)
valence error
#' (1 2; 3 4 5)
^

In kona:

$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  #:'(1 2; 3 4 5)
2 3
  #'(1 2; 3 4 5)
(#[1 2;];#[3 4 5;])
tavmem commented 4 years ago

Related to this issue:

One of the tests for kona in src/tests.c is: TC_("a:(#'3 4 6)[0]; a 9", "9 9 9")

However, in k2.8:

K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
Evaluation. Not for commercial use. 
\ for help. \\ to exit.

  a:(#'3 4 6)[0]; a 9
valence error
a:(#'3 4 6)[0]; a 9
   ^
>
tavmem commented 4 years ago

Similarly, one of the other tests for kona in src/tests.c is: TC_(".'\"98\"", ".'\"98\"")

But in k2.8:

K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems 
\ for help. \\ to exit.

  .'"98"
valence error
.'"98"
^
>
tavmem commented 4 years ago

There is yet another test for kona in tests.c that does not work in k2.8. It definitely looks like there was a planned extension to k3. That would be fine, except for some basic capabilities not working, that caused creation of this issue.

The test is: TC((0 1;1 2 3) , a:(!a)+!:/:2+!a:4; a[0 1;]) //Extension: !:/:2+!4 works. K3.2 valence err for !, !:, or (!:)

in k2.8:

K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems 
\ for help. \\ to exit.

  a:(!a)+!:/:2+!a:4; a[0 1;]
valence error
a:(!a)+!:/:2+!a:4; a[0 1;]
       ^
>
tavmem commented 4 years ago

A 4th test for kona in src/tests.c that does not work in k2.8 ... ... further evidence of an extension that inadvertently caused problems with core k3 concepts.

The test is: TC((2#,(,0;,1)), =:/:(1 2;2 1)) //Nice extension to K3.2, which errs on both =/: and =:/:

in k2.8:

K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
\ for help. \\ to exit.

  =:/:(1 2;2 1)
valence error
=:/:(1 2;2 1)
^
>
tavmem commented 4 years ago

A 5th test for kona in src/tests.c that does not work in k2.8

The test is: TC_("a:.'(+;-);a@\:1 2", "3 -1")

in k2.8:

K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
Evaluation. Not for commercial use. 
\ for help. \\ to exit.

  a:.'(+;-);a@\:1 2
valence error
a:.'(+;-);a@\:1 2
  ^
>