Statically typed, stack-based functional programming language with concatenative semantics.

Kitten is a statically typed, stack-based functional programming language designed to be simple and fast. It is a concatenative language, combining aspects of imperative and pure functional programming.

99 bottlesOfBeer

def bottlesOfBeer (Int -> +IO):
  -> x
  x verse
  if (x 1 >):
    x-- bottlesOfBeer

def verse (Int -> +IO):
  -> x
  x wall newline
  x beer newline
  take newline
  x-- wall newline
  newline

def beer (Int -> +IO):
  bottles " of beer" print

def wall (Int -> +IO):
  beer " on the wall" print

def take (-> +IO):
  "take one down, pass it around" print

def bottles (Int -> +IO):
  -> x
  if (x 0 =):
    "no more bottles"
  else if (x 1 =):
    "one bottle"
  else:
    x showInt " bottles" cat
  print
Information updated 08/28/15
View Comments