October 30, 2006 3:42 PM   Subscribe

Fractran. A Turing complete programming language expressed in prime numbers from John Conway. (Interpreter here.) More pathological programming. Via Good Math, Bad Math.
posted by loquacious (14 comments total) 8 users marked this as a favorite
OK, it's gonna take me a few days to wrap my brain around this. Speaking of which, I've always been a fan of Brainfuck.
posted by gwint at 4:02 PM on October 30, 2006

I've always had a soft spot for Befunge, but Fractran is a different brand of wonderful entirely.
posted by cortex at 4:47 PM on October 30, 2006

Awesome! I love how you multiply primes in temporarily to keep track of where you are in the computation. And you can even change the syntax pretty easily to make it easier to program in; just give the primes names and you've got a normal term-rewriting language...
posted by equalpants at 5:27 PM on October 30, 2006

Brainfuck is good, but a couple posts on the blog, he even beats that with Iota and Jot, which are both Turing complete and have only two symbols. This is really awesome, loquacious, thanks!
posted by Upton O'Good at 6:01 PM on October 30, 2006

Esoteric languages are amazing. For those interested in bizarre programming languages, be sure to check out INTERCAL and, more importantly, the documentation.
posted by spiderskull at 7:31 PM on October 30, 2006

01001000 01100001 01110000 01110000 01111001 00100000 01001000 01100001 01101100 01101100 01101111 01110111 01100101 01100101 01101110
posted by swift at 9:49 PM on October 30, 2006

So, who's going to write the BASIC-to-Fractran compiler?
posted by blenderfish at 12:33 AM on October 31, 2006

You know, I don't think it would be all that hard, really. It's pretty easy to make sure a sequence of "instructions" runs only in sequential order--assign each one a unique prime label, then have it divide by its label and multiply by the next instruction's (in addition to its other work, of course). Kind of like a program counter that holds only primes.

So transforming from imperative-style is easy, calling subroutines would be pretty similar, multiply/divide can be replaced with subroutines. For comparing two numbers, just subtract until one disappears.

As for I/O, one way to do it would be to allow letters as factors: you could have 7x/13, say, which acts just like 7/13 except that whenever it's used it prints an 'x' to the console. I'll bet there's a nicer way, though.

I wish I wasn't totally buried in work/homework right now; sounds like a fun project...
posted by equalpants at 1:01 AM on October 31, 2006

I'm rather fond of Shakespeare.
posted by flabdablet at 6:11 AM on October 31, 2006 [1 favorite]

I was amazed to see (third link) Conway has at least six children, by several wives, the most recent born 2001 when he was in his sixties-- only doing his bit, I guess, to make up for poor old Newton dying a virgin.
posted by jamjam at 8:17 AM on October 31, 2006

LOL, that was by his own choice! Such a notorious character could surely have gotten laid if he had wanted to.
posted by sonofsamiam at 8:28 AM on October 31, 2006

The Primes, the Primes-- always the inscrutable damned Primes!

If the children of this (lesser?) God had had a Holy Book, would the Gospel of Archimedes read: 'In the beginning were the Primes, and the Primes were with God, and the Primes were God. The same were in the beginning with God. All things were made by them; and without them was not any thing made that was made.'
posted by jamjam at 1:21 PM on October 31, 2006

Can you put a goodmathbadmath tag on this?
posted by Eideteker at 1:51 PM on October 31, 2006

Well, God created the natural numbers; all else is the work of Man. Presumably the primes are extra holy.
posted by hattifattener at 12:09 AM on November 1, 2006

« Older Mic In Track   |   But each time he hit the button next to the... Newer »

This thread has been archived and is closed to new comments