Public Vars

Back

set (clj)

(source)

function

(set coll)
Returns a set of the distinct elements of coll.

Examples

clojure
(deftest division
  (is (= clojure.core// /))
  (binding [*ns* *ns*]
    (eval '(do (ns foo
                 (:require [clojure.core :as bar])
                 (:use [clojure.test]))
               (is (= clojure.core// bar//))))))

(deftest Instants
  (testing "Instants are read as java.util.Date by default"
    (is (= java.util.Date (class #inst "2010-11-12T13:14:15.666"))))
  (let [s "#inst \"2010-11-12T13:14:15.666-06:00\""]
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date produces java.util.Date"
        (is (= java.util.Date (class (read-string s)))))
      (testing "java.util.Date instants round-trips"
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Date instants round-trip throughout the year"
        (doseq [month (range 1 13) day (range 1 29) hour (range 1 23)]
          (let [s (format "#inst \"2010-%02d-%02dT%02d:14:15.666-06:00\"" month day hour)]
            (is (= (-> s read-string)
                   (-> s read-string pr-str read-string))))))
      (testing "java.util.Date handling DST in time zones"
        (let [dtz (TimeZone/getDefault)]
          (try
            ;; A timezone with DST in effect during 2010-11-12
            (TimeZone/setDefault (TimeZone/getTimeZone "Australia/Sydney"))
            (is (= (-> s read-string)
                   (-> s read-string pr-str read-string)))
            (finally (TimeZone/setDefault dtz)))))
      (testing "java.util.Date should always print in UTC"
        (let [d (read-string s)
              pstr (print-str d)
              len (.length pstr)]
          (is (= (subs pstr (- len 7)) "-00:00\"")))))
    (binding [*data-readers* {'inst read-instant-calendar}]
      (testing "read-instant-calendar produces java.util.Calendar"
        (is (instance? java.util.Calendar (read-string s))))
      (testing "java.util.Calendar round-trips"
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Calendar remembers timezone in literal"
        (is (= "#inst \"2010-11-12T13:14:15.666-06:00\""
               (-> s read-string pr-str)))
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Calendar preserves milliseconds"
        (is (= 666 (-> s read-string
                       (.get java.util.Calendar/MILLISECOND)))))))
  (let [s "#inst \"2010-11-12T13:14:15.123456789\""
        s2 "#inst \"2010-11-12T13:14:15.123\""
        s3 "#inst \"2010-11-12T13:14:15.123456789123\""]
    (binding [*data-readers* {'inst read-instant-timestamp}]
      (testing "read-instant-timestamp produces java.sql.Timestamp"
        (is (= java.sql.Timestamp (class (read-string s)))))
      (testing "java.sql.Timestamp preserves nanoseconds"
        (is (= 123456789 (-> s read-string .getNanos)))
        (is (= 123456789 (-> s read-string pr-str read-string .getNanos)))
        ;; truncate at nanos for s3
        (is (= 123456789 (-> s3 read-string pr-str read-string .getNanos))))
      (testing "java.sql.Timestamp should compare nanos"
        (is (= (read-string s) (read-string s3)))
        (is (not= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date should truncate at milliseconds"
        (is (= (read-string s) (read-string s2) (read-string s3))))))
  (let [s "#inst \"2010-11-12T03:14:15.123+05:00\""
        s2 "#inst \"2010-11-11T22:14:15.123Z\""]
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date should convert to UTC"
        (is (= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-timestamp}]
      (testing "read-instant-timestamp should convert to UTC"
        (is (= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-calendar}]
      (testing "read-instant-calendar should preserve timezone"
        (is (not= (read-string s) (read-string s2)))))))
clojure
(ns clojure.test-clojure.server
    (:import java.util.Random)
    (:require [clojure.test :refer :all])
    (:require [clojure.core.server :as s]))

(defn create-random-thread
  []
  (Thread.
    (fn []
      (let [random (new Random)]
      (while (not (.isInterrupted (Thread/currentThread)))
        (System/setProperty (Integer/toString (.nextInt random)) (Integer/toString (.nextInt random))))))))
clojure/core.async
;; The clojure.core.async namespace contains the public API.
(require '[clojure.core.async :as async :refer :all])

;; We can create a background thread with alts that combines inputs on
;; either of two channels. `alts!!` takes a set of operations
;; to perform - either a channel to take from or a [channel value] to put
;; and returns the value (nil for put) and channel that succeeded:
noprompt/meander
(ns multimethods
  (:refer-clojure :exclude [defmethod defmulti])
  (:require
   #?(:clj [clojure.core :as clj] :cljs [cljs.core :as cljs])
   [meander.epsilon :as m]))

(defprotocol IMeanderMethods
  (-set-fn         [this f]))

(deftype MultiMeanderFn [^:unsynchronized-mutable target-fn]
  IMeanderMethods
  (-set-fn [_ f]
    (set! target-fn f))

(defmacro defmethod
  [mf [& lhr] & body]
  (swap! cache_ assoc-in [mf lhr] body)
  (let [ptrns (get @cache_ mf)]
    `(-set-fn ~(with-meta mf {:tag `MultiMeanderFn})
              (fn [& ~'argsv]
                (m/match ~'argsv
                  ~@(loop [[[l r] & more] ptrns xs []]
                      (if l
                        (recur more (conj xs l (cons `do r)))
                        xs)))))))
hraberg/deuce
(ns deuce.emacs.charset
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [deuce.emacs.alloc :as alloc]
            [deuce.emacs.fns :as fns]
            [deuce.emacs-lisp.globals :as globals])
  (:refer-clojure :exclude []))

(defvar inhibit-load-charset-map nil
  "Inhibit loading of charset maps.  Used when dumping Emacs.")

(defvar charset-list (alloc/list)
  "List of all charsets ever defined.")

(defvar charset-map-path nil
  "*List of directories to search for charset map files.

(defun sort-charsets (charsets)
  "Sort charset list CHARSETS by a priority of each charset.
  Return the sorted list.  CHARSETS is modified by side effects.
  See also `charset-priority-list' and `set-charset-priority'."
  )

(defun charset-plist (charset)
  "Return the property list of CHARSET."
  )

(defun set-charset-plist (charset plist)
  "Set CHARSET's property list to PLIST."
  )

(defun charset-after (&optional pos)
  "Return charset of a character in the current buffer at position POS.
  If POS is nil, it defaults to the current point.
  If POS is out of range, the value is nil."
  )

(defun define-charset-internal (&rest args)
  "For internal use only."
  )

(defun define-charset-alias (alias charset)
  "Define ALIAS as an alias for charset CHARSET."
  )

(defun charsetp (object)
  "Return non-nil if and only if OBJECT is a charset."
  )

(defun encode-char (ch charset &optional restriction)
  "Encode the character CH into a code-point of CHARSET.
  Return nil if CHARSET doesn't include CH.

(defun charset-id-internal (&optional charset)
  "Internal use only.
  Return charset identification number of CHARSET."
  )

(defun split-char (ch)
  "Return list of charset and one to four position-codes of CH.
  The charset is decided by the current priority order of charsets.
  A position-code is a byte value of each dimension of the code-point of
  CH in the charset."
  )

(defun find-charset-region (beg end &optional table)
  "Return a list of charsets in the region between BEG and END.
  BEG and END are buffer positions.
  Optional arg TABLE if non-nil is a translation table to look up.

(defun unify-charset (charset &optional unify-map deunify)
  "Unify characters of CHARSET with Unicode.
  This means reading the relevant file and installing the table defined
  by CHARSET's `:unify-map' property.

  Optional second arg UNIFY-MAP is a file name string or a vector.  It has
  the same meaning as the `:unify-map' attribute in the function
  `define-charset' (which see).

(defun find-charset-string (str &optional table)
  "Return a list of charsets in STR.
  Optional arg TABLE if non-nil is a translation table to look up.

(defun set-charset-priority (&rest charsets)
  "Assign higher priority to the charsets given as arguments."
  )

(defun declare-equiv-charset (dimension chars final-char charset)
  "Declare an equivalent charset for ISO-2022 decoding.

  On decoding by an ISO-2022 base coding system, when a charset
  specified by DIMENSION, CHARS, and FINAL-CHAR is designated, behave as
  if CHARSET is designated instead."
  )

(defun clear-charset-maps ()
  "Internal use only.
  Clear temporary charset mapping tables.
  It should be called only from temacs invoked for dumping."
  )

(defun get-unused-iso-final-char (dimension chars)
  "Return an unused ISO final char for a charset of DIMENSION and CHARS.
  DIMENSION is the number of bytes to represent a character: 1 or 2.
  CHARS is the number of characters in a dimension: 94 or 96.

  This final char is for private use, thus the range is `0' (48) .. `?' (63).
  If there's no unused final char for the specified kind of charset,
  return nil."
  )

(defun charset-priority-list (&optional highestp)
  "Return the list of charsets ordered by priority.
  HIGHESTP non-nil means just return the highest priority one."
  )

(defun map-charset-chars (function charset &optional arg from-code to-code)
  "Call FUNCTION for all characters in CHARSET.
  FUNCTION is called with an argument RANGE and the optional 3rd
  argument ARG.

(defun make-char (charset &optional code1 code2 code3 code4)
  "Return a character of CHARSET whose position codes are CODEn.

(defun char-charset (ch &optional restriction)
  "Return the charset of highest priority that contains CH.
  If optional 2nd arg RESTRICTION is non-nil, it is a list of charsets
  from which to find the charset.  It may also be a coding system.  In
  that case, find the charset from what supported by that coding system."
  )

(defun decode-char (charset code-point &optional restriction)
  "Decode the pair of CHARSET and CODE-POINT into a character.
  Return nil if CODE-POINT is not valid in CHARSET.

(defun iso-charset (dimension chars final-char)
  "Return charset of ISO's specification DIMENSION, CHARS, and FINAL-CHAR.

  ISO 2022's designation sequence (escape sequence) distinguishes charsets
  by their DIMENSION, CHARS, and FINAL-CHAR,
  whereas Emacs distinguishes them by charset symbol.
  See the documentation of the function `charset-info' for the meanings of
  DIMENSION, CHARS, and FINAL-CHAR."
  )
hraberg/deuce
(ns deuce.emacs.print
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [clojure.string :as s]
            [deuce.emacs.buffer :as buffer]
            [deuce.emacs.data :as data]
            [deuce.emacs.editfns :as editfns]
            [deuce.emacs.fns :as fns])
  (:refer-clojure :exclude [print]))

(defvar print-charset-text-property nil
  "A flag to control printing of `charset' text property on printing a string.
  The value must be nil, t, or `default'.

  If the value is nil, don't print the text property `charset'.

  If the value is t, always print the text property `charset'.

  If the value is `default', print the text property `charset' only when
  the value is different from what is guessed in the current charset
  priorities.")

(defvar print-continuous-numbering nil
  "*Non-nil means number continuously across print calls.
  This affects the numbers printed for #N= labels and #M# references.
  See also `print-circle', `print-gensym', and `print-number-table'.
  This variable should not be set with `setq'; bind it with a `let' instead.")

(defun redirect-debugging-output (file &optional append)
  "Redirect debugging output (stderr stream) to file FILE.
  If FILE is nil, reset target to the initial stderr stream.
  Optional arg APPEND non-nil (interactively, with prefix arg) means
  append to existing target file."
  )
nasa/Common-Metadata-Repository
(ns cmr.client.dev
  "The CMR client Clojure REPL development namespace."
  (:require
   [clojure.core.async :as async]
   [clojure.data.json :as json]
   [clojure.data.xml :as xml]
   [clojure.java.io :as io]
   [clojure.pprint :refer [pprint]]
   [clojure.string :as string]
   [clojure.tools.namespace.repl :as repl]
   [cmr.client.ac :as ac]
   [cmr.client.common.const :as const]
   [cmr.client.common.util :as util]
   [cmr.client.http.core :as http]
   [cmr.client.ingest :as ingest]
   [cmr.client.search :as search]
   [cmr.client.testing.runner :as runner]
   [cmr.client.tests]
   [ltest.core :as ltest]))

(repl/set-refresh-dirs
   "src/clj"
   "src/cljc"
   "dev-resources/src")

(def reset
   "An alias for `repl/refresh`"
   #'repl/refresh)