diff options
author | Konrad Hinsen <konrad.hinsen@laposte.net> | 2009-03-16 07:47:02 +0000 |
---|---|---|
committer | Konrad Hinsen <konrad.hinsen@laposte.net> | 2009-03-16 07:47:02 +0000 |
commit | 39d42ec4bc1f30ee35db94e876db8165440b4d7f (patch) | |
tree | 839a597f4be792a08790dc35b07281296d60f8bc /src/clojure/contrib/types | |
parent | 9313f194627cf326c3b942a4919a86ccdfada9ad (diff) |
types: algebraic types implemented as maps
Diffstat (limited to 'src/clojure/contrib/types')
-rw-r--r-- | src/clojure/contrib/types/examples.clj | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/clojure/contrib/types/examples.clj b/src/clojure/contrib/types/examples.clj index e38d6425..8f4f98e4 100644 --- a/src/clojure/contrib/types/examples.clj +++ b/src/clojure/contrib/types/examples.clj @@ -8,7 +8,7 @@ (ns clojure.contrib.types.examples (:use [clojure.contrib.types - :only (deftype defadt match get-value get-values)])) + :only (deftype defadt match)])) ; ; Multisets implemented as maps to integers @@ -133,20 +133,3 @@ (foo-to-int (bar 3 3 1)) (foo-to-int (bar 0 3 1)) (foo-to-int (bar 10 20 30)) - -; -; Value accessors are defined only for algebraic data types that have -; exactly one constructor. get-values is defined if there is at least -; one argument in the constructor; it returns a vector of values. -; get-value is defined only for exactly one argument, it returns -; the value directly. -; - -(get-value (bar 1 2 3)) ; fails -(get-values (bar 1 2 3)) - -(defadt ::sum - (sum x)) - -(get-value (sum 42)) -(get-values (sum 42)) |