Created
July 22, 2011 23:10
-
-
Save omasanori/1100647 to your computer and use it in GitHub Desktop.
An example to use record constructor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns bar | |
"Other namespace." | |
(:use foo)) | |
(println "WARNING: constructor functions are enabled from 1.3 series!") | |
(println "WARNING: for now, try beta version at your risk.") | |
(println "Simple constructor: ->Point" | |
(->Point 10 20)) | |
(println "Construct from hash-map: map->Point" | |
(map->Point {:x 10 :y 20})) | |
(println "Good news: records will be constructed without explicit importing.") | |
(println "Bad news: for the moment you can't do it at work.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo | |
"A namespace.") | |
(defrecord Point [x y]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment