« first day (1499 days earlier)      last day (1150 days later) » 

ngn
8:00 PM
a script can do \d ownnamespace in the beginning and it will have its own namespace as "globals" (i know, i know.. not really "global")
 
ngn
@dzaima ?
 
how do you structure namespaces in a project? as in if I'm storing to disk?
folders?
 
@ngn a is only assigned within the brackets, but is visible from the outside, hence dynamic scope. Of course, it's a joke
 
ngn
@nathanrogers any way you like, but folders seem like overkill, given the language is so concise
 
8:03 PM
@ngn how is anyway I like
I don't know the first way, let alone others
 
ngn
@dzaima but it's not visible. didn't you get a value error ('val)?
 
also, if anyone is interested, I've gussied up the test thing from yesterday github.com/ndrogers/apltest
if anyone would take a look and comment
 
@ngn there's only a value error for the global read, not the one inside {} but outside $[]
 
xpqz mentioned something about test tools and this was a fun little distraction
 
ngn
@nathanrogers you're not being serious
 
8:05 PM
what
 
@nathanrogers you can store code in an actual filesystem files & folders if that's what you're asking
 
but does storing k files in a subfolder define a namespace?
 
@nathanrogers definitely no
 
ngn
@dzaima ah, i see :) unlike in apl, locals don't spring into existence only after you assign to them. they exist from the beginning of the invocation of the function, initialized with ::.
@nathanrogers no
 
that's my question
how then
 
ngn
8:07 PM
@nathanrogers either with \d ns (not supported in ngn/k) or by directly creating it, e.g. ns:`a`b!(+;0 1 2)
 
@nathanrogers you place things in files however you want to, but k doesn't care about how the code is laid across the files. It just executes code
 
ngn
and you can load one file from another with \l file.k
 
@ngn does non-ngn/k allow multiple \ds in a single file?
 
ngn
@dzaima i think it does
i've never used or felt the need for \d, but to be honest i've never tried to make anything big and complicated enough with k
(same for apl, btw)
i think the languages themselves discourage such complicated structures, because they allow concise expressions
 
@MortenKromberg Is there a convenient location to find some of his publications?
 
8:14 PM
@nathanrogers wiki, APLcart
 
ngn
8:25 PM
@nathanrogers how familiar are you with q tables?
for instance, are you comfortable with the notion that they are flipped dictionaries?
 
i'm not an expert, but I love how nice they are to work with
yes
 
ngn
great
in k monadic + is flip. dyadic ! combines keys and values to make a dict.
 
I recall that yes
 
ngn
so, this: +`a`b!(0 1 2;("zero";"one";"two")) is a table
 
looks like one
 
ngn
8:29 PM
both dicts and tables are physically represented as pairs of (keys;values)
but conceptually, a table is a list of dicts
when you index a table with an int, you get back a dict, as if you've indexed each of the columns individually and slapped the same set of keys on them
 
I see all of that
but the table just evaluates to the expression of the table
not... a representation of the table
 
@nathanrogers what would be a representation of a table? (ngn/k output must round-trip, that is, be evaluatable to the same thing)
 
ngn
@nathanrogers you mean it's not formatted nicely as a grid, for viewing?
 
yes
I mean the data isn't represented
literal notation is not representation
like I can't store a 2d matrix like
a←(1 2 3
4 5 6)
 
ngn
as dzaima mentioned, k6 used to format the output in such a way that if you copy and paste it back in the repl, you get the exact same value
and i strongly prefer that to be the default formatting
 
8:36 PM
and when I evaluate a, I don't get back 2 3⍴1+⎕io-⍨⍳6
@ngn I think it warrants a bit of explanation
especially for actually wanting to see the damn table right
I got all my variables all nice and evaluated, I now want to SEE THE TABLE, but all i get is how I would have encoded the table I want to seee, but I never see the table
I just see a table literal notation
which also isn't a table
 
ngn
@nathanrogers ok, let me try to say it another way: the programmer and the interpreter communicate using the same language. if the interpreter writes (1 2 3;4 5 6), that matches the value produced when the programmer types (1 2 3;4 5 6).
 
