// Rust
#[derive(Debug, Clone, PartialEq)]
pub struct Span<'a> { text: &'a str, start: usize, end: usize }

impl<'a> Span<'a> {
	pub fn new(text: &'a str, start: usize, end: usize) -> Self {
		assert!(start <= end && end <= text.len(), "bad span {start}..{end}");
		Self { text, start, end }
	}
	fn is_empty(&self) -> bool { self.start == self.end }
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let xs: Vec<u32> = (0..10).filter(|x| x % 2 != 0).map(|x| x << 1).collect();
    let total = xs.iter().fold(0u64, |acc, &x| acc + u64::from(x));
    println!("{:?} => {}", xs, total);
    let s = r#"raw "string" with \n not escaped"#;
    let t = "escaped\tstring\nwith\\backslashes\u{1F980}";
    if total >= 50 || xs.is_empty() { return Err("too big".into()); }
    Ok(())
}

# Python
import re, json
from typing import List, Optional

def tokenize(text: str, pattern: str = r"\w+|[^\w\s]+") -> List[str]:
    """Split `text` into tokens."""
    return [m.group(0) for m in re.finditer(pattern, text)]

class Config:
    def __init__(self, **kwargs):
        self.__dict__.update(kwargs)
        self.ratio = kwargs.get('ratio', 0.5) ** 2 // 1

print(json.dumps({"a": [1, 2, 3], "b": None, "c": True}, indent=2))
lambda_ = lambda x, y=3: x @ y if x is not None else ~y

// JavaScript / TypeScript
const f = async (x: number): Promise<number> => { return await g(x ?? 0) + (x?.y || 1); };
export default function App({ items = [] }: { items?: string[] }) { return <ul>{items.map(i => <li key={i}>{i}</li>)}</ul>; }

/* C */
#include <stdio.h>
int main(int argc, char **argv) { for (int i = 0; i < argc; ++i) printf("%s\n", argv[i]); return 0; }

-- SQL
SELECT u.id, COUNT(*) AS n FROM users u LEFT JOIN orders o ON o.user_id = u.id WHERE u.created_at >= '2026-01-01' GROUP BY u.id HAVING COUNT(*) > 10 ORDER BY n DESC LIMIT 100;

$ shell
cargo build --release --locked && ./target/release/tokenizer count --tokenizer models/gpt2.tokenizer.json --text "hello world!" | jq '.count'
export PATH="$HOME/.cargo/bin:$PATH"; grep -rnE '^(fn|pub fn) [a-z_]+' src/ | wc -l

{"json": {"nested": [1, 2.5, -3e10, true, false, null, "str\u00e9"], "empty": {}, "arr": []}}
<xml attr="value"><![CDATA[raw & unescaped]]><self-closing/></xml>
https://example.com/path/to/resource?query=string&amp;other=1#fragment mailto:someone@example.org
0x7FFFFFFF 0b1010_1010 0o755 1_000_000u64 3.0f32 1e-10 .5 5. NaN -Infinity
a+=1; b-=2; c*=3; d/=4; e%=5; f**=6; g<<=7; h>>=8; i&=9; j|=10; k^=11; l>>>=12; m===n; o!==p; q<=>r; s->t; u::v; w..=x; y...z
