Arc Forumnew | comments | leaders | submitlogin
source of rainbow (arc in java)
10 points by conanite 5145 days ago | 4 comments

  git clone git://
  cd rainbow
  chmod 755
This will build rainbow (using ant) and start an interactive arc shell. Requires java 5 and ant on your path. If you get this far without everything breaking down, try the following

  arc> (load "unit.arc")
  arc> (load "foundation-test.arc")
  #hash((passed . 258) (failed . 0))
"foundation-test.arc" is a suite of tests that I originally ran using junit, the java testing tool of choice for many. But later, I found it easier to run them directly from the arc console.

(nsv) works, as far as I can tell - I can create posts and comments, but I haven't pushed it all the way yet.

Please note that I'm a complete lisp n00b - my only experience is from poking around with my .emacs file years ago, and reading Godel, Escher, Bach many years prior to that. Rainbow is probably full of terrible misunderstandings, and my primary goal in building it was to get a grasp of how lisp works (in particular, continuations, tail-call optimisation, and macros - completely alien stuff in javaland where I'm from).

In particular, the following areas are implemented dubiously or not at all:

- complex numbers (not at all)

- escape sequences in strings (\n and \" but no others)

- disp and write probably don't behave as differently as they should - disp makes a special case for strings but that's about all

- certain math operations always return a real number (eg sqrt) - Arc returns a rational where possible

- some macro expansion still happens at runtime

- continuations can be re-entered in a different thread - don't know if this is supposed to be possible, although it seems useful.

- optional arguments work at the top level ... but I haven't even tried optionals nested deep inside a destructuring params list

- Java expects you to decide whether you want characters or bytes when you open a stream, whereas arc seems to allow mixed character and byte access. This might give rise to horrible bugs.

- other stuff that I haven't thought of

The excellent documentation work by kens at helped enormously in producing this.

good luck, and enjoy ...

1 point by jazzdev 4797 days ago | link

Can't seem to get it to run. Where is rainbow.arc?

  % ./ 
  Buildfile: build.xml
  Total time: 0 seconds
  Unable to access jarfile /Users/jd/tmp/rainbow/build/dist/rainbow.jar
  % java -jar build/dist/rainbow/rainbow.jar --strict-arc
  Exception in thread "main" Could not find rainbow/rainbow.arc under [.]
          at rainbow.Console.find(
          at rainbow.Console.loadFile(
          at rainbow.Console.main(


1 point by jazzdev 4796 days ago | link

Okay, I found rainbow.arc. (I was doing find from the wrong place). And am following the README, but still no joy.

  % setenv ARC_PATH ~/tmp/arc:./src/arc
  % java -jar build/dist/rainbow/rainbow.jar
  Exception in thread "main" rainbow.ArcError: call* table not found in environment: if you are not using anarki please specify --strict-arc on the command-line
          at rainbow.vm.continuations.FunctionDispatcher.anarkiCompatibleTypeDispatch(
          at rainbow.vm.continuations.FunctionDispatcher.digestFunction(
          at rainbow.vm.continuations.FunctionDispatcher.onReceive(
          at rainbow.vm.continuations.ContinuationSupport.receive(
          at rainbow.vm.Interpreter.interpret(
          at rainbow.vm.continuations.FunctionDispatcher.process(
          at rainbow.Console.compileAndEval(
          at rainbow.Console.load(
          at rainbow.Console.loadFile(
          at rainbow.Console.main(


1 point by conanite 4795 days ago | link

Rainbow assumes you are using anarki - it's at

If you are using anarki and still getting this error, then it's a mystery. It might be necessary to expand "~/tmp/arc" into a full path - I know rainbow doesn't expand "~", and I don't know if the shell does. And "~/tmp/arc" should contain arc.arc and the usual arc files from the distribution.

Let me know if it still isn't working.


1 point by almkglor 5145 days ago | link

> - continuations can be re-entered in a different thread - don't know if this is supposed to be possible, although it seems useful.

I believe this is supposed to be possible