Rhombus Language:易用且可定制的通用编程语言

Rhombus

Rhombus 是一种易于使用且具有独特可定制性的通用编程语言。

// 简单语法,适用于日常任务

class[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/class.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._class._rhombus/defn\)\)>) Rect(left, top, right, bottom)
           
fun[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/ref-function.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._fun._rhombus/defn\)\)>) area(r):
 let[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Definitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._let._rhombus/defn\)\)>) w =[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Equality.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3d\)\)>) r.[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Dot.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._..\)\)>)right -[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._-\)\)>) r.[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Dot.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._..\)\)>)left
 let[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Definitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._let._rhombus/defn\)\)>) h =[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Equality.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3d\)\)>) r.[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Dot.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._..\)\)>)bottom -[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._-\)\)>) r.[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Dot.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._..\)\)>)top
 w*[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._*\)\)>)h
                
area(Rect(0, 0, 10, 5))
// ⇒ 50

// 对象、列表和映射上的模式匹配

class[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/class.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._class._rhombus/defn\)\)>) Rect(left, top, right, bottom)
           
fun[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/ref-function.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._fun._rhombus/defn\)\)>) rect_like_to_rect(v):
 match[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Matching.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._match\)\)>) v
 | Rect(_[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Matching.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\).__._rhombus/bind\)\)>), _[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Matching.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\).__._rhombus/bind\)\)>), _[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Matching.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\).__._rhombus/bind\)\)>), _[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Matching.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\).__._rhombus/bind\)\)>)): 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)

// `:` 用于嵌套, `|` 用于替代,
// `::` 用于类型检查注解

fun[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/ref-function.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._fun._rhombus/defn\)\)>) repeat(str ::[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Annotations.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3a~3a._rhombus/bind\)\)>) String[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Strings.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._.String._rhombus/annot\)\)>), n ::[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Annotations.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3a~3a._rhombus/bind\)\)>) NonnegInt[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._.Nonneg.Int._rhombus/annot\)\)>)) ::[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Annotations.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3a~3a._rhombus/bind\)\)>) List[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Lists.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._.List._rhombus/annot\)\)>):
 if[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Conditionals.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._if\)\)>) n ==[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Equality.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3d~3d\)\)>) 0
 | []
 | [str] ++[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Appendables.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._++\)\)>) repeat(str, n-[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._-\)\)>)1)
 
repeat("hello", 3)
// ⇒ ["hello", "hello", "hello"]
repeat(3, "hello")
// ⇒ error: 3 is not a String

// 用省略号创建和使用重复

fun[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/ref-function.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._fun._rhombus/defn\)\)>) all_same([str0, str, ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......._rhombus/bind\)\)>)]):
 all[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Booleans.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._all\)\)>)(str0 ==[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Equality.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3d~3d\)\)>) str, ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......\)\)>))
 
all_same(["hello", "hello", "hello"])
// ⇒ #true
all_same(["hello", "goodbye", "hello"])
// ⇒ #false

// 在所有绑定位置进行模式匹配

class[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/class.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._class._rhombus/defn\)\)>) Posn(x, y)
 
fun[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/ref-function.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._fun._rhombus/defn\)\)>) flip_all([Posn(x, y), ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......._rhombus/bind\)\)>)]):
 [Posn(y, x), ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......\)\)>)]
 
flip_all([Posn(1, 2), Posn(3, 4)])
// ⇒ [Posn(2, 1), Posn(4, 3)]
flip_all([Posn(5, 6)])
// ⇒ [Posn(6, 5)]

// 高效的函数式数据结构

class[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/class.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._class._rhombus/defn\)\)>) Tree(val, children ::[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Annotations.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3a~3a._rhombus/bind\)\)>) List.of[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Lists.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._.List._\(.List..of._rhombus/annot\)\)\)>)(Tree)):
 method[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/class.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._method._rhombus/class_clause\)\)>) flatten(): // O(N lg N) for N `val`s
  for[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Iteration.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._for\)\)>) fold[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Multiple_Values.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._fold._rhombus/reducer\)\)>)(lst = [val]) (child in[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Membership_Tests.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._in\)\)>) children):
   // because append with `++` is O(lg N)
   lst ++[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Appendables.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._++\)\)>) child.[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Dot.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._..\)\)>)flatten()
 
Tree(1, [Tree(2, [Tree(4, [])]),
     Tree(3, [Tree(5, [])])])
 .[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Dot.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._..\)\)>)flatten() // ⇒ [1, 2, 4, 3, 5]

// 语法即数据

fun[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/ref-function.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._fun._rhombus/defn\)\)>) interp(e):
 match[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Matching.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._match\)\)>) e
 | '$[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24._rhombus/bind\)\)>)(n ::[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~3a~3a._rhombus/unquote_bind\)\)>) Number[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Syntax_Classes.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._.Number._rhombus/stxclass\)\)>))': n.[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Dot.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._..\)\)>)unwrap()
 | '$[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24._rhombus/bind\)\)>)lhs ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......._rhombus/bind\)\)>) + $[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24._rhombus/bind\)\)>)rhs ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......._rhombus/bind\)\)>)':
   interp('$[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)lhs ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......\)\)>)') +[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._+\)\)>) interp('$[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)rhs ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......\)\)>)')
 | '$[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24._rhombus/bind\)\)>)lhs ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......._rhombus/bind\)\)>) * $[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24._rhombus/bind\)\)>)rhs ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......._rhombus/bind\)\)>)':
   interp('$[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)lhs ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......\)\)>)') *[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._*\)\)>) interp('$[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)rhs ...[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Repetitions.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._......\)\)>)')
           
interp('1 +[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._+\)\)>) 3 *[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._*\)\)>) 4') // '' quotes syntax, not a string
// ⇒ 13

// 宏

expr.macro[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-meta/Expression_Macros.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core-meta\)._expr._\(expr..macro._rhombus/defn\)\)\)>) '$[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)left but_first $[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)right':
 'block[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Block.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._block\)\)>):
   $[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)right
   $[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)left'
           
println[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Printing.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._println\)\)>)("there") but_first print[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Printing.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._print\)\)>)("hi ")
// ⇒ prints "hi there"

// 用于绑定位置的宏和更多功能

class[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/class.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._class._rhombus/defn\)\)>) Rect(left, top, right, bottom)
 
bind.macro[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-meta/Binding_Macros.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core-meta\)._bind._\(bind..macro._rhombus/defn\)\)\)>) 'OriginRect($[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)right, $[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)bottom)':
 'Rect(0, 0, $[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)right, $[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/stxobj.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._~24\)\)>)bottom)'
 
fun[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/ref-function.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._fun._rhombus/defn\)\)>) area(r):
 match[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Matching.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._match\)\)>) r
 | OriginRect(r, b): r*[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._*\)\)>)b
 | Rect(l, t, r, b): (r-[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._-\)\)>)l)*[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._*\)\)>)(b-[](https://rhombus-lang.org/<https:/docs.racket-lang.org/rhombus-reference/Numbers.html#\(def._\(\(submod._\(lib._rhombus/private/amalgam..rkt\)._core\)._-\)\)>)t)
           
area(Rect(0, 0, 10, 5))
// ⇒ 50

构建于 Racket 之上 ... 这意味着 Rhombus 可以即时编译为机器代码,受益于成熟的工具链和包系统,并且可以访问许多实用的库。 为什么需要一种新语言? 请参阅 Rhombus GoalsDownloadRhombus 已经为 早期采用者 准备就绪。Documentation 包含 Quick StartWork in Progress完整且足够稳定以供使用,但尚未完成所有工作。