Some additions that at least make plumatic/schema run partially (#1267)

This commit is contained in:
Michiel Borkent 2022-05-14 13:10:16 +02:00 committed by GitHub
parent f8657cd59f
commit c1539fe3b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 45 deletions

View file

@ -10,6 +10,7 @@
"feature-selmer" "feature-selmer"
"feature-logging" "feature-logging"
"feature-priority-map" "feature-priority-map"
"feature-rrb-vector"
"feature-jdbc" "feature-jdbc"
"pods/src" "pods/src"
"babashka.nrepl/src" "babashka.nrepl/src"
@ -18,7 +19,7 @@
"resources" "sci/resources"], "resources" "sci/resources"],
:deps {org.clojure/clojure {:mvn/version "1.11.0"}, :deps {org.clojure/clojure {:mvn/version "1.11.0"},
org.babashka/sci {:local/root "sci"} 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"} org.babashka/sci.impl.types {:mvn/version "0.0.2"}
babashka/babashka.curl {:local/root "babashka.curl"} babashka/babashka.curl {:local/root "babashka.curl"}
babashka/fs {:local/root "fs"} babashka/fs {:local/root "fs"}
@ -46,7 +47,8 @@
com.taoensso/timbre {:mvn/version "5.2.1"} com.taoensso/timbre {:mvn/version "5.2.1"}
org.clojure/tools.logging {:mvn/version "1.1.0"} org.clojure/tools.logging {:mvn/version "1.1.0"}
org.clojure/data.priority-map {: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 :aliases {:babashka/dev
{:main-opts ["-m" "babashka.main"]} {:main-opts ["-m" "babashka.main"]}
:profile :profile
@ -134,7 +136,9 @@
aysylu/loom {:mvn/version "1.0.2"} aysylu/loom {:mvn/version "1.0.2"}
com.layerware/hugsql-core {:mvn/version "0.5.3"} com.layerware/hugsql-core {:mvn/version "0.5.3"}
com.github.seancorfield/expectations {:mvn/version "2.0.157"} 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 :classpath-overrides {org.clojure/clojure nil
org.clojure/spec.alpha nil}} org.clojure/spec.alpha nil}}
:clj-nvd :clj-nvd

2
sci

@ -1 +1 @@
Subproject commit afc1c010a71a0640a3c4466b7b3a1cce0ad88eee Subproject commit 65c9d0d1b838afdaceece1f74dc7cbac66a658bf

View file

@ -97,7 +97,8 @@
{:name "aset"} {:name "aset"}
{:name "aclone"}]} {:name "aclone"}]}
clojure.lang.Compiler clojure.lang.Compiler
{:fields [{:name "specials"}]} {:fields [{:name "specials"}
{:name "CHAR_MAP"}]}
clojure.lang.PersistentHashMap clojure.lang.PersistentHashMap
{:fields [{:name "EMPTY"}]} {:fields [{:name "EMPTY"}]}
clojure.lang.APersistentVector clojure.lang.APersistentVector
@ -358,6 +359,7 @@
java.time.temporal.Temporal java.time.temporal.Temporal
java.time.temporal.TemporalAccessor java.time.temporal.TemporalAccessor
java.time.temporal.TemporalAdjuster]) java.time.temporal.TemporalAdjuster])
java.util.concurrent.atomic.AtomicReference
java.util.concurrent.ExecutionException java.util.concurrent.ExecutionException
java.util.concurrent.LinkedBlockingQueue java.util.concurrent.LinkedBlockingQueue
java.util.concurrent.ScheduledThreadPoolExecutor java.util.concurrent.ScheduledThreadPoolExecutor
@ -387,6 +389,8 @@
java.util.Base64$Decoder java.util.Base64$Decoder
java.util.Base64$Encoder java.util.Base64$Encoder
java.util.Date java.util.Date
java.util.IdentityHashMap
java.util.List
java.util.Locale java.util.Locale
java.util.Map java.util.Map
java.util.MissingResourceException java.util.MissingResourceException
@ -396,6 +400,7 @@
java.util.Scanner java.util.Scanner
java.util.Set java.util.Set
java.util.StringTokenizer java.util.StringTokenizer
java.util.WeakHashMap
java.util.UUID java.util.UUID
java.util.function.Consumer java.util.function.Consumer
java.util.function.Function java.util.function.Function
@ -494,11 +499,13 @@
clojure.lang.Seqable clojure.lang.Seqable
clojure.lang.Volatile clojure.lang.Volatile
java.lang.ExceptionInInitializerError java.lang.ExceptionInInitializerError
java.lang.LinkageError
java.lang.ThreadDeath
java.lang.VirtualMachineError
java.sql.Timestamp java.sql.Timestamp
java.util.concurrent.atomic.AtomicInteger java.util.concurrent.atomic.AtomicInteger
java.util.concurrent.atomic.AtomicLong java.util.concurrent.atomic.AtomicLong
java.util.Collection java.util.Collection
java.util.List
java.util.Map$Entry java.util.Map$Entry
~@(when features/xml? ['clojure.data.xml.node.Element])] ~@(when features/xml? ['clojure.data.xml.node.Element])]
:custom ~custom-map}) :custom ~custom-map})
@ -572,6 +579,8 @@
java.util.concurrent.Future java.util.concurrent.Future
(instance? java.util.concurrent.ScheduledExecutorService v) (instance? java.util.concurrent.ScheduledExecutorService v)
java.util.concurrent.ScheduledExecutorService java.util.concurrent.ScheduledExecutorService
(instance? java.util.Iterator v)
java.util.Iterator
;; keep commas for merge friendliness ;; keep commas for merge friendliness
,,,)))] ,,,)))]
m)) m))
@ -614,6 +623,7 @@
File java.io.File File java.io.File
Float java.lang.Float Float java.lang.Float
Long java.lang.Long Long java.lang.Long
LinkageError java.lang.LinkageError
Math java.lang.Math Math java.lang.Math
NullPointerException java.lang.NullPointerException NullPointerException java.lang.NullPointerException
Number java.lang.Number Number java.lang.Number
@ -630,6 +640,8 @@
System java.lang.System System java.lang.System
Thread java.lang.Thread Thread java.lang.Thread
Throwable java.lang.Throwable Throwable java.lang.Throwable
VirtualMachineError java.lang.VirtualMachineError
ThreadDeath java.lang.ThreadDeath
;; UnsupportedOperationException java.lang.UnsupportedOperationException ;; UnsupportedOperationException java.lang.UnsupportedOperationException
}) })

