Some additions that at least make plumatic/schema run partially (#1267)
This commit is contained in:
parent
f8657cd59f
commit
c1539fe3b0
4 changed files with 89 additions and 45 deletions
|
|
@ -10,6 +10,7 @@
|
|||
"feature-selmer"
|
||||
"feature-logging"
|
||||
"feature-priority-map"
|
||||
"feature-rrb-vector"
|
||||
"feature-jdbc"
|
||||
"pods/src"
|
||||
"babashka.nrepl/src"
|
||||
|
|
@ -18,7 +19,7 @@
|
|||
"resources" "sci/resources"],
|
||||
:deps {org.clojure/clojure {:mvn/version "1.11.0"},
|
||||
org.babashka/sci {:local/root "sci"}
|
||||
org.babashka/babashka.impl.reify {:mvn/version "0.0.7"}
|
||||
org.babashka/babashka.impl.reify {:mvn/version "0.1.0"}
|
||||
org.babashka/sci.impl.types {:mvn/version "0.0.2"}
|
||||
babashka/babashka.curl {:local/root "babashka.curl"}
|
||||
babashka/fs {:local/root "fs"}
|
||||
|
|
@ -46,7 +47,8 @@
|
|||
com.taoensso/timbre {:mvn/version "5.2.1"}
|
||||
org.clojure/tools.logging {:mvn/version "1.1.0"}
|
||||
org.clojure/data.priority-map {:mvn/version "1.1.0"}
|
||||
insn/insn {:mvn/version "0.5.2"}}
|
||||
insn/insn {:mvn/version "0.5.2"}
|
||||
org.clojure/core.rrb-vector {:mvn/version "0.1.2"}}
|
||||
:aliases {:babashka/dev
|
||||
{:main-opts ["-m" "babashka.main"]}
|
||||
:profile
|
||||
|
|
@ -134,7 +136,9 @@
|
|||
aysylu/loom {:mvn/version "1.0.2"}
|
||||
com.layerware/hugsql-core {:mvn/version "0.5.3"}
|
||||
com.github.seancorfield/expectations {:mvn/version "2.0.157"}
|
||||
com.rpl/specter {:mvn/version "1.1.4"}}
|
||||
com.rpl/specter {:mvn/version "1.1.4"}
|
||||
com.github.askonomm/clarktown {:mvn/version "1.1.2"}
|
||||
org.clojure/math.numeric-tower {:git/tag "math.numeric-tower-0.0.5", :git/sha "12eb9c5", :git/url "https://github.com/clojure/math.numeric-tower"}}
|
||||
:classpath-overrides {org.clojure/clojure nil
|
||||
org.clojure/spec.alpha nil}}
|
||||
:clj-nvd
|
||||
|
|
|
|||
2
sci
2
sci
|
|
@ -1 +1 @@
|
|||
Subproject commit afc1c010a71a0640a3c4466b7b3a1cce0ad88eee
|
||||
Subproject commit 65c9d0d1b838afdaceece1f74dc7cbac66a658bf
|
||||
|
|
@ -97,7 +97,8 @@
|
|||
{:name "aset"}
|
||||
{:name "aclone"}]}
|
||||
clojure.lang.Compiler
|
||||
{:fields [{:name "specials"}]}
|
||||
{:fields [{:name "specials"}
|
||||
{:name "CHAR_MAP"}]}
|
||||
clojure.lang.PersistentHashMap
|
||||
{:fields [{:name "EMPTY"}]}
|
||||
clojure.lang.APersistentVector
|
||||
|
|
@ -358,6 +359,7 @@
|
|||
java.time.temporal.Temporal
|
||||
java.time.temporal.TemporalAccessor
|
||||
java.time.temporal.TemporalAdjuster])
|
||||
java.util.concurrent.atomic.AtomicReference
|
||||
java.util.concurrent.ExecutionException
|
||||
java.util.concurrent.LinkedBlockingQueue
|
||||
java.util.concurrent.ScheduledThreadPoolExecutor
|
||||
|
|
@ -387,6 +389,8 @@
|
|||
java.util.Base64$Decoder
|
||||
java.util.Base64$Encoder
|
||||
java.util.Date
|
||||
java.util.IdentityHashMap
|
||||
java.util.List
|
||||
java.util.Locale
|
||||
java.util.Map
|
||||
java.util.MissingResourceException
|
||||
|
|
@ -396,6 +400,7 @@
|
|||
java.util.Scanner
|
||||
java.util.Set
|
||||
java.util.StringTokenizer
|
||||
java.util.WeakHashMap
|
||||
java.util.UUID
|
||||
java.util.function.Consumer
|
||||
java.util.function.Function
|
||||
|
|
@ -494,11 +499,13 @@
|
|||
clojure.lang.Seqable
|
||||
clojure.lang.Volatile
|
||||
java.lang.ExceptionInInitializerError
|
||||
java.lang.LinkageError
|
||||
java.lang.ThreadDeath
|
||||
java.lang.VirtualMachineError
|
||||
java.sql.Timestamp
|
||||
java.util.concurrent.atomic.AtomicInteger
|
||||
java.util.concurrent.atomic.AtomicLong
|
||||
java.util.Collection
|
||||
java.util.List
|
||||
java.util.Map$Entry
|
||||
~@(when features/xml? ['clojure.data.xml.node.Element])]
|
||||
:custom ~custom-map})
|
||||
|
|
@ -572,6 +579,8 @@
|
|||
java.util.concurrent.Future
|
||||
(instance? java.util.concurrent.ScheduledExecutorService v)
|
||||
java.util.concurrent.ScheduledExecutorService
|
||||
(instance? java.util.Iterator v)
|
||||
java.util.Iterator
|
||||
;; keep commas for merge friendliness
|
||||
,,,)))]
|
||||
m))
|
||||
|
|
@ -614,6 +623,7 @@
|
|||
File java.io.File
|
||||
Float java.lang.Float
|
||||
Long java.lang.Long
|
||||
LinkageError java.lang.LinkageError
|
||||
Math java.lang.Math
|
||||
NullPointerException java.lang.NullPointerException
|
||||
Number java.lang.Number
|
||||
|
|
@ -630,6 +640,8 @@
|
|||
System java.lang.System
|
||||
Thread java.lang.Thread
|
||||
Throwable java.lang.Throwable
|
||||
VirtualMachineError java.lang.VirtualMachineError
|
||||
ThreadDeath java.lang.ThreadDeath
|
||||
;; UnsupportedOperationException java.lang.UnsupportedOperationException
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -100,28 +100,28 @@
|
|||
(pprint/pprint s writer))))
|
||||
|
||||
(defn cl-format
|
||||
"An implementation of a Common Lisp compatible format function. cl-format formats its
|
||||
arguments to an output stream or string based on the format control string given. It
|
||||
supports sophisticated formatting of structured data.
|
||||
Writer is an instance of java.io.Writer, true to output to *out* or nil to output
|
||||
to a string, format-in is the format control string and the remaining arguments
|
||||
are the data to be formatted.
|
||||
The format control string is a string to be output with embedded 'format directives'
|
||||
describing how to format the various arguments passed in.
|
||||
If writer is nil, cl-format returns the formatted result string. Otherwise, cl-format
|
||||
returns nil.
|
||||
For example:
|
||||
(let [results [46 38 22]]
|
||||
(cl-format true \"There ~[are~;is~:;are~]~:* ~d result~:p: ~{~d~^, ~}~%\"
|
||||
"An implementation of a Common Lisp compatible format function. cl-format formats its
|
||||
arguments to an output stream or string based on the format control string given. It
|
||||
supports sophisticated formatting of structured data.
|
||||
Writer is an instance of java.io.Writer, true to output to *out* or nil to output
|
||||
to a string, format-in is the format control string and the remaining arguments
|
||||
are the data to be formatted.
|
||||
The format control string is a string to be output with embedded 'format directives'
|
||||
describing how to format the various arguments passed in.
|
||||
If writer is nil, cl-format returns the formatted result string. Otherwise, cl-format
|
||||
returns nil.
|
||||
For example:
|
||||
(let [results [46 38 22]]
|
||||
(cl-format true \"There ~[are~;is~:;are~]~:* ~d result~:p: ~{~d~^, ~}~%\"
|
||||
(count results) results))
|
||||
Prints to *out*:
|
||||
There are 3 results: 46, 38, 22
|
||||
Detailed documentation on format control strings is available in the \"Common Lisp the
|
||||
Language, 2nd edition\", Chapter 22 (available online at:
|
||||
http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node200.html#SECTION002633000000000000000)
|
||||
and in the Common Lisp HyperSpec at
|
||||
http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm
|
||||
"
|
||||
Prints to *out*:
|
||||
There are 3 results: 46, 38, 22
|
||||
Detailed documentation on format control strings is available in the \"Common Lisp the
|
||||
Language, 2nd edition\", Chapter 22 (available online at:
|
||||
http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node200.html#SECTION002633000000000000000)
|
||||
and in the Common Lisp HyperSpec at
|
||||
http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm
|
||||
"
|
||||
[& args]
|
||||
;; bind *out* to sci/out, so with-out-str works
|
||||
(binding [*out* @sci/out]
|
||||
|
|
@ -135,36 +135,63 @@ http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm
|
|||
(apply #'pprint/execute-format args)))
|
||||
|
||||
(defn get-pretty-writer
|
||||
"Returns the java.io.Writer passed in wrapped in a pretty writer proxy, unless it's
|
||||
already a pretty writer. Generally, it is unnecessary to call this function, since pprint,
|
||||
write, and cl-format all call it if they need to. However if you want the state to be
|
||||
preserved across calls, you will want to wrap them with this.
|
||||
For example, when you want to generate column-aware output with multiple calls to cl-format,
|
||||
do it like in this example:
|
||||
"Returns the java.io.Writer passed in wrapped in a pretty writer proxy, unless it's
|
||||
already a pretty writer. Generally, it is unnecessary to call this function, since pprint,
|
||||
write, and cl-format all call it if they need to. However if you want the state to be
|
||||
preserved across calls, you will want to wrap them with this.
|
||||
For example, when you want to generate column-aware output with multiple calls to cl-format,
|
||||
do it like in this example:
|
||||
(defn print-table [aseq column-width]
|
||||
(binding [*out* (get-pretty-writer *out*)]
|
||||
(doseq [row aseq]
|
||||
(doseq [col row]
|
||||
(cl-format true \"~4D~7,vT\" col column-width))
|
||||
(prn))))
|
||||
Now when you run:
|
||||
Now when you run:
|
||||
user> (print-table (map #(vector % (* % %) (* % % %)) (range 1 11)) 8)
|
||||
It prints a table of squares and cubes for the numbers from 1 to 10:
|
||||
1 1 1
|
||||
2 4 8
|
||||
3 9 27
|
||||
4 16 64
|
||||
5 25 125
|
||||
6 36 216
|
||||
7 49 343
|
||||
8 64 512
|
||||
9 81 729
|
||||
It prints a table of squares and cubes for the numbers from 1 to 10:
|
||||
1 1 1
|
||||
2 4 8
|
||||
3 9 27
|
||||
4 16 64
|
||||
5 25 125
|
||||
6 36 216
|
||||
7 49 343
|
||||
8 64 512
|
||||
9 81 729
|
||||
10 100 1000"
|
||||
[writer]
|
||||
(binding [pprint/*print-right-margin* @print-right-margin
|
||||
pprint/*print-miser-width* @print-miser-width]
|
||||
(pprint/get-pretty-writer writer)))
|
||||
|
||||
(def current-length #'pprint/*current-length*)
|
||||
|
||||
(defn write-out
|
||||
"Write an object to *out* subject to the current bindings of the printer control
|
||||
variables. Use the kw-args argument to override individual variables for this call (and
|
||||
any recursive calls).
|
||||
*out* must be a PrettyWriter if pretty printing is enabled. This is the responsibility
|
||||
of the caller.
|
||||
This method is primarily intended for use by pretty print dispatch functions that
|
||||
already know that the pretty printer will have set up their environment appropriately.
|
||||
Normal library clients should use the standard \"write\" interface. "
|
||||
{:added "1.2"}
|
||||
[object]
|
||||
(let [length-reached (and
|
||||
@current-length
|
||||
@sci/print-length
|
||||
(>= @current-length @sci/print-length))]
|
||||
(if-not pprint/*print-pretty*
|
||||
(pr object)
|
||||
(if length-reached
|
||||
(print "...")
|
||||
(do
|
||||
(when @current-length
|
||||
(.set ^clojure.lang.Var current-length (inc @current-length)))
|
||||
(print-pprint-dispatch object))))
|
||||
length-reached))
|
||||
|
||||
(def pprint-namespace
|
||||
{'pp (sci/copy-var pprint/pp pprint-ns)
|
||||
'pprint (sci/copy-var pprint pprint-ns)
|
||||
|
|
@ -181,6 +208,7 @@ It prints a table of squares and cubes for the numbers from 1 to 10:
|
|||
'with-pprint-dispatch (sci/copy-var pprint/with-pprint-dispatch pprint-ns)
|
||||
'*print-pprint-dispatch* print-pprint-dispatch
|
||||
'*print-miser-width* print-miser-width
|
||||
'get-pretty-writer (sci/copy-var get-pretty-writer pprint-ns)})
|
||||
'get-pretty-writer (sci/copy-var get-pretty-writer pprint-ns)
|
||||
'write-out (sci/copy-var write-out pprint-ns)})
|
||||
|
||||
(vreset! patched? true)
|
||||
|
|
|
|||
Loading…
Reference in a new issue