I can see like... having an OPTION, or a SETTING like ⎕SE.Dyalog.Utils.repObj X. That's pretty handy, but that isn't the default
like, I get that
so how do I see the table
 
@nathanrogers I'm planning that for 19.0
 
@nathanrogers write your own formatting function :)
 
like, I'm a data scientist, and I'm hoping to identify the relationships between certain records... y'know, in a table, so I whip up a table literal expression
and all I get back is the expression
and not a table
seems like a worthless table
 
ngn
8:40 PM
@nathanrogers i don't have built-in fancy formatting, that's left to the applications, libs, tools, etc
 
how about... any. not saying you need fancy, but literally any output at all ever
rather than... y'know, parotting back to me
I fully know the expression I typed in
I don't need it spit back at me
 
@nathanrogers it's primarily for the cases when you don't fully know what object you've created. (but i also agree that having pretty formatting as at the very least an option, for a database language of all things, is good)
 
ngn
@nathanrogers it doesn't just repeat what you typed. it evaluates it and prints a simple representation of the result. this expression just happens to be simple enough to represent itself.
 
how can I get a list of values of a dictionary in K?
or keys
 
ngn
@rak1507 keys !d, values . d
 
8:43 PM
thanks
 
yeah, I can't understand the point of a literal notation for a data structure, and then not actually evaluating the data in terms of the encoding of the data structure
 
keys being ! is obvious now I think about it
 
I mean, if its a symbolic representation of the data structure, that's fine
but that doesn't appear to be what this is
 
@nathanrogers it's the canonical representation of it. see this - the input and output are obviously different
 
ngn
@nathanrogers i'm not sure i understand. what round-tripping output would you expect? or are you arguing it should not be round-tripping?
 
8:46 PM
like
what even is round-tripping
 
ngn
@dzaima thanks
 
@nathanrogers the outputting of a value in a way that can be evaluated to get the exact same object
 
@dzaima and why is that something that would ever cross anyones mind aside from nice cases when you want a concise format for representing a given data structure
again, representing the data
not is the data
 
@nathanrogers well, ngn/k doesn't have a way to "represent" data as you want
 
that isn't the question. the question was why
aside from "terse lol"
 
ngn
8:49 PM
@nathanrogers it's easier to learn the language when you know that the output contains complete information about the value being displayed, and you know that you can paste it back
 
I fundamentally disagree
I think its much easier when the language allows you to visualize your expressions clearly
seems pretty straight forward to me
 
@nathanrogers image not found?
 
ngn
@nathanrogers have you tried filling in this? i'd be interest to hear what you think about the captcha at the end :)
 
does that one work?
@ngn that's funny
 
yes
 
8:56 PM
@ngn 1) i highly doubt that helps at all with learning. You might learn dyadic ! and vector syntax faster, but that's about it. I don't think one is significantly less likely to misunderstand syntax than pretty boxes, but pretty boxes are much better at actually helping to understand what data you have (a +…!… table representation is just horrible, you can't at all see a row as a single "thing");
@dzaima 2) Anyone that doesn't already know k wouldn't ever think of using copy-pasting as a means to copy data
 
ngn
@nathanrogers i'm trying to make a point with that "captcha": if in the output 0 as an int is indistinguishable from 0 as a char, it's harder for beginners to learn that language
 
I mean, I agree. '' or "" should delineate strings
 
@ngn pretty-printing doesn't necessarily need to be ambiguous
 
separating them from numbers
 
@dzaima which is why pretty-printing should not be the default
 
8:58 PM
@Wezl ?
 
@dzaima what does this mean as output from APL: 1 2?
 
depends on whether box is on or off
 
@Wezl I said doesn't need to be ambiguous. I agree APLs default formatting is awful
 
the APL output is pretty and small compared to boxes, but not helpful
the k output isn't pretty, but it is everything else
 
every character vector should be delineated by " or '
 
8:59 PM
BQN (both mine and mashalls impls) have pretty-printing, but it's always unambiguous unlike APL
 
