Fork me on GitHub

is it possible to somehow define a variadic anonymous function? Like (fn ([a] ...) ([a b] ...))?


exactly like that


i thought i just tried that, hang on


(fn [& args] (let [[a b] args] (prn a)))


sorry pradyumna, i got variadic and multi-arity mixed up


Now that I’m increasingly embracing qualified keywords, I find myself sometimes using keywords from a requirer namespace within its dependent namespaces. For example, I might have a foo.client namespace with my public api, and foo.client.impl on which it depends with implementation details. Having been trained by the clojure single-pass compiler, it feels weird to use :foo.client/key within the impl ns, but I can’t tell if it’s good or bad design, or just a different aesthetic to which I need to get accustomed.


@donaldball this is not specific to named keywords, but the pattern I find useful is an abstract namespace (describing protocols and data etc.) an implementation namespace requiring the abstract namespace and making concrete the things the abstract on defines, and an app namespace that does everything in terms of the abstract namespace's functions / datatypes except for a single line construction of sometihng from the impl


so in terms of that pattern, the data shapes (and thus namespaced keywords) would come from the abstract ns that all the others use


That has long been my basic approach to namespace design also, but from the user’s point of view, if the namespaced keywords are part of the public contract, they more naturally fall into what you call the app namespace than the abstract namespace.


my take on that is that the end user writes the app namespace


and they should be using your abstract namespace, for everything but the constructor