4 ms·
am I mistaken in thinking that part of this problem is a desire to not pollute the namespace since most(all?) lisps are unable to properly privatize functions?
by rbxbx 16y ago
am I mistaken in thinking that part of this problem is a desire to not pollute the namespace since most(all?) lisps are unable to properly privatize functions?
- astine 16y agoYes. You can define functions locally with "flet" or "labels" and never touch the global namespace. This alone is enough so that you don't have to resort to lambdas to avoid polluting the global namespace. In addition Common Lisp provides both generic methods and packages, which both provide a means of managing the global namespace, so one should never use lambdas for that purpose.
- d0m 16y agoYou can also use (define) inside others (define) if you want private functions. And, because of closures, it makes it extremely powerful and flexible since you don't have to repeat parameters already given in the outer scope.
- technomancy 16y agoPerhaps this is true in CL, but Clojure makes it easy to define private functions. In the case of the particular example he points to it's just a long function because many people contributed to that function over a period of several months.
- rbxbx 16y agoThanks! I didn't know about defn- Time for refactoring :D