ngn
@dzaima unambiguous is better than ambiguous, obviously, but i'd argue copypastable is just as important
 
@ngn I'd estimate the number of people that are annoyed by tables being ugly to be much greater than the number of people who take advantage of output copy-pasteability
 
I don't think that is important in any way ,and is something that a utility function can handle
 
ngn
@nathanrogers so why shouldn't tables be delineated with something too?
 
aka ⎕SE.Dyalog.Utils.repObj X
 
ngn
9:02 PM
@nathanrogers i think the other way round - pretty printing should be handled by a utility function
 
and I think that's loony town
like, the very primary use case of K makes that silly
I'm a day trader, and I want to observe the relationship between all this data
but instead all I get is the expression that... returns itself
 
ngn
when learning, implementing, debugging.. the language i'd rather be able to tell precisely what value i'm looking at, and paste it back if i want to experiment with it more
 
man, if I'm using my mouse, I'm not having a good time at all
 
ngn
@nathanrogers btw, k9 doesn't do round-tripping by default. it pretty-prints. (and of course i think that's awful)
 
@ngn a data scientist cares much more about the data than the language.
 
ngn
9:04 PM
@dzaima true!
 
I don't want to copy and paste anything. I'd much rather just reevaluate what I've typed, and see what the data IS, not how to encode what the data is
 
@ngn and the default ngn/k printing of a table is literally useless if you want to observe a single row when you have >3 rows
 
because if I never see it in an intuitive fashion... what's the point
@dzaima this
 
then patch the language
 
right
I don't have a core feature, so I should just implement the language MYSELF
that sounds like a USEFUL language
 
ngn
9:06 PM
@nathanrogers well, you are the "data scientist" type dzaima mentioned
 
@nathanrogers pretty printing is not a core feature
 
i mean, you are the .0000000000001% of people who even think this is a primary, and not a fringe/debugging feature
@Wezl "PRETTY PRINTING" you keep using that word... I don't think it means waht you think it means
 
@nathanrogers are you attacking me, ngn, or both?
 
how about... print, at all
@Wezl none of the above?
I am taking issue with the idea that this kind of representation is useful for anything besides fringe debugging cases
 
ngn
@nathanrogers i'm a language geek, not a data scientist. big data tools must be built on top of something. i'm trying to make that something, not the end-user tools themselves.
 
9:09 PM
....
end users are people who use applications
programmers are not end users
 
ngn
yes
you expect me to build the whole stack with just this pair of hands? for free?
 
@nathanrogers I'm not yelling btw
 
you're expecting me to implement applications around your language when there is no language
 
@ngn so you're admitting ngn/k is only a good tool for creating other tools, and not for actually getting things done?
 
ngn
@nathanrogers "there is no language"??
 
9:10 PM
@dzaima this again
@ngn not if I can't use it to develop applications
if its only capable of developing tools for itself, doesn't seem like a usable language
 
ngn
@dzaima i'm not playing word games with you again :)
 
and I'll wait until the core language comes with those necessary tools so I can be produtive with it
@Wezl how exactly does someone "yell" in text?
 
@ngn i mean, that is what you're saying. No useful tools for data scientists → not a good language for data scientists
 
no what I'm saying is no useful tools for people who program
and who write programs
so, not a good language for those people
 
ngn
@dzaima and only data scientist can get things done? (there i go again, playing word games, not being productive..)
 
9:14 PM
I mean, if there is no way for me to simply eyeball that may data is roughly in a form that makes any sense whatsoever
its a completely worthless representation
 
@ngn i might have been a bit too harsh with "not for actually getting things done". Point remains though, ngn/k isn't really fit for data scientists if it can't display a readable table
 
unless I'm trying to debug an expression and I need to share the exact data I'm working with as an expression that can be evaluated
 
ngn
@nathanrogers well, once someone writes a function to pretty-print it, you will be able to
 
@dzaima I'm not a data scientist, and it wont be useful for me if I can't observe the contents of a table ... as a table
@ngn pretty printing... i swear you guys have your OWN definitions and you just don't tell anyone else about them... you're talking about printing literally anything ever
not some kind of fancy shmancy, featureful, configurable kind of printing with all sorts of niceness
 
