Five languages that show up less in "build an app" courses and more in specialized ones โ systems programming, compilers, programming-language theory, and pure functional programming. You won't need all five; most CS programs touch one or two of them in an upper-level elective. Here's what each is actually for, and a taste of the syntax.
C/C++'s memory speed without C/C++'s memory bugs โ Rust's compiler enforces strict ownership rules at compile time, so a whole category of crashes (use-after-free, data races) become compile errors instead of runtime disasters.
fn main() {
let nums = vec![1, 2, 3, 4];
let sum: i32 = nums.iter().sum();
println!("{}", sum); // 10
}
The purest mainstream functional language โ functions have no side effects at all (a function called twice with the same input always returns the exact same output), which makes certain kinds of correctness proofs and parallelism dramatically easier.
factorial :: Integer -> Integer
factorial 0 = 1
factorial n = n * factorial (n - 1)
-- factorial 5 -> 120
A Lisp dialect built specifically for teaching โ its minimal, uniform syntax (everything is a parenthesized list) is designed to make recursion, state machines, and the deep structure of programming languages easy to see clearly.
(define (factorial n)
(if (= n 0)
1
(* n (factorial (- n 1)))))
; (factorial 5) -> 120
A functional language with a very strong, very fast type-inference system โ you rarely write out types explicitly, but the compiler still catches type errors before you ever run the program. A favorite for building other programming languages' compilers.
let rec factorial n =
if n = 0 then 1
else n * factorial (n - 1)
(* factorial 5 -> 120 *)
Racket's minimalist ancestor โ a tiny, elegant Lisp designed to demonstrate that a handful of core ideas (functions, recursion, and treating code itself as data) can build up an entire programming language from almost nothing.
(define (factorial n)
(if (= n 0)
1
(* n (factorial (- n 1)))))
; identical to the Racket example above โ Racket grew directly out of Scheme