Public Vars

Back

printf (clj)

(source)

function

(printf fmt & args)
Prints formatted output, as per format

Examples

originrose/cortex
(ns cortex.util-test
  (:refer-clojure :exclude [defonce])
  (:require
    #?(:cljs [cljs.test :refer-macros [deftest is testing]]
       :clj [clojure.test :refer [deftest is testing]])
    [clojure.core.matrix :as m]
    [clojure.string :as str]
    [cortex.util :refer :all]))

(deftest sprintf-test
  (is (= (with-out-str (sprintf "%(d%n" [[1 -3 5] [-7 3]]))
         (format "[[1 (3) 5] [(7) 3]]%n"))))
originrose/cortex
(ns cortex.optimise.util-test
  (:refer-clojure :exclude [defonce])
  (:require [cortex.optimise.util :refer :all]
            [clojure.core.matrix :as m]
            [clojure.test :refer :all]))

(deftest sprintf-test
  (is (= (with-out-str (sprintf "%(d%n" [[1 -3 5] [-7 3]]))
         (format "[[1 (3) 5] [(7) 3]]%n"))))
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'.
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/print [t/Any :* :-> nil]
cc/println [t/Any :* :-> nil]
cc/print-str [t/Any :* :-> t/Str]
cc/println-str [t/Any :* :-> t/Str]
#?@(:cljs [] :default [
cc/printf [t/Str t/Any :* :-> nil]
cc/format [t/Str t/Any :* :-> t/Str]
])
cc/pr [t/Any :* :-> nil]
cc/prn [t/Any :* :-> nil]
cc/flush [:-> nil]
cc/*print-length* (t/U nil false t/AnyInteger)
cc/*print-level* (t/U nil false t/AnyInteger)
#?@(:cljs [] :default [
cc/*verbose-defrecords* t/Bool
cc/print-ctor [Object [Object java.io.Writer :-> t/Any] java.io.Writer :-> nil]
])