« first day (849 days earlier)      last day (686 days later) » 

ngn
12:08 AM
rank-sensitive find in ngn/k. if it breaks anyone's code, please tell me and i'll revert.
 
 
4 hours later…
3:56 AM
@ngn nono keep it we need more reference links
 
 
3 hours later…
6:34 AM
@Razetime github.com/JohnEarnest/ok/blob/gh-pages/docs/Programming.md and github.com/JohnEarnest/ok/blob/gh-pages/docs/Trees.md may be of general interest. My blog also has a few articles demonstrating/discussing algorithms in (o)K: beyondloom.com/blog/index.html
special-K isn't really a K implementation but it might be entertaining to some
 
 
1 hour later…
7:54 AM
@JohnE special-K is a cereal right
@JohnE I've added a few links to the loom blog
 
ngn
philosophical question: what is the rank of a dictionary?
 
ngn
8:18 AM
and another: should rank-sensitive find tolerate non-uniform rank? e.g. find a record in a table with columns of different rank:
t:+`name`age!(("alice";"bob";"charles");23 34 45)
t?`name`age!("bob";34)
 
8:49 AM
@ngn may need to separate the concepts of rank of keys and values?
 
ngn
@chrispsn ok but x?y needs to compute a single rank for the object in order to decide what to do
 
@ngn whats the K way of finding rank
 
ngn
@Razetime we're trying to define it now
 
aha
 
ngn
it's just a concept, there's no primitive that returns rank
 
9:10 AM
@JohnE this tree article is really useful. I once came across a cp question which needed a tree structure and it was very annoying to try and implement.
 
@ngn rank of values
 
ngn
@chrispsn yeah, that's probably the one that makes most sense
i'm also considering rank(dict)=0
 
is it computing it on demand, or does it already know what the rank is behind the scenes (the former as no prototypes?)
 
ngn
@chrispsn my current implementation computes it every time it's needed and makes sure it's unirank
 
from an indexing perspective, a dict is a function just like a list, so if lists have rank, dicts have rank
 
ngn
9:18 AM
@chrispsn but dicts are less likely to be unirank (e.g. records in a table), so treating them as rank0 could help avoid the restriction
i'm not sure this restriction for unirank is a good thing - it's too expensive to compute and in cases like this it gets in the way
 
 
1 hour later…
10:24 AM
i'm trying to extend ngn's approach to sublists to replace each-left/right, or at least provide a way to generate a table without having to raze the result
odometer lets us generate the desired element indices 'flat' but we still need a self-reference to index back in
the possible {y!x y} primitive lets us avoid the self-reference (at least until we apply except or drop), but it seems to take a lot of memory, and it's messy
any thoughts on how to improve the latter?
 
10:48 AM
@chrispsn what am i supposed to do to the result
 
 
2 hours later…
12:36 PM
@Razetime normally each-right would apply the verb directly, but this approach instead generates the pairs independently of the operation done on them (in this case a multiply) which is instead done by */
 
1:22 PM
heh. @ngn if deep where worked on a keyed table then that could generate the pairs for the prime sieve without using each-right or indexing
 
ngn
@chrispsn what's a keyed table? i forgot
 
a table that's a dict
:D
 
ngn
ah, i think i get it
 
^ everything up to the deep where works
 
ngn
ϵ is a bit misleading
 
1:29 PM
sorry, it's a terrible choice of greek, it was just the first one to come to mind
just a placeholder character to get it infix
 
ngn
can't resist the urge to golf :) i!+i!1|=#i:2+!8
 
2:03 PM
Identity matrix - exactly what I was looking for
 
2:54 PM
@ngn I think I found your comparison table a few weeks ago linked from hn or from a repo, amazing resource, I'd keep it up if it isn't too much of a hassle (perhaps link to the wiki or another place if it should go out of date for some reason?)
 
