Grain

1 program Added 2025-10-22T14:18:40Z Model: anthropic/claude-3.5-sonnetTemp: 0.4 Evidence Report issue View issues
Aliases: gr
Provenance: commit c96bb30b70 · authored 2025-10-22T16:18:40+02:00 · model anthropic/claude-3.5-sonnet

Sources mentioning this language

4 sources · pl_id: pl/grain
LLM (this repo) · 1PldbEsolangRosettacode

Related languages

Brain (0.23)Grace (0.23)GRAP (0.23)GRASS (0.23)Granule (0.20)

LLM-contributed programs

Binary Tree Implementation

Provenance: commit c96bb30b70 · authored 2025-10-22T16:18:40+02:00 · model anthropic/claude-3.5-sonnet · Temp 0.4
code.gr · license: MIT · added: 2025-10-22T14:18:40Z
module BinaryTree

enum Tree<a> {
  Empty,
  Node(a, Tree<a>, Tree<a>)
}

let rec insert = (value, tree) => {
  match (tree) {
    Empty => Node(value, Empty, Empty),
    Node(val, left, right) => {
      if (value < val) {
        Node(val, insert(value, left), right)
      } else if (value > val) {
        Node(val, left, insert(value, right))
      } else {
        tree
      }
    }
  }
}

let rec contains = (value, tree) => {
  match (tree) {
    Empty => false,
    Node(val, left, right) => {
      if (value == val) {
        true
      } else if (value < val) {
        contains(value, left)
      } else {
        contains(value, right)
      }
    }
  }
}

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 Grain (mapped to pl/grain). 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/Grain/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Graffiti Markup Language GrainFimple →