rFun

1 program Added 2026-03-05T10:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: Rfun, RFun
Provenance: commit f2505e3018 · authored 2026-03-05T14:38:52+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

NFun (0.30)Datafun (0.23)Radon (0.17)Raven (0.17)SETUN (0.17)

LLM-contributed programs

Fibonacci with Peano Numbers

Provenance: commit f2505e3018 · authored 2026-03-05T14:38:52+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.rfun · added: 2026-03-05T10:00:00Z
-- Peano natural numbers and arithmetic in rFun (reversible functional language)
data Nat = Z | S Nat

plus :: Nat -> Nat <-> Nat
plus Z     x = x
plus (S y) x =
  let x' = plus y x
  in  (S x')

minus :: Nat -> Nat <-> Nat
minus y x = plus! y x

-- The classical Fibonacci function (embedded to result in a pair)
-- fib n gives the (n+1)-th and n-th Fibonacci numbers
fib :: Nat <-> (Nat, Nat)
fib Z    = ((S Z),Z)
fib (S m) =
  let (x,y) = fib m
      y' = plus x y
  in (y', x)

Contribute — propose a file extension

Tell us where to find evidence about rFun (mapped to pl/rfun). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/rFun/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← RFOL rgb-format →