简体   繁体   中英

Injecting namespaces in functions in clojure

Is it possible to inject namespaces in a function in Clojure?

I want my i/o to be outside from the program and only inject it. The problem i faced, that i tried to give a namespace and invoke it i get the error message:

 No name namespace: my
(ns mymain
  (:require [myio]))

...

(defn my-test [my]
  (my/showworld))

;(play_game)
(my-test myio)

The usual way to pass logic is through functions and not by namespace aliases:

(defn my-test [show-world]
  (show-world))

(require 'myio)
(my-test myio/show-world)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM