Back
short (clj)
(source)function
(short x)
Coerce to short
Examples
clojure/core.typed
(ns clojure.core.typed.test.protocol
(:require [clojure.core.typed :as t :refer [ann-protocol ann-datatype check-ns]]))
(ann-protocol short/ShortNs)
hraberg/deuce
(ns deuce.emacs.indent
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c]
[deuce.emacs.buffer :as buffer]
[deuce.emacs.data :as data]
[deuce.emacs.editfns :as editfns])
(:refer-clojure :exclude []))
Optional second argument FORCE non-nil means if COLUMN is in the
middle of a tab character, change it to spaces.
In addition, if FORCE is t, and the line is too short to reach
COLUMN, add spaces/tabs to get there.
hraberg/deuce
(ns deuce.emacs.process
(:use [deuce.emacs-lisp :only (defun defvar) :as el])
(:require [clojure.core :as c]
[clojure.java.shell :as sh])
(:refer-clojure :exclude []))
(defvar process-adaptive-read-buffering nil
"If non-nil, improve receive buffering by delaying after short reads.
On some systems, when Emacs reads the output from a subprocess, the output data
is read in very small blocks, potentially resulting in very poor performance.
This behavior can be remedied to some extent by setting this variable to a
non-nil value, as it will automatically delay reading from such processes, to
allow them to produce more output before Emacs tries to read it.
If the value is t, the delay is reset after each write to the process; any other
non-nil value means that the delay is not reset on write.
The variable takes effect when `start-process' is called.")
(defun process-send-string (process string)
"Send PROCESS the contents of STRING as input.
PROCESS may be a process, a buffer, the name of a process or buffer, or
nil, indicating the current buffer's process.
If STRING is more than 500 characters long,
it is sent in several bunches. This may happen even for shorter strings.
Output from processes can arrive in between bunches."
)
(defun process-send-region (process start end)
"Send current contents of region as input to PROCESS.
PROCESS may be a process, a buffer, the name of a process or buffer, or
nil, indicating the current buffer's process.
Called from program, takes three arguments, PROCESS, START and END.
If the region is more than 500 characters long,
it is sent in several bunches. This may happen even for shorter regions.
Output from processes can arrive in between bunches."
)
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 float-output-format nil
"The format descriptor string used to print floats.
This is a %-spec like those accepted by `printf' in C,
but with some restrictions. It must start with the two characters `%.'.
After that comes an integer precision specification,
and then a letter which controls the format.
The letters allowed are `e', `f' and `g'.
Use `e' for exponential notation \"DIG.DIGITSeEXPT\"
Use `f' for decimal point notation \"DIGITS.DIGITS\".
Use `g' to choose the shorter of those two formats for the number at hand.
The precision in any of these cases is the number of digits following
the decimal point. With `f', a precision of 0 means to omit the
decimal point. 0 is not allowed with `e' or `g'.
A value of nil means to use the shortest notation
that represents the number without losing information.")
typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
"Type annotations for the base Clojure distribution."
#?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
(:require [clojure.core :as cc]
[typed.clojure :as t]
#?(:clj [typed.ann-macros.clojure :as macros])
#?(:clj typed.ann.clojure.jvm) ;; jvm annotations
#?(:clj clojure.core.typed))
#?(:clj
(:import (clojure.lang PersistentHashSet PersistentList
APersistentMap #_IPersistentCollection
#_ITransientSet
IRef)
(java.util Comparator Collection))))
cc/long [#?(:cljs t/Num :default (t/U Character t/Num)) :-> #?(:cljs t/AnyInteger :default Long)]
cc/parse-long [t/Str :-> (t/Option #?(:cljs t/AnyInteger :default Long))]
#?@(:cljs [] :default [
cc/num [t/Num :-> t/Num]
])
#?@(:cljs [
cc/short [t/Num :-> t/Num]
] :default [
cc/short [(t/U Character t/Num) :-> Short]
])
;array ctors
#?@(:cljs [] :default [
cc/boolean-array (t/IFn [(t/U t/Num (t/Seqable t/Bool)) :-> (Array boolean)]
[t/Num (t/U t/Bool (t/Seqable t/Bool)) :-> (Array boolean)])
cc/byte-array (t/IFn [(t/U t/Num (t/Seqable Byte)) :-> (Array byte)]
[t/Num (t/U Byte (t/Seqable Byte)) :-> (Array byte)])
cc/char-array (t/IFn [(t/U t/Num (t/Seqable Character)) :-> (Array char)]
[t/Num (t/U t/Num (t/Seqable Character)) :-> (Array char)])
cc/short-array (t/IFn [(t/U t/Num (t/Seqable Short)) :-> (Array short)]
[t/Num (t/U Short (t/Seqable Short)) :-> (Array short)])
cc/int-array (t/IFn [(t/U t/Num (t/Seqable t/Num)) :-> (Array int)]
[t/Num (t/U t/Num (t/Seqable t/Num)) :-> (Array int)])
cc/double-array (t/IFn [(t/U t/Num (t/Seqable t/Num)) :-> (Array double)]
[t/Num (t/U t/Num (t/Seqable t/Num)) :-> (Array double)])
])
;cast to java array
;; TODO rethink input and output types. eg.,
;; cc/booleans [(ReadyOnlyArray boolean) :-> (t/U nil (Array boolean))]
;; TODO objects??
;; cc/objects [(ReadyOnlyArray Object) :-> (t/U nil (ReadyOnlyArray Object))]
;;
;; TODO propagate to Numbers/booleans etc
;cc/booleans [t/Any :-> (t/U nil (Array boolean))]
;cc/bytes [t/Any :-> (t/U nil (Array byte))]
;cc/chars [t/Any :-> (t/U nil (Array char))]
;cc/shorts [t/Any :-> (t/U nil (Array short))]
;cc/ints [t/Any :-> (t/U nil (Array int))]
;cc/longs [t/Any :-> (t/U nil (Array long))]
;cc/floats [t/Any :-> (t/U nil (Array float))]
;cc/doubles [t/Any :-> (t/U nil (Array double))]