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

  git clone git://github.com/conanite/rainbow
  cd rainbow
  chmod 755 rainbow.sh
  ./rainbow.sh
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")
  nil
  arc> (load "foundation-test.arc")
  #hash((passed . 258) (failed . 0))
  nil
"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 http://arcfn.com helped enormously in producing this.

good luck, and enjoy ...



1 point by jazzdev 5717 days ago | link

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

  % ./rainbow.sh 
  Buildfile: build.xml
  
  compile-parser:
  
  compile:
  
  jar:
  
  BUILD SUCCESSFUL
  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" java.io.FileNotFoundException: Could not find rainbow/rainbow.arc under [.]
          at rainbow.Console.find(Console.java:125)
          at rainbow.Console.loadFile(Console.java:133)
          at rainbow.Console.main(Console.java:41)

-----

1 point by jazzdev 5717 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(FunctionDispatcher.java:68)
          at rainbow.vm.continuations.FunctionDispatcher.digestFunction(FunctionDispatcher.java:52)
          at rainbow.vm.continuations.FunctionDispatcher.onReceive(FunctionDispatcher.java:38)
          at rainbow.vm.continuations.ContinuationSupport.receive(ContinuationSupport.java:28)
          at rainbow.vm.Interpreter.interpret(Interpreter.java:30)
          at rainbow.vm.continuations.FunctionDispatcher.process(FunctionDispatcher.java:33)
          at rainbow.vm.ArcThread.run(ArcThread.java:28)
          at rainbow.Console.compileAndEval(Console.java:149)
          at rainbow.Console.load(Console.java:140)
          at rainbow.Console.loadFile(Console.java:133)
          at rainbow.Console.main(Console.java:39)

-----

1 point by conanite 5716 days ago | link

Rainbow assumes you are using anarki - it's at http://github.com/nex3/arc/tree/master

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 6065 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

-----