Arc Forumnew | comments | leaders | submitlogin
3 points by shawn 2147 days ago | link | parent

Basically, arc shares a global namespace with racket. (def foo (x) (+ x 1)) results in a function named foo, not _foo.

If an expression starts with a symbol bound to a racket syntax transformer, then the arc compiler switches to "racket-style" output.

  (begin "everything in here is racket code...")
If you want to switch back to arc, you can use (%do ...)

  arc> (begin (require racket) (%do (+ "foo" 42)))
  "foo42"
The last change is that pairwise expressions like (< 1 2) now return #t or #f, not 't or '(). Meaning you can pass arc predicates like `even` into racket functions that expect predicates.

It's pretty convenient to call any racket function without worrying about interop.



2 points by i4cu 2146 days ago | link

This is awesome. :)

> If you want to switch back to arc, you can use (%do ...)

Personally I would prefer '.arc' or '%arc':

  arc> (begin (require racket) (.arc (+ "foo" 42)))

  "foo42"
Yeah it's one more char, but I think it makes the code more explicit, understandable and also extendable (i.e. '.racket' also becomes an option too - not that it's needed).

-----

2 points by krapp 2146 days ago | link

>(i.e. '.racket' also becomes an option too - not that it's needed).

.arc / .racket (or .rkt) seems more intuitive than .arc / $

We could also keep the dollar sign in both cases, which I prefer aesthetically, because being familiar with javascript and C type languages, seeing a dot alone like that just seems weird.

-----

3 points by i4cu 2146 days ago | link

yeah but the dot reads to me like a file extension so I immediately get it.

$arc would be ok too. I can get behind that :)

-----

2 points by shawn 2146 days ago | link

Good point! (%arc ...) and (%rkt ...) already work, actually. (I couldn't decide between %arc vs %do and %rkt vs %scm)

-----

2 points by akkartik 2146 days ago | link

I wonder if it's possible to end up with a list ending in #f rather than nil.

-----