| As many of you know, I have suggested the option of an implementation of make-br-fn that binds as arguments the alphabetically sorted unbound symbols contained in it's body. This still may not appeal to you, and you don't have to use it. But as far as I can tell, all the code needed to implement it is: (def unbound (x)
(let l nil
(ontree (fn (_) (if (and (isa _ 'sym) (~bound _)) (push _ l))) x)
(sort < (dedup l))))
(mac make-br-fn (body)
`(fn ,(unbound body) ,body))
That is significantly shorter than the current implementation of make-br-fn, which takes 117 lines of code, and should work in complete backwards compatibility with both arc and Anarki. Note that I say this without having tested it in all of its current uses, but it seems to work the same way when nested, and it correctly orders _1 - _9. It doesn't work with _nums larger than 9, though, because alpha sort thinks that 1 < 2 (imagine that)What do you think? I'm pushing the code to anarki as lib/alpha-br-fn.arc |