Arc Forumnew | comments | leaders | submitlogin
5 points by absz 5769 days ago | link | parent

If you're coming from Java or another such language, then anonymous functions and the REPL are must-shows. The former really makes things far more clear and concise; just compare Arc's

  (let squares (map [* _ _] nums)
    ...)
to Java's

  ArrayList<Integer> squares = new ArrayList<Integer>();
  for (Integer n : nums)
    squares.addObject(n*n)
  ...
. The latter is fantastic for development; rather than having to code up a new test, save, and recompile every time you have something you want to test out, you can iteratively develop your test and run it immediately. This becomes even more of a net win when you realize you need to change that previous test case just a little; instead of open-edit-recompile-run, it's uparrow-edit-run.

If you're instead coming from something more like a scripting language, then yeah---macros and everything they can do is the biggest win.



4 points by conanite 5768 days ago | link

True, [_] is one of those radical shortcuts that improves readability rather than obfuscates. Thank you.

As for up-arrow, I get "^[[A", so I haven't enjoyed the REPL as much as I ought to. I'm on a mac. Does anyone know a way to fix this?

-----

5 points by absz 5768 days ago | link

I'm on a Mac too; the trick is that you need mzscheme's readline library. In your ~/.arcshrc, put the line

  ($ (dynamic-require '(lib "rep.ss" "readline") (zero? 1)))
, and then you should have no problem.

(As a side note, you need to use (zero? 1) instead of #f because Arc turns #f into nil.)

-----