kevinlawler / kona

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

`_gtime _t` does not zero-fill as in `HHMMSS` format #631

Open 0ihsan opened 1 year ago

0ihsan commented 1 year ago
t: -392059337
(24 60 60 _vsx t ! 86400)
100 _sv (24 60 60 _vsx t ! 86400)
_gtime t

outputs

6 37 43
63743
20220731 63743

The HHMMSS section 63743 (6 37 43) should be zero-filled like this 063743 (06 37 43) I think _sv implementation is related to this.

tavmem commented 1 year ago

In kona:

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

  (24 60 60 _vsx t ! 86400)
6 37 43

  100 _sv (24 60 60 _vsx t ! 86400)
63743

  _gtime t
20220731 63743

In k2.8

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

  (24 60 60 _vsx t ! 86400)
reserved error
(24 60 60 _vsx t ! 86400)
          ^
parse error

  100 _sv (24 60 60 _vsx t ! 86400)
reserved error
100 _sv (24 60 60 _vsx t ! 86400)
                  ^
parse error

  _gtime t
20220730 63743

In k2.8 _gtime _t does not zero-fill either. Arguably, this is a bug in both k2.8 and kona. On the other hand, the intent of kona was to replicate k2.8 as much as possible. It's not clear to me whether this is a bug in kona ... or not.