« first day (669 days earlier)      last day (866 days later) » 

1:55 AM
okay I give up now: {x@&(&\^x)=|&\|^x}
 
 
5 hours later…
6:52 AM
@coltim that's awesome! in k9: trim:(=/(&\;|&\|)@\:~)#
ie ~ is 'is null'
 
7:03 AM
(which of course means something different to k6 given 0 is null)
or one char shorter: (&/(|\;||\|)@\:)#
or a hybrid approach: {(|\x)&||\|x}#
 
7:28 AM
An 'under' verb might be useful here
 
 
2 hours later…
8:58 AM
@JohnE do you see a reasonable definition of recursive de-structuring assignment? IIUC the way you define "rest" makes that impossible except for tail recursion ...
 
 
8 hours later…
5:19 PM
@coltim ugh, this doesn't work if the input only contains spaces
 
5:50 PM
I think {x@&(&/^x)<(&\^x)=|&\|^x} works. these array languages have definitely given me an appreciation for using <, >, =, etc on booleans too
 
6:17 PM
d'oh: {x@&~(&\^x)||&\|^x}
 
6:31 PM
another random idea: why can't # (also) be cast instead of $?
 
ngn
@coltim i guess it could. the only clash i can think of is with `key#dict
 
6:47 PM
@coltim i assume it's $ because x$y and $x are related. monadic casts to string while dyadic is more general, but still a cast.
 
6:59 PM
@ngn hmm. k4 has ` sym#x as Set Attribute, with the x#dict version only working with a list x
@ktye it is interesting to group the monadic/dyadic pairs by how "consistent" they are
also how int$str is sorta like a take but with filling instead of repeating
monadic $ is super useful when golfing though!
 
ngn
7:59 PM
@coltim i think the repeating one is called "reshape"
at least in apl: ⍺↑⍵ is take (filling) and ⍺⍴⍵ is reshape (repeating)
 
@ngn for some reason I thought "reshape" was just the name for a multi-dimensional take. there's a third variant too, sublist
 
ngn
@coltim there are different systems of terminology, and confusingly they can be different for different versions of k. i think k9 went in that direction - calling only list# "reshape", but then they removed it from the language and.. i haven't been following the developments since then
 
8:47 PM
what's the best way to insert a value into a list at a certain index, keeping all the other values? e.g. changing 1 2 3 4 to 1 2 8 8 3 4 by inserting two 8's after the second value
 
ngn
@coltim there used to be ideas about "splice"
@coltim if you're asking about ngn/k and golfing, probably something with amend and raze: ,/@[;1;,;8 8]1 2 3 4
 
@ngn oooh. I'm working with strings so there's another level of nesting to figure out... it seems like something like {(x,,y)@<(!#x),z}[("A header";"Another header");"--------";0] works though
meh, it's a lot longer than {(*x;y),1_x} (I just want to insert y after the first value in x)
 
ngn
9:05 PM
@coltim {..}[x;y;z] -> {..}[x;y]z
(if that's part of the solution)
 
@ngn trying to trim down this codegolf
 
ngn
9:39 PM
@coltim that's a hard one :|
 
 
1 hour later…
11:07 PM
hmm, another (unnecessary) direction to explore is additional triadic/tetradic overloads
e.g. #[x;y;z] as a take-with-z-as-the-fill, =[x;y;z] as within, or ?[x;y;z] as find/replace
 
ngn
@coltim if you have models (k implementations) for these, it would be easy for me to add them
i think triadic or tetradic ?[x;y;z] was going to be used for something (splice?) in recent k-s
or was it #[x;y;z].. i lost track
 
@ngn ?[x;y;z] was vector-blend in k4 (e.g. a $[x;y;z] that could take a list for x)
another random idea that may be too idiosyncratic is to make e.g. !"AZ" return A-Z (or !"09" return digits)
(not sure how !"A" would work...)
@ngn I'll try playing around with them
 

« first day (669 days earlier)      last day (866 days later) »