Forked from anonymous/flengyel-4clojure-solution65.clj
Created
December 8, 2011 06:34
-
-
Save flengyel/1446291 to your computer and use it in GitHub Desktop.
Solution to Black Box Testing (4clojure problem 65)
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
;; flengyel's solution to Black Box Testing | |
;; https://4clojure.com/problem/65 | |
(fn blackbox [s] | |
(cond | |
(= (conj s {}) s) :map | |
(empty? s) (cond | |
(= (clojure.set/union s #{}) #{}) :set | |
(= (conj (conj s 0) 1) [0 1]) :vector | |
:else :list) | |
(= (clojure.set/union s s) s) :set | |
(= (first (conj s s)) s) :list | |
:else :vector)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(conj :map {})
=:map
(conj :list 1)
=:list
(conj :vector [1] )
=[:vector 1]
(union :set #{})
=:set
(union [1] [1])
=[1 1]
;