Skip to content

Instantly share code, notes, and snippets.

@omasanori
Created July 22, 2011 23:10
Show Gist options
  • Save omasanori/1100647 to your computer and use it in GitHub Desktop.
Save omasanori/1100647 to your computer and use it in GitHub Desktop.
An example to use record constructor
(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.")
(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