Empty variadic input to function in ring gives "variable arguments does not exist" error.
[Note to Jens, the original problem is solved, but the second problem is still pending. Title changed accordingly. --bh]
EDIT: I've made some edit to the link, please see my comment below also.
Hello,
Since I'm pretty new to Snap! and to coding in general, I'm sorry if this is not the place to ask about this.
Link to my work. As the title says, the error "list.at is not a function" appeared when I tried to click the script I've made at the end of page 46 of the manual.
I double checked but didn't find any copying error when following the manual (but I still think I've made an error somewhere).
My guess is that since the reporter (item 1 of (item 1 of (empty list))) throws an error, it makes the "assoc" custom block unusable and therefore throws error for everything else.
Hopefully someone can I point out where I did wrong. Thanks in advance!
Okay after playing around with it for a bit I managed to make the code work, but with some alterations to the code in the manual (I have added some EDIT notes in the link).
Please make these changes to the code:
Change 1: Change the (list) in the definition of "methods" and "data" inside block "clone of []" to list(list). This change to account for the fact that "insert" cannot add to (list) alone. After this change, the final code will throw error: "A variable of name 'arguments' doesn't exist".
Change 2: Add 1 more input slot for the "ask" blocks in method "next". Somehow the "ask" blocks don't work if they don't have the input slot for "args" when inside a ring.
I'm happy the code works now, but I still feel like this is just a work around and perhaps I made a mistake along the way. If someone can point out where I did wrong or explain to me why the code in the manual doesn't work I would really appreciate it.
Thank you for all this effort! I agree with you about the empty-list problem. I solved it this way:
This is pretty embarrassing; the root of the problem is that FOR counts backward if the end value is less than the start value, and I've seen other people get caught by that in the same way, but I wrote FOR so I should know better.
But, @jmoenig, I think the second problem is actually a Snap! bug. It should be possible (and usually is!) for a variadic input to be empty.
Hmm... yes, a variadic input can be empty, then you just have to pass in a list and it should work. But, remember, the variadic input has to be empty, i.e. it cannot be expanded, say, to one item. Is this the issue here?
Can we drill this issue down somewhat more?
BTW, it's great that you're investigating into this. I've seen reports of this problem elsewhere but wasn't able to put my finger on it. Thanks, both of you!
(cough...)

(Kids, don't do this at home) :-)
Okay, I think I now understand the issue here. Parameters to functions are never variadic. We have the notion of a - single - variadic parameter, but - other than e.g. JavaScript - Snap's number of parameters must match the number of arguments and vice-versa. That's why you cannot drop a list reporter onto the arrow-heads of the parameters slot in a ring, just as you cannot drop a list-reporters onto the arrow-heads of the parameters to the list-reporter itself.
So, this is not a bug but a trait of the language. The part I'm interested in is why this shows up to be a problem with an example in the Snap manual, because - to my knowledge - this has never been different in Snap, ever. Something else must have changed. Can we put a finger onto that`
that said, I don't qualify the new title of this issue a bug