Anyfix

From Esolang
Jump to navigation Jump to search

Anyfix is a golfing language by HyperNeutrino inspired by Jelly and 05AB1E that uses Anyfix notation or this language by Hyper Neutrino). Anyfix is written in Python.

Example Programs

n-th triangular number:

 RS
 R  Range up to value
  S Sum

digital sum:

 DS
 D  Decimal Digits
  S Sum

binary digital sum:

 BS
 B  Binary Digits
  S Sum

digital root

 ¡DS»
 ¡  » Repeat the code until the values are no longer unique
  D   Decimal Digits
   S  Sum

take number n as input, then for each line of input replace all runs of n spaces at the beginning with a tab (space → tab because tabs are superior):

 ⁶Ɠ×@ɦ€¡"\t"®ʂ»»Y
 ⁶                 single space onto stack
  Ɠ                take a line of input and evaluate it onto stack
   ×               multiply the space by that number onto stack
    @              pop that value off of stack and store in register
     ɦ             read all lines of input as a list of lines
      €        »   for each element in this list
       ¡      »    keep repeating until the results are no longer unique
        "\t"       push a tab onto the stack
            ®      copy the register (the spaces) onto the stack
             ʂ     regex-replace
                 Y join by newlines

See also