Skip to content

RhoLang

Christian Schladetsch edited this page Mar 10, 2023 · 1 revision

Rho

Rho is an in-fix language and reads a lot like Python.

Rho is translated to pi code and uses the same Executor.

Example

// test nested functions and name lookup
fun foo(a)
	fun bar(b)
		a + b
	bar(2)
assert(foo(3) == 5)

// note: we can over-ride variables/functions
fun foo()
	1
fun bar(f, n)
	n + f()
assert(bar(foo, 1) == 2)
assert(bar(foo, 2) == 3)

// multiple nested functions
fun foo()
	fun bar(f, num)
		1 + f(num)
	fun spam(num)
		num + 2
	bar(spam, 3)
assert(foo() == 6)