« first day (379 days earlier)      last day (1156 days later) » 

5:57 AM
RIP @ngn
 
 
1 hour later…
ngn
7:22 AM
haha, not yet
 
@ngn you're at the danube? so you drink what kelas leaves over (or worse).
 
ngn
@ktye probably true of tap water
this makes me think of philosophical questions: what if all hardware&software is destroyed in a nuclear war over toilet paper, the few survivors have to live in bunkers for the next 100 years, and you're the only programmer among them. what can you remake from scratch?
 
7:56 AM
with no hardware? probably not very much. you better invest your time working on the next generation instead.
 
ngn
@ktye yeah, true :) no hardware - ok, maybe a nokia3310 has survived and doubles up as a hammer
 
8:19 AM
k seems incredibly well suited for being re-typable from a source printout... and a theoretical drawcard for kOS
@ngn I should change the tag line for the k code twitter to 'algorithms that fit on a square of toilet paper'
 
ngn
hardware is unjustly neglected. for instance, the free software movement fought so hard over software, and it looked like it's winning, but now that every cpu is backdoored, it turns out those efforts have been in vain.
@chrispsn collapseos - very interesting, thanks
 
8:40 AM
@ngn this works in ngn/k:
@[127#" ";("['/\\";":+-*%!&|<>=~,^#_$?@.";";)] ");"av;"]
" ;v vvvva ;vvvvva v;vvvvv aa;vv v v"
what is that? triadic @[x;y;z] with a y(list) ?
 
ngn
@ktye yes @[a;i;b] <=> @[a;i;:;b]
 
so it replaces in a at index i with values b. and what does the list do? sometimes indexing with a list produces the same shape as the index, not here.
 
ngn
@ktye it's a special case for convenience, not a logical extension of the way amend normally works
 
oh, i get it. it's just like a[i]:b works the same in k7. i think you cannot use chars as index in k7.
 
ngn
@ktye k9 currently doesn't treat chars as ints either: "a"+1 is an error
 
8:50 AM
we'll see how messy things turn out when arthur implemented all 40 types...
 
 
1 hour later…
10:01 AM
@ngn RISC-V seems pretty exciting
 
10:52 AM
@ngn Is this final? IIRC in both k2 and k4 @[d;i;f] means d[i]:f'd[i] which is useful even if f is a list.
 
ngn
@beagle3 @[a;i;b] <=> @[a;i;:;b] only when b is not a function. otherwise it works the old way.
i don't know if adopting this was a good idea in general. it was good for golfing.
 
@ngn I would vote against, as that breaks the usual function<->list equivalence in read contexts, but then I don't golf myself
 
ngn
11:16 AM
@beagle3 only 2 golfs rely on it. i might as well change it.
 
@beagle3 can you give an example where it's useful? i like the convenience
 
ngn
@chrispsn example: a:(+:;-:;*:);a[1]:(%:) works but the same can't be done with functional amend @[(+:;-:;*:);1;(%:)]
 
11:31 AM
@chrispsn I cannot off hand, if I can think of one I will write it, but in my experience simple mental models like "a list/dict is a function of its index/key" makes for robust software; It means that when a function computation is expensive, I can replace it with a precomputed list/dict and trust that it works.
 
ngn
@chrispsn as for trust in computers, i think mpc looks promising
 
i think there was a version of k where you could write a:3; a-: (monadic self apply) which is like a:-a but this does not work anymore for k4 and later.
 
@chrispsn ngn has two historiical examples where it saved two chars in each (at most), which - considering the special casing in the source code and the need to document this, is about a %5000 loss in my book
 
ngn
@beagle3 2 examples in golfing, a few more in k-strings, a lot more in project euler (but brevity isn't that critical, except in golfing)
i should count the dmends too..
removing .[a;i;b] doesn't break anything :)
 
ngn
11:59 AM
@beagle3 @chrispsn there's a similar problem with @[a;i;f;b] where a is a list of symbols
 
 
2 hours later…
1:47 PM
k3:
b:0;b~:;b
1
 
yes, i think i read in the the manual. do you miss it?
 
yes i do
k3 has some frustrating limitations, but overall i find it to be the most elegant version of the language.
k3 was designed specifically as a general purpose programming language. from k4 onwards, the tendency has been to give weight to database applications.
 
Hello. Does ngn/k support IPC ?
 
@StevanApter i looked at f. it uses the same verb for flip and where. it's a good idea. i want to use + for abs already, so i need something else for flip. &l for lists could work.
 
ngn
@Simon no, due to the fact that so far i've used it only for golfing and solving simple maths problems
 
1:56 PM
a new paper from john earnest: beyondloom.com/blog/strings.html
 
@ngn but you have fork/exec/pipe/connect and recently serialization. what is missing?
 
@ngn, thanks for quick response.
 
ngn
@ktye server sockets are missing. i can only connect as a tcp client, and tbh i haven't tested lately if that still works.
what should be the syntax for reading from a file descriptor?
i can send: nc -l -p 1234 (in bash) and f:<`:127.0.0.1:1234; f"hello" (in k), but i can't receive
 
f:<.. connects to the given address, then f"..." sends data? does it close/disconnect also?
 
ngn
@ktye >f closes
 
2:12 PM
@ngn where is the file descriptor? you have it outside and want to input it as a number within k?
 
ngn
@ktye f is the file descriptor
 
Ah i see, you can currently only write with f"...".
you cannot use it with in io verb instead of a file name? (i'm not that familiar with all the monadic/dyadic io verbs and different k versions)
 
ngn
@ktye i'm not familiar either, but i know it works roughly like this in k4/q
so, i should implement 1:f then
 
if you want to read from it, how much? all, a fixed number of bytes, a line?
 
ngn
@ktye however many bytes read() returns when i give it a reasonably(TM) sized buffer to fill
 
2:20 PM
maybe you can read the same way as from stdin, but point stdin to f. is that what 1:f is doing, or is it a read already?
 
ngn
@ktye currently 1:"file" and 1:`:file use mmap()
i was thinking 1:f could use read()
reading from stdin is done with 0:""
everything i/o looks like a mess :)
 
i just avoid all that and don't do io at all. my k assumes all data is already in the ktree. someone else has to write it there and decipher the result.
 
ngn
@ktye but how do they write it there if there's no i/o?
 
that has to be done by the embeder. on the website, it's js, in the c application it's the main function. k.w compiles to a library only (wasm module, c or go).
 
 
4 hours later…
ksi
6:48 PM
@ngn on the topic of porting ngn/k to mac, i tried debugging the u1c_ 'mmap1 error yesterday. it turned out to be a wrong result returned from fstat symcall. i had no idea why that happened. so, i replaced it with lseek to find out the file size and it works out correctly, only at O0 level though.
at O3 level, somehow run() will return (A)0 and triggers the error reporting function without printing anything except '. mysteriously, things worked out when i removed this:P(q-(V*)uc,err("mmap1")).
the other syscall i changed is to use pipe instead of pipe2, with the latter one being linux specific. but you used it with the second parameter to be 0 anyway. so, i guess it doesn't matter.
now i can see how much frustration it saves to target only one system :D
 
7:05 PM
@ksi does my port of ngn/k compile on your system? https://github.com/ktye/i/blob/master/_/ngn/k.c . it's a single file, compile with gcc k.c
I added libc headers, removed the assembly and commented out most io functions. the interactive interpreter should work however.
 
ksi
@ktye thanks, i haven't tried it though. i will give it a try.
 
ngn
@ksi you're right about pipe() and pipe2(), i'll change it in a moment
i don't know what to say about the other issues
 
ksi
@ktye it mostly works, some small things i need to change is the prototype of main, since gcc on mac complains that it should be int main(int, chat**), also gcc/clang on mac uses the mangled name for c function, so in _start, it should be jmp _main. i think if you decides to get rid of all the asm, you can just comment out the part of defining _start.
 
ngn
7:23 PM
oops.. freebsd doesn't have pipe()
 
ksi
@ngn do you consider using lseek for getting the file size? someone says its faster than fstat. although it moves the pointer to the end of file, but since you use the mmap to read the file, it doesn't matter.
 
ngn
@ksi sure, if i can get it to work
 
ksi
@ngn i guess its hard to keep everyone happy, then the port must have another layer on choosing which version of pipe.
@ngn it will be great as well if you change the signature of main to make the c standard happy:)
 
