« first day (735 days earlier)      last day (800 days later) » 

12:43 AM
@ngn Looks a lot like my APL solution
https://ngn.bitbucket.io/k/#eJyFUz9v00AU3/0pXtPBdp3EPgs62IraTmwsIDGUqrrGd4klxxf5bGT34i6gUgpBSAywsCAhdWOALh3LN7lPwp2dpEQNcHJs5+ne7989R0GEK9g1poEQ1s6sBGR3+2YJPjyoofdwuwOd52UNq+XCFGecQM5UH4c4nRa5gYMOSWlnyxqEogpRHQY2bFouaDIEeJjHLOXGybJPVI7vlHUokFM6lXr22hf7zz5/1ccD4c36h1UoSmcLOaKc9cq6Uj/TRcenYbm/cxp6R7XqQ8BzMgWDBsJxXQt5ngf6tu3ZpVvVGxTmLMeJYXEUct8OBD3kh+XRUb1vWjg8uWdrsZ8DZRkQPBxrpYbBvV0szz+IjSmsLzn/ArvHB/CIpCTDSXxK4ITlY+AsKVq3etfZr0/yzVc5vwYIAMnLb105v/knZr/fh8csB5xWe/B0TFLgxQQyEhVD0kCylFEKSqXafqPR5NtXys0oWdSuG7bNuHhCgBZpexx33oeYt9gZTkekwRFdYcnLlwrLlhefndsrOf+
Except I didn't inlude the parser in the APL solution, that's somewhere else
but boy do I wish APL had true first class functions
this is gravy
I want to ask about day 2's function table though
because we're using amend, and amend is passing a right and left argument, it appears that I MUST MENTION both arguments explicitly
b:"enf"!({y+2+x};{1+x+y};{-1+x+y}) / day 2 actions
this is really annoying, how can I avoid that?
b:"enf"!((2+@:);(1+@:);(-1+@:)) / day 2 actions
that isn't much better
 
could you do (2++;1++;-1++)?
 
