« first day (852 days earlier)      last day (683 days later) » 

2:29 AM
re. k.miraheze.org/wiki/Identity_matrix, a shorter definition of identity matrix would be im:{t=/:t:!x}
imo a bit more natural, too
and personally I think it makes more sense to think of bracket application (x[y]) as a form of . rather than @. f[x;y;z] is f.(x;y;z)
dot is the core primitive, and juxtaposition/@/brackets are all sugar which make various uses more convenient
with the important caveat that in some dialects (k3) projection is a feature of bracket syntax, whereas in other dialects (k6) projection is a feature of all applications.
 
2:45 AM
I thought it was faster because that’s what ngn/k uses internally but it’s actually slower? @ngn ngn.bitbucket.io/k/…
 
 
2 hours later…
4:48 AM
I'm going to create a page about atomicity
should be worth linking from many primitives
 
5:09 AM
thanks for the edits @Traws
I need to add K language highlighting
gonna try and figure that out today
ok, so it's done with pygments
so <syntaxhighlight lang="apl"> works to an extent
 
 
1 hour later…
7:01 AM
this identity matrix seems fast: {-1_x(0 :':)\~!:x}
even better in k9 since no seed required for each-prior
 
7:27 AM
slightly better {(x-1)(0 :':)\~!x}
 
8:08 AM
Try it! link currently breaks the code box. I found that two lines in CSS should be removed:
.mw-highlight pre {
    -moz-tab-size: 4;
    tab-size: 4;
    position: relative; // <--
}

pre, .mw-code {
    padding: 1em;
    white-space: pre-wrap;
    overflow-x: hidden; // <--
    word-wrap: break-word;
}
But the problem is that they're not part of Common.css, so I don't know if it's fixable :/
(Actually they can be solved with a rule with higher specificity?)
 
 
2 hours later…
10:07 AM
might be
 
 
4 hours later…
1:58 PM
I wonder if it would be worthwhile to describe the two stranger alternatives to atomic behavior seen in K on the atomicity page: "string-atomic" like $: and whatever we want to call the behavior of find
 
 
2 hours later…
ngn
3:31 PM
@Traws @JohnE @chrispsn thanks, i changed it to the one with =/:
 
@JohnE oh the rank sensitivity things?
i suppose we can define an atom as the lowest depth value a primitive can operate on
 
ngn
3:54 PM
@JohnE what is strange about $:?
ah.. got it. oK's and k9's $string doesn't recurse down to individual characters
 
@JohnE is there a general pattern to converting between the various forms? I know f@x is the same as f .,x, but from an earlier discussion, how do inplace updates fit in?
@chrispsn more generally, at least this specific example falls into the category of segmented scans
 
4:34 PM
whats the best way to raise number to a fractional power
 
using a different language
 
gee thanks
 
lol, pretty sure I did something a while ago wait a sec
 
hm ,newton's method
 
yea
 
4:37 PM
agh so clunky
 
yep
I can't find when I implemented exponentiation :(
 
ngn
@Razetime a^b = exp(b ln(a)) ?
 
wait what
i missed that
 
ngn
that's just mathematics
k4 and k9 (at least) have exp and log keywords. ngn/k - not yet..
 
@ngn well there's no exp or ln in ngn/k
 
4:45 PM
there is exp and ln in oK :)
 
ah, I just assumed you were using ngn/k
 
k4 has x xexp y to do x^y
 
I'm sure I did implement fractional exponentiation in ngn/k but I can't find it
frustrating
 
{(x;n;a):x;((x*n-1)+(a%*/1_n#x)%n;n;a)}/
i tried this but it says a is not defined
 
@Razetime I don't think oK has list destructuring
 
4:50 PM
oh.no wonder
{[x;y;z]!x {[r;s;i;j](j!pow.(i;s))%r}.(x;z)\:/:!y}
{(!x){[r;s;i;j](j!pow[i;s])%r}[x;z]\:/:!y}
this is my function
 
"there are many like it, but this one is mine"?
 
it's supposed to take three args and compute the table here
 
@Razetime what does it do
aha, beat me to it
 
attempting luis mendo's thing in iKe
but honestly idk how to make it work
function or list expected, found number.
  f:{r::x;s::z;(!x){(y!pow[x;s])%r}\:/:!y}
{[x;y;z]r::x;s::z;!x {[x;y](y!pow.(x;s))%r}\:/:!y}
  f[50;80;0.8]
the name 'r' has not been defined.
this was the original problem
global assignment just.. wasn't happening?
so i decided on partial application but that also doesn't seem right
 
5:13 PM
I think part of the issue is that (!x),\:/:!y returns nested data (i.e. y lists each containing x pairs of indices)
ooh, maybe it's the y!pow part, if y isn't a scalar/atom integer
 
i'm doing \:/: on two flat integer arrays
in the outer function, x and z are an int and a float respectively
 
hmm it looks like using `\:/:` on a projected function fails. a workaround is: http://johnearnest.github.io/ok/index.html?run=%20%7B%5Bx%3By%3Bz%5D%7B%5Ba%3Bb%3Bc%3Bd%5D%28d%21exp%5Bb%2alog%20c%5D%29%25a%7D%5Bx%3Bz%5D.%27%2C%2F%28%21x%29%2C%2F%3A%5C%3A%21y%7D%5B50%3B80%3B.8%5D?run=%20%7B%28x%3By%29%23%7B%5Ba%3Bb%3Bc%3Bd%5D%28d%21exp%5Bb%2alog%20c%5D%29%25a%7D%5Bx%3Bz%5D.%27%2C%2F%28%21x%29%2C%2F%3A%5C%3A%21y%7D?run=%7B%7B%5Ba%3Bb%3Bc%3Bd%5D%28d%21exp%5Bb%2alog%20c%5D%29%25a%7D%5Bx%3Bz%5D.%27%2C%2F%28%21x%29%2C%2F%3A%5C%3A%21y%7D%5B50%3B80%3B.8%5D
 
oh gawd
 
that was really helpful
 
5:28 PM
there's probably a cleaner way to work around it, I'll play around with it some more
 
@coltim I replaced .',/with .'' for the required matrix
 
yeh; you'd also have to reshape at the end to restore the matrix shape
oh, if you assign the projected function to a variable, then use that variable in your (!x)f\:/:!y part it works
 
ah interesting
@JohnE oK bug: when I resize the canvas to 800x500, it obscures the run button and stuff next to it
would be worth adding an overflow to
 
another workaround: johnearnest.github.io/ok/…
 
that looks like the shortest
I've gotten this so far, not the right pattern
but i need to sleep
thanks a ton
 
5:42 PM
np!
 
 
ngn
@Traws thanks! i think it's time to follow other k-s and make x%y floating-point division, leaving int div only as (-y)!x
 
 
3 hours later…
9:42 PM
@ngn so I haven't found any issues with x?y across my golfs (in fact, it's saved some bytes in a few places), but there's the downstream users of find like x^y that are also affected
I'm pretty sure I'm on the latest commit, but this fails with a 'lmt error there but returns (("24816";"81632";"64128");(();();())) locally
 
ngn
10:15 PM
i'm not sure how to handle this
should "without" work in rank-sensitive way or like it did before?
k9's "without" (y_x) is not rank-sensitive
oK is neither rank-sensitive nor flat
oK v0.1 (inspired by K5: kparc.com/k.txt; \h for help)
 ("ab";"cd")^"ab"
("ab"
 "cd")
 ("ab";"cd")^,"ab"
("ab"
 "cd")
 
ngn
10:46 PM
..and it took me too long to realize kona's x^y is "power" :)
 
@ngn hmm that is a good question. I have to imagine that it would benefit from some rank-sensitivity, although it seems more vague than with find itself
like if it goes find => in => except then maybe there's some connecting thread to pull
 
ngn
@coltim if it's rank-sensitive, there must be a requirement for unirankness of the left arg, otherwise x^y may have to remove items deeper in x
and ("ab";()) is not unirank :(
 
yeh, I'm not sure what the x^() should do. another variant/possibility would be x^,()
trying to figure out if there's any "benefit" beyond just doing x@&~x~\:y for except/without
 
ngn
@coltim what the x^() should do - well, in the flat interpretation (the way it worked before) it would be a no-op. with rank sensitivity - it depends.
 
11:03 PM
@coltim I guess there the issue is if the y is more than one "value"
 
ngn
@coltim i think it's a little more complicated, x@&~0|/x~\:/:y
 
hmm, this may be a stretch but the /: there is probably the rank sensitive part - if it's possible to determine that multiple y values actually represent a single entity, then there shouldn't be a /:
or at least, a different version of /:...
maybe the y in x^y needs to be unirank as well - these seem a bit off
 
ngn
interesting, k4 docs say: "except uses Find to identify items of x in y"
 
the page for in may be relevant too
 
ngn
11:20 PM
tbh, i think the flat interpretation makes more sense here
"find" is the inverse of "at", which is right-recursive, so it makes sense for "find" to try to counteract this recursion
but "except" is the inverse of what? "catenate" maybe.. which works only on one dimension
 
hmm I wonder if a big chunk of the rank sensitivity stuff is to make the operations work on tables
 
ngn
well, probably tables and matrices
tables are essentially matrices with named columns
 
and differing types/ranks/etc. potentially
 
ngn
hm, right
 
@ngn well, if except is material nonimplication then its inverse is material conditional!
 
ngn
11:28 PM
i was thinking more informally :)
x,y adds y to x, x^y removes y from x (if we think of them as sets)
and of course no-one is suggesting that , become rank-sensitive: ("ab";"cd"),"ef" should not be ("ab";"cd";"ef")
so why should ^ be rank-sensitive then? (rhetorical question)
 
hmm, i guess the argument would be that in is implemented as ~^y?x (otherwise there’s a gap in what find is capable of). except can be x@&^y?x (or something like x where not y in x)
 
Honestly I don't see any good reason to make set difference more complex than simple (list of things)^(list of things)
 
ngn
@coltim with ranky find y?x could be nested, so &^y?x would become a "deep where" which is another can of worms in the non-unirank case
@Bubbler do you think the same about "find"?
 
11:48 PM
@ngn hmm i’d have to think about whether or not it would make sense for find to return anything other than a flat list of integers of y’s count (barring dictionary lookups or whatnot)
or not count y, but whatever it would be in the rank sensitive world, although maybe that’s the rub…
 
@ngn Yes (except for atom y)
 

« first day (852 days earlier)      last day (683 days later) »