Live data from Hacker News

Show HN: XKCD-inspired StackSort

gkoberger.github.com

101–110 of 210 posts

Re: Show HN: XKCD-inspired StackSort

#101
post #33

Has anybody made a gallery of real implementations of Randall Munroe's hilarious ideas yet? I recall at least three exhibitions: this, M-x butterfly, and Hell Tetris; there are probably many others.

Never forget the "import antigravity". I can't think of another comic idea that was implemented in a mainstream language. :-)

Burn the infidel implying that elisp isn’t mainstream!

Re: Show HN: XKCD-inspired StackSort

#102
post #88

Earlier quoted context omitted.

I tried a basic version of that 1.5 weeks ago. At first it was generating random characters, then I tried some Markov chains trained on valid code. After running it overnight (it was attempting 40+ programs per second), the very best program looked something like this: package main; func main() { i := 0 // wae64309i Next step I wanna try is to use tokens of the language instead of series of random characters. Edit: H…

If you actually want to go down this path then you want a language with as little redundancy as possible. Comments may be useful to humans but they needlessly complicate the search space. Abstractly you want to think about the how your language is parsed so you don't for example try different variable names. Though if you spend enough time your probably going to be reimplementing some type of http://en.wikipedia.org/…

Yep, I was considering directly generating the AST.

Re: Show HN: XKCD-inspired StackSort

#103
post #91

Earlier quoted context omitted.

I tried a basic version of that 1.5 weeks ago. At first it was generating random characters, then I tried some Markov chains trained on valid code. After running it overnight (it was attempting 40+ programs per second), the very best program looked something like this: package main; func main() { i := 0 // wae64309i Next step I wanna try is to use tokens of the language instead of series of random characters. Edit: H…

Hah, fun idea. Modified it a bit to run in parallel. I guess I'll leave it on for couple hours and see if it gets anywhere. current output: 1363637914 2013-03-18 22:18:34.118051 +0200 EET Stats: 0/53659699 (0%) good/tries, 223559.91320127275 ops/sec

Cool, let me know the best you get (and submit a PR with your parallel patch if you want).

You can tweak the range of the number of generated characters, the length of Markov chains, the minimum main body clauses, etc. With my original config it should give you a valid program every hour~few hours or so.

Re: Show HN: XKCD-inspired StackSort

#104
post #24

Earlier quoted context omitted.

It doesn't test for two reasons: 1) I thought it would defeat the purpose 2) "Sort" is very arbitrary. Do you want to sort by key or value? Is "1000" bigger or smaller than "2"? etc

Fair; also, it's called an 'ineffective' sort, and if you tested it, it'd become effective (not efficient, of course). So, good point!

You could probably test it by taking multiple sorts from SO and then comparing results. the moment you get two that agree, you have a winner!

Re: Show HN: XKCD-inspired StackSort

#105
post #53

Earlier quoted context omitted.

Also, geohashing I'm waiting for 1Password to implement 936. http://xkcd.com/936/ It's not that I don't trust 1Passwords generation algorithm, but when I'm on a borrowed PC (wife's laptop, inlaws desktop or even at work where I can't install 1P) this would help. It's much easier to open 1P on my iPhone, look up a password and type in "correct horse battery staple" than to constantly have to refer back to my phone.

I actually changed my way to pick password thanks to that comic. There are longer and usually with the same entropy, but so much easier to remember!

I just wish my password manager would do that automatically. I know there are terminal scripts and apps that will do it. I'd just like it to be integrated.

Re: Show HN: XKCD-inspired StackSort

#106
post #57

Earlier quoted context omitted.

Genetic programming; type that into google scholar and look at the late-80s and early-90s papers.

Thanks!, I used to play with GP back in the university. It's really fun! However, GP is more like an oriented random search where the space of search is really big. Here the space is somehow filtered by humans, where each hypothesis had been generated by a human and not by a machine. It would be interesting if the machine could evolve those solutions that are not quite but close to be the proper one :)

I think it's also amazing what has been done with Field Programable Gate Arrays (FPGAs) running genetic algorithms. For those not in the know, FPGAs are programmable logic, so you essentially generate random logic codes and check for their ability to for example interpret a signal properly. There was an experiment where this was done for an FPGA with only several hundred gates, over several thousands of generations. It was tasked to differentiate between a 10khz and a 10hz wave. The most amazing thing is, the resulting code used only about 50 of these gates, some of them not connected to others, yet removal of the nonconnected gates would cause inability to carry out the task (Yay, Quantum weirdness). Nor would the code work on any other, larger FPGA. Essentially, it boils down to the Genetic Algorithm finding a code that used specific quirks in the structure of the hardware, utilizing effects we are currently not aware of, to solve a problem. I wish I could find the Article in question, but it's too late in the evening.

Re: Show HN: XKCD-inspired StackSort

#107
post #51

Earlier quoted context omitted.

I will read more about GP for future attempts, thanks.

This is an exciting exchange for me because all joking aside I had this idea in the past and believe it should be a more active area of research. Why Forth? I doubt it is possible to solve "serious" problems with this approach but there is a whole class of work that is solved by mediocre programmers with copy pasting. We strive to automate other jobs, why not these? :) We should come up with some sort of Turing like…

Forth, Factor, APL or any other concatenative language provides the benefit of a "point free" style in which there are no explicitly named variables- that's one way to reduce the possibility space of programs. In the case of Factor (or Forth with an appropriate DSL) you could further use type information to ensure that your program generator only used words in sequence whose stack effects match up properly- ie a 'valid' program. Concatenative languages also tend to have an extremely simple grammar- Forth is just a sequence of tokens and numbers.

Re: Show HN: XKCD-inspired StackSort

#108
post #5

If you give it about 30 seconds it works eventually, this is beautiful. I had a good laugh. Edit: It makes me want to do something crazy like setup a tool chain that cobbles whole programs together with trial and error like this. Throw enough resources at it maybe it will be faster and cheaper than your avg. developer. It will be an unmaintainable mess as if you used Brainfuck or Perl. But it will run, by god, it wil…

The key last step is to have it automatically post questions to StackOverflow to fill in the last code snippets it can't complete.

Re: Show HN: XKCD-inspired StackSort

#109

Earlier quoted context omitted.

Ah, applying the Infinite monkey theorem to programming :) http://en.wikipedia.org/wiki/Infinite_monkey_theorem

Yeah, but there are a few well trained monkeys hanging out [mining for karma points] at StackOverflow. The really adventurous would direct it at 4chan.

Direct at at /prog/ and you may eventually run across SleepSort, which would at least do something mildly useful (in >30 languages, no less!)

Re: Show HN: XKCD-inspired StackSort

#110

I'm sure that TempleTypeDef ( http://stackoverflow.com/users/501557/templatetypedef ) is loving this. As their answer ( http://stackoverflow.com/questions/14761032/infinite-recursi... ) went from 5 upvotes when this was originally submitted to 29 at the time of this comment. Presumably all due to the HN effect. Does the script run through the same order each time, because I keep getting that answer first, and by the…

It looks like the same order, and every time i run it stops at the same answer
Post reply on HN