Public Vars

Back

refer (clj)

(source)

function

(refer ns-sym & filters)
refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to something else in the current namespace. Filters can be used to select a subset, via inclusion or exclusion, or to provide a mapping to a symbol different from the var's name, in order to prevent clashes. Use :use in the ns macro in preference to calling this directly.

Examples

clojure
(ns clojure.test-clojure.reducers
  (:require [clojure.core.reducers :as r]
            [clojure.test.generative :refer (defspec)]
            [clojure.data.generators :as gen])
  (:use clojure.test))

(deftest test-closed-over-clearing
  ;; this will throw OutOfMemory without proper reference clearing
  (is (number? (reduce + 0 (r/map identity (range 1e8))))))
hraberg/deuce
(ns deuce.emacs.doc
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [clojure.string :as s]
            [deuce.emacs-lisp :as el])
  (:refer-clojure :exclude []))

  This differs from `get' in that it can refer to strings stored in the
  `etc/DOC' file; and that it evaluates documentation properties that
  aren't strings."
  )
hraberg/deuce
(ns deuce.emacs.term
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [deuce.emacs.data :as data]
            [deuce.emacs.eval :as eval]
            [deuce.emacs.terminal :as terminal])
  (:import [com.googlecode.lanterna.screen Screen])
  (:refer-clojure :exclude []))

  TERMINAL can be a terminal object, a frame, or nil (meaning the
  selected frame's terminal).  This function always returns nil if
  TERMINAL does not refer to a text-only terminal."
  true)

  TERMINAL can be a terminal object, a frame or nil (meaning the
  selected frame's terminal).  This function always returns nil if
  TERMINAL does not refer to a text-only terminal."
  )

  TERMINAL can be a terminal object, a frame, or nil (meaning the
  selected frame's terminal).  This function always returns 0 if
  TERMINAL does not refer to a text-only terminal."
  ({"xterm-256color" 256} (System/getenv "TERM") 16))
hraberg/deuce
(ns deuce.emacs.dired
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [clojure.java.io :as io]
            [deuce.emacs-lisp.cons :as cons])
  (:import [java.io File])
  (:refer-clojure :exclude []))

  ID-FORMAT specifies the preferred format of attributes uid and gid (see
  below) - valid values are 'string and 'integer.  The latter is the
  default, but we plan to change that, so you should specify a non-nil value
  for ID-FORMAT if you use the returned uid or gid.

(defun directory-files-and-attributes (directory &optional full match nosort id-format)
  "Return a list of names of files and their attributes in DIRECTORY.
  There are four optional arguments:
  If FULL is non-nil, return absolute file names.  Otherwise return names
   that are relative to the specified directory.
  If MATCH is non-nil, mention only file names that match the regexp MATCH.
  If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
   NOSORT is useful if you plan to sort the result yourself.
  ID-FORMAT specifies the preferred format of attributes uid and gid, see
  `file-attributes' for further documentation.
  On MS-Windows, performance depends on `w32-get-true-file-attributes',
  which see."
  )
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-gensym nil
  "Non-nil means print uninterned symbols so they will read as uninterned.
  I.e., the value of (make-symbol \"foobar\") prints as #:foobar.
  When the uninterned symbol appears within a recursive data structure,
  and the symbol appears more than once, in addition use the #N# and #N=
  constructs as needed, so that multiple references to the same symbol are
  shared once again when the text is read back.")

(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.")

(defvar print-number-table nil
  "A vector used internally to produce `#N=' labels and `#N#' references.
  The Lisp printer uses this vector to detect Lisp objects referenced more
  than once.
hraberg/deuce
(ns deuce.emacs.floatfns
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [deuce.emacs.alloc :as alloc])
  (:refer-clojure :exclude [float]))

  Rounding a value equidistant between two integers may choose the
  integer closer to zero, or it may prefer an even integer, depending on
  your machine.  For example, (round 2.5) can return 3 on some
  systems, but 2 on others."
  (Math/round (/ arg (double (or divisor 1)))))