Skip to main content
deleted 29 characters in body
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484

Flurry -nii, 14 bytes

{}{{}({})}{{}} 

Run example

Try it online!

$ ./flurry -nin -c $pgm 2 1 2 $ ./flurry -nin -c $pgm 2 2 4 $ ./flurry -nin -c $pgm 2 3 16 $ ./flurry -nin -c $pgm 2 4 65536 $ ./flurry -nin -c $pgm 5 2 3125 

Takes two numbers a b from stdin, and outputs as the return value.

How it works

It works basically like xnor's Haskell answer: repeat (a^) b times to 1. a is left on the stack, so that it can be referenced in each iteration.

// In Church numeral, x a → a^x main = b power_of_a 1 power_of_a = \x. x a = \x. x (push pop) // assumes a is on the top of the stack, // pops and takes its value and pushes it back 

Flurry, 14 bytes

{}{{}({})}{{}} 

Run example

$ ./flurry -nin -c $pgm 2 1 2 $ ./flurry -nin -c $pgm 2 2 4 $ ./flurry -nin -c $pgm 2 3 16 $ ./flurry -nin -c $pgm 2 4 65536 $ ./flurry -nin -c $pgm 5 2 3125 

How it works

It works basically like xnor's Haskell answer: repeat (a^) b times to 1. a is left on the stack, so that it can be referenced in each iteration.

// In Church numeral, x a → a^x main = b power_of_a 1 power_of_a = \x. x a = \x. x (push pop) // assumes a is on the top of the stack, // pops and takes its value and pushes it back 

Flurry -nii, 14 bytes

{}{{}({})}{{}} 

Try it online!

Takes two numbers a b from stdin, and outputs as the return value.

How it works

It works basically like xnor's Haskell answer: repeat (a^) b times to 1. a is left on the stack, so that it can be referenced in each iteration.

// In Church numeral, x a → a^x main = b power_of_a 1 power_of_a = \x. x a = \x. x (push pop) // assumes a is on the top of the stack, // pops and takes its value and pushes it back 
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484

Flurry, 14 bytes

{}{{}({})}{{}} 

Run example

$ ./flurry -nin -c $pgm 2 1 2 $ ./flurry -nin -c $pgm 2 2 4 $ ./flurry -nin -c $pgm 2 3 16 $ ./flurry -nin -c $pgm 2 4 65536 $ ./flurry -nin -c $pgm 5 2 3125 

How it works

It works basically like xnor's Haskell answer: repeat (a^) b times to 1. a is left on the stack, so that it can be referenced in each iteration.

// In Church numeral, x a → a^x main = b power_of_a 1 power_of_a = \x. x a = \x. x (push pop) // assumes a is on the top of the stack, // pops and takes its value and pushes it back