Front Page All Articles Recent Changes Random Article

Contents

Concatenative language

  • ACL
  • Ait
  • Aocla
  • Breeze
  • Callisto
  • Cat
  • Cognate
  • colorForth
  • Concata
  • CoSy
  • Deque
  • DSSP
  • dt
  • Elymas
  • Enchilada
  • ETAC
  • F
  • Factor
  • Fiveth
  • Forth
  • Fourth
  • Freelang
  • Gershwin
  • hex
  • iNet
  • Joy
  • Joy of Postfix App
  • kcats
  • Kitten
  • lang5
  • Listack
  • LSE64
  • Lviv
  • Meow5
  • min
  • Mirth
  • mjoy
  • Mlatu
  • Ode
  • OForth
  • Om
  • Onyx
  • Plorth
  • Popr
  • Porth
  • PostScript
  • Prowl
  • Quest32
  • Quackery
  • r3
  • Raven
  • Retro
  • RPL
  • SPL
  • Staapl
  • Stabel
  • Tal
  • Titan
  • Trith
  • Uiua
  • Worst
  • xs
  • XY
  • 5th
  • 8th

Concatenative topics

  • Compilers
  • Interpreters
  • Type systems
  • Object systems
  • Quotations
  • Variables
  • Garbage collection
  • Example programs

Concatenative meta

  • People
  • Communities

Other languages

  • APL
  • C++
  • Erlang
  • FP trivia
  • Haskell
  • Io
  • Java
  • JavaScript
  • Lisp
  • ML
  • Oberon
  • RPL
  • Self
  • Slate
  • Smalltalk

Meta

  • Search
  • Farkup wiki format
  • Etiquette
  • Sandbox

Kitten

A Concatenative language by Jon Purdy with static typing, type inference, and effect types. Not actively developed since 2018.

  • GitHub
  • Home Page

Example

define fib_naive (UInt64 -> UInt64):
  -> n;
  if (n <= 1u64):
    1u64
  else:
    (n - 2u64) fib_naive + (n - 1u64) fib_naive

define fib_tailrec (UInt64 -> UInt64):
  1u64 1u64 fib_tailrec_helper

define fib_tailrec_helper (UInt64, UInt64, UInt64 -> UInt64):
  -> n, a, b;
  if (n = 0u64):
    a
  elif (n = 1u64):
    b
  else:
    (n - 1u64) b (a + b) fib_tailrec_helper

define fib_fix (UInt64 -> UInt64):
  do (fix) -> n, rec:
    if (n <= 1u64):
      1u64
    else:
      (n - 2u64) rec call -> a;
      (n - 1u64) rec call -> b;
      a + b

define test ((UInt64 -> UInt64) -> +IO):
  10u64 swap call say

[\fib_naive, \fib_tailrec, \fib_fix] \test each

This revision created on Sat, 23 Mar 2024 23:24:10 by evincarofautumn (Tidy formatting and add example.)

Latest Revisions Edit

All content is © 2008-2024 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.