« first day (702 days earlier)      last day (833 days later) » 

00:43
assuming the "int is the char themselves" - in the ascii table?
why not simply 'seed' your global list with the ascii table, you can then treat everything the same ?
 
2 hours later…
02:43
just saying, would be a good idea to link a K documentation page/ tutorial somewhere in the description
@Razetime not a bad idea. I think a good starting point is the oK manual (at least for oK and ngn/k)
yep, ngn told me
searching up "K documentation" shows schooling websites
@Razetime my trick with googling k is to use "kdb" instead. the official kx/q docs are mostly applicable (although they're focused on q and not on the underlying k)
nice
@ngn yes
03:15
@coltim this page is GREAT
@Razetime all credit to @JohnE!
03:29
@ngn 1bit int is very useful, like chess bit board.
is ngn/k no longer open source?
04:19
@HaoDeng I think it's on sourcehut, still open source
 
3 hours later…
07:53
it seems that my documentation has proved at least as useful as my k interpreter for the broader open-source vector languages community
absolutely
@JohnE yes, very helpful
 
2 hours later…
09:44
@ngn you could also store compact symbols as 6chars lowercase only in 4 bytes.
ngn
ngn
10:28
@juanez the int is the chars. i mean, if the identifier is "abc", it's represented as 'a'|'b'<<8|'c'<<16. this way it can be converted back to a char* simply by casting (assuming little-endian arch).
if it's longer than 3 bytes, it becomes the (negative of) an index in a global grow-only list, and getting back the char* takes some pointer chasing, but so what.
in my current experiment i parse symbols (max 6 chars) as:
if x >= 'a' && x <= 'z' { // parse symbol
Y *= 32
Y += x - '`'
}
ngn
ngn
@ktye that takes a bit more effort to encode and decode, compared to no-op casting. but it could make sense if you're expecting longer identifiers on average.
i also need some bits (of these 32) for type-tagging.
ngn
ngn
@ktye 32 is 2^5, and you said you can fit 6 chars, so that's 5*6=30 bits, so there are only 2 bits left for tagging
:56986348 no problem
..000 pointer(list)
....1 int x>>1
...10 symbol x>>2
..100 operator x>>3
ngn
ngn
10:40
@ktye why not Y += x - 'a'?
because the parser is "basic" and does not keep state. Y=0 means it's not currently parsing a symbol. same for numbers.
ngn
ngn
who needs more than 3 chars anyway :)
52letters * 62alphanumerics^2 ≈ 200000, that should be enough for everybody
@ngn how do you use symbols for variable lookup?
ngn
ngn
@ktye globals are stored in an ordinary dict (there's room for optimization there), locals are looked up by index (like offsets from some base pointer on the stack)
10:58
@ngn that means you have to do a linear scan over all keys to find the location of a global.
ngn
ngn
@ktye yeah
some day i'll get to optimizing the bytecode a bit more, and then a reference to a global can be a direct pointer
in my k, symbol values are offsets for both: to lookup the string from from the list of keys and to lookup values of global variables.
i'm surprised this gives 1 in both k9 and ngn/k
  97~"a"
1b
ngn
ngn
@ktye so if i name my variable "abc", its offset would be 1091 (i.e. 32/1 2 3)?
@ngn no. the above 6 char thing is another language. the offsets are in my k implementation.
ngn
ngn
11:06
@chrispsn thanks, i'll fix that
searching is done at parse time only for symbols. if the key exists, it's offset in the key list is used as the value (otherwise appended). the global value list must be kept in sync (has always the same length). this means ab`c also creates 3 global variables even if they are never used. as a consequence, there is no undefined error.
ngn
ngn
@chrispsn actually, it already works. are you using an old version?
@ngn huh. i was using the web repl... clearly going crazy
ngn
ngn
@chrispsn why does k9 print 1b instead of 1? are booleans not ints?
they are ints to the user but they display as booleans and i think they are booleans behind the scenes
boolean display/syntax may go away entirely
ngn
ngn
11:22
@Razetime in this chat room's description?
@ngn yep yep
ngn
ngn
room topic changed to the k tree: see oK's manual for a quick introduction to k (k6 dialect) (no tags)
looks like markdown doesn't apply at all to the description
ngn
ngn
room topic changed to the k tree: see github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual.md for a quick introduction to k (k6 dialect) (no tags)
cool
ngn
ngn
11:26
@Razetime SE chat is strange
i've been writing a 'welcome to k' doc but it's not really a tutorial - just a bunch of links - and it needs work gist.github.com/chrispsn/6b9ed1c3dc8bf5594d8e6022495f390a
@ngn I think everyone unanimously hates SE chat lol
Make a K Wiki, pronounced "quickie"
ngn
ngn
@chrispsn that would be a very useful thing to link to
@chrispsn "...tables (one column per dimension)" is that correct?
i'd say that tables flatten higher dimensional arrays by catenating data AND adding an additional key column (which can be grouped on to recover an index into the dimension)
@ktye I think of the column count as the equivalent of matrix rank
ngn
ngn
11:37
@Razetime kona has a relatively well-developed wiki
@ktye specifically with this example in mind news.ycombinator.com/item?id=24168132
12:08
hmm going back to speed of lobsters
i wonder - if the fill char is pretty flexible - if anything could be done with {x*y{y_x,y=:*x}/x}
i mean this gets to the same char count (and with the right fill value) without the expand trick {`c$42|x*y{y_x,y~:*x}/x}, but it's not an improvement
it could be cool if "ab"|"cd" resulted in a string, not ints
@chrispsn (although it does now match ngn/k in k9 :) )
 
2 hours later…
14:01
@chrispsn going back to this, something I think could be interesting would be ?=list returning the original list. I would have to play around more, but there may be times where it's more convenient to work with the =x representation (the tricky part now with that is transforming it back to a flat list)
14:23
me too! playing around with
https://ngn.bitbucket.io/k/#eJxVUttu2zAMfc9XEN7LJgQYhmLAED85sixfI+sSS3YQFFmWtFvTdWnTxm7RfvvkOFdBECXykIc64HLwNr+u+58d5LjXzZf5oPlA9fvXXm8zeJvUbuO+TpeTxq2n773NxInAZzBiCjAbKcFSUCEBmRPig6dAhxEOIWVDqYiQ4EfEcR3M/Nagw5o/oIv16/KJFp1xpi2fIlJhT1oOJaIRtXWUJ+25aSGzp0NOBx7TNNQezYEX5UhVWWCB48515nlGq9vt7OYfWr80fzev98sumYvEw8aA1kHsQSzL2A8CDwodUNOmcRwUrV23X9iRLs+7ftk9u1IV6EpSVoQhxCzXEFFsIBubGEyWRdL4I1CQZkNbjeJxbNLhQZ+b85ItyzP6g+qTa4V+dhSJCSCmWUXiMh9C6Tlu3zlXeXEhTECAmTKB0iKIaWE2Xp/iDLSAIIsSG2Ja7G8PaPuIlve/7zpQTkmloGQVLjkHXxgFFBdeDKGBFCIDhmRRljFz6mXh9K9+fHL2LAnHaQJDCBOqRNiiWpY7p//t6
 
8 hours later…
ngn
ngn
22:13
@JohnE the graphical demos are very useful too, to impress people

« first day (702 days earlier)      last day (833 days later) »