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

Rhombus

< >

Rhombus is a programming language created in 2023 by Matthew Flatt.

#1431on PLDB 2Years Old
Download source code:
git clone https://github.com/racket/rhombus
Homepage · Source Code · Docs

Rhombus is a general-purpose programming language that is easy to use and uniquely customizable.


Example from the web:
// simple syntax for everyday tasks class Rect(left, top, right, bottom) fun area(r): let w = r.right - r.left let h = r.bottom - r.top w*h area(Rect(0, 0, 10, 5)) // ⇒ 50

Language features

Feature Supported Example Token
Pattern Matching ✓ // pattern matching on objects, lists, and maps class Rect(left, top, right, bottom) fun rect_like_to_rect(v): match v | Rect(_, _, _, _): v | {"LT": [l, t], "RB": [r, b]}: Rect(l, t, r, b) | {"TL": [t, l], "RB": [b, r]}: Rect(l, t, r, b) rect_like_to_rect({"TL": [0, 2], "RB": [10, 5]}) // ⇒ Rect(0, 2, 10, 5) rect_like_to_rect({"LT": [0, 2], "RB": [10, 5]}) // ⇒ Rect(2, 0, 5, 10) // pattern matching in all binding positions class Posn(x, y) fun flip_all([Posn(x, y), ...]): [Posn(y, x), ...] flip_all([Posn(1, 2), Posn(3, 4)]) // ⇒ [Posn(2, 1), Posn(4, 3)] flip_all([Posn(5, 6)]) // ⇒ [Posn(6, 5)]
Macros ✓ macro 'thunk: $body': 'fun (): $body' // > def delayed_three = thunk: 1 + 2 // > delayed_three() // 3
Semantic Indentation ✓

- Build the next great programming language · Add · Add Prompt · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements

Built with Scroll v175.2.1