123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|598|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Misc Languages -> Implementing FRACTRAN

Sun, 24 Aug 2025, 19:02
Pixel_Outlaw

Implementing FRACTRAN


FRACTRAN is a horrible esoteric language that uses a list of fractions (they need to be true fractions not floating point numbers) and an integer to preform calculations.
Also due to the huge size of the numbers you want a host language that implements unlimited integer length.
The numeric values are entered as exponents of "registers" which are base numbers for those exponents.

For example, the fraction 2/3 happens to be "add" due to the way the algorithm works.
I'm working through the book "Strange Code: Esoteric Languages That Make Programming Fun Again".

I've written my implementation in Common Lisp using the LOOP facility to match the imperative style of the original algorithm which requires mutation of the iterator.
LOOP in itself is a sort of dark magic in Common Lisp designed to be comfortable to ALGOL programmers.