@ksi i commented out the asm. i didn't notice it was still there, as gcc on windows does not complain. i try to do as few manual changes as possible after running ./update
 
ngn
@ksi i added an #ifdef SYS_pipe and now it works on both linux and freebsd (and i believe macos)
i'm getting these strange memory leaks though.. probably an unrelated issue on freebsd
@ksi done
 
ksi
7:51 PM
@ngn thanks, for now i think i have to give up on fully porting it to macos before figuring out which part causes the different behavior on different os's at O3, and it maybe a rabbit hole :(
 
ngn
@ksi btw, lseek works on linux, but i can't figure out the right combination of #includes on freebsd
SEEK_END is defined on linux but not on freebsd. man says i should #include<unistd.h> but then other things don't compile
@ksi lseek() works now!
 
isn't seek_end always 3?
 
ngn
@ktye it might be, until some OS decides to use a different value :) like it happened with MAP_.. and PROT_..
 
correct 2. i think i remember a discussion that in this special case, (SEEK_*) they are everywhere the same.
 
 
2 hours later…
10:12 PM
@StevanApter even more elegant than k9?
 
 
2 hours later…
11:51 PM
hmm my last one in that shakti thread won't work if we need 'no results' to be an empty string...
 

« first day (379 days earlier)      last day (1156 days later) »