Can I refer another namespace and expose its functions as public for the current ns?

前端 未结 3 1834
傲寒
傲寒 2021-02-01 20:37

I thought use would do it but it seems the mapping created in the current namespace is not public. Here is an example of what I\'d like to achieve:

         


        
3条回答
  •  眼角桃花
    2021-02-01 21:27

    One way to do this selectively (specifying each function explicitly) is to use something like Zach Tellman's Potemkin library. An example of it's use is found in the lamina.core namespace which serves as the public entry point for Lamina, importing the key public functions from all other internal namespaces.

    You can also use clojure.contrib.def/defalias:

    (use 'clojure.contrib.def/defalias)
    (defalias foo clojure.string/blank?)
    (foo "")
    

提交回复
热议问题