Is there a way to convert a set of arc code back into the equivalent scheme code? For example, I like arc's http server, and I'd like to use it in Racket. Do I port that over to Racket by hand line by line, or is there an automatic way to do it?
As far as I know it's currently hard to use Arc code from Racket.
Ideally, you'd like to be able to put Arc inside a Racket module that you could import into your Racket program. My Arc runtime project will eventually be one way to do this, but it's still under development. I believe this would be technically feasible to do with Arc 3.1 as well, but I haven't heard of anyone implementing it yet.
What would probably be easier today is to write the Racket part of your program as a Racket module and import that into Arc, instead of going the other way around. You could have a "main" function in Racket that you'd call from Arc, passing in any functions from Arc that you needed in Racket (such as a way to hook into the web server, for example).
I thought about that but I've decided to leave arc behind, but take my favorite things about it with me. In particular, I really like the http server because it is great to do web dev on a repl-based server.
I'm not sure whether you mean by "leaving Arc behind but taking some things with you" you want to be able to write your own programs in Racket but use Arc libraries that are useful to you, or to have no Arc code running in your system at all?
If you mean you'd like to use Arc's http server from Racket, the answer is yes, you can write your programs in Racket and use Arc libraries if you want to. It's currently rather awkward, but we can help you with that if you want.
Or if you mean you don't want to be running any Arc code at all, I suppose you could translate the Arc library you want into Racket. I can't quite tell why you'd want to do that, because it would be a lot of work and you would end up with a library that did the same thing anyway as the Arc library you already can use anyway.
You also asked if there's an "automatic" way to translate Arc into Racket. The answer to that as rntz explained is yes, that's what the Arc compiler does. It takes Arc code and translates it into Racket. But that's really the same as option one.
Perhaps you're asking if there's an automatic way to translate Arc into readable Racket. No, the Arc compiler produces a giant blob of Racket code. The Arc compiler produces working Racket code, but not code that you can look at and see what it's doing (not without a lot of work, at any rate), or to be able to modify yourself at all easily. So the answer to the question "is there an automatic way to translate Arc code into Racket code readable by humans" the answer to that one is no.
Or, if using Arc libraries from your Racket program is more trouble than it's worth right now (and I imagine it could be), perhaps you'd like to implement a REPL with Racket's web server. Of course the Arc forum probably isn't the best place to ask about that, the Racket email lists would probably be more help, but I imagine it's probably possible since Racket does have eval.
"Or, if using Arc libraries from your Racket program is more trouble than it's worth right now (and I imagine it could be), perhaps you'd like to implement a REPL with Racket's web server. Of course the Arc forum probably isn't the best place to ask about that, the Racket email lists would probably be more help, but I imagine it's probably possible since Racket does have eval."
It's actually kind of an example in (the most advanced part of) the Racket getting started pages:
> Given the "many" example, it’s a small step to a web server that accepts arbitrary Racket code to execute on the server. In that case, there are many additional security issues besides limiting processor time and memory consumption. The racket/sandbox library provides support to managing all those other issues. (http://docs.racket-lang.org/more/index.html)
The racket/sandbox module reference has another example:
These examples complement each other. The first doesn't actually 'eval any client input, and the second uses a TCP socket directly rather than bothering with session handling or HTTP, but each of them picks up the other's slack. I'm a bit surprised there aren't many Racket Web REPLs for Racket the way there are for Arc.
Turning arc into racket is exactly how the arc compiler works internally. See the ac function in ac.scm, which takes an arc expression and turns it into a racket expression, and acompile, which takes an arc file and turns it into a racket file.
There are nonetheless a few issues with using arc code in racket, such as the arc runtime, interaction with racket's require system, and the fact that arc alters the reader to allow for square-bracket anonymous fn syntax. I haven't worked with arc in a while, so I don't remember them in full. Hopefully someone else will chime in with details. But basically, yes, with a little work, you can use arc code from racket.