« first day (853 days earlier)      last day (682 days later) » 

ngn
12:02 AM
@Bubbler the argument that finally convinced me to implement rank-sensitive find (it took a long time) was that "find" should be (as close as possible to) an inverse of "at"
for instance, it's nice to be able to make a dictionary and index it like this:
 d:("key";"anotherkey")!("value";"anothervalue")
 d["key"]
"value"
instead of
 *d[,"key"]
"value"
 
Hmm
 
ngn
dict indexing is "find it in the domain and at it in the range", i.e. if d:k!v then d[x] is v@k?x
so it's nice for @ and ? to complement each other in cases like this
but (as i tried to argue above) "except" is a different matter
 
That somewhat makes sense for "find"
combined with the fact that the right arg of @ can be a multi-dimensional array of indices
And yes, "except" is unrelated to this matter
 
ngn
@Bubbler yes, or a ragged array, or a mixed-rank array..
 
But then how do you actually do a rank-sensitive find? Recursively dig through y until a match is found in x?
 
ngn
12:18 AM
Jul 4 at 15:32, by ngn
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
 
So both x and y are required to have some uniform rank?
 
ngn
@Bubbler only x is required (though i don't actually verify that, i just assume it.. for performance reasons)
rank (with assumption of uniformity) is defined as: rank(atom)=0, rank(list)=1+rank(first(list)), rank(dict)=rank(values(dict))
 
12:32 AM
So it somewhat works if x is uniform and y is not too ragged
 
ngn
i think it should work whatever y is
i mean, in some cases it may error..
but you can do things like ("ab";"cd")?("ab";,"ab";,,,,"ab";())
 
Btw why not 0N instead of error?
 
ngn
good question
@Bubbler if ("ab";"cd")?"a" is 0N, the inverse ("ab";"cd")@0N is " " (two spaces)
i'm a little uncomfortable with "a" and " " having different ranks
 
12:49 AM
Oh ok, I guess it's a sensible decision
 
 
4 hours later…
4:56 AM
johnearnest.github.io/ok/ike/ike.html?key=M7RwLwQ1 I got the required rice field pattern, but the first band isn't matching up quite right
might be a floating point inaccuracy
 
5:44 AM
oh re. the identity matrix thing there's also a cute tacit version in dialects which have a rotate primitive, like k3: (-1!)\0=!:
it works because converge-scan halts when you revisit the initial value in the sequence
 
ah nice
 
perhaps the page on odometer could use an implementation: {+x\'!*/x}
worth noting that in some dialects (early k5, I think?) the result was the transpose of what oK and ngn/k produce now, for reasons which may be obvious given the above implementation
 
@JohnE sure, I'll add it in
which dialects do not have odometer
 
hmm. well, k2/3 don't have it
dunno about k4
in k3 it would be {x _vs!*/x}
in q it's {x vs til prd x}
and I don't see a mention of odometer in the kdb+ documentation, nor does ! appear to have it as an overload in k4
 
6:02 AM
sure, I'll also add the k3 one
 
I don't have kona installed on this machine but the k3 one will probably work there too
 
@JohnE Try it online! works alright
@JohnE this is k6 right
 
haha well looks like kona gives you the transpose of the k3 version
the original version I gave was k6, yeah- works in oK and should work in ngn/k
I think if you dig around in the right places it's possible to find a real copy of k2 online. I have a personal license for k3 which I cannot redistribute, but I can always try stuff out for people
 
cool, added
 
so to clarify the k3 version I provided has the exact same behavior as the k6 version. Kona, however, appears to have different semantics (a bug?) for _vs
so kona gives you transposed output
 
6:13 AM
@Razetime neat! i think the issue may be the denominator; what about this?
 
one general note: if you're drawing a single matrix as a bitmap, you can leave the position off entirely (like (;pal;image) ) and it'll automatically be centered on the display. This saves a few characters in this program and makes it easier to make stuff resizable.
also while oK doesn't have it, iKe adds a pow[x;y] function along with several other handy math functions
 
6:41 AM
@coltim @Razetime how about this oneliner:

w:100;h:60;{,(;gray;+_255*((pow[1+!h;x])!\:/:1+!w)%pow[w;x])}0.7
or, golfing further,

w:100;h:60;p:pow[;0.7];,(;gray;+_255*((p 1+!h)!\:/:1+!w)%p w)
and it looks fine to me with the default size:

p:pow[;0.7];,(;gray;+_255*((p 1+!h)!\:/:1+!w)%p w)
 
hi guys
 
welcome
 
hi guys
 
@JohnE canvas needs to be size of the args
@coltim idk how that works tbh
because the questions says R^s
 
6:56 AM
oh, is this a golf problem
 
but removing the power somehow works
@JohnE yepyepyep
@MaximusSu welcome, new to K?
@JohnE using w and h will save a bunch of bytes
 
as well as just generally untangling all those nested lambdas in the original version
 
did not know pow existed in iKe
 
@JohnE quite maddening to forget that i'm using an array language
 
7:04 AM
A.B.C.: Always Be Conforming
 
whatzat mean
 
conforming is what atomic operators do: line up scalars to vectors and vectors to vectors and so on
 
'll write that down
 
I'm also making an oblique reference to a famous scene in the film Glengarry Glen Ross: youtube.com/watch?v=w7y6EOGY87U
 
added to watchlist
wow this movie is stacked
 
7:11 AM
it's one of the most crystalline representations of the mind of a salesman in cinema
 
I've seen whiplash for the musician, blackswan for the dancer's mind, birdman for the performance artist
I'll tell you when i watch it :thumbsup:
 
Wag The Dog might be an ideal example for PR
or you could just read edward bernays' Propaganda
probably the most societally-damaging book of the 20th century
 
"full on horror disguised as a buddy comedy"
that's a description
 
 
3 hours later…
ngn
10:32 AM
@Razetime @Bubbler this looks wrong: <syntaxhighlight lang="apl">
 
needs a highlighter for k
 
ngn
empty highlighter works well for k :)
4
 
mm doesn't sit right with me
but if it doesn't look correct I'll remove it
 
ngn
one example: ' delimits a string in apl but is an adverb in k
 
yep removed it
 
ngn
10:36 AM
thanks
 
 
3 hours later…
1:29 PM
@JohnE that is super cool
 
 
4 hours later…
ngn
5:33 PM
@Razetime in case you didn't know: you can use 1-space indent instead of <pre> or <syntaxhighlight>
 
 
2 hours later…
7:13 PM
@ngn is there any way to convert a number to hexadecimal in ngn/k? `c$ only works if the value is outside the printable ASCII space
maybe passing that into a hex@?
 
ngn
@coltim or using stuff from golf.k: (𝔻[],𝔸[])@16\
@coltim `hex@ is for strings (currently)
 
I see. it is for a golf, and I think the value I would want to output in hexadecimal would be <255, so maybe I can get away with hex@`c$ here
@ngn hmm, this works when run locally (returning !0) but throws a 'lmt on the wasm version
 
ngn
7:33 PM
something's wrong with "where" on an empty int list in wasm: &!0
@coltim works now
 
7:49 PM
@ngn that was fast, nice!
 

« first day (853 days earlier)      last day (682 days later) »