A dynamic general-purpose high-level functional-programming language with familiar syntax that compiles to native binaries.
Implementation of the Ackermann function:
ns!(ackermann,
{} =>
letfn A := [m, n] =>
cond(
zero?(m) => inc(n)
zero?(n) => A(dec(m), 1)
:else => A(dec(m), A(m, dec(n)))
)
defn!(main!, {}, [_, m, n] =>
let [m, n] := map(string->number, [m, n])
println!("A(" m ", " n ") = " A(m, n))
)
)
Check out other sample programs.
- Ergonomic familiar syntax, destructuring everywhere
- Extensible top-level functions are polymorphic by default
- Immutable data structures by default
- Concurrency-friendly mutability using Clojure-like
atom
s - Full numeric tower example: no integer overflows,
pow(-1, 0.5)
is0+i
- Recursion-friendly many algorithms are simpler when defined recursively - they should be written as such
This repo contains a compiler written in Clojure.
It compiles Rudra source to Chez Scheme, and then to a native binary via chez-exe.
$ git clone git@github.com:divs1210/rudralang.git
$ brew install chezscheme
There are compiled binaries available for all major platforms, otherwise build it yourself from source.
It's really easy to build from source.
$ cd path/to/rudralang
Update config.edn
to point to the correct chez-exe
path.
$ lein -compile samples/fact.rudra
$ target/fact 5
In the rudralang directory, run:
$ ./repl
Copyright © 2021 Divyansh Prakash
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.