kevinlawler / kona

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

"trace n times" parses incorrectly #515

Closed rats-god closed 6 years ago

rats-god commented 6 years ago

10(+\)\1 1 and 10(||+\)\1 1 evaluate differently, but should be equivalent:

10(+\)\1 1 returns (10; 10 11; (10 11; 11 12))
i expected (1 2; 1 3; 1 4; 1 5; 1 6; 1 7; 1 8; 1 9; 1 10) (which is how kdb+ evaluates this code)

tavmem commented 6 years ago

This bug is not a regression. Using the kona code as of commit 41e48b64aefe0db53f904857dfc5f166a0a2479a made on Nov 24, 2011:

 $ rlwrap -n ./k
K Console - Enter \ for help
  10(+\)\1 1
(10
 10 11
 (10 11
  11 12))

  10(||+\)\1 1
(1 1
 1 2
 1 3
 1 4
 1 5
 1 6
 1 7
 1 8
 1 9
 1 10
 1 11)