Changes for clojure.core/create-ns

zkim on Sun, 26 Sep 2010
;; You can create a namespace, not switch to it and still work in, by storing it

;; create the namespace
user=> (def for-later-use (create-ns 'my-namespace))
#'user/for-later-use

;; assign a value for a variable
user=> (intern for-later-use 'my-var "some value")
#'my-namespace/my-var
;; notice how the "for-later-use" symbol has been evaluated to the namespace it represents

;; check the new variable
user=> my-namespace/my-var
"some value"

;; you can also work on a namespace by using the its name
;; (but quoting it) instead of the return of "create-ns"
user=> (intern 'my-namespace 'my-var "some other value")
#'my-namespace/my-var

;; check the new assignment and see what's changed
user=> my-namespace/my-var
"some other value"
belun on Tue, 21 Sep 2010
You can create a namespace, not switch to it and still work in, by storing it
; create the namespace
user=> (def for-later-use (create-ns 'my-namespace))
#'user/for-later-use

; assign a value for a variable
user=> (intern for-later-use 'my-var "some value")
#'my-namespace/my-var
; notice how the "for-later-use" symbol has been evaluated to the namespace it represents

; check the new variable
user=> my-namespace/my-var
"some value"

; you can also work on a namespace by using the its name
; (but quoting it) instead of the return of "create-ns"
user=> (intern 'my-namespace 'my-var "some other value")
#'my-namespace/my-var

; check the new assignment and see what's changed
user=> my-namespace/my-var
"some other value"
belun on Tue, 21 Sep 2010
You can create a namespace, not switch to it and still work in, by storing it
; create the namespace
user=> (def for-later-use (create-ns 'my-namespace))
#'user/for-later-use

; assign a value for a variable
user=> (intern for-later-use 'my-var "some value")
#'my-namespace/my-var
; notice how the "for-later-use" symbol has been evaluated to the namespace it represents

; check the new variable
user=> my-namespace/my-var
"some value"

; you can also work on a namespace (but quoting it)
; by using the its name, and not the return of "create-ns"
user=> (intern 'my-namespace 'my-var "some other value")
#'my-namespace/my-var

; check the new assignment and see what's changed
user=> my-namespace/my-var
"some other value"
belun on Tue, 21 Sep 2010
You can create a namespace, not switch to it and still work in, by storing it

; create the namespace
user=> (def for-later-use (create-ns 'my-namespace))
#'user/for-later-use

; assign a value for a variable
user=> (intern for-later-use 'my-var "some value")
#'my-namespace/my-var
; notice how the "for-later-use" symbol has been evaluated to the namespace it represents

; check the new variable
user=> my-namespace/my-var
"some value"

; you can also work on a namespace
; by using the its name, and not the return of "create-ns"
user=> (intern 'my-namespace 'my-var "some other value")
#'my-namespace/my-var

; check the new assignment
user=> my-namespace/my-var
"some other value"