User talk:Thebigh/mysandbox

From Rosetta Code

FRACTRAN

Anyone may start a Category page just like they may provide solutions.
--GarveyPatrickD (talk) 04:26, 23 November 2021 (UTC)

  • True. But there's a few things we'd need to work out first. The programs are just ordered lists of fractions, and there's no "official" compiler, so it's hard to settle on a consistent way of representing programs. For example, consider the program {105/2, 11/9, 1/3} called with the input 512. All this does is copy the exponent 9 into two other registers, and 4 into a third.

But what's the "correct" representation of this program, its input and output? I've seen all of the following during my frenzied googling:

  • <lang>{105/2, 11/9, 1/3}</lang>
  • <lang>(105, 11, 1)(2, 9, 3)</lang>
  • <lang>(105, 2), (11,9), (1, 3)</lang>

and probably others, with and without numerators and denominators factored. And should the final state be reported as 1,153,939,765,794,921,875 or as 5^9 x 7^9 x 11^4? How to report "output" of nonterminating programs like Conway's prime game? What do you think?

After that we'd probably need to move the Fractran task to Execute Fractran to make room for a redirect to the new category.

I think I'd probably want to collect ten or twelve actual programs before it's ready to go live. Thebigh (talk) 10:14, 23 November 2021 (UTC)

FWIW I'd say the correct representation is the string "105/2 11/9 1/3", optionally with commas, and any {}/[]/() are implementation-specific details. Then again you could say a parser has to cope with all three of the above forms [as plain text input, that is]. --Pete Lomax (talk) 18:41, 23 November 2021 (UTC)