ngn
@tosh yeah, i don't have time and desire to keep it up to date, so i thought it might be better to move it to the wiki
 
@ngn neat! I'll definitely play around with it
 
3:14 PM
@ngn is "unirank" == "all values in the list have the same rank"?
 
ngn
@coltim yes
list or table or dict
 
and the issue is what happens if you have a list or dictionary that contains truly variable data...
I mean there always is the "backup" of where-equals or where-match, which you would probably want to use anyways if your list/dict contains duplicates
 
ngn
@coltim yes, for instance this example
 
@ngn but that's just a table and a row from the table
 
ngn
@coltim but the table is not unirank
a value in the first column is a string (rank1) and in the second column an int (rank0)
the problem can be illustrated with a plain matrix (not table) too:
m:(("alice";23);("bob";34);("charles";45))
m?("bob";34)
 
3:23 PM
hmm, maybe this is the general list vs. rank thing
like intuitively when you have a table and you want to see if a given row is contained within it, you would check each row of the table individually, seeing if the whole of that row matches the whole of whatever "row" you are looking up
 
ngn
@coltim you could be looking for multiple rows though, like table?table
the implementation of "find" i have now is very simple - only 3 cases:
if rank(x)=rank(y)+1 search for y (as a whole) among the elements (i.e. major cells) of x
if rank(x)<rank(y)+1 recurse into y, using the same x
if rank(x)>rank(y)+1 error
 
3:42 PM
@ngn hmm, there I guess it would be something like "search for each y (each as a whole) among the elements/major cells of x"
the q/k4 docs have what appears to be a somewhat recently updated explanation of find here: code.kx.com/q/ref/find
 
ngn
every time i read k4 docs i end up more confused
 
yeh the terminology keeps changing. "simple list" vs. "mixed list" is new to me
 
ngn
so, it starts with a nice simple description of what i call "flat find", and by the end it contradicts itself by describing "rank-sensitive find"
 
the difference between a "list of lists" and a "mixed list" hides a lot of nuance I bet
 
ngn
and in the middle there's a section on "type-specific find" in which i don't see anything type-specific
"x?y can’t deal with mixed-rank x" - literally, the previous example (with u:("abcde";10 2 -6;(2 3;`ab))) showed that :)
 
4:04 PM
I think the difference is if y is a "simple list"; any form of nested list (even if the "leaf" lists are "simple") isn't itself simple?
I mean there's some real flowchart logic going on here
 
 
1 hour later…
5:09 PM
@JohnE woah that is so cool
is there anyplace i can read up on to use this
oht here's a manual
perfect
 
5:44 PM
would love some help with the table and the pages here
 
ngn
6:15 PM
@Razetime these are adverbs: ' / \ ': /: \:, k has no schizos like apl
maybe merge the columns for k3-k6, as they are not too different?
 
6:32 PM
@ngn updated find. it's now like that: github.com/ktye/i/blob/master/k.t#L76,L83 (type based not rank)
 
ngn
@ktye "abc"?(("bc";"a");"cc") /((1 2;0);2 2) - interesting, seems logical
"abc"@((1 2;0);2 2) is (("bc";"a");"cc"), so it passes my test for being an inverse of @
 
6:51 PM
as discussed yesterday, finding a single item of a nested list, i need to enlist: (...)?,() which returns an enlisted index, which is also compatible with @
 
ngn
@ktye you mean like in this test: ((1;"a");(2;"b"))?,(2;"b") /,1?
 
yes
 
ngn
@ktye shouldn't ((1;"a");(2;"b"))?(2;"b") /1 work too?
 
L?L treats y as a vector and loops over each item.
 
ngn
following the same logic, ((1;"a");(2;"b"))@1 is (2;"b")
 
7:05 PM
the lists may have any structure. i don't assume uniformity
 
 
2 hours later…
ngn
8:53 PM
started a wiki page on grammar
 

« first day (849 days earlier)      last day (686 days later) »