Skip to main content
added 365 characters in body
Source Link
xnor
  • 149.8k
  • 26
  • 289
  • 677

Haskell, 29 bytes

(+1)?(2?)
z?f=(iterate f z!!)

Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order for "apply f n times starting from z" from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for 2 bytes longer:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Another alternative to the original is to flip the two arguments to ?, allowing it to be defined in a point-free way for the same byte count.

29 bytes

(?2)?(+1)
(?)=((!!).).iterate

Try it online!

29 bytes

(?2)?(+1)
(?)f=(!!).iterate f

Try it online!

31 bytes

n?0=n+1
0?m=2
n?m=(n-1)?m?(m-1)

Try it online!

Haskell, 29 bytes

(+1)?(2?)
z?f=(iterate f z!!)

Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order for "apply f n times starting from z" from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for 2 bytes longer:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Another alternative to the original is to flip the two arguments to ?, allowing it to be defined in a point-free way for the same byte count.

29 bytes

(?2)?(+1)
(?)=((!!).).iterate

Try it online!

29 bytes

(?2)?(+1)
(?)f=(!!).iterate f

Try it online!

Haskell, 29 bytes

(+1)?(2?)
z?f=(iterate f z!!)

Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order for "apply f n times starting from z" from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for 2 bytes longer:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Another alternative to the original is to flip the two arguments to ?, allowing it to be defined in a point-free way for the same byte count.

29 bytes

(?2)?(+1)
(?)=((!!).).iterate

Try it online!

29 bytes

(?2)?(+1)
(?)f=(!!).iterate f

Try it online!

31 bytes

n?0=n+1
0?m=2
n?m=(n-1)?m?(m-1)

Try it online!

added 499 characters in body
Source Link
xnor
  • 149.8k
  • 26
  • 289
  • 677

Haskell, 29 bytes

(+1)?(2?)
z?f=(iterate f z!!)

Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order for "apply f n times starting from z" from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for the same byte count2 bytes longer:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Another alternative to the original is to flip the two arguments to ?, allowing it to be defined in a point-free way for the same byte count.

29 bytes

(?2)?(+1)
(?)=((!!).).iterate

Try it online!

29 bytes

(?2)?(+1)
(?)f=(!!).iterate f

Try it online!

Haskell, 29 bytes

(+1)?(2?)
z?f=(iterate f z!!)

Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order for "apply f n times starting from z" from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for the same byte count:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Haskell, 29 bytes

(+1)?(2?)
z?f=(iterate f z!!)

Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order for "apply f n times starting from z" from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for 2 bytes longer:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Another alternative to the original is to flip the two arguments to ?, allowing it to be defined in a point-free way for the same byte count.

29 bytes

(?2)?(+1)
(?)=((!!).).iterate

Try it online!

29 bytes

(?2)?(+1)
(?)f=(!!).iterate f

Try it online!

added 44 characters in body
Source Link
xnor
  • 149.8k
  • 26
  • 289
  • 677

Haskell, 3129 bytes

(?)(+1)?(2?)
z?f=(iterate f z!!)

Try it online!Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order for "apply f n times starting from z" from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for the same byte count:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Haskell, 31 bytes

(?)(+1)(2?)
z?f=(iterate f z!!)

Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for the same byte count:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Haskell, 29 bytes

(+1)?(2?)
z?f=(iterate f z!!)

Try it online!

An Ackermann-like function. Starting the base numerical value at 2 makes for a simple base case. An annoying number of bytes are spent converting the arguments order for "apply f n times starting from z" from iterate f z!!n to (?) z f n which can be curried nicely.

Same thing written more explicitly for the same byte count:

31 bytes

0%n=n+1
m%n=iterate((m-1)%)2!!n

Try it online!

Source Link
xnor
  • 149.8k
  • 26
  • 289
  • 677
Loading