Arc Forumnew | comments | leaders | submitlogin
Multi-arg anonymous functions broken?
1 point by garply 4866 days ago | 7 comments
In the current Anarki repo:

([= _.0 _.1] 0 1)

Goes to:

"#<procedure>: expects 1 argument, given 2: 0 1"

The bracket code is something into which I have never dug deeply. Anyone know what might have broken it?



2 points by aw 4865 days ago | link

I don't use Anarki myself, but figuring this out is easy with git.

Your first step is to find out if this was working earlier in the current branch; that is, did this get broken by a later commit or was it simply never ported to Arc 3.1?

If your find an earlier commit on the branch where it was working, finding out which commit exactly broke is easy: write a small shell script that returns true or false depending on whether the feature is working, and then use git-bisect (http://www.kernel.org/pub/software/scm/git/docs/git-bisect.h...)

Once you've found the commit that broke the feature, you can either look at the change yourself and/or contact the author of the commit.

-----

2 points by shader 4865 days ago | link

What is it that you want that code to do? I'm not sure I see why that's a bug. You seem to be providing two arguments, 0 and 1, to a function that only expects one, '_ .

-----

2 points by evanrmurphy 4865 days ago | link

The OP is presuming that anarki hacked the bracketed functions to accept multiple arguments. I remember reading that somewhere as well, but since I haven't tried using the feature before I don't really know.

-----

2 points by shader 4865 days ago | link

If that is the case, then he needs to use the _ and _1, instead of _.0 and _.1 to access the separate arguments, if I remember correctly.

_0 and _ are synonymous, I think.

-----

1 point by garply 4864 days ago | link

Thanks, it seems like my brain was scrambled last night. _0 and _1 (or _a and _b) are the appropriate pieces of code. But the real problem was that I was operating out of an arc directing that was lacking a load/ directory. Thus I was missing the make-br-fn.arc file. Fixed now. Thanks guys!

-----

1 point by garply 4864 days ago | link

It works, although I'm still not sure exactly where the _0 _1 or _a and _b components are implemented.

-----

1 point by zck 4865 days ago | link

I don't use anarki, but I seem to recall the arguments to an anonymous function aren't _.0 and _.1 . Note that x.y expands to (x y).

I think you want _0 and _1, but I'm not sure.

To be clear, you want the function to be equivalent to (fn (x y) (= x y)) ? That's odd, since = is the setf operator, not equal.

-----