Nit

1 program Added 2025-10-22T15:31:46Z Model: anthropic/claude-4.5-sonnetTemp: 0.4 Evidence Report issue View issues
Aliases: nitlanguage
Provenance: commit a82268fd78 · authored 2025-10-22T17:31:46+02:00 · model anthropic/claude-4.5-sonnet

Sources mentioning this language

6 sources · pl_id: pl/nit
LLM (this repo) · 1PldbLinguistPygmentsHyperpolyglotRosettacode

Extensions claimed by this language

2 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.nitlinguistprimary37.5K files
.nitpygmentsprimary37.5K files

Related languages

Nyx (0.43)Io (0.38)Xi (0.38)Eve (0.36)Lime (0.36)

LLM-contributed programs

Binary Search Tree Implementation

Provenance: commit a82268fd78 · authored 2025-10-22T17:31:46+02:00 · model anthropic/claude-4.5-sonnet · Temp 0.4
code.nit · license: Apache-2.0 · added: 2025-10-22T15:31:46Z
# This file is part of NIT ( http://www.nitlanguage.org ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Simple example of binary search tree
module trees

# A binary tree node
class Node
	var value: Int
	var left: nullable Node = null
	var right: nullable Node = null

	# Insert a value in the tree
	fun insert(v: Int)
	do
		if v < value then
			var l = left
			if l == null then
				left = new Node(v)
			else
				l.insert(v)
			end
		else if v > value then
			var r = right
			if r == null then
				right = new Node(v)
			else
				r.insert(v)
			end
		end
	end

	# Print the tree in order
	fun print_in_order
	do
		var l = left
		if l != null then l.print_in_order
		print value
		var r = right
		if r != null then r.print_in_order
	end

	# Search for a value in the tree
	fun search(v: Int): Bool
	do
		if v == value then return true
		if v < value then
			var l = left
			if l == null then return false
			return l.search(v)
		else
			var r = right
			if r == null then return false
			return r.search(v)
		end
	end
end

# Create a tree and insert some values
var root = new Node(50)
root.insert(30)
root.insert(70)
root.insert(20)
root.insert(40)
root.insert(60)
root.insert(80)

print "Tree in order:"
root.print_in_order

print "\nSearching for 40: {root.search(40)}"
print "Searching for 25: {root.search(25)}"

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 Nit (mapped to pl/nit). 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/Nit/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← nirvana Niue →