Sparcl

1 program Added 2026-03-06T10:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: —
Provenance: commit a82ab69561 · authored 2026-03-06T10:22:10+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

SPARK (0.36)Sparrow (0.31)Sparkling (0.27)Spade (0.25)SPOOL (0.25)

LLM-contributed programs

Bijective Functions

Provenance: commit a82ab69561 · authored 2026-03-06T10:22:10+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.sparcl · added: 2026-03-06T10:00:00Z
-- Sparcl: A Language for Partially-Invertible Computation
-- Simple bijective functions example
-- Based on: Matsuda, K. and Wang, M. (ICFP 2018)

data Nat = Z | S Nat

-- Successor bijection: forward adds S, backward removes S
succN :: Nat <-> Nat
succN n = S n

-- Swap pair elements (self-inverse bijection)
swap :: (a, b) <-> (b, a)
swap (x, y) = (y, x)

-- Negate integer (self-inverse bijection)
negateZ :: Int <-> Int
negateZ n = -n

-- Add a constant to the first component of a pair
-- forward: (x, y) -> (x+y, y)
-- backward: (x, y) -> (x-y, y)
addFst :: (Int, Int) <-> (Int, Int)
addFst (x, y) = (x + y, y)

Contribute — propose a file extension

Tell us where to find evidence about Sparcl (mapped to pl/sparcl). 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/Sparcl/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← SPARC Assembly SPARCs Fly →