Ficus

1 program Added 2026-02-27T00:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: —
Provenance: commit 943319daca · authored 2026-02-27T07:12:25+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

FOCUS (0.40)Circus (0.25)Fluxus (0.25)Fift (0.18)Fika (0.18)

LLM-contributed programs

Y Combinator (Factorial and Fibonacci)

Provenance: commit 943319daca · authored 2026-02-27T07:12:25+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.fx · added: 2026-02-27T00:00:00Z
/*
    This file is a part of ficus language project.
    See ficus/LICENSE for the licensing terms
*/

// From https://rosettacode.org/wiki/Y_combinator; adoped from OCaml implementation.
// The trick from Lambda calculus to convert non-recursive functions into recursive ones
type 'a mu = Roll: ('a mu -> 'a)
fun unroll(Roll(x): 'a mu) = x

fun ycomb (f: ('a -> 'b) -> ('a -> 'b)): 'a -> 'b {
    fun l(x: ('a -> 'b) mu): 'a -> 'b = fun (a: 'a) { f(unroll(x)(x))(a) }
    l(Roll(l))
}

fun fac (f: int->int) =
    fun (n: int) {
    | 0 => 1
    | _ => n*f(n-1)
    }

fun fib (f: int->int) =
    fun (n: int) {
    | 0 => 0
    | 1 => 1
    | _ => f(n-1) + f(n-2)
    }

val recfac = ycomb(fac)
println(f"5! = {recfac(5)}")

val recfib = ycomb(fib)
println(f"fib(8) = {recfib(8)}")

Contribute — propose a file extension

Tell us where to find evidence about Ficus (mapped to pl/ficus). 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/Ficus/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Fiction Markup Language FIFOrth →