ngn
@nathanrogers i'm sorry, i didn't come up with this term. it's just what its called
 
9:16 PM
like, if a literal notation to descibe tables, doesn't describe a table, and instead describes the literal notation of the table you've already notated
then it isn't a table
its a table literal notation
the output of your notation is notation
not a table
hence, your notation isn't a table
 
@nathanrogers "printing literally anything ever" that's yelling, it sounds like you're angry
 
no, its emphasis, and also... idk snarky?
you're projecting
 
ngn
the data is there in the round-tripping form, even if it's not pleasant for the eyes
 
right, but it isn't a table
 
@nathanrogers notation of a table is definitely still a table. Not a pretty one, not meant to be read, but still a table
 
9:17 PM
no it isn't
idk how many times I have to post that picture
the representation of a thing is not the thing
 
@dzaima unless by "table" you mean a literal 2D table in the html sense
 
like markdown notation for an html table IS NOT an html table
without markdown parsers, there is no HTML table
 
ngn
@nathanrogers ok, can you please help me build a formatting function according to your taste, when you have time?
 
probably not?
 
ngn
you seem to already know enough k for that
 
9:19 PM
@nathanrogers ok, a rendered html table
 
ngn
@nathanrogers as you wish, can't force you
 
@nathanrogers so ngn/k should have a builtin function that outputs HTML? that's less readable than the current output
 
ngn
i can't make them all happy
 
I'd consider the markdown notation to be a table, because a table is a visual thing and a markdown table is visibly in the shape of a table
 
@Wezl I didn't bring up HTML, dzaima did... and I never suggested anything aobut the form of the output, other than it should be a table
 
9:22 PM
@nathanrogers someone can implement this "printing" if you have an example
 
@Wezl that's completely irrational and illogical. the painting of a pipe is not a pipe, the MD encoding of an HTML table is NOT an HTML table... try to render that as HTML, doens't work without the MD parser converting it to an HTML table
even the HTML encoding of an html table is not a table
it is a representation of the table
only the page once rendered does the HTML encoding of an HTML table become an HTML table
 
a markdown table isn't an HTML table
 
that's what I said
 
I'm agreeing with that part
 
@nathanrogers ngn/k defines a table as a flipped dictionary and literally nothing else. You may want to use it to mean some 2D thing, but that's unrelated, other than that the name might be equal.
 
@nathanrogers but it is a table because a table is a representation of data in some rectangle and a markdown table is representing the data in a rectangle, that happens to be made out of ascii characters instead of the pixels a rendered HTML table is made out of
 
I don't think that's even a table unto itself
That's a legal MD table
 
However, if you print that rendered HTML table onto thick cardboard, and stick four legs on it, then it's a table.
4
 
I feel like someone could have written the format function by now
And solved everyone's problems
 
@nathanrogers if you padded it with spaces to align the columns, then it magically becomes a table? isn't that just a different representation of a table? what even is a "table"?
 
9:27 PM
@rak1507 yup
@rak1507 no, because @nathanrogers wants it built-in to k or something
 
lol
damn it, why isn't there an online q repl or anything
 
Right... the only reason I liked the tables in Q is because it made manipulation for purposes of viewing large sets of data completely trivial
and easier than even just opening the file in a text editor
without that
its completely useless to any practical purpose... aside from debugging
or sending someone else my data representation for... idk... debugging
read transform write. that's what a program does. read, visualize transformation, encode transformation, write, that's what a programmer does
 
@ngn how do I do a newline in K
 
ngn
@rak1507 "\n" ?
 
oh I suppose it's the giving back a representation thing
 
ngn
9:41 PM
to write a string to stdout: 1"string";
 
is there a way to make a multiline string that when output looks like a multiline string
ok
that'll do I suppose
 
