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

ngn
ngn
00:02
@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"
ngn
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
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
ngn
00:18
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
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))
00:32
So it somewhat works if x is uniform and y is not too ragged
ngn
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
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
00:49
Oh ok, I guess it's a sensible decision
 
4 hours later…
04:56
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
05:44
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
06:02
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
06:13
@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
06:41
@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
06:56
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
07:04
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
07:11
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
ngn
10:32
@Razetime @Bubbler this looks wrong: <syntaxhighlight lang="apl">
needs a highlighter for k
ngn
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
ngn
one example: ' delimits a string in apl but is an adverb in k
yep removed it
ngn
ngn
10:36
thanks
 
3 hours later…
13:29
@JohnE that is super cool
 
4 hours later…
ngn
ngn
17:33
@Razetime in case you didn't know: you can use 1-space indent instead of <pre> or <syntaxhighlight>
 
2 hours later…
19:13
@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
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
ngn
19:33
something's wrong with "where" on an empty int list in wasm: &!0
@coltim works now
19:49
@ngn that was fast, nice!

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