Charity

1 program Added 2026-02-05T21:19:54Z Agent: claude-codeModel: sonnetWebSearch: enabled Evidence Report issue View issues
Aliases: —
Provenance: commit b73409fedc · authored 2026-02-05T22:21:25+01:00 · agent claude-code · model sonnet

Sources mentioning this language

4 sources · pl_id: pl/charity
LLM (this repo) · 1PldbLinguistHyperpolyglot

Extensions claimed by this language

1 claim. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.chlinguistprimary134.1K files

Related languages

Clarity (0.50)Charly (0.42)Charm (0.33)Charcoal (0.27)Charm++ (0.25)

LLM-contributed programs

List and Natural Number Functions

Provenance: commit b73409fedc · authored 2026-02-05T22:21:25+01:00 · agent claude-code · model sonnet · WebSearch enabled
code.ch · added: 2026-02-05T21:19:54Z
rf "Lnat.ch".
rf "Llist.ch".


def min_max: Lnat * Lnat -> Lnat * Lnat
 = (m, n) => fn ( n
 , {| Lzero: () => (fn: _ => (m, n))
 | Lsucc: f => (fn: Lzero => (n, m)
 | Lsucc n' => fn (lid n', lid f)
 )
 |}
 m
 ).

def max_min = pn => {(m, n) => (n, m)} min_max pn.
def new_min = pn => p0 min_max pn.
def new_max = pn => p1 min_max pn.


def new_zip: Llist(A) * Llist(B) -> Llist(A * B)
 = (l1, l2) => fn (l2
 , {| Lnil : () => (fn: _ => Lnil)
 | Lcons: p => (fn: Lnil => Lnil
 | Lcons (b, (lid: l2')) =>
 { (a, f) =>
 Lcons ( (a, b)
 , (lid: fn (l2', f))
 )
 }
 (p0 p, lid p1 p)
 )
 |}
 l1
 ).


def take_drop: Lnat * list(A) -> list(A) * list(A)
 = (n, l) => fn (l
 , {| Lzero: () => (fn: l' => ([], l'))
 | Lsucc: f => (fn: nil => ([], [])
 | cons (a, l') => { (t, d) =>
 (cons (a, t), d)
 }
 fn (l', lid f)
 )
 |}
 n
 ).

def new_take = p => p0 take_drop p.
def new_drop = p => p1 take_drop p.


def new_eq: Lnat * Lnat -> bool
 = (m, n) => fn (n, {| Lzero: () => (fn: Lzero => true
 | Lsucc _ => false
 )
 | Lsucc: f => (fn: Lzero => false
 | Lsucc (lid: n') => fn (n', lid f)
 )
 |}
 m
 ).

def new_neq = pn => not new_eq pn.


def bwhile{ initial: A -> C
 , iterate: C -> C
 , final : C -> B
 , cond : C -> bool
 }:
 A * Lnat -> SF(B)
 = (a, n) => SF{final} fn (initial a
 , {| Lzero: () => (fn: _ => ff)
 | Lsucc: f => (fn: c =>
 { true => fn ( iterate c
 , lid f
 )
 | false => ss c
 }
 cond c
 )
 |}
 n
 ).


def diff: Lnat * Lnat -> Lnat * Lnat
 = (m, n) => max_min (n, Lsub (m, n)).


def gcd: Lnat * Lnat -> SF(Lnat)
 = pn => bwhile{max_min, diff, p0, new_neq} (pn, new_max pn).

Real programs from Software Heritage

No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)

Contribute — propose a file extension

Tell us where to find evidence about Charity (mapped to pl/charity). 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/Charity/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← CharCode CharLang →