ngn
@rak1507 or maybe ` 0:("..";"..")
 
is there 'enclose if simple' in K lol
or $ on a string returns itself
ah who cares just use symbols anyway
 
ngn
@rak1507 thanks! @nathanrogers ^ :D
 
oops: spotted a bug
fails when the column name length is longer than the data length
 
9:50 PM
@ngn I feel like I should clarify.. my criticism was about the representation of tables, not intending to criticize the language. but that I felt the representation is not useful
 
ngn
@nathanrogers i understand
@rak1507 k has no deep scalars. the closest equivalent to apl's is "enlist" (monadic ,) which is more like ,⊂⍵. and there's no "..-if-simple" of course.
 
how to pass cmdline args
 
ngn
@rak1507 `k@ could be useful too - it formats an object in the default way
@nathanrogers not yet implemented. normally they would be made available as a global variable x
 
ngn
@rak1507 can i use it? :) i mean, once i implement a mechanism for setting a custom formatter in the repl, which will probably not be this week
 
10:00 PM
sure lol
I mean, it's probably not very good or well written
oh yea you should probably stick an extra newline on the end too
 
ngn
@rak1507 details..
 
it's a shame k doesn't have flip ⍨ bc certainly in APL value,⍨longcomplicatedexpression is something I do a lot
and in k you have to parenthesise everything
 
ngn
@rak1507 "flip"(+ in k) = "transpose"(⍉ in apl)
@rak1507 that's supposed to happen rarely..
 
I mean ⍨ not ⍉
 
ngn
@rak1507 i understand, i'm just pointing out this trap of terminology
 
10:08 PM
right fair enough, idk what else to call it seeing as there isn't a name for it in k
 
ngn
"swap"?
 
that works
what does 'dom mean @ngn
oh domain error
 
ngn
@rak1507 domain error
 
what are your opinions on like `p@ and things adding something like `fmt@ to pretty print various types
 
ngn
@rak1507 there already is `k@ for the default formatting
 
10:13 PM
I thought we established that wasn't particularly useful to people ;)
 
ngn
i imagine a custom formatter would be something in user code, not built into the interpreter
 
fair enough
 
ngn
though much of the interpreter is written in k itself, so the boundaries are blurry..
 
fmt:{(a;b):(p:1+|/'(#''d)|#'$!+x)$/:($!+x;d:$.+x);,/(,,/a),"\n",(,(+/p|#'a)#"-"),("\n",1_,/"\n",',/'+b),"\n"} isn't so bad
 
ngn
@rak1507 yes, it does address nathan's primary concern (i think). thanks very much for showing us it can be written so quickly.
 
10:19 PM
how would you format that encoding?
like say I wanted to write something like
fmt: {
...
}
 
so you can't write

f:{
...
}

You have to write
f: {
...}
 
ngn
@rak1507 like this ?
 
is that it?
 
ngn
@nathanrogers yes, lines beginning with a space are continuation lines
newline characters are equivalent to ;
 
10:22 PM
oh nvm you can
 
I thought a new line ends an expression
 
ngn
the last expression in { } is returned, so if you insert a newline just before the }, there would be an empty statement at the end, so the result would always be ::
@nathanrogers well, yes. ; and \n both do that. they are equivalent.
 
oh I completely forgot about join
silly me
 
and } with no spaces at the beginning of the line is gibberish
 
ngn
@nathanrogers yes
 
10:25 PM
:C
 
@nathanrogers how familiar are you with k4? I think a lot of these differences (how tables are output, continuation lines, etc.) are present there as well
 
I think I learned Q when K4 was current, and I was learning Kona at the time which is K3, so most of my K experience was with Kona
That was a good while ago at this point
 
if I have three variables a b and c and a="ab", b="cd", and c=("ef";"gh") how do I get ("ab";"cd";"ef";"gh")
oh I can do (a;b),c
 
noooooo it's broken still
 
ngn
10:31 PM
@rak1507 or (,a),(,b),c
 
yeah
I found that one but thought it was incredibly ugly
where's ⍥ when you need it
fmt:{
 headers:$!+x; data:$.+x
 padding:1+|/'(#''data)|#'$!+x
 header:,/padding$'headers
 ,/((header;(+/padding)#"-"),,/'padding$/:+data),'"\n"}
 
ngn
oh no.. long variable names :O
 
@rak1507 reverse compose is also nice - a,⍛,b,⍛,c
 
I kninda don't like the style of it. I greatly appreciate use of whitespace for clarity, like spaces bettwen or indentation of paragraphs
 
@dzaima that looks cool so gets my vote
@ngn haha yep just as an explanation
 
10:34 PM
I get succinctness and brevity, but I still really want to } at column 0 :/
difference with lisp is that the rest of the body is variously indented to suggest form
 
yeah I always prefer free-form languages
 
butthisisjustputtingeverythingbacktobackand
makesitseemlikeitwaswrittenbyacokeuser
highonspeedandabouttohaveaheartattackfromtoomuchstimulus
 
lol
 
github.com/ndrogers/apltest/blob/main/test.aplf check the BODY:: section of fmt or at the bottom of the page
white space is important for me
 
ngn
@nathanrogers } in first col actually works but it still introduces an empty statement
 
10:37 PM
suggests parallels and intuition where possible, and also separates thoughts
 
unicode is a problem for alignment though
 
not in an editor
just in github
:P
 
fmt:{,/(,/'(1+|/'(#''$.+x)|#'$!+x)$/:(,$!+x),+$.+x),'"\n"}
much simpler implementation without the ----s
 
@nathanrogers do you think the ---s separating the column names and column data is necessary?
(or anyone else)
 
10:42 PM
@rak1507 to some degree it disambiguates the values in the rows of the table from the column names (versus pretty printing some nested list I guess)
 
I don't really have any opinions on HOW it should be formatted. I think what you had is just fine
 
@coltim yeah, if it was completely trivial to insert I would do it, but it isn't
(or at least not for a k noob like me)
i.imgur.com/Xvji4IC.png I think I've fallen into a k hole
 
oh yeah that is loads simpler
didn't know about ` 0:
 
