« first day (879 days earlier)      last day (656 days later) » 

00:27
@ngn I only got to 70. Going down to 64 looks hard
01:25
@ngn I give up. I simply don't see a shorter way to create the five matrices, or to generate strings out of them, or whatever
01:49
would an appropriate-based decode work?
would certainly make for an elegant formulation, but hard to say if it'd be compact
@JohnE yeah this is what i was suggesting earlier
but ngn said it wasn't part of his solution
oh, and curses- it's a variable upscale
wouldn't work as well, then
yeah tis a different nxn block for each thing
 
1 hour later…
02:57
@Bubbler got it down to 60
03:09
Huh, TIL $<string> stringifies each char
Also nice use of boolean negation
@coltim Is # (in y#w!...) a reversed @ of some sort...?
@Bubbler yes; with dictionaries # takes a list of keys and returns those items (keys + values)
(may be worth noting that keys _ dict will delete those keys, returning a trimmed down dictionary)
03:25
And the keys are discarded on ,/, nice
03:39
Got 58 based on that
03:59
An interesting snippet: x#&0 2\x for an odd positive integer x gives 0 0 ... 1 ... 0 0 of length x with the single 1 in the middle
though it doesn't help much in golfing this specific problem
04:32
05:18
ergh, feels like there is some extractable structure to ~(+>\|=x;|=x;=x),+:\x#,i=|i:!x but it’s eluding me (something like x{y x}\(=:;|:;+>\) is cool, but takes more bytes)
Can you use the current character instead of having a predefined string?
Maybe, ovs's solution has ord(c)%23%5
That was clever
@Bubbler i think something like ` 0:"\n"/f[5;s] works for outputting
05:33
Nice
Is there a way to stringify a char without the double quotes from $?
@coltim Golfed: {}` 0:'f[5;s]
(ngn/k parses `0 as the symbol form of “0” but that 0: overload needs to take ` as its left arg. to be honest i have never actually understood k/q’s i/o)
@Ausername Those double quotes are part of prettyprinting
@Bubbler case in point :P (how does an empty lambda do anything here?? could you put a semicolon at the end of it instead? why is any of this different than 0N!? mysteries)
05:38
Then why does this happen?
@coltim I use {} to suppress prettyprinting the thing already printed
@Ausername Oh... that's a quirk of oK. It doesn't in ngn/k
Maybe you can replace $ with , (wrap in a singleton list)?
Ok
I'll switch to ngn/k then
@Bubbler i think $: string in some k’s leaves things that are already strings (or at least lists of strings) untouched
@Bubbler hmm maybe some of the output helpers I’ve seen in J golfs will begin to make more sense to me
@Ausername (also every K on TIO is somewhat outdated. You'll need to use respective online interpreters to use the newest version)
ngn/k has weird typing stuff.
Ok
Is there anything I can run K5 on aside from oK?
05:48
oK is actually close enough to K6 I think
Exact differences between oK and ngn/k are not very well documented but we can help you sort out the quirks
(btw, turns out that oK's $ does some kind of uneval, in that it wraps strings in quotes and escapes backslashes and double quotes)
Ok, so this works in oK, aside from the quirk with ", but errors in ngn/k
First error is that you don't need to split with ";"\ because s is already a list of strings (list of lines)
But then...
'val
..'!k};$[92=j;a[];47=j;|:'a[];45=j;h v,j;95=j;{k#" _"@x=k-1}'!k;v=j;(k;k)#v;+h v,j]}
                                                                ^
btw why is a a function?
Because it has two separate usecases
Can probably be golfed
06:00
why's it a function instead of an array
@Ausername k and v need to be global variables to be accessed within the nested functions; can do k::y;v::" ";
Uhh... it doesn't look easy to fix, because ngn/k doesn't seem to recognize nested scopes (everything is local or global)
@coltim Oh, didn't know that
@coltim whaaaaaat
although yeh, no closures in ngn/k (oK may be a bit of an exception k-wise; most don’t and rely on projecting/currying args)
I'ma stay in oK for the time being.
06:04
Yeah, probably better to stick with one impl when you already have a (near-)working solution
It is working, just $ working would save a byte
Jun 23 at 9:12, by ktye
i don't like io verbs. what about:
c:<`file (monadic/read)
`file<c (dyadic/write)
if implement a K, it'll probably have this
@Ausername So j in there is always a single char?
I guess you can't save a byte at that particular point
original code had v,j instead of $j, right?
Though there's a high chance you can use "pad" to save bytes on appending/prepending some spaces
06:13
@Bubbler There's a pad builtin? Cool
Yes, ctrl+f "pad" on oK manual
ngn
ngn
06:27
@coltim @Bubbler very nice! you can save a byte by turning w into an argument and making a projection like this
@ngn Oh wow, I definitely saw that but never thought of golfing with it
I do not understand any of this
Also I knew it must be golfier to use remainder trick somehow
ngn
ngn
@Ausername i'm sure you understand { } and ,/. do you understand ,'/'?
,/ is flat, {} wraps in a function, but no clue what that is
I presume 8!19! is to do with some remainder trick
ngn
ngn
06:36
@Ausername ,'/' is "catenate each over each". if you have a matrix of matrices, it joins the rows horizontally
Oh that's nice
ngn
ngn
but it's probably better to start from the right
What does a@<a do?
ngn
ngn
@Ausername sort
a there is the matrix corresponding to "-"
all 0s except for the middle row which is all 1s
+a is for | right?
ngn
ngn
06:38
so a@<a brings the 1s row to the bottom and we get a matrix for "_"
Cool
I think I understand it now.
ngn
ngn
@Ausername +a means "flip" over the main diagonal (a.k.a. "transpose")
Bye for now
@ngn Yeah
ngn
ngn
@Ausername right
@Ausername o/
06:59
I'm back
So basically how I think it works (correct me if I'm wrong) is:
Build a list of binary matrices, modifying the previous each time
Map each character to that with a modulo trick
Replace 0s with spaces and 1s with the relevant character
And transpose, concatenate each row and flatten.
Is this right?
ngn
ngn
@Ausername yes. so, you understand all of it :)
you might be wondering how " " is handled. 8!19!-x maps it to 6 which is out of bounds for the provided list of matrices. but k supports out of bounds indexing - in this case it will return a matrix of "nulls" (0N which is the smallest representable signed int). 0N*" " happens to be 0 which suits us just fine :)
the solution might be even shorter in k9 where char arithmetic returns chars and sort is ^x instead of x@<x
07:49
@ngn did you ever try test coverage? i guess it's hard in non-line oriented programming style. i started doing that, and found many bugs immediately.
08:12
@dzaima do you have range types in bqn? e.g. represent a+b*!c with 3 ints only. k7 had a+!b ranges. i could think of many operations that preserve the compact form. but again, is it worth it? without doubt, all these optimizations add to the code base..
@ktye i want to know a lot more about your implementations
and what has changed between iterations and what you're learned
a write-up would be really interesting
@coltim it would be nice if there was a composition verb for this purpose (compose\fnList)
@coltim something that kinda works but again, is longer - stringify, merge, execute: (.',\$(1+;2*;3-))@\:3
@chrispsn good idea, i think i can do that.
@ktye :D
 
2 hours later…
ngn
ngn
10:21
@ktye no and i'm not sure if i'll ever get to that
@ktye Not yet at least. Adding them would mean everything reading integer arrays has to check for them, which, as I found out, makes things reasonably slower. I'd rather have an optimization pass over the byteceode, searching for such patterns and replacing them with better code
(fwiw, CBQN currently has only i32/c32/f64 typed arrays, so adding i8/i16/c8/c16 (and bit booleans) is a priority over fancy optimized types)
 
13 hours later…
23:18
CMC: Build me a room in K
@Bubbler I was playing around with this but it fails on 2’s and I gave up
I'm pretty sure the best way is to generate a flat version using base (or !x with x a vector)
23:35
@dzaima (note that marshall wants thunks at some point, so who knows how things will look in the future)

« first day (879 days earlier)      last day (656 days later) »