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.StringWriter
|
||||
java.io.Writer
|
||||
java.lang.Appendable
|
||||
java.lang.ArithmeticException
|
||||
java.lang.AssertionError
|
||||
java.lang.Boolean
|
||||
java.lang.Byte
|
||||
java.lang.Character
|
||||
java.lang.CharSequence
|
||||
java.lang.Class
|
||||
java.lang.ClassNotFoundException
|
||||
java.lang.Comparable
|
||||
|
|
@ -199,6 +201,7 @@
|
|||
java.security.MessageDigest
|
||||
java.security.DigestInputStream
|
||||
java.security.SecureRandom
|
||||
java.sql.Date
|
||||
java.text.ParseException
|
||||
~@(when features/java-time?
|
||||
`[java.time.format.DateTimeFormatter
|
||||
|
|
@ -329,6 +332,9 @@
|
|||
clojure.lang.Sequential
|
||||
clojure.lang.Seqable
|
||||
clojure.lang.Volatile
|
||||
java.util.concurrent.atomic.AtomicInteger
|
||||
java.util.concurrent.atomic.AtomicLong
|
||||
java.util.Collection
|
||||
java.util.List
|
||||
java.util.Iterator
|
||||
java.util.Map$Entry]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
(ns babashka.impl.pprint
|
||||
{:no-doc true}
|
||||
(:require [clojure.pprint :as pprint]
|
||||
[sci.core :as sci]
|
||||
[sci.impl.vars :as vars]))
|
||||
[sci.core :as sci]))
|
||||
|
||||
(defonce patch-option-table
|
||||
(alter-var-root #'pprint/write-option-table
|
||||
|
|
@ -48,10 +47,8 @@
|
|||
|
||||
(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
|
||||
"Prints a collection of maps in a textual table. Prints table headings
|
||||
|
|
@ -62,13 +59,20 @@
|
|||
(binding [*out* @sci/out]
|
||||
(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
|
||||
"Pretty print object to the optional output writer. If the writer is not provided,
|
||||
print the object to the currently bound value of *out*."
|
||||
([s]
|
||||
(pprint s @sci/out))
|
||||
([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))))
|
||||
|
||||
(def pprint-namespace
|
||||
|
|
@ -80,4 +84,10 @@
|
|||
;; we alter-var-root-ed write above, so this should copy the right function
|
||||
'write (sci/copy-var pprint/write 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))))
|
||||
|
||||
(def imports
|
||||
'{ArithmeticException java.lang.ArithmeticException
|
||||
'{Appendable java.lang.Appendable
|
||||
ArithmeticException java.lang.ArithmeticException
|
||||
AssertionError java.lang.AssertionError
|
||||
BigDecimal java.math.BigDecimal
|
||||
BigInteger java.math.BigInteger
|
||||
Boolean java.lang.Boolean
|
||||
Byte java.lang.Byte
|
||||
Character java.lang.Character
|
||||
CharSequence java.lang.CharSequence
|
||||
Class java.lang.Class
|
||||
ClassNotFoundException java.lang.ClassNotFoundException
|
||||
Comparable java.lang.Comparable
|
||||
|
|
|
|||
Loading…
Reference in a new issue