4 ms·
Eh, "implement X in Y lines" for Y < 10 is pretty much always a cheat. At least this cheat has solid computer science behind it; most such cheats boil down to "
by jerf 11y ago
Eh, "implement X in Y lines" for Y < 10 is pretty much always a cheat. At least this cheat has solid computer science behind it; most such cheats boil down to "import library; library.cheat()", or, for the particular "implement a programming language", JavaScript "eval".
- deleted 11y ago[deleted]
- nickpsecurity 11y agoNah, there's those that are cheats and those that are solid work. Here's a LISP in 500 lines of C I just found that doesn't seem to cheat: https://gist.github.com/sanxiyn/523967 https://gist.github.com/sanxiyn/523967 It was one of many from the link below. The Scheme in Racket example would've been even easier to specify concretely because it's so easy to implement read in a Scheme. Gets the C and C++ implementations more props for doing things directly. Real question is how small can those go? https://news.ycombinator.com/item?id=7530427 https://news.ycombinator.com/item?id=7530427
- segmondy 11y agoA better lisp, in prolog in 160 lines. http://www.metalevel.at/lisprolog/lisprolog.html http://www.metalevel.at/lisprolog/lisprolog.html
- jerf 11y agocough It would seem to me that both 500 and 160 are substantially larger than 10.
- nickpsecurity 11y agoReminds me of the tale of the two programmers arguing. One says "Mine actually works right." The other retorts, "But mine runs faster!" The first merely sighs. Building almost nothing and using a very, high-level language definitely helps keep line count low. I wonder if we should count the runtime in these very-HLL examples. One like PreScheme, a system variant, I'd probably not count the runtime although might count the running time. :)
- nickpsecurity 11y agoThat's a trip. Reminds me of when I studied and toyed with AI programs. The first books I learned taught LISP, Prolog, and mixing the two. We'd normally implement Prolog in LISP. Allegro still does. Neat to see it done the other way. Want a fun project? Run this one through a Prolog compiler and create some LISP benchmarks. Then, recode it in the Mercury language, which IIRC is No 1 logic language, then see how that code performs (and looks). Should be straight-forward and enlightening for those interested in logic programming.
- deleted 11y ago[deleted]