defcall is pretty simple to use. The syntax is the same as that of def, except instead of a function name, you provide the type of the object. The function receives both the objects and its "arguments". E.g.
arc> (defcall sym (self n)
(repeat n (prn self))
#<procedure>
arc> ('a 3)
a
a
a
nil
.
As an aside, this appears to be popular, it might be possible to add this to the ssyntax extension.
As an aside, I suspect that much of the slowdown from the new ssyntax/ssexpand comes from scheme-side 'ac emitting a lot of 'ar-eval calls, but I'm not sure, since I haven't studied 'ac output much yet.
I will do so soon, and hopefully when I get a chance to study ssyntax.arc a little more, I will add a-ssyntax-bottom.
What might be nice would be to have numerical precedence levels (reals, not integers), so that you could add an operator later with the right precedence without redefining everything.
yep, that's it. I never used the ssyntax-definer, so I forgot it was existing. Sorry, but it's a little late here, so I can hardly even understand myself :)
That doesn't actually address my concern, but this (from the same page) does:
(if (amb #f #t)
1
(amb))
This has to force the first amb to return #t, or the whole expression would fail. I still find it somewhat odd, though, that I can (fail) on the next line, but I suppose there's not a better way to handle it; after all, that's probably just because the interpreter is sequential.
tempting reason to switch from arc2 to anarki :).If I understand right, I could make arc understand that if I have a list of lists, (mylist 3 2) wants the second position from the third list.
Nice, is this a something that you can influence locally, within a function, or is it a do-once-per-program thing of arc?
It might be possible to do so by using some sort of dynamic global (a la kennytilton's implementation some time back, but using 'thread-local objects to handle it).
No, it does not. Why do you want it? Perhaps there's a better (or at least more Arcish) way to accomplish it. Returning a list, for instance. To quote arc.arc:
; The problem with returning a list instead of multiple values is that
; you can't act as if the fn didn't return multiple vals in cases where
; you only want the first. Not a big problem.
Also, a formatting tip: to get your text to appear as code, surround it by blank lines and indent it by two spaces.
Hear hear! Let there be libraries! The school year's almost over, and I'll contribute more then. And I second the idea of a list of necessary libraries that stefano proposed.
Also, has anyone else found themselves accumulating a file of utility functions? I have one with a little fewer than 30 functions which I find generally useful. There's probably some duplication of standard stuff, but there are also things that aren't. If other people have these, we might put the common functions on Anarki.
I mean scanning Arc files or, better, the help* table and gather information in text files formatted in a wiki-friendly format in order to easily put them on the Anarki wiki.
Edit: have a look at the file lib/help-to-wiki in Anarki (just pushed it).