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

00:16
@ktye can splice combine existing indices in addition to inserting stuff?
@coltim hmm, I guess kinda, in that you need to explicitly provide the value to replace with
e.g. x:!6;i: 1 2; ?[x;i;+/x i]
 
2 hours later…
01:51
@ngn I found another segfault: `"\"
02:21
@ngn also, another generic-empty-list edge case, but should $() return ""?
 
6 hours later…
08:38
@coltim ok does this: x:!6;i:1 3; ?[x;i;-1] -> 0 -1 3 4 5
@ngn did you remove splice or never had it?
k9 doesn't have it any more.
 
2 hours later…
10:55
down to 19... there's probably some simpler equivalent symmetries that can make this shorter
++,'/(+|+|';)@'+2^'
ngn
ngn
@coltim what would be better? ()?
Oct 23 '19 at 20:21, by ngn
@ktye i'm throwing splice away. i feel cheated :)
"feel cheated" because i (like everyone?) assumed it was implemented natively, and in k7 it was just a k string
11:15
@ngn but you use k-stringgs as well for other primitives
ngn
ngn
@ktye now i do, yes
should i add it? it doesn't clash with anything else
@ngn if you like k6 (more important: ok-doc) compatibility, why not?
ngn
ngn
@ktye wait, did k6 have that??
@ngn idn, but oK
?[x;I;[f;]y] insert (from kparc)
ngn
ngn
reluctantly adding a todo ..
11:24
maybe k9 plans it too: there's a line left blank between cond and amend,dmend.
11:53
'splice' feels like a cut extension - maybe it should go on triadic _?
ngn
ngn
that's for the gods to decide
@ngn well your cut is different to k9 cut
splice being on ? could be vestigial - you have an opportunity to fix it
ngn
ngn
@chrispsn that doesn't bother me. for the basic set of primitives i stick to k6.
@chrispsn wasn't cut "^" in k9?
12:33
@ngn yeah. I think splice should be triadic ^ in k9, if it gets added
 
3 hours later…
ngn
ngn
15:57
f:{                                      /x:dowker notation, y:crossing signs
 N::2*n:#x                               /n:number of crossings, N:twice n
 s:1-2*!n#2                              /s:all possible sets of smoothing signs for the crossings (n*(2^n) matrix of -1 1)
 S:{(x,'1+|x;0 1+\:x:(0<x)|:/y,-1+x|-x)} /S:smoothe the crossing numbered x,y in dowker notation (x can be negative)
 a:N!(x S'2*!n)@'/:+~y=s                 /generate all possible smoothed knots (results consist of neighbour pairs that form sets of disjoint unknots)
@rak1507 how's ^this?
whoa, amazing, I'll have to examine it more later
ngn
ngn
lots of words, but i'm afraid some areas might still be unclear
16:22
maybe but the fact each bit is broken down is great
16:54
@ngn right now that's what it does. it came up when trying to use ` 0: strList, which doesn't like () but works fine with ""'s
ngn
ngn
@coltim doesn't it?
@ngn I guess if the only value is (), was thinking like this (replacing the "" with ())
ngn
ngn
@coltim but 0: is right to complain that it's not given a list of strings. how did you obtain the ()?
often this comes down to my lack of prototypical elements in empty lists
@ngn I think it came from $:'ing a list of symbols
@ngn but why does it work with just () then?
ngn
ngn
@coltim () is empty, so we can consider it a list of strings without any strings :)
17:05
@ngn I see... somewhat related, but did the behavior of &() change recently?
ngn
ngn
@coltim yes, it's @chrispsn's idea for deep where
the motivation is to make &boolmatrix work like &boolvector - return the coords of the 1s
@ngn ooh. is part of that it returning ,!0 rather than !0 (like &!0 does)?
ngn
ngn
this extends to non-booleans, to more than 2 dims, and to ragged arrays.. and i'm not sure we've got all the details right yet
@coltim yes, unfortunately there's a discontinuity at 1 dimension - &vec returns a plain (not: enlisted) vector, while &ndimarray returns a list of n vectors
@ngn ooh, so () is standing in for the latter case? (I think I came across some old APL stuff talking about this sort of nuance)
ngn
ngn
@coltim apl (dyalog, actually) has had ⍸vec only for a couple of years iirc, and ⍸anyarray only since the last version
in The APL Orchard, Jul 28 '20 at 13:29, by ngn
@Adám the new looks consistent with , it has the same discontinuity at rank 1 :)
17:20
@ktye hmm, I guess this is slightly different than the k7 version? (if my understanding is correct, the k7 version can take just a single index, and the oK version with a function feels like a @ variant?)
ngn
ngn
@ngn the problem with i was talking about is that ⍳,3 returns 0 1 2 instead of the mathematically correct (,0)(,1)(,2), for backwards-compatibility reasons related to the treatment of singletons as if they are scalars
@ngn oh I meant the "how do you represent higher-dimensional arrays when you have typed empty arrays" thing
ngn
ngn
@coltim well, in ngn/k currently you can't :(
i want to fix that but there are more important fires to extinguish right now - arithmetic and "find"
@ngn yeh, I don't recall there being an elegant solution (I think it was more like "empty arrays are messy" or something)
ngn
ngn
@coltim the traditional way is to store a "prototype" - one hidden element in the empty array, used only to determine the structure of what's missing
my favourite way to explain prototypes:
in The APL Orchard, Nov 23 '17 at 19:08, by ngn
here's the joke: a customer in a shop criticizes the shop owner for not having any fish in the shop, "But sir, in this shop we have no vegetables. If you want no fish, go across the street."
17:28
@ngn ah yes, the empty array jokes =P
17:46
56849027: I really like being able to apply a function to the values specified by the indices; I've run into that when golfing
emptiness has a color; absence a form
ngn
ngn
@JohnE is that a joke? explain pls?
18:22
@coltim to expand on this, it would be great to be able to do ?[x;i;10/0^x@i:0 1+*&~0>':x] instead of @[x;t-1;(0^x t)+10*]_t:1+*&~0>':x. i.e. remove the values from x at i (the latter of which could be multiple indices), apply the monadic f to those values (as a single arg to the monadic f), and stitch the results (which may be one or several) back in at the first index in i
@ngn more like poetry I guess
@coltim (f could also be a value)
18:38
you know k9 f_x ?
{x>4}_!10
0 1 2 3 4
18:57
@ktye yeh, sorta like the inverse of (...)#x
(in that example I was using list_int to drop a specific index from the list)
ngn
ngn
19:22
@rak1507 do you know what these mean: positive/negative smoothing, laurent polynomial, unknot?
first two, no, unknot, yes, but I can always google the terms
the unknot + trefoil are about the only things I remember from a short introductory thing about knot theory I went to
that and having to do lots of colouring stuff :(
ngn
ngn
@rak1507 "smoothing" is from the recursive definition of bracket polynomial
the classic algorithm goes like this: we choose a crossing (the first blue circle), we smoothe it in two different ways (the other 2 blue circles), compute the bracket polynomials for the resulting knots, multiply one by A and the other by A^-1 (this depends on the crossing sign) and sum them
being an array programmer, i decided not to do recursion, but to process all crossings at once :)
this might have been a mistake - it would have been easier to explain if my solution followed the algorithm from the definition
maybe to explain but not necessarily to implement/port
ngn
ngn
not sure if it would have been a shorter or longer solution
how does K handle recursion out of interest?
ngn
ngn
19:28
@rak1507 it handles it well :)
does it have an equivalent of ∇?
ngn
ngn
in ngn/k o is a special variable name like apl's
ah
not a symbol? :(
is z a special variable name too?
ngn
ngn
we're short on symbols
I heard unicode has some ;)
ngn
ngn
19:29
@rak1507 i think not but .z is a special namespace
Ah
because I think I had an issue when I tried to do z:something, but maybe that was just me
ngn
ngn
officially k doesn't support unicode. my support for unicode is an own extension.
@rak1507 oh, it could have been because x y z are default argument names, like
ahh yeah that's it
that makes a lot of sense
ngn
ngn
so if you don't have an explicit arg list (like {[a;b;c;d;e] ..}), and you mention z, the function automatically becomes triadic
ngn
ngn
19:32
unlike apl, k functions know their valence
in what way do APL functions not know?
ngn
ngn
@rak1507 {2×⍵} - is this a monadic or dyadic function?
oh wow, I have never noticed that if you do 1{⍵}2 it uses both arguments!
ngn
ngn
the answer is: it's neither. it's ambivalent. it can be applied monadically or dyadically
And in K you can only apply a function one way?
ngn
ngn
19:36
when you give it fewer args, it forms a projection (a.k.a. currying or partial application)
when you give it more, it signals a rank error (rank is a concept that applies to functions, as well as arrays)
Yeah that makes things clear now because when I tried to use z as a variable name what I got back must have been the representation of a curried function
ngn
ngn
if it looked something like {..}[..], probably
yeah I think it was something like that
ngn
ngn
there are exceptions, for instance f/ is ambivalent in k
and some primitive verbs can take up to 4 args, notably @ and .

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