10:47 PM
:0
 
a space is a valid character in a symbol?!
 
ngn
@rak1507 no, the ` is the left arg of 0:
 
oh
 
ngn
@rak1507 0 is a valid char in a symbol, so the space is necessary to separate the ` from 0
 
10:49 PM
makes sense, is ` a valid function? I'm confused
`@"test" -> 0x01040000000000000074657374
 
ngn
@rak1507 it is a symbol, not a function. but in k you can "apply" any object to any other object (not always meaningfully)
@rak1507 `@ is "serialize"
 
I hate markdown
I give up
 
yay I got it
 
ngn
these usually come in pairs (at least in k9) `@ and `?
@rak1507 +1
 
10:51 PM
you could use the rare ,,, idiom to somewhat achieve things
 
 
@coltim that's nice
 
@Wezl I use doom emacs
@rak1507 why do you hate markdown?
 
@nathanrogers I don't actually it can just sometimes be frustrating doing what you want
 
ngn
@nathanrogers it's more like markdown hates us all :)
 
10:54 PM
does k have regex?
 
ngn
@rak1507 no (not natively)
 
thought so :(
 
@nathanrogers I tried using emacs, but only to use SLIME and that didn't even work :|. It's tolerable with evil but I have a friend with like 30 MBs of free space on one computer because they have doom, while vis is 0 MB + lua + syntax highlighting
 
@rak1507 k4/q has a limited form: code.kx.com/q/basics/regex
 
cool
 
ngn
10:56 PM
@Wezl imagine the amount of code that can fit on a screen with this font - we'll never need to press pagedown again :)
 
adapting some stuff from a golf I did
 
@ngn that's (almost) the only reason I use it
Feb 23 at 1:09, by Wezl
I use it for the same reason parents put toddler's art on refridgerators
 
@rak1507 I guess I don't encroach on the limitations of MD. either that I fit what I want within the box of what I know is possible in MD
@Wezl I used vim + vundle forever. I still actually kinda prefer tmux with vim-slime because I can do slime-like things with every language, rather than just lisps or schemes
 

« first day (1499 days earlier)      last day (1150 days later) »