Pyret

1 program Added 2026-02-05T20:56:06Z Agent: claude-codeModel: opusWebSearch: enabled Evidence Report issue View issues
Aliases: —
Provenance: commit f38a379d88 · authored 2026-02-05T21:56:49+01:00 · agent claude-code · model opus

Sources mentioning this language

4 sources · pl_id: pl/pyret
LLM (this repo) · 1PldbLinguistRosettacode

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
.arrlinguistprimary32.9K files

Related languages

Pyrex (0.40)Pyro (0.30)PyRTL (0.27)Ferret (0.25)Puppet (0.25)

LLM-contributed programs

Functional Queue

Provenance: commit f38a379d88 · authored 2026-02-05T21:56:49+01:00 · agent claude-code · model opus · WebSearch enabled
code.arr · added: 2026-02-05T20:56:06Z
#lang pyret

data Queue:
 | queue(from-front, from-back)
end

mt-queue = queue([list: ], [list: ])

fun enqueue(q, elt):
 queue(link(elt, q.from-front), q.from-back)
where:
 enqueue(mt-queue, 4) is queue([list: 4], [list: ])
 mt-queue
 ^ enqueue(_, 4)
 ^ enqueue(_, 5) is queue([list: 5, 4], [list: ])
 full-q = queue([list: ], [list: 4])
 full-q
 ^ enqueue(_, 5)
 ^ enqueue(_, 6) is queue([list: 6, 5], [list: 4])
end

fun size(q):
 q.from-front.length() + q.from-back.length()
end

fun dequeue(q):
 cases(List) q.from-back:
  | empty =>
   cases(List) q.from-front:
    | empty => raise("Dequeue on an empty queue")
    | link(_, _) =>
     new-from-back = q.from-front.reverse()
     new-queue = queue([list: ], new-from-back.rest)
     result = new-from-back.first
     { q: new-queue, v: result }
    end
  | link(f, r) => { q: queue(q.from-front, r), v: f }
 end
where:
 little-q = queue([list: ], [list: 4])
 dequeue(little-q) is { q: queue([list: ], [list: ]), v: 4 }
 dequeue(dequeue(little-q).q) raises "empty queue"

 full-q2 = queue([list: 1, 2, 3], [list: 4, 5, 6])

 dq1 = dequeue(full-q2)
 dq1 is { q: queue([list: 1, 2, 3], [list: 5, 6]), v: 4 }
 dq1.q ^ dequeue(_) is { q: queue([list: 1, 2, 3], [list: 6]), v: 5 }
 (dq1.q ^ dequeue(_)).q ^ dequeue(_) is { q: queue([list: 1, 2, 3], [list: ]), v: 6 }
 ((dq1.q ^ dequeue(_)).q ^ dequeue(_)).q ^ dequeue(_) is { q: queue([list: ], [list: 2, 1]), v: 3 }
end

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 Pyret (mapped to pl/pyret). 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/Pyret/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Pyramid Scheme pyret-lang →