Back
newline (clj)
(source)function
(newline)
Writes a platform-specific newline to *out*
Examples
arohner/spectrum
(ns spectrum.core-specs
(:require [clojure.core :as core]
[clojure.spec.alpha :as s]
[spectrum.core :as st]
[spectrum.types :as t]
[spectrum.util :refer [def-instance-predicate]]))
(st/var-spec #'clojure.core/*flush-on-newline* #'boolean?)
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-escape-newlines nil
"Non-nil means print newlines in strings as `\\n'.
Also print formfeeds as `\\f'.")
(defun print (object &optional printcharfun)
"Output the printed representation of OBJECT, with newlines around it.
Quoting characters are printed when needed to make output that `read'
can handle, whenever this is possible. For complex objects, the behavior
is controlled by `print-level' and `print-length', which see.
(defun terpri (&optional printcharfun)
"Output a newline to stream PRINTCHARFUN.
If PRINTCHARFUN is omitted or nil, the value of `standard-output' is used."
(println)
true)
cloojure/tupelo
; Copyright (c) Alan Thompson. All rights reserved.
; The use and distribution terms for this software are covered by the Eclipse Public License 1.0
; (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at
; the root of this distribution. By using this software in any fashion, you are agreeing to be
; bound by the terms of this license. You must not remove this notice, or any other, from this
; software.
(ns tst.tupelo.string
(:refer-clojure :exclude [take drop])
;---------------------------------------------------------------------------------------------------
; https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html
; http://blog.fikesfarm.com/posts/2015-12-18-clojurescript-macro-tower-and-loop.html
#?(:cljs (:require-macros [tupelo.test]))
(:require
[clojure.test] ; sometimes this is required - not sure why
[clojure.core :as cc]
[tupelo.core :as t :refer [spy spyx spyxx spyx-pretty forv]]
[tupelo.chars :as char]
[tupelo.string :as str]
[tupelo.test :refer [testing is verify verify-focus
is isnt is= isnt= is-set= is-nonblank= is-nonblank-lines=
throws? throws-not?
]]
))
(verify
(let [text-blk (str/join \newline
["one two three four five six seven eight nine ten"
"one two three four five six seven eight nine ten"
"one two three four five six seven eight nine ten"])]
(is (str/nonblank= (str/clip-text 30 text-blk)
(str/join \newline ["one two three four five six se"
"one two three four five six se"
"one two three four five six se"])))))
(verify
(is= (str/join \newline [" a"
"0 a"])
(str/tabs->spaces 4
(str/join [\tab \a \newline
\0 \tab \a])))
(is= (str/join \newline [" ab"
"0 a"])
(str/tabs->spaces 4
(str/join [\tab \a \b \newline
\0 \tab \a])))
(is= (str/join \newline [" abc"
"0 a"])
(str/tabs->spaces 4
(str/join [\tab \a \b \c \newline
\0 \tab \a])))
(is= (str/join \newline [" abcd"
"0 a"])
(str/tabs->spaces 4
(str/join [\tab \a \b \c \d \newline
\0 \tab \a]))))
(verify
(is (= "abc def g hij kl"
(str/whitespace-collapse " abc def g
hij kl ")))
(is (= "abc" (str/whitespace-remove "abc")))
(is (= "" (str/whitespace-remove "")))
(is= "abcdef"
(str/whitespace-remove "abc def")
(str/whitespace-remove " abc def")
(str/whitespace-remove "abc def ")
(str/whitespace-remove " abc def ")
(str/whitespace-remove " a bc def ")
(str/whitespace-remove (str " abc " \newline " def ")))
(is= "a"
(str/whitespace-remove "a")
(str/whitespace-remove "a ")
(str/whitespace-remove " a")
(str/whitespace-remove (str " a " \newline " ")))
(is= ""
(str/whitespace-remove "")
(str/whitespace-remove " ")
(str/whitespace-remove (str " " \newline " "))))
(verify
; clojure accepts either CR/LF or LF (CR=/return & LF=\newline) as line-separator
(is (= "abc" (str/indent-lines 0 "abc")))
(is (= "abc" (str/indent-lines 0 (str "abc" \newline))))
(is (= "abc" (str/indent-lines 0 (str "abc" \return \newline))))
(is (= " abc\n def" (str/indent-lines 2 (str "abc" \newline "def"))))
(is (= " abc\n def" (str/indent-lines 2 (str "abc" \newline "def" \newline))))
(is (= "abc\ndef" (str/indent-lines 0 (str "abc" \newline "def"))))
(is (= " abc\n def" (str/indent-lines 1 (str "abc" \newline "def"))))
(is (= " abc\n def" (str/indent-lines 2 (str "abc" \newline "def"))))
(is (= " abc\n def" (str/indent-lines 3 (str "abc" \newline "def"))))
)
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]
#?@(:cljs [] :default [
cc/*file* t/Str
])
cc/*command-line-args* (t/NilableNonEmptyASeq t/Str)
#?@(:cljs [
cc/*unchecked-if* t/Bool
cc/*unchecked-arrays* t/Bool
cc/*warn-on-infer* t/Bool
cc/enable-console-print! [:-> t/Any]
] :default [
cc/*warn-on-reflection* t/Bool
cc/*compile-path* t/Str
cc/*compile-files* t/Bool
cc/*unchecked-math* t/Bool
cc/*compiler-options* (t/Map t/Any t/Any)
cc/*in* java.io.Reader
cc/*out* java.io.Writer ;; FIXME cljs
cc/*err* java.io.Writer
cc/*repl* t/Any
])
cc/*flush-on-newline* t/Bool
cc/*print-meta* t/Bool
cc/*print-dup* t/Bool
cc/*print-readably* t/Bool
#?@(:cljs [] :default [
cc/*read-eval* (t/U ':unknown t/Bool)
])
camsaul/methodical
(ns methodical.impl.multifn.cached
(:require
[clojure.core.protocols :as clojure.protocols]
[clojure.datafy :as datafy]
[methodical.interface :as i]
[methodical.util.describe :as describe]
[pretty.core :as pretty])
(:import
(clojure.lang Named)
(methodical.interface Cache MultiFnImpl)))
describe/Describable
(describe [_this]
(str (describe/describe cache)
\newline \newline
(describe/describe impl))))