An experimental language for algorithmic problem solving.
Algorithms,
clearly expressed.
Python-inspired syntax. Static types. Data structures that belong in the language. More room to think through the problem.
A little Birdie code.
A map. A loop. A solution.
Keep track of the numbers you have seen. When the missing partner appears, return both indices.
Parameter types are explicit. The map’s key and value types are inferred from how it is used.
Walk through the examplesfn twoSum(nums: [int], target: int) [int]:
seen = map()
for i, num in nums:
diff = target - num
if diff in seen:
return [seen[diff], i]
seen[num] = i
return []A stack that says what it does.
Push opening brackets, then pop and match each closing bracket. An empty stack means everything paired up.
Stacks are a dedicated collection. Their LIFO behavior is explicit, with push and pop operations.
Walk through the examplesfn isValid(s: str) bool:
matching = {')': '(', ']': '[', '}': '{'}
opened = stack()
for char in s:
if char in matching:
if not opened or opened.pop() != matching[char]:
return false
else:
opened.push(char)
return not openedKeep the algorithm in view.
Start with a sorted list. Compare the middle value, then keep searching the half that can contain the target.
Indentation defines blocks. Integer floor division makes the midpoint calculation explicit.
Walk through the examplesfn search(nums: [int], target: int) int:
left = 0
right = nums.size - 1
while left <= right:
mid = (left + right) // 2
if nums[mid] == target:
return mid
if nums[mid] < target:
left = mid + 1
else:
right = mid - 1
return -1Small language.
Deliberate choices.
Birdie is being designed around familiar algorithm problems. Each feature should make the solution easier to read and reason about.
- Familiar, with a few good habits.
- Indentation-based blocks, explicit function parameters, and predictable type inference. Readable code with useful static checks.
- The right collection, right there.
- First-class stacks, maps, and more are part of the design. Express the data structure directly, without import boilerplate.
- Understand the work.
- A future cost model will count language-level operations, helping you investigate an algorithm beyond wall-clock timing.