Public Vars

Back

prn (clj)

(source)

function

(prn & more)
Same as pr followed by (newline). Observes *flush-on-newline*

Examples

clojure/core.typed
(ns clojure.core.typed.annotator.debug-macros
  (:require [clojure.core.typed.annotator.util :refer [*debug*
                                                       *debug-depth*
                                                       current-time]])
  )

(defmacro time-if-slow
  "Evaluates expr and prints the time it took.  Returns the value of expr."
  [msg expr]
  `(let [start# (current-time)
         ret# ~expr
         msduration# (/ (double (- (current-time) start#)) 1000000.0)]
     (when (< 1000 msduration#)
       (prn (str "Elapsed time: " msduration# " msecs"))
       (prn ~msg))
     ret#))
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/str [t/Any :* :-> t/Str]
cc/prn-str [t/Any :* :-> t/Str]
cc/pr-str [t/Any :* :-> t/Str]
cc/newline [:-> nil]

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]
])
mauricioszabo/repl-tooling
(ns repl-tooling.editor-integration.connection-test
  (:require [clojure.test :refer [testing]]
            [check.core :refer [check]]
            [check.async-old :as a]
            [clojure.core.async :as async]
            [repl-tooling.editor-integration.connection :as connection]
            [repl-tooling.editor-helpers :as editor-helpers]
            [repl-tooling.eval :as eval]))

    (testing "capturing stdout"
      (-> repls a/await! :clj/repl (eval/evaluate '(prn :foo) {} identity))
      (check (a/await! stdout) => ":foo\n"))

    (testing "capturing stderr"
      (-> repls a/await! :clj/repl (eval/evaluate "(binding [*out* *err*] (prn :bar))" {} identity))
      (check (a/await! stderr) => ":bar"))

(a/def-async-test "Batches of commands" {:teardown (connection/disconnect!)}
  (let [repls (async/promise-chan)
        stdout (async/chan 60000)]
    (. (connection/connect-unrepl! "localhost" 2233
                                   #(async/put! stdout %)
                                   #()
                                   #()
                                   #())
      then #(async/put! repls %))
    (-> repls a/await! :clj/repl (eval/evaluate "(doseq [n (range 2000)] (prn n))" {} identity))
    (doseq [n (range 2000)]
      (check (a/await! stdout) => (str n "\n")))))
gerritjvv/fun-utils
(ns fun-utils.chan-bridge-tests
  (:require [fun-utils.core :refer [chan-bridge]]
            [clojure.core.async :refer [chan >!! <!!]])
  (:use midje.sweet))

               ;(prn (repeatedly 5 #(<!! ch2)))
               (reduce + (repeatedly 5 #(<!! ch2))) => 15
Cnly/clj-latex
(ns mmul
  (:require [clojure.core.matrix :as m]
            [clojure.pprint :as pp]
            [clj-latex.core :as l]))

      "This result can be produced using the following Clojure source code (with clojure.core.matrix):"
      ('verbatim
       (l/esc (prn-str ans-src))))))))