Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 4275 days ago | link | parent

I just ran the following at the repl:

  arc> ([(prn "You entered " _)] 34)
  You entered 34
  Error: "...urces/arc/ac.scm:974:33: arity mismatch;\n the expected number of arguments does not match the given number\n  expected: 1\n  given: 0"
Do you see something different? I think your defop expression is also incorrect. It just happens to have the right side-effect before it runs into the error. You probably have errors at the server -- that aren't visible on the browser.

Edit: I kept having this feeling I'd already pointed this out to you -- and I just found it :) http://arclanguage.org/item?id=16356



1 point by lark 4275 days ago | link

I see the following:

  arc> ([(prn "You entered " _)] 34)
  You entered 34
  Error: "car: expects argument of type <pair>; given ()"
That's good investigation. Note the work described in this thread uses Arc 3.1, not Anarki.

Btw do you mean there's something wrong with defop, or that the example I wrote is incorrect? I had gotten that example from: http://arcfn.com/doc/srv.html

-----

3 points by rocketnia 4275 days ago | link

The examples at arcfn say [do (prn ...) ...] and [w/link (pr ...) ...]. At some point you changed one of these to [ (prn ...)] for your example.

-----

1 point by lark 4274 days ago | link

Thanks. I understand one should write:

  [do (prn "...")]
I support one shouldn't. The do should be implicit.

-----

2 points by Pauan 4274 days ago | link

The reason it does that is so that things like [+ _ 1] work. Under your suggestion, you would have to write [(+ _ 1)] which looks ugly.

Rather than using [(prn ...)] you can just use [prn ...]

---

Incidentally, using Arc/Nu, it's easy to make the square brackets behave the way you want them to:

  (mac square-brackets args
    `(fn (_) (do ,@args)))
I believe Anarki has something similar as well.

-----