Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Topaz

< >

Topaz is a programming language created in 2021 by m-schm.

#2194on PLDB 3Years Old
Download source code:
git clone https://github.com/m-schm/topaz
HomepageSource Code

Dependently typed language that compiles to JavaScript


Example from the web:
;; A comment ;; `Ven n a` represents lists that are `n` long, that contain `a`s ;; A Vec is either: type Vec (n: Uint) (a: Type) = ;; empty, with length 0... Nil: {a} -> Vec 0 a ;; or 1 item longer than a Vec of length n. `::`: {n a} -> a -> Vec n a -> Vec (n+1) a ;; `zip` should take two lists and return a list of pairs. ;; The two lists are required to be the same length because `n` is the same for ;; both parameters. let zip {n a b} (left: Vec n a) (right: Vec n b): Vec n (a, b) = match left, right in ;; Either both lists are empty... Nil, Nil => Nil ;; or they both contain at least one item. x :: xs, y :: ys => (x, y) :: zip xs ys ;; No other cases are needed, because the lists are the same length!
View source
- Build the next great programming language Add About Search Keywords Livestreams Labs Resources Acknowledgements Part of the World Wide Scroll