« first day (847 days earlier)      last day (688 days later) » 

02:49
maybe just ask Adam about adding K content to the wiki and find out
the problem with K's existing pages is that they link to APL primitive which don't exactly do the same thing
 
8 hours later…
11:14
@ngn how come `j uses ? when lots of other things use @
@rak1507 it depends on which direction you're going
dyadic ? is 'function inverse'
ah
so `j@something would theoretically be convert to json?
ngn
ngn
@rak1507 yes
cool
ngn
ngn
11:21
@rak1507 this idea is from k9. i think it uses `json? and `json@ now instead of `j? and `j@
wow, whitney making things longer, what is happening
peer pressure, probably
ngn
ngn
nah, probably too many formats to fit in one letter :)
well, symbols can be arbitrarily long, no?
yeah but there are only 26 one letter symbols
so can't fit them all in one letter
ngn
ngn
11:32
is there another popular data format that starts with j?
good question, probably not, wonder why he didn't keep `j then
@ngn jeans
ngn
ngn
:)
11:48
@ngn digging into some older messages and oh man, x:'2. that's good
is that the same as (#x)#2
yeah, but a nice use of 'right'
yeah
wait how does that work
:' is a dyad - for each pairing of the left and right elements, take the right one
ohh right yeah I was trying to read it as an adverb and getting confused
I forgot that : is a function, got it
11:52
yeah it's not each-prior
yeah
i thought it was window at first
that is really nice
12:36
now that i've learned ngn/k filter can replicate i'm trying to write a tacit version of the sublists function
wait what??
that's epic
@ngn how do i take command line args in your impl
ngn
ngn
@Razetime there's `argv[] for all, or `argv[i] for the i-th
oh perfect
that makes it very suitable for inclusion into code.golf
ngn
ngn
`argv[0] is the k interpreter itself
woah
ngn
ngn
12:51
just like argv in c
how would i supply it with args
using \l?
ngn
ngn
@Razetime no, \l can't do that. args are usually supplied from the shell: ./k arg1 arg2..
so ./k file arg1 arg2
ngn
ngn
@Razetime ah, right.. i forgot the .k file is also an arg :)
so first two args are ./k and fliename
this'll do
ngn
ngn
12:56
yep
 
1 hour later…
14:13
ngn.bitbucket.io/k/#eJxTSkxSitcxAQAHVgHH don't think it's a 'bug' really but some of the code is revealed with this error
not that it particularly matters
ngn
ngn
14:29
it's a feature :)
is it just me or do the arguments to cut seem the wrong way round almost? it seems like it'd be more common to calculate indices than the value
ngn
ngn
14:41
@rak1507 iirc @chrispsn has raised this question before but i can't find it in the transcript
14:53
@rak1507 I guess another question is how often the indices are calculated from the list itself, versus being hardcoded or dependent on some external value
 
1 hour later…
16:13
k9's x^y cut seems useful, especially if it subsumes parts of I_y cut and (I,0N)#x
 
3 hours later…
18:51
@coltim I'd say (f x)_x is probably a common pattern
@rak1507 oh, agreed. it's probably the large majority of times it's used (an exception would be something like ,/|0 1_x). I think depending on the implementation some other primitives/operations use cut as well (not sure how they use it, but presumably it would be like your example there)
would be interesting to do some source code analysis
ngn
ngn
19:08
cut is an extention of drop - i think that's the most likely reason why the indices are on the left
yeah, it does make sense that way, it's just unfortunate k doesn't have ⍨
@ngn but then there's x_i (delete index?)
ngn
ngn
@coltim well, yeah, but not compatible with cut
19:35
@ngn challenge accepted! ngn.bitbucket.io/k/…
ngn
ngn
@coltim huh what
@coltim an implementation of "cut" using _ only as "delete"?
@ngn a literal "not compatible with" I guess. although I now see what you likely meant, i.e. 5_x is very similar to (,5)_x
 
3 hours later…
22:24
is there a nice way to do upcase/downcase on strings?
_ is lower case, but what is uppercase?
ngn
ngn
22:41
uppercase - not really: `c$-32+
shame there's no ceiling as that would be an obvious solution for it
or inverse, _⍣¯1 lol
ngn
ngn
that's why so many k fans write only in lowercase :)
lol makes sense, just a small annoyance, I assume in real life projects they might just have some uppercase function imported in everything? it can't be that rare to want
ngn
ngn
23:00
@rak1507 well, it's not hard to write such a function if you really need it
another question, I was just trying to create a function that applies another function to the first and last elements of an array, I came up with 2(|@[;0;f]@)/, is {@[x;0,-1+#x;f]} better or is there something even better than both of them?
ngn
ngn
23:36
2(|@[;0;f]@)/ - clever

« first day (847 days earlier)      last day (688 days later) »