←back to thread

-2000 Lines of code (2004)

(www.folklore.org)
510 points xeonmc | 2 comments | | HN request time: 0.428s | source
Show context
Scuds ◴[] No.44381825[source]
This being Lisa that's -2000 lines in 68k assembler. That's about as verbose as any real PL can ever get.

For what it's worth, here's quicksort in 5 lines of haskell https://stackoverflow.com/questions/7717691/why-is-the-minim...

replies(5): >>44382075 #>>44382858 #>>44383316 #>>44384752 #>>44386775 #
kragen ◴[] No.44383316[source]
That's not quicksort, though, because it's not in place; the actual quicksort on that page is in https://stackoverflow.com/a/7833043, which is 11 lines of code. That's still pretty concise. My own preferred concise, or at least terse, presentation of quicksort is http://canonical.org/~kragen/sw/dev3/paperalgo#addtoc_20.

How long would a quicksort (say, of integers) be in 68000 assembly? Maybe 20 lines? My 68000 isn't very good. The real advantage of writing it in Haskell is that it's automatically applicable to anything that's Ord, that is, ordered.

replies(1): >>44385082 #
duskwuff ◴[] No.44385082[source]
> How long would a quicksort (say, of integers) be in 68000 assembly?

About 70 lines, once you strip out the comments and blank lines.

https://github.com/historicalsource/supermario/blob/9dd3c4be...

replies(1): >>44386638 #
1. kragen ◴[] No.44386638[source]
This is great, thanks! I was thinking it could be much simpler, but it looks like I was mistaken.

I'm trying to code up a version in ARM assembly to compare, and it looks like it'll be about 30 lines; when I get that working I can compare to see why the difference. In some ways the 68000 is more expressive than ARM, like being able to reference memory directly, even twice in one instruction.

(Am I misunderstanding this, or is this the source code to Apple System 7.1? There seems to have been a mailing list about this codebase from 02018 to 02021: https://lists.ucc.gu.uwa.edu.au/pipermail/cdg5/)

replies(1): >>44388718 #
2. duskwuff ◴[] No.44388718[source]
> Am I misunderstanding this, or is this the source code to Apple System 7.1?

More or less, yes. It only encompasses the system (i.e. not applications like the Finder) and isn't entirely complete, but it's still a great window into the world of Apple pre-OS X.

> There seems to have been a mailing list about this codebase from 02018 to 02021: https://lists.ucc.gu.uwa.edu.au/pipermail/cdg5/

This mailing list was for a set of projects which focused on taking this code dump (among other things) and making it compile, ideally to reproduce released binaries.

https://github.com/elliotnunn/cdg5