View file

@ -101,27 +101,27 @@
(defn cl-format (defn cl-format
"An implementation of a Common Lisp compatible format function. cl-format formats its "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 arguments to an output stream or string based on the format control string given. It
supports sophisticated formatting of structured data. supports sophisticated formatting of structured data.
Writer is an instance of java.io.Writer, true to output to *out* or nil to output 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 to a string, format-in is the format control string and the remaining arguments
are the data to be formatted. are the data to be formatted.
The format control string is a string to be output with embedded 'format directives' The format control string is a string to be output with embedded 'format directives'
describing how to format the various arguments passed in. describing how to format the various arguments passed in.
If writer is nil, cl-format returns the formatted result string. Otherwise, cl-format If writer is nil, cl-format returns the formatted result string. Otherwise, cl-format
returns nil. returns nil.
For example: For example:
(let [results [46 38 22]] (let [results [46 38 22]]
(cl-format true \"There ~[are~;is~:;are~]~:* ~d result~:p: ~{~d~^, ~}~%\" (cl-format true \"There ~[are~;is~:;are~]~:* ~d result~:p: ~{~d~^, ~}~%\"
(count results) results)) (count results) results))
Prints to *out*: Prints to *out*:
There are 3 results: 46, 38, 22 There are 3 results: 46, 38, 22
Detailed documentation on format control strings is available in the \"Common Lisp the Detailed documentation on format control strings is available in the \"Common Lisp the
Language, 2nd edition\", Chapter 22 (available online at: 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) 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 and in the Common Lisp HyperSpec at
http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm
" "
[& args] [& args]
;; bind *out* to sci/out, so with-out-str works ;; bind *out* to sci/out, so with-out-str works
(binding [*out* @sci/out] (binding [*out* @sci/out]
@ -136,20 +136,20 @@ http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm
(defn get-pretty-writer (defn get-pretty-writer
"Returns the java.io.Writer passed in wrapped in a pretty writer proxy, unless it's "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, 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 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. 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, For example, when you want to generate column-aware output with multiple calls to cl-format,
do it like in this example: do it like in this example:
(defn print-table [aseq column-width] (defn print-table [aseq column-width]
(binding [*out* (get-pretty-writer *out*)] (binding [*out* (get-pretty-writer *out*)]
(doseq [row aseq] (doseq [row aseq]
(doseq [col row] (doseq [col row]
(cl-format true \"~4D~7,vT\" col column-width)) (cl-format true \"~4D~7,vT\" col column-width))
(prn)))) (prn))))
Now when you run: Now when you run:
user> (print-table (map #(vector % (* % %) (* % % %)) (range 1 11)) 8) user> (print-table (map #(vector % (* % %) (* % % %)) (range 1 11)) 8)
It prints a table of squares and cubes for the numbers from 1 to 10: It prints a table of squares and cubes for the numbers from 1 to 10:
1 1 1 1 1 1
2 4 8 2 4 8
3 9 27 3 9 27
@ -165,6 +165,33 @@ It prints a table of squares and cubes for the numbers from 1 to 10:
pprint/*print-miser-width* @print-miser-width] pprint/*print-miser-width* @print-miser-width]
(pprint/get-pretty-writer writer))) (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 (def pprint-namespace
{'pp (sci/copy-var pprint/pp pprint-ns) {'pp (sci/copy-var pprint/pp pprint-ns)
'pprint (sci/copy-var pprint 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) 'with-pprint-dispatch (sci/copy-var pprint/with-pprint-dispatch pprint-ns)
'*print-pprint-dispatch* print-pprint-dispatch '*print-pprint-dispatch* print-pprint-dispatch
'*print-miser-width* print-miser-width '*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) (vreset! patched? true)