Bait

1 program Added 2026-02-24T00:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: enabled Evidence Report issue View issues
Aliases: bait-lang
Provenance: commit 425c197a2b · authored 2026-02-24T13:49:50+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

Bau (0.39)Mint (0.30)Civet (0.29)Janet (0.29)Bend (0.27)

LLM-contributed programs

Pascal's Triangle

Provenance: commit 425c197a2b · authored 2026-02-24T13:49:50+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch enabled
code.bait · added: 2026-02-24T00:00:00Z
// Create a Pascal's triangle with a given number of rows.
// Returns an empty array for row_nr <= 0.
fun pascals_triangle(row_nr i32) [][]i32 {
	mut rows := [][]i32

	// Iterate over all rows
	for r := 0; r < row_nr; r += 1 {
		// Store the row above the current one
		mut above := rows[r - 1]

		// Fill the current row. It contains r + 1 numbers
		for i := 0; i <= r; i += 1 {
			// First number is always 1
			if i == 0 {
				rows.push([1]) // Push new row
			}
			// Last number is always 1
			else if i == r {
				rows[r].push(1)
			}
			// Other numbers are the sum of the two numbers above them
			else {
				rows[r].push(above[i - 1] + above[i])
			}
		}
	}

	return rows
}


// Helper function to pretty print triangles.
fun print_triangle(triangle [][]i32) {
	for i, row in triangle {
		// Create string with leading spaces
		mut s := ' '.repeat(triangle.length - i - 1)

		// Add each number to the string
		for n in row {
			s += n.str() + ' '
		}

		// Print and trim the extra trailing space
		println(s.trim_right(' '))
	}
}


fun main() {
	print_triangle(pascals_triangle(7))
}

Contribute — propose a file extension

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