7 ms·
How to program computers (kOS)
- anfedorov 12y agoNot to be confused with kOS [1]? 1. http://ksp-kos.github.io/KOS_DOC/ http://ksp-kos.github.io/KOS_DOC/
- justincormack 12y agoNo, its from http://kx.com/ http://kx.com/ see also https://en.wikipedia.org/wiki/K_(programming_language) https://en.wikipedia.org/wiki/K_(programming_language)
- rco8786 12y agoFeel bad for the guy holding the mic
- justincormack 12y agoHi, thats me. Last minute issues when organizing a conference...
- justincormack 12y agoThis was from the conference I organized a couple of weeks ago. The other videos are also available [1]. Sorry about the screen visibility on this, as it was being live coded it was a bit hard to film. [1] https://operatingsystems.io/ https://operatingsystems.io/
- anoother 12y agoThanks for organising such a great conference. I missed this talk, so have been looking forward to the videos.
- deleted 12y ago[deleted]
- rasz_pl 12y agoNext time organize some microphone stands too :)
- lukifer 12y agoIt was honestly difficult not to be distracted by that.
- justincormack 12y agoSorry, there was some sort of technical issue with the lectern mike.
- justincormack 12y agoThere was another thread about kos a while back [1] which was why I invited Geo to speak, as there seemed like a lot of interest. [1] https://news.ycombinator.com/item?id=8475809 https://news.ycombinator.com/item?id=8475809
- akkartik 12y agoLooks like what Geo was covering in the first few minutes at least is summarized in this comment: https://news.ycombinator.com/item?id=8476633 https://news.ycombinator.com/item?id=8476633
- akkartik 12y agoI tried to run K, but the link at http://kparc.com http://kparc.com requires a password. Is it not generally available yet? Is there a mailing list or IRC channel somewhere? https://github.com/kevinlawler/kona https://github.com/kevinlawler/kona doesn't run edit.k successfully.
- voidiac 12y agoThe free version of K can be downloaded at http://kx.com/software-download.php http://kx.com/software-download.php
- akkartik 12y agoBut it doesn't look like that version can run edit.k from kparc.com. So for all practical purposes kx.com and kparc.com are distinct languages/dialects. Edit: I should clarify that I'm trying to make sense of the specific code in the OP, in particular to play with the views idea (the :: operator). I should have probably put this thread under https://news.ycombinator.com/item?id=8743325 https://news.ycombinator.com/item?id=8743325
- cturner 12y agoYeah, I tried the same and came to same conclusions. Someone who knew what they were doing could implement a new-k impl from the lang def on kparc. That is all you would need. Alas, I am not that guy.
- geocar 12y agokOS is K5; it's as different from K4 as K4 was to K3. Views are available in K4/Q/KDB+, so the version on kx.com does work with views. If you want to play with the views idea, try to solve a problem and see where a view helps you. Here's one I did earlier this week; I've got this tool that takes a whole bunch of logfiles of userids and counts; they look like this: 5033703751425413371 1 5409789758109122623 4 10102846067816284236 4 I call these columns `s(sessionid) and `c(count); I can load them with this: G:{g::select from(+`s`c!("*I";" ")0:"S"$":",x) where (c>0)} Now I say something like: G"trk/tnl5/20141207/TRK_ITM" to get one of these structures into the g variable. I actually have a bunch of filenames: t:{R:{(x,"/"),/:$:!"S"$":",x};,/R',/R'R"trk"}[] So I can load the first one with: G t 0 This is convenient, since these files are big (1Gb each or so) I'll want to work with a subset: g:10000#g This isn't part of my program, it's just something I do while developing. If I run "G" again it'll get the entire file again. Now, I want to match these against another list of users. I'll do a similar trick: D:{d::0:"S"$":",x} and now I can do: D"users.txt" to put this into the d variable. My program needs to find the rows of g that d match. Some of the sessionids in the logfiles are corrupt. They look like this instead: 7241110807448127691320303160517889791474867567241110807448127691320312936057606400732600664532969577042775 4 62349552899220301013203170219134834182361546234955289922030101320303170219134834182361546234955289922030101 4 These are wrong. I originally tried to figure out them by finding the longest string that was also at the beginning of the sessionid, but after talking it out with Oleg and Pierre I decided to try to simply match them against the lengths of d: ?:#:'d said I only have two lengths (19 and 20), so this is a much smaller search than what I was trying before! To do this, I used views: K::?:#:'d k::"S"$"S",/:$:'K f::k!+(K#\:/:g.s) Now f is an index on g; instead of a `s column it has an `Sn column where n is length of the key; i.e. I have a `S19 and an `S20 column with the first 19 characters of `s and the first 20 characters of `s accordingly. s::g.s[&|/f[k]in\:d] c::g.c[&|/f[k]in\:d] Now I can look at the `s and `c vars and do what I want to do; get my unique userids and my counts. More importantly, I can apply this to all my files (I have a lot of them): n:0;m:0;{G x;n+:+/c;m+:+/g.c}'t
- jodrellblank 12y agoHis suggestion is that the cure for code bloat is, basically, codegolf?
- codemonkeymike 12y agoI was thinking the same thing myself. Like your code may be 1/10th the length but you need to find someone with a seemingly rare skill set to maintain it.
- geocar 12y agoBut what skill is this? Is it something we can develop in people? Teach? Practice? It may be rare that people will do it and invent it on their own, but I know there was a point in my life that I did not want to write code this way, so I know at least one person can change.
- codemonkeymike 12y agoYes people can change that is true, and I don't think anyone goes into a CS or IT program thinking this will be the type of code they write. The skills really are to think differently about code, and functional programming. Two things that are not taught in American universities(Or companies for that matter). So I feel like if I were to choose K as the language for my project which I expect to hire others to work on, I would have to build a K community in my area just to have the talent to work on my project.
- geocar 12y agoI'm not (yet) advocating we all program in K, but we start with the simpler problem of trying to talk about programming like scientists: To try to define things only in terms of what we can measure. The speed at which code runs? The size that the binary is? The size of the source file? How long it takes to build software that runs correctly? These are things we can measure, and while I suspect once we optimise programming languages for these things we will end up with something that looks like K, I do not think that it will be K because I have noticed that K is very bad at some things that I like to do.
- agentultra 12y agoAre there any post-scripts or notes from the ensuing conversations? An interesting point was made about humans not understanding programming and then dodges any explanation due to time.
- geocar 12y agoI'm sorry: It wasn't an intentional dodge. It really was getting late in the day. Only one person was hostile. They wanted to point out that there was no point in writing it all on one line "just to be unreadable". I told them I thought the readability was improved by having all the words together, but maybe it made it difficult to learn. I noted Arthur had recently annotated edit.k[1] and asked them if that layout made it easier for beginner programmers to learn to read. I don't think they liked being referred to as beginner programmers because he mentioned that he lectures at Cambridge, so of course they know how to program. But most people were very encouraging: A lot of people wanted to share something they didn't like about different programming languages, and wanted some ideas about how they can learn more. I got asked to read some more snippets of code [2] so that people could see this and get a better feel for it. I got a couple of questions about syntax highlighting and development tools, and if there might be some middle-of-the-road solutions that were terse but not-as-terse. Also: Beers. [1]: http://kparc.com/edit.k http://kparc.com/edit.k [2]: http://nsl.com/k/sudoku/ http://nsl.com/k/sudoku/
- agentultra 12y agoI don't believe they teach rhetoric as a standard component of one's education anymore. The default position is not one of charity but of doubt. A symptom of our time. I felt as though you were about to make a very critical point and I would very much like to know what it was.
- geocar 12y agoIt's on the tip of my tongue; I'm not yet articulate enough to describe this thought clearly. I had a go here: https://news.ycombinator.com/item?id=8476294 https://news.ycombinator.com/item?id=8476294 I'm still working on it though...
- 101914 12y agoDo you think Whitney ever considered using the NetBSD kernel code instead of Linux kernel code? No doubt, small was a priority. Why not BSD? And why doesn't kx have binaries available for BSD? They have Solaris. Burning questions I have always had. Maybe just based on demand from their licensses? k and kdb are some of the very few things that keep me interested in programming and computers.
- geocar 12y agokOS doesn't use the Linux kernel code. It supports a few of the same syscalls: clone, execve(!), epoll_create, epoll_ctl, epoll_wait, dup2, stat, rename, unlink, getcwd, chdir, fstat, getdents, open, close, read, write, ftruncate, mmap2, munmap, ioctl, gettimeofday, socket, bind, connect, listen, acccept, socketpair, setsockopt execve just runs another k interpreter (regardless of what you tell it to do) though, so it can just be used to run more k programs.
- 101914 12y agoI recall seeing a solictation on the kOS website for people who could get a Linux kernel down to a certain size. I presumed that meant the intent was to use Linux code; at least I was thinking he would end up getting responses from people with a Linux bias. But I also recall reading the line "no linux", which really piques my interest. I thought that just meant no Linux userland. Now I like this project even better! Sounds like you have access to the kOS source. Lucky you. Enjoy.
- realllly 12y agoPlease stop bringing this subject up. Yeah, I know. You are 10x programmers, willing to bash anyone in the comments with your superiority. Wanging your dong, like you own the place. This is very childish. Until I don't see an open download for this kos. GO FUCK YOURSELF. I can't believe you got so much circle jerking without having anything real to give. You want to stand behind your superior toy. Let me have a go at it. It's fucking 2014. Don't jew this bitch up. You'll get your pennies in the after life. Either let us enjoy what you speak of, or crawl back in to the cave you came from.
- realllly 12y agoPlease stop bringing this subject up. Yeah, I know. You are 10x programmers, willing to bash anyone in the comments with your superiority. Wanging your dong, like you own the place. This is very childish. Until I don't see an open download for this kos. GO FUCK YOURSELF. I can't believe you got so much circle jerking without having anything real to give. You want to stand behind your superior toy. Let me have a go at it. It's fucking 2014. Don't jew this bitch up. You'll get your pennies in the after life. Either let us enjoy what you speak of, or crawl back in to the cave you came from.