Arc Forumnew | comments | leaders | submitlogin
1 point by sjs 6066 days ago | link | parent

Thank you for the correction. While spouting all that I forgot about the extra stuff that make-br-fn does.


1 point by almkglor 6065 days ago | link

make-br-fn allows you to use _1 _2 ... _n (it searches for the n AFAIK) as well as __. If you use _n you get a n-arity function. If you use _n and __, you get a >=n-arity function, with __ containing the rest. I have a few reservations about whether it handles checking of free variables properly but I haven't actually dived into the code.

-----

1 point by absz 6065 days ago | link

make-br-fn doesn't search for a literal _n, but it searches for anything matching the regexp /_(\d+|_)?/, except for anything of the form /_0+/. The free-variable checking code is based off of problems I did while working through Essentials of Programming Languages by Friedman, Wand, and Haynes, and it certainly shouldn't break in most common cases (especially since most common cases won't bind any extra variables). A second set of eyes is probably a good idea, though.

-----