from Hacker News

Show HN: You can program without loop and recursion and×÷- is all you need

by raoof on 7/16/24, 10:07 AM with 17 comments

  • by rstuart4133 on 7/22/24, 10:45 AM

    Why over complicate it? FRACTRAN is a Turning complete language based on only one operation: multiplication. It's Wikipedia entry gives a short FRACTRAN program that finds all primes. https://en.wikipedia.org/wiki/FRACTRAN

    In the words of it's inventor, John Conway:

        Makes workday really easy!  FRACTRAN needs no complicate programming manual. It's entire syntax can be learned in 10 seconds, and programs for quite complex and interesting functions can be written almost at once.  The entire configuration of a FRACTRAN computer at any instant is a single integer - no messy "tapes" or other foreign concepts to be understood by the fledging programmer.
    
    What's not to like? This is a good introduction for someone seriously considering doing their next project in FRACTRAN: https://raganwald.com/2020/05/03/fractran.html
  • by voidUpdate on 7/16/24, 10:19 AM

    How do you go back to an earlier point in the program if you can't loop? For example, how would you do a primality test for an arbitrary input?
  • by brudgers on 7/17/24, 4:34 PM

           Epigram 54.
    
           Beware of the Turing tar-pit
           in which everything is possible
           but nothing of interest is easy.