1:15 AM
(s061;s062):{
 a:"enf"!(=;{y;1};:)                     / day 1 actions
 b:"enf"!({2+x+y};{1+x+y};{-1+x+y})      / day 2 actions
 s:{0|.[y;{x+!1+{x|-x}y-x}'/1_z;x@*z;0]} / 1 step
 t:{+//(1000 1000#0)x/y}                 / total
 {t[s[x]]}@'(a;b)}0   / totals for each day
can somebody explain why something like this doesn't work?
I just want to define the functions without polluting the global
but even that final function {t[s[x]]} doesn't know about s
what gives
@coltim what you suggested works
like I get there's no proper clojures, but it also looks like there's no actual lexical scope whatsoever
 
1:35 AM
@ngn if you could take a look at this and explain the scope system in K. A lot of my preferred programming style is this sort of nesting definitions particular to a given function like this. This is one solution that does take multiple lines to define, but I'd really rather not have a single file for all cases, and if I load each file and they have clashing names, I'd rather not deal with that either
What I was thinking about with regard to project structure is modules that contain definitions, loaded into a central script, and then run a testing tool that runs all tests. If 2015 uses \l on all 2015 k files, and 2016 \l on all its 2016 k files etc. for all years, I could \l them. Obviously this probably isn't the best solution for this project as many of the tests are going to take a long time and should be parallelized
But if I can't even scope the names to a definition, there's going to be a lot of global name clobbering going on, and that doesn't sound too good either
In Python, I can make definitions but to selectively export names you need a whole file structure. In node I can define a module.exports, a dictionary containing the names I choose to export. In Lisp or other functional languages, I can at least nest definitions inside the function scope where they are used, so that only the relevant names are exposed for exporting.
What I was hoping to do was, for days that require longer solutions, define a function which returns the function solutions, so that only those names are exposed, and I can use arbitrary shorter names, and wouldn't need the use of namespaces for inside the "module", and I could then append those names to a namespace at the end, but if names inside of a function body don't even know about their own lexical scope, I don't think that is going to be possible
I don't know how K projects look like in the wild, and I'm sure it has the same APL problem of having no de-facto project structure, and thus is kind of up to the user, but it seems like my options are limited.

Perhaps it is normal for k to, instead of call functions under program control, to execute scripts under new processes and read from stdout for the results
But I don't know what that looks like as projects grow in size, or when there's shared dependencies etc
My ideal would be to at least to define a function for each file, that when called returns a dictionary of selectively exported names and their values. But I'm not sure how to do that if I can't refer to names defined even within a given function, like in the example from earlier.
 
2:02 AM
I suspect that symbols are a way to maybe work around this? If I define references as symbols, then they should be able to evaluate those symbols as names in different contexts. If that's possible I'd love to know how @ngn
https://github.com/ndrogers/adventofcode/blob/main/k/s.k

This is an example of what I was thinking about originally
https://github.com/ndrogers/adventofcode/blob/main/k/s2.k

This is what I was thinking about for the symbolic approach. In something Common Lisp, I can define symbols that will only resolve when inside of a given context. If this is the case, I can import and define day/year/prc and these symbols should resolve inside various contexts without the need to explicitly pass them in, or define anything in the global namespace
So the question is @ngn how do symbols resolve, and how do I resolve them?
if I
\l 2015.k
\l s2.k
h:utils""
day:h[`day]

 day 6
'dom
{f:`prc@x-1       / proce func
I et this error, even though prc is defined in the 2015.k file
so with this as a simplified example, how exactly does `prc resolve, if it does, or how do I tell it to resolve? I'm not sure if this is even possible?
 
 
3 hours later…
5:27 AM
@nathanrogers i'm curious what you mean by 'boomer arrow keys', do you mean hjkl?
 
@user41805 no I mean arrow keys
used by boomers
 
but you can use hjkl in rlwrap
 
can you jump around your text?
go up 10 lines then forward 3(
then ci(
 
@nathanrogers right, i see what you mean now, i thought ci( would have worked :(
@nathanrogers so you weren't looking for a repl in the first place
 
5:47 AM
@user41805 what do you mean I wasn't looking for a repl?
 
since you wanted to move around and modify existing code, and presumably load it after changes, which doesn't seem like a repl-y task
 
@user41805 have you ever used Slime? Learned Common Lisp or Scheme with Emacs?
@user41805 its a repl, where I get to keep my text changes, and typing a wrong character isn't a whole rigamarole of line by line, re-entering the same crap over and over
I type code, I send it to the repl, it evaluates, and prints and then reads...
just instead, I've hooked up my editor to the reader to send the text that way, rather than typing it directly into the repl.... how, 1970's that would be
I type on the left, I send it to the repl
but I already have my code saved in a file
go figure, welcome to the 1980's
We have "the future" here
 
@nathanrogers no, but do you mean <m-x>ielm or the scratch buffer or osmething else for emacs?
 
6:02 AM
@user41805 I don't follow
 
where/how do you find the repl experience you mentioned in emacs?
*lisp repl i mean
 
Oh, its called Slime for lisp
there's also cider for clojure
and geizer? I think for scheme
 
oh you meant slime with lisp, i thought you meant slime or emacs's default lisp repl(s)
 
no it doesn't come default with emacs
there's also vimslime, which works in the general case, where you open a tmux split pane, I can send any arbitrary text to the tmux pane running some REPL
I use that method for node and python development
vim slime doesn't care what language or repl you use, it just pipes text to another terminal over a socket
so yes, I want a repl, I just also want to be able to edit what I'm typing effectively, and repls are not editors
I tried doing the same thing with a linux Dyalog instance, works pretty well, until you are working on a large enough project what with namespaces and procedural Tradfns and you get stuck nested deep in the debugger and have no idea what their hotkeys are for linux
 
so you keep your definitions in your file and have it set up so that change to it automatically load them in the repl, and then you do the testing/function calls in the repl?
 
6:09 AM
I hit ctrl-c ctrl-c over a line of text, if its a "body" of code, it sends the whole body, if its a single line, just the line
with lisp, I'd use something like ql to quickload modules I'm using, and then just "send" functions I'm writing to play with them
rather than having to , idk what you would do, copy paste?
seems laborious
 
i had used ngn's vim setup for apl, so you keep everything in your file, and hitting enter in normal mode is mapped to running the file by passing it to dyalog -script using a bash wrapper
 
ngn
@nathanrogers my goodness! that's a lot of messages. i'll read all and reply later today.
btw, i think i'll be able to have triadic . too. seems easy to add.
 
6:34 AM
what is triadic . ?
 
 
7 hours later…
1:23 PM
 .[3 3#0;(1 2;0 1);1+]
0 0 0
1 1 0
1 1 0
@nathanrogers sounds like k9 exprs
well, maybe not the 'without passing it in' part
 [a:1;b:2] :a+b
3
 
2:11 PM
So how do symbols resolve?
 
 
1 hour later…
3:12 PM
@ngn what about triadic @ with a value instead of a monadic function? e.g. like this
 
ngn
3:22 PM
@coltim but functions are values
what should @[(+:;-:);0;%:] return?
2 days ago, by ngn
@Wezl x, y, and z are implicit parameter names, like in apl. but unlike apl's always-ambivalent dfns, k functions have fixed valence. mentioning z makes the function triadic. mentioning y (but not z) makes it dyadic.
@nathanrogers scope is limited to locals and globals only
 
@ngn right... but in the example I linked yesterday, locals didn't even have scope to locals
so I need a better definition
 
ngn
@nathanrogers "locals didn't even have scope to locals"? what
 
The whole wall of text began by trying to define a function to wrap up some names, and inside of that function, local functions didn't have scope to those local definitions...
{t[s[x]]}@'(a;b)}0 / totals for each day
this last line of the function
s is undefined
or an error that looks like it doesn't know what s is
 
ngn
@nathanrogers so, you have { .. s .. { .. s .. } ..} there. the inner lambda can see only locals and globals, but not the other s, as it's in an intermediate scope
 
.............................................
I also tried {x[y[z]]}[t;s]
 
ngn
3:35 PM
you're overcomplicating things
 
@ngn why would you ever want to not be able to refer to names in your lexical scope..................................................
 
ngn
give me a few minutes and i'll show you how to solve it
 
like, what benefit does that have............
 
ngn
@nathanrogers you're not interested in a simpler solution?
 
I'm always interested
but how {...s...{...s...}...} isn't allowed!?
that's ridiculous
 
ngn
3:38 PM
@nathanrogers i wouldn't have designed it that way
but that's how arthur's k works, and that gives it some advantages in terms of ease of implementation and performance, and serializability of functions
 
so its not that there are no closures, there actually is no lexical scope
 
ngn
i too wish k had proper closures, because sometimes programming with only local/global scope can be frustrating
 
that isn't even a closure. a closure assumes that you're preserving stack frames. This is just immediate reference
 
ngn
@nathanrogers call it what you will. only locals and globals are visible. it's not full lexical scoping, but it's definitely not dynamic scoping (k will never change the locals of the calling function).
@nathanrogers correct, no closures in k
 
right, so then how do you do anything?
aside from the architecture you demonstrated with launching independet k processes and reading from their stdout
 
ngn
3:48 PM
@nathanrogers you use \d which i don't have as i've never needed it yet
 
@ngn I'm interested in "A" solution, because this doesn't work
How do symbols resolve
 
ngn
@nathanrogers this is the challenge, right? adventofcode.com/2015/day/6
 
yes
@ngn when i say solution, I'm referring to how the thing is encoded. the wall of text wasn't just some meaningless self expression, I'm wondering how to effectively achieve an ends when I don't know the means
 
ngn
@nathanrogers patience, please
@nathanrogers so, the ends of those rectangles are inclusive, and their coordinates seem to always come in order (left-to-right and top-to-bottom)
i:(("e";2 4;5 5);("n";3 1;8 8))
.[;;;0]/[10 10#0].+{(y+!'1+z-y;(=;~<;:)"enf"?x)}.'i
@nathanrogers how does ^this look?
i:(("e";2 4;5 5);("n";3 1;8 8))
.[;;]/[10 10#0].+{(y+!'1+z-y;(~:;{1};{0})"enf"?x)}.'i
or ^this (after you git pull and make)
 
4:08 PM
not sure what happened, but running this on the complete problem set turned my pc's fan on overdrive
and I had to kill it
 
ngn
it's applying the amending functions individually to the cells. 1000x1000 is a lot.
we should make it use vectorized arithmetic somehow..
 
idk, I want to be rude, but my main question from yesterday was about project architecture, how to scope names/group definitions explicitly, how do symbols resolve
 
ngn
@nathanrogers "how do symbols resolve?" - doesn't this answer that?
"how to scope" - ns.name: ..
or wait for \d but it's gonna take time
@ngn the version with tetradic . is faster: .[;;;0]/[1000 1000#0].+{(y+!'1+z-y;(=;~<;<)"enf"?x)}.'i
@nathanrogers "APL problem of having no de-facto project structure" - how do you imagine that structure? a "project" could be a bunch of .k files in a directory, \l-ing each other. is there a need for more than that? (\d issues aside..)
 
4:33 PM
no, because `md5 can be called from within functions... but like I said in my example,

\l 2015.k
\l s2.k
h:utils""
h[`day] 6

prc not defined (`prc used in `day in utils, prc imported by 2015, *but the symbol doens't resolve*)
 
ngn
@nathanrogers `md5 is not "resolved". it is a symbol and remains a symbol throughout the evaluation. note that `md5 is not the same as md5. the interpreter knows how to handle the application `md5@x in a special way.
symbols are not variables. symbols represent variables.
 
what is the purpose of a symbol if it isn't to represent the data of a name, and not refer to the name of itself
@ngn right
so how do I resolve the name
 
ngn
if you have a symbol, let's say `a, and you want to know what's the current value of the variable a, you can use .`a to retrieve it (i'll document that)
there's also .`a`b`c (dot applied to a list of symbols) to retrieve a.b.c (a chained dict lookup equivalent to a[`b][`c])
also: amend and dmend (i prefer to call the latter "drill") have special cases like @[`a`b`c;..] to amend the value of a variable
 
neat
this actually works
\l 2015.k
\l s.k
h:utils""
h[`day] 6
 
ngn
it seems there should be a faster algorithm for this problem
 
4:47 PM
but now I have to define "day" globally"
 
ngn
@nathanrogers day:value, obviously? or from within a lambda {day::value}
 
(day;t;c):.utils"" works fine
 
ngn
/main.k
\l utils.k
util.foo 123
util.bar 123

/util.k
h.foo:{x+1} /put h. before all names in util.h
h.bar:{2*x}
util:h      /export everything here as util
h:(::)      /clean up temporary variable h
@nathanrogers what do you think of the above as a poor man's substitute for \d?
 
ngn
it's not ideal. for instance if foo calls bar, it would have to call it as util.bar, not h.bar, because h will disappear later
 
5:02 PM
so you're telling me that the \l f.k in a new process is the implied architecture for K projects?
 
ngn
@nathanrogers no, i'm not making such grand claims
i was saying it worked well for me when solving problem sets like aoc
 
I mean, its great, like, free parallelism
 
ngn
because there isolation between problems is good
@nathanrogers i don't really run them in parallel
 
but you could. the only question would be how do you hook events to processes
you would need to probably wrap your proceedure spawn in a function that knows how to handle the response
 
ngn
what i like most is the isolation - if one solution crashes or has a memory leak, it doesn't affect the others
 
5:07 PM
in my APL tester, I have a trap around, returning a text error rather than crashing
 
ngn
so i can start the test runner, make tea, and when i'm back i'll have a nice report for all solutions
@nathanrogers yeah, that could work too, but i'd say the operating system is a lot more reliable than any apl or k interpreter :)
 
surenuff
 
ngn
about namespacing: in practice util.foo is hardly any different from utilfoo, so the need for "encapsulation" can be solved simply by prefixing everything with a common string
not too beautiful but is simple and does work
the sky (max number of globals) is the limit :)
 
I hate that these concepts are so fucking perfect but then each language has its own massive warts that each make the other appear more attractive
 
5:38 PM
@ngn how exactly not? mathematica, yes everything is a symbol, but defining a function that evaluates its values inside a given context, that seems pretty much like dfeining functions in mathematica
 
ngn
@nathanrogers mathematica has knowledge about what those symbols mean and how to manipulate them to achieve particular goals, for instance it can solve an equation without doing numeric computation.
 
I see, then no that's not what I mean
I mean in the meta programming sense
 
@nathanrogers that's why I explicitly asked you what you meant by symbolic programming (in the orchard). instead, you just linked a wikipedia article
 
Right, I understood it to mean something else
But also that
@ngn in what way is k homoiconic?
k functions are not lists, or dictionaries are they?
 
ngn
@nathanrogers it can parse its own source code as a tree built from its own data structures
@nathanrogers internally they are lists. only the "type" is different.
you can see that with .{}
 
5:48 PM
i thought homo iconic meant that the AST resembles the code itself
 
ngn
yes
 
but the code doesn't resemble any kind of list or dictionary to me
 
are parse trees relevant here? e.g. .(+;4 5 6;2)
 
i too share the sentiment that functions don't behave as perfectly as i imagined them to
 
@user41805 what is this referring to?
 
5:51 PM
@nathanrogers to this
still not quite at the level of a lisp from my limited experience
 
That isn't my sentiment? I'm just saying they don't resemble data
 
ngn
@nathanrogers i might be using the term incorrectly, i'm not sure. k code can be parsed into k data structures, but of course k code isn't exactly made of k data structures.
 
I might be too
 
@nathanrogers i kind of mean the same thing, i'm not sure though
 
@ngn those might both be valid definitions, I only knew of the second one
 
5:55 PM
@ngn from metalevel.at/prolog/facets#homoiconic, 'Prolog programs are also valid Prolog terms!' where a 'term' is 'In Prolog, all data are represented by Prolog terms.' metalevel.at/prolog/data#term, so according to this definition, it may not be homoiconic
 
I get the sense that there are only so many possible homoiconic forms where programs are valid "terms"
 
i wonder if there is a rigorous definition somewhere for homoiconicism
 
ngn
@user41805 surely prolog programs are strings that need parsing
(but that could be said about any language)
 
yeah not sure of the point you're making there, but the author has a section on metainterprers and macros metalevel.at/acomip metalevel.at/prolog/macros respectively if you're interested
 
K basically has the meta programming facilities I was thinking of. Perhaps not to the degree a masterful LISPer might expect, but to my skill and understanding of scheme and lisp, in K I can pass function literals, and delay evaluation of code... I wonder if this works in a general case, like can I have a symbol that is comprised of the value of another symbol
 
6:01 PM
@ngn you have to stop being homoiconic somewhere, but k doesn't even try, no source code is directly data
 
ngn
@nathanrogers fyi: i added new stuff in \' (docs for adverbs) - monad/x and similar
 
.`{x+y+z}
'prs
so this isn't valid?
 
@nathanrogers as i said, k's `names are literally just string atoms. `{…} just isn't a thing
 
but `"aaaaaaaaa" is a thing
 
@nathanrogers that's just alternative syntax for `aaaaaaaaa
 
6:03 PM
and `1
 
ngn
@nathanrogers .{x+y+z} (no quote before the curly brace) if you want to see what a function object consists of
 
@nathanrogers see `1 = `"1"
 
I guess that means I'm left with just eval and strings then
val:3
."{x+y+",($val),"+z}"
{x+y+3+z}
which @dzaima you're right is just ⍎
mok
so no meta programming in array languages, no true symbolic programming, and only first class functions with closures and partial function application in BQN
while k has first clsas function partial application but no closures
 
ngn
@dzaima or even `1 ~ `"1" (to make sure they are of the same type)
 
@ngn but = also shows that they're atoms
 
6:07 PM
@nathanrogers 'no meta programming in array languages' *in the array langs we have so far, why can't k be extended to be truly lisp-level homiconic?
"You can make any language homoiconic. Essentially you do this by 'mirroring' the language (meaning for any language constructor you add a corresponding representation of that constructor as data, think AST)." cs.stackexchange.com/a/63467
 
ngn
@dzaima not sure what you mean. wouldn't ~`11=`1 be a better way to show that they are atoms.
 
@ngn i meant that as that the result is a single atom 1, which means both sides were atoms. `11=`"11" would've been better but eh
 
ngn
@dzaima ah, i see
 
@nathanrogers I'm probably still missing something, but in k4 you can do x:5;val:3;f:(+;`x;`val);-6!f (-6! being "eval")
(x and val don't need to be defined ahead of time there)
 
ngn
@user41805 @ktye's latest language is something like that - a mix of k and joy
 
6:30 PM
@ktye just been messing with your j, why does [2 2+]1@ [2]eq work but not [2 2+]2@ [+]eq? (can't figure out how to box yet, but looks like it vectorises anyways)
@user41805 btw the linked slides talk a bit about the different types of 'homoiconism', eg, see slide 49 of users.sussex.ac.uk/~mfb21/publications/mp-slides/slides.pdf
 
@user41805 I think that's a question for someone who is both an implementor of K and a grand wizard of lisp because I don't know the answer to that
 
ngn
 
@coltim right, if you check github.com/ndrogers/adventofcode/blob/main/k/s2.k that's how I'm handling this function
 
ngn
@user41805 ^^ from that presentation - best summary of ppcg i've ever seen :D
 
ppcg?
 
ngn
6:44 PM
er.. cgcc. whatever it's called now, the "codegolf and coding challenges" part of stackexchange
 
hey ngn, I'm getting a wierd error
could you possible pull that repo and \l 2015.k
its really odd, because it completes the tests, prints 1, but then still somehow errors afterwards?
 
ngn
ngn/k, (c) 2019-2021 ngn, GNU AGPLv3 - git.sr.ht/~ngn/k/blob/master/LICENSE
 \l 2015.k
1
1
 
sorry just did a push
the function returns 1, then prints out the value of c, with a parse error for the processors?
 
ngn
..it's still thinking..
 
you can add 6 to skip
 
ngn
6:48 PM
@nathanrogers yep, i'm there
 
day;t;c;e all imports from s2.k
 
ngn
you have strange stuff at the end of the file. looks like accidental pasting.
 
e is the execute tests function, it removes skipped values and runs the test
you mean just new lines or what
 
wtf?
I don't have that in my file
what the shit
the left is my file
the right is the cat of my file
there's no .swp or funny copies either
 
6:55 PM
@user41805 [+][+]= does not work. = only allows ints. the implementation is simplistic: eql.V:I{pi ip~ip} pi means push as int, ip means pop int.
 
is there some kind of IIFE syntax? @ngn
 
@user41805 but it's nice to get feedback. you are the first who admits having tried it.
@ngn "latest language". depends on the definition. my latest is a wasm to go decompiler. one day i might run ngn/k on windows as a go binary. raw.githubusercontent.com/ktye/i/master/_/gw/gw.go
 
ngn
@ktye wsl should work
@nathanrogers obviously { }0 (or any other fake arg) but you lose access to the surrounding scope (unless it's global)
 
7:10 PM
@ngn is there a way to introspect a scope for a name?
see whether a name is defined?
 
ngn
@nathanrogers just noticed the {x[y[z]]}[t;s] there - most of the time the lack of closures can be worked around with this technique (making projections)
but in this case it could be simpler {x[y[z]]}[t;s] -> {x y z}[t;s] -> (t@s@)
 
haha that's cool
 
ngn
@nathanrogers no. or maybe by abusing \v and \f but i don't have those
 
ok, so how would I check that a function that is being called exists or not?
at runtime
 
ngn
@nathanrogers maybe use "try" to trap the error.. ? but i'm sure there must be a simpler solution if you take a step back and consider the bigger picture
 
7:15 PM
what I want is (f x) or 0
regardless of a defined name
 
ngn
@nathanrogers .[.:;`f;{{0}}]x
this triadic form of . is "try": .[function;arglist;errorhandler]
it tries to apply .: (i.e. monadic .) to the symbol `f, and if that fails, it calls {{0}} which in turn returns {0}
 
is there something like (2 3⍴⍳6),1 ?
,' I guess
 
ngn
so .[.:;`f;{{0}}] gives you either the function f or {0}. and then that's applied to x
@nathanrogers yes
 
7:33 PM
@ngn ok that isn't working how I expected
{.[.:;x;{{0}}]y}[`s011]
gives me 0
 
ngn
@nathanrogers that's a projection?
you have y in the outermost { }, so it's dyadic, but you gave it only one arg
 
oh no I see what's going on
so I have a list of functions and a list of inputs for those functions
 
8:03 PM
@ngn is there the equivalent of 4↑1 in k?
    4↑1
1 0 0 0
    4#1
1 1 1 1
 
ngn
@nathanrogers no. you can use ~!4 instead.
 
so ~ is only true if 1?
or is this another monadic case
 
ngn
@nathanrogers 0 is the only falsy number
 
oh
right, because index 0
lol
good thinking
 
ngn
the question of ⎕io doesn't even come up in k :)
@nathanrogers what do you think about ⎕ct, by the way?
 
8:06 PM
if you want sometime more general I have this. definitely not fully generalized or anything but it should work with vectors
 
ngn
@coltim also: {@[x#z;0;:;y]}
or: {y,1_x#z} (shorter but not fast)
 
mine handles negative x's (and is lifted straight from your str-pad code =P)
 
ngn
@coltim ok, you win :)
 
8:40 PM
the .`sym is irrelevant it seems so long as the names are defined before their reference
 
8:54 PM
@ngn I can't the foggiest what ⎕CT is, is that the side that gets to buy the USP instead of the Glock?
 
9:07 PM
@ngn we have an APLcart, and Bacon Crate, what about a K Car? or Conex?
or just... container?
what is the default argument order to '?
 
@nathanrogers which version of '?
 
ngn
@nathanrogers it's "comparison tolerance", the idea that two floats should be considered equal if their ratio is within 1(-,+)⎕ct, it affects the behaviour of = (equality is no longer transitive) and a few other primitives, notably ∪⍵ (the result depends on the order of ). original k has something like ⎕ct, but it's not exposed to the user. in my impl i treat it as 0, i.e. two floats are equal iff their bits match exactly.
@nathanrogers what are USP and Glock?
 
9:23 PM
@ngn needs more complexity! like only using it for comparisons (and not find or distinct), and then have a special rule for comparing to 0
 
ngn
@coltim suggest that to the aplers :)
@nathanrogers afaik no, feel free to make one if you want
 
(I guess to be accurate, there isn't a special rule for comparing to 0. but for something to be equal to 0 it must be exactly 0. regardless I find the behavior of e.g. numpy's isclose() to be more sensible in practice)
 
ngn
@coltim i think it depends on the nature of the numbers you're comparing, depends on what they represent in the real world. roughly speaking, some numbers are meant to be used additively, others multiplicatively.
for additive (≈)←{eps>|⍺-⍵} works better
 
@ngn I wish I had a better understanding of the problem domains where things like denormals-are-zero, or rounding errors being different between e.g. SIMD code and "scalar" code are important
 
ngn
@coltim those may have more to do with implementations than application domains
 
9:38 PM
@ngn like running code on different architectures?
 
ngn
99% of the time nobody cares about tiny errors, but i guess if you're in the 1%, at some point there's a trade-off between accuracy and simplicity (the amount of work you're willing to put in the impl)
 
ngn
denormals improve accuracy, they make use of the range between 0 and the otherwise smallest representable float as "1.mantissa * 2^(exponent-bias)", but they also introduce special cases for formatting a float as a string
@nathanrogers what's that? :)
 
9:53 PM
@ngn I could see there being a conflict between what certain applications want vs. others (specifically, fuzziness around tiny values), but I have to assume most of that would be driven by the problem domain :S
 
ngn
@coltim well, my educated guess is it matters 1% of the time :)
 
@ngn I guess this could be some meta thing where my comparison tolerance is >0.01
 
@ngn you can't see a picture?
 
ngn
@nathanrogers i can, but what does it mean?
 
counter strike, its a game... like, the most popular online game for almost 25 years?
abbreviated CS
 
ngn
9:56 PM
@nathanrogers what's the connection with k?
 
has two sides, CT's (counter terrorits) and T's (terrorists)
⎕CT
 
ngn
ah.. :D
 
cts get to buy usp
t's buy glocks
just assumed you'd have played it at some point i guess
 
ngn
@nathanrogers i stopped doing that at some early version of wolfenstein, but resumed again a couple of years ago with openarena
but my thinkpad broke last year, so now i play only tuxfootball on an old netbook - a very stupid game, but i'm so addicted to it, i rewrote it arthur-style :)
 
ngn
10:02 PM
@nathanrogers yes
 
ngn
yeah, stupid, i know.. we all have quirks
 
I didn't call it stupid tho
I really like the original gameboy game Kid Icarus
I can run through it in about 20 minutes or so start to finish
i remember it took me a slogging year to beat it the first time
lots of batteries
I still have the music in my head
 
10:19 PM
Hey @ngn, I sent you a quick hack to make ngn/k work on freebsd.
only works on FreeBSD-12 or later. no fix for i386.
 
ngn
@nathanrogers reminds of frank zappa
 
especially the dungeons
the one with the swung shuffly is always in my head
and I hear it a lot in other music too
 
ngn
@bakul your first patch for sys/stat.h worked perfectly, thanks for taking the time to investigate! i'll try the new one in a moment..
@bakul pushed
 
10:34 PM
great!
Fails to compile. You need to add I getdirentries(UI,V*,UI,V*);
Rather, it needs to be before its use
 
ngn
@bakul oops..
@bakul sorry. does it work now?
 
0.c 0.c:44:15: fatal error: expected ')'
asm(h(pipe2),h4(getdirentries));
That ',' is not needed I think
Works now!
 
ngn
right :( pushed again
@bakul thanks a lot!
 
!
 
10:54 PM
@ngn is there an implicit recursion name in your K?
 
ngn
@nathanrogers yes, o is like
 
o
@ngn thanks for all the work on the menu
its indispensable
 
ngn
my pleasure
 
@ngn do you have a test case for getdents?
 
wanted to ask, are noun dyadic forms of \ and / adverbs?
or are they just verbs
 
ngn
10:59 PM
@bakul no, other than as part of the test runner for "advent of code"
@nathanrogers such as 2/ and 2\ and "sep"/ and "sep"\ ? anything followed by an adverb is a verb
 
thx!
 
/join \split
/ decode \encode
 
ngn
@nathanrogers now i won't be able to sleep until i find out where i've heard before this tune at the beginning of the video
 
11:13 PM
I checked a19/ a20/ on FreeBSD and Ubuntu (in a bhyve VM on the same machine). outputs match.
great job!
 

« first day (735 days earlier)      last day (800 days later) »