Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

101 lines (74 sloc) 2.963 kb


Ruby + Clojure = Rouge.


Rouge is not yet mature enough to have an installer or distributions. Just clone the source and run the rouge script to start:

git clone git://
cd rouge
bundle install

You'll see the user=> prompt. Enjoy!


See boot.rg, em-rg, but to demonstrate salient features:

; define a macro
(defmacro defn [name args & body]
  `(def ~name (fn ~name ~args ~@body)))

; call a Ruby method on Kernel (if the ruby namespace is referred)
(defn require [lib]
  (.require Kernel lib))

; call a Ruby method on an Array with a block argument
(defn reduce [f coll]
  (.inject coll | f))

; using Ruby's AMQP gem with an inline block
(.subscribe queue {:ack true} | [metadata payload]
  (puts (str "got a message: " payload))
  (.ack metadata))

; copied from core.clj and modified to work with our currently smaller core
(defmacro binding [bindings & body]
  (let [var-ize (fn [var-vals]
                      (fn [pair]
                        (let [key (first pair)
                              val (second pair)]
                          [`(.name (var ~key)) val]))
                      (.each_slice var-vals 2))
     (push-thread-bindings (hash-map ~@(var-ize bindings)))

What about in Rails?

$ r c -- -I../rouge/lib -rrouge
Loading development environment (Rails 3.2.6)
1.9.3p194 :002 > Rouge::REPL.repl []
user=> (.where ruby/Content {:id 1})
  Content Load (0.7ms)  SELECT "contents".* FROM "contents" WHERE "contents"."id" = 1
[#<Content id: 1, content_group_id: 1, name: "welcome", content: "blah blah", created_at: "2012-08-26 11:30:50", updated_at: "2012-08-26 11:50:27", order: nil>]


See TODO, but big ones include:

  • seqs
  • persistent datastructures everywhere
  • defprotocol


Yes, please! The usual dance would be:

  • Fork.
  • Check that tests are passing. (master should always be 100%, but currently this is not the case.)
  • Make a topic branch.
  • Do your tests, do your thing.
  • Make sure you didn't break anything!
  • Pull request!

Note that I've yet to work out copyright or license (will ask on clojure-dev), but promise that they won't be anything stupid.


Original author: Arlen Cuss —

Inspiration: 100% Clojure. Thanks be to Rich Hickey.

copyright and licensing

Yet to be determined; likely EPL due to the entire concept and some code taken direct from Clojure.

Jump to Line
Something went wrong with that request. Please try again.