Importing things in Clojure

INSIDE AN (NS) ONLY, LOL

from foo.core import *

(:use foo.core)

from foo.core import bar (only if bar is not another module, lol)

(:use [foo.core :only (bar)])

import foo.bar

(:require [foo.bar])

import foo.bar as bar (only if bar is another module, lol)

(:require [foo.bar :as bar])

import foo.core.Bar as Bar (only if bar is a record, trolololol)

(:require [foo.core])
(:import [foo.core Bar])


OUTSIDE AN (NS) ONLY, LOL

from foo.core import *

(use 'foo.core)

from foo.core import bar

(use '[foo.core :only (bar)])

import foo.bar

(require '[foo.bar])

import foo.bar as bar

(require '[foo.bar :as bar])

4 Hearts

You've Got Great Taste!

Share on Twitter Share on Facebook
×

Done! Now Share Your Page

Share on Twitter Share on Facebook
you can edit your page by clicking the Edit Page link at the bottom of the page ×