Mercurial > lasercutter
view src/clojure/contrib/set.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
line wrap: on
line source
1 ;; Copyright (c) Jason Wolfe. All rights reserved. The use and2 ;; distribution terms for this software are covered by the Eclipse Public3 ;; License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can4 ;; be found in the file epl-v10.html at the root of this distribution. By5 ;; using this software in any fashion, you are agreeing to be bound by the6 ;; terms of this license. You must not remove this notice, or any other,7 ;; from this software.8 ;;9 ;; set.clj10 ;;11 ;; Clojure functions for operating on sets (supplemental to clojure.set)12 ;;13 ;; jason at w01fe dot com14 ;; Created 2 Feb 200916 ;; Deprecations in 1.2: subset and superset have been promoted to17 ;; clojure.set19 (ns20 ^{:author "Jason Wolfe",21 :doc "Clojure functions for operating on sets (supplemental to clojure.set)"}22 clojure.contrib.set)24 (defn subset?25 "Is set1 a subset of set2?"26 {:deprecated "1.2"}27 [set1 set2]28 {:tag Boolean}29 (and (<= (count set1) (count set2))30 (every? set2 set1)))32 (defn superset?33 "Is set1 a superset of set2?"34 {:deprecated "1.2"}35 [set1 set2]36 {:tag Boolean}37 (and (>= (count set1) (count set2))38 (every? set1 set2)))40 (defn proper-subset?41 "Is s1 a proper subset of s2?"42 [set1 set2]43 {:tag Boolean}44 (and (< (count set1) (count set2))45 (every? set2 set1)))47 (defn proper-superset?48 "Is s1 a proper superset of s2?"49 [set1 set2]50 {:tag Boolean}51 (and (> (count set1) (count set2))52 (every? set1 set2)))