parent
b95a40c4f2
commit
46892580c2
4 changed files with 26 additions and 8 deletions
2
sci
2
sci
|
|
@ -1 +1 @@
|
||||||
Subproject commit 34bc45b0531b52ca2a7a8d8b21b0d86f30f697cf
|
Subproject commit e4cfa161b06fa3cfe2c18342aaf8d7ffe2d5ae9d
|
||||||
|
|
@ -111,11 +111,13 @@
|
||||||
java.io.StringReader
|
java.io.StringReader
|
||||||
java.io.StringWriter
|
java.io.StringWriter
|
||||||
java.io.Writer
|
java.io.Writer
|
||||||
|
java.lang.Appendable
|
||||||
java.lang.ArithmeticException
|
java.lang.ArithmeticException
|
||||||
java.lang.AssertionError
|
java.lang.AssertionError
|
||||||
java.lang.Boolean
|
java.lang.Boolean
|
||||||
java.lang.Byte
|
java.lang.Byte
|
||||||
java.lang.Character
|
java.lang.Character
|
||||||
|
java.lang.CharSequence
|
||||||
java.lang.Class
|
java.lang.Class
|
||||||
java.lang.ClassNotFoundException
|
java.lang.ClassNotFoundException
|
||||||
java.lang.Comparable
|
java.lang.Comparable
|
||||||
|
|
@ -199,6 +201,7 @@
|
||||||
java.security.MessageDigest
|
java.security.MessageDigest
|
||||||
java.security.DigestInputStream
|
java.security.DigestInputStream
|
||||||
java.security.SecureRandom
|
java.security.SecureRandom
|
||||||
|
java.sql.Date
|
||||||
java.text.ParseException
|
java.text.ParseException
|
||||||
~@(when features/java-time?
|
~@(when features/java-time?
|
||||||
`[java.time.format.DateTimeFormatter
|
`[java.time.format.DateTimeFormatter
|
||||||
|
|
@ -329,6 +332,9 @@
|
||||||
clojure.lang.Sequential
|
clojure.lang.Sequential
|
||||||
clojure.lang.Seqable
|
clojure.lang.Seqable
|
||||||
clojure.lang.Volatile
|
clojure.lang.Volatile
|
||||||
|
java.util.concurrent.atomic.AtomicInteger
|
||||||
|
java.util.concurrent.atomic.AtomicLong
|
||||||
|
java.util.Collection
|
||||||
java.util.List
|
java.util.List
|
||||||
java.util.Iterator
|
java.util.Iterator
|
||||||
java.util.Map$Entry]
|
java.util.Map$Entry]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
(ns babashka.impl.pprint
|
(ns babashka.impl.pprint
|
||||||
{:no-doc true}
|
{:no-doc true}
|
||||||
(:require [clojure.pprint :as pprint]
|
(:require [clojure.pprint :as pprint]
|
||||||
[sci.core :as sci]
|
[sci.core :as sci]))
|
||||||
[sci.impl.vars :as vars]))
|
|
||||||
|
|
||||||
(defonce patch-option-table
|
(defonce patch-option-table
|
||||||
(alter-var-root #'pprint/write-option-table
|
(alter-var-root #'pprint/write-option-table
|
||||||
|
|
@ -48,10 +47,8 @@
|
||||||
|
|
||||||
(alter-var-root #'pprint/write (constantly new-write))
|
(alter-var-root #'pprint/write (constantly new-write))
|
||||||
|
|
||||||
(def pprint-ns (vars/->SciNamespace 'clojure.pprint nil))
|
(def pprint-ns (sci/create-ns 'clojure.pprint nil))
|
||||||
|
|
||||||
(def print-right-margin
|
|
||||||
(sci/new-dynamic-var 'print-right-margin pprint/*print-right-margin* {:ns pprint-ns}))
|
|
||||||
|
|
||||||
(defn print-table
|
(defn print-table
|
||||||
"Prints a collection of maps in a textual table. Prints table headings
|
"Prints a collection of maps in a textual table. Prints table headings
|
||||||
|
|
@ -62,13 +59,20 @@
|
||||||
(binding [*out* @sci/out]
|
(binding [*out* @sci/out]
|
||||||
(pprint/print-table ks rows))))
|
(pprint/print-table ks rows))))
|
||||||
|
|
||||||
|
(def print-right-margin
|
||||||
|
(sci/new-dynamic-var '*print-right-margin* pprint/*print-right-margin* {:ns pprint-ns}))
|
||||||
|
|
||||||
|
(def print-pprint-dispatch
|
||||||
|
(sci/new-dynamic-var '*print-pprint-dispatch* pprint/*print-pprint-dispatch* {:ns pprint-ns}))
|
||||||
|
|
||||||
(defn pprint
|
(defn pprint
|
||||||
"Pretty print object to the optional output writer. If the writer is not provided,
|
"Pretty print object to the optional output writer. If the writer is not provided,
|
||||||
print the object to the currently bound value of *out*."
|
print the object to the currently bound value of *out*."
|
||||||
([s]
|
([s]
|
||||||
(pprint s @sci/out))
|
(pprint s @sci/out))
|
||||||
([s writer]
|
([s writer]
|
||||||
(binding [pprint/*print-right-margin* @print-right-margin]
|
(binding [pprint/*print-right-margin* @print-right-margin
|
||||||
|
#_#_pprint/*print-pprint-dispatch* @print-pprint-dispatch]
|
||||||
(pprint/pprint s writer))))
|
(pprint/pprint s writer))))
|
||||||
|
|
||||||
(def pprint-namespace
|
(def pprint-namespace
|
||||||
|
|
@ -80,4 +84,10 @@
|
||||||
;; we alter-var-root-ed write above, so this should copy the right function
|
;; we alter-var-root-ed write above, so this should copy the right function
|
||||||
'write (sci/copy-var pprint/write pprint-ns)
|
'write (sci/copy-var pprint/write pprint-ns)
|
||||||
'simple-dispatch (sci/copy-var pprint/simple-dispatch pprint-ns)
|
'simple-dispatch (sci/copy-var pprint/simple-dispatch pprint-ns)
|
||||||
|
;; 'formatter-out (sci/copy-var pprint/formatter-out pprint-ns)
|
||||||
|
;; 'cached-compile (sci/copy-var pprint/cached-compile pprint-ns) #_(sci/new-var 'cache-compile @#'pprint/cached-compile (meta @#'pprint/cached-compile))
|
||||||
|
;; 'init-navigator (sci/copy-var pprint/init-navigator pprint-ns)
|
||||||
|
;; 'execute-format (sci/copy-var pprint/execute-format pprint-ns)
|
||||||
|
;; 'with-pprint-dispatch (sci/copy-var pprint/with-pprint-dispatch pprint-ns)
|
||||||
|
;; '*print-pprint-dispatch* print-pprint-dispatch
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -409,13 +409,15 @@ Use bb run --help to show this help output.
|
||||||
@(resolve 'babashka.impl.selmer/selmer-validator-namespace))))
|
@(resolve 'babashka.impl.selmer/selmer-validator-namespace))))
|
||||||
|
|
||||||
(def imports
|
(def imports
|
||||||
'{ArithmeticException java.lang.ArithmeticException
|
'{Appendable java.lang.Appendable
|
||||||
|
ArithmeticException java.lang.ArithmeticException
|
||||||
AssertionError java.lang.AssertionError
|
AssertionError java.lang.AssertionError
|
||||||
BigDecimal java.math.BigDecimal
|
BigDecimal java.math.BigDecimal
|
||||||
BigInteger java.math.BigInteger
|
BigInteger java.math.BigInteger
|
||||||
Boolean java.lang.Boolean
|
Boolean java.lang.Boolean
|
||||||
Byte java.lang.Byte
|
Byte java.lang.Byte
|
||||||
Character java.lang.Character
|
Character java.lang.Character
|
||||||
|
CharSequence java.lang.CharSequence
|
||||||
Class java.lang.Class
|
Class java.lang.Class
|
||||||
ClassNotFoundException java.lang.ClassNotFoundException
|
ClassNotFoundException java.lang.ClassNotFoundException
|
||||||
Comparable java.lang.Comparable
|
Comparable java.lang.Comparable
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue