core: 16 more bindings to the overlay — promise/deliver, the proxy surface, JVM-shape stubs
Batch 2 of the post-shrink sweep, all pure compositions or documented stubs: enumeration-seq/iterator-seq (seq), promise/deliver (an atom — deref of an undelivered promise stays nil, single-threaded host), bean, uri?, special-symbol? (an evaluated set of quoted symbols — a QUOTED set literal stays an unevaluated reader form on jolt, which the first version tripped over), print-method/print-dup (inert until jolt-g1r), and the whole proxy surface (mappings/call-with-super/init/update pass through, the constructive half throws). The seed loses 16 defns and bindings; nothing kept.
This commit is contained in:
parent
001bb0c4c6
commit
89e67fbc47
2 changed files with 43 additions and 38 deletions
|
|
@ -1041,3 +1041,39 @@
|
||||||
(into [] coll))))
|
(into [] coll))))
|
||||||
|
|
||||||
(defn ->Eduction [xform coll] (into [] xform coll))
|
(defn ->Eduction [xform coll] (into [] xform coll))
|
||||||
|
|
||||||
|
;; --- JVM-shape stubs and trivial shells (seed-shrink batch 2) --------------
|
||||||
|
;; Pure compositions or documented jolt stubs; the host keeps nothing.
|
||||||
|
(defn enumeration-seq [e] (seq e))
|
||||||
|
(defn iterator-seq [i] (seq i))
|
||||||
|
|
||||||
|
;; jolt is single-threaded: a promise is an atom, deref never blocks
|
||||||
|
;; ((deref undelivered) is nil rather than a hang).
|
||||||
|
(defn promise [] (atom nil))
|
||||||
|
(defn deliver [p v] (reset! p v) p)
|
||||||
|
|
||||||
|
(defn bean [x] (if (map? x) x {}))
|
||||||
|
|
||||||
|
(defn uri? [x] false)
|
||||||
|
|
||||||
|
;; An EVALUATED set of quoted symbols — a quoted set literal ('#{if ...})
|
||||||
|
;; stays an unevaluated reader form on jolt and contains? can't see into it.
|
||||||
|
(def ^:private special-syms
|
||||||
|
#{'if 'do 'let* 'fn* 'quote 'var 'def 'loop* 'recur 'throw 'try 'catch
|
||||||
|
'finally 'new 'set! '. 'monitor-enter 'monitor-exit})
|
||||||
|
|
||||||
|
(defn special-symbol? [s] (contains? special-syms s))
|
||||||
|
|
||||||
|
;; Printer hooks are inert until print-method is a real multimethod (jolt-g1r).
|
||||||
|
(defn print-method [x writer] nil)
|
||||||
|
(defn print-dup [x writer] nil)
|
||||||
|
|
||||||
|
;; JVM proxies don't exist on a Janet host: the read-only surface is inert,
|
||||||
|
;; the constructive surface throws (matching the prior seed stubs).
|
||||||
|
(defn proxy-mappings [p] {})
|
||||||
|
(defn proxy-call-with-super [f p meth] (f))
|
||||||
|
(defn init-proxy [p mappings] p)
|
||||||
|
(defn update-proxy [p mappings] p)
|
||||||
|
(defn proxy-super [& args] (throw "proxy-super: JVM proxies are not supported in Jolt"))
|
||||||
|
(defn construct-proxy [c & args] (throw "construct-proxy: not supported in Jolt"))
|
||||||
|
(defn get-proxy-class [& interfaces] (throw "get-proxy-class: not supported in Jolt"))
|
||||||
|
|
|
||||||
|
|
@ -1402,7 +1402,7 @@
|
||||||
|
|
||||||
# inst?/inst-ms live in the Clojure collection tier (core/20-coll.clj).
|
# inst?/inst-ms live in the Clojure collection tier (core/20-coll.clj).
|
||||||
# Jolt has no uri host type, so uri? is always false.
|
# Jolt has no uri host type, so uri? is always false.
|
||||||
(defn core-uri? [x] false)
|
# uri? lives in the Clojure collection tier (no uri host type: always false).
|
||||||
# uuid? now lives in the Clojure collection tier (tagged-value predicate).
|
# uuid? now lives in the Clojure collection tier (tagged-value predicate).
|
||||||
(defn core-bytes? [x] (buffer? x))
|
(defn core-bytes? [x] (buffer? x))
|
||||||
# tagged-literal? now lives in the Clojure collection tier (tagged-value predicate).
|
# tagged-literal? now lives in the Clojure collection tier (tagged-value predicate).
|
||||||
|
|
@ -2370,27 +2370,17 @@
|
||||||
(string/replace pat repl s)))
|
(string/replace pat repl s)))
|
||||||
|
|
||||||
# Iterator/enumeration seqs — Jolt has no Java iterators, so adapt to plain seq.
|
# Iterator/enumeration seqs — Jolt has no Java iterators, so adapt to plain seq.
|
||||||
(defn core-enumeration-seq [x] (core-seq x))
|
# enumeration-seq / iterator-seq live in the Clojure collection tier.
|
||||||
(defn core-iterator-seq [x] (core-seq x))
|
|
||||||
# xml-seq now lives in the Clojure collection tier (core/20-coll.clj).
|
# xml-seq now lives in the Clojure collection tier (core/20-coll.clj).
|
||||||
# line-seq now lives in the Clojure IO tier (core/50-io.clj), over the reader
|
# line-seq now lives in the Clojure IO tier (core/50-io.clj), over the reader
|
||||||
# protocol of the *in* family.
|
# protocol of the *in* family.
|
||||||
(defn core-re-matcher [re s] @{:jolt/type :jolt/matcher :re re :s s :pos 0})
|
(defn core-re-matcher [re s] @{:jolt/type :jolt/matcher :re re :s s :pos 0})
|
||||||
|
|
||||||
# JVM reflection / proxies — not applicable on a Janet host; resolve-only.
|
# bean / print-method / print-dup / the proxy surface live in the Clojure
|
||||||
(defn core-bean [x] (if (core-map? x) x {}))
|
# collection tier (JVM-shape stubs; print hooks inert until jolt-g1r).
|
||||||
(defn core-print-method [x writer] nil)
|
|
||||||
(defn core-print-dup [x writer] nil)
|
|
||||||
(defn core-proxy-call-with-super [f proxy meth] (f))
|
|
||||||
(defn core-proxy-mappings [proxy] {})
|
|
||||||
(defn core-update-proxy [proxy mappings] proxy)
|
|
||||||
# == lives in the Clojure collection tier (core/20-coll.clj); memfn is an
|
# == lives in the Clojure collection tier (core/20-coll.clj); memfn is an
|
||||||
# overlay macro (core/30-macros.clj) over the .method call sugar.
|
# overlay macro (core/30-macros.clj) over the .method call sugar.
|
||||||
# eduction / ->Eduction live in the Clojure collection tier (core/20-coll.clj).
|
# eduction / ->Eduction live in the Clojure collection tier (core/20-coll.clj).
|
||||||
(defn core-proxy-super [& args] (error "proxy-super: JVM proxies are not supported in Jolt"))
|
|
||||||
(defn core-construct-proxy [c & args] (error "construct-proxy: not supported in Jolt"))
|
|
||||||
(defn core-init-proxy [proxy mappings] proxy)
|
|
||||||
(defn core-get-proxy-class [& interfaces] (error "get-proxy-class: not supported in Jolt"))
|
|
||||||
|
|
||||||
(def- char-escapes
|
(def- char-escapes
|
||||||
{10 "\\n" 9 "\\t" 13 "\\r" 12 "\\f" 8 "\\b" 34 "\\\"" 92 "\\\\"})
|
{10 "\\n" 9 "\\t" 13 "\\r" 12 "\\f" 8 "\\b" 34 "\\\"" 92 "\\\\"})
|
||||||
|
|
@ -2434,18 +2424,13 @@
|
||||||
# numerator / denominator now live in the Clojure collection tier (Jolt has
|
# numerator / denominator now live in the Clojure collection tier (Jolt has
|
||||||
# no ratios; they throw, as on a non-ratio in Clojure).
|
# no ratios; they throw, as on a non-ratio in Clojure).
|
||||||
|
|
||||||
(def- special-syms
|
# special-symbol? lives in the Clojure collection tier (a quoted symbol set).
|
||||||
{"if" true "do" true "let*" true "fn*" true "quote" true "var" true "def" true
|
|
||||||
"loop*" true "recur" true "throw" true "try" true "catch" true "finally" true
|
|
||||||
"new" true "set!" true "." true "monitor-enter" true "monitor-exit" true})
|
|
||||||
(defn core-special-symbol? [x]
|
|
||||||
(and (core-symbol? x) (= true (get special-syms (x :name)))))
|
|
||||||
|
|
||||||
# record? now lives in the Clojure collection tier (tagged-value predicate).
|
# record? now lives in the Clojure collection tier (tagged-value predicate).
|
||||||
|
|
||||||
# Promise: single-threaded box backed by an atom (deref returns nil until set).
|
# Promise: single-threaded box backed by an atom (deref returns nil until set).
|
||||||
(defn core-promise [] (core-atom nil))
|
# promise / deliver live in the Clojure collection tier (an atom; deref of an
|
||||||
(defn core-deliver [p v] (core-reset! p v) p)
|
# undelivered promise is nil — single-threaded host, no blocking).
|
||||||
|
|
||||||
(defn core-tagged-literal [tag form] @{:jolt/type :jolt/tagged-literal :tag tag :form form})
|
(defn core-tagged-literal [tag form] @{:jolt/type :jolt/tagged-literal :tag tag :form form})
|
||||||
# ensure-reduced / halt-when live in the Clojure collection tier
|
# ensure-reduced / halt-when live in the Clojure collection tier
|
||||||
|
|
@ -2637,9 +2622,6 @@
|
||||||
"reduce" core-reduce
|
"reduce" core-reduce
|
||||||
"apply" core-apply
|
"apply" core-apply
|
||||||
"map-entry?" core-map-entry?
|
"map-entry?" core-map-entry?
|
||||||
"special-symbol?" core-special-symbol?
|
|
||||||
"promise" core-promise
|
|
||||||
"deliver" core-deliver
|
|
||||||
"future-call" core-future-call
|
"future-call" core-future-call
|
||||||
"future?" core-future?
|
"future?" core-future?
|
||||||
"future-cancel" core-future-cancel
|
"future-cancel" core-future-cancel
|
||||||
|
|
@ -2769,19 +2751,7 @@
|
||||||
"disj!" core-disj!
|
"disj!" core-disj!
|
||||||
"reader-conditional" core-reader-conditional
|
"reader-conditional" core-reader-conditional
|
||||||
"class" core-class
|
"class" core-class
|
||||||
"enumeration-seq" core-enumeration-seq
|
|
||||||
"iterator-seq" core-iterator-seq
|
|
||||||
"re-matcher" core-re-matcher
|
"re-matcher" core-re-matcher
|
||||||
"bean" core-bean
|
|
||||||
"print-method" core-print-method
|
|
||||||
"print-dup" core-print-dup
|
|
||||||
"proxy-call-with-super" core-proxy-call-with-super
|
|
||||||
"proxy-mappings" core-proxy-mappings
|
|
||||||
"update-proxy" core-update-proxy
|
|
||||||
"proxy-super" core-proxy-super
|
|
||||||
"construct-proxy" core-construct-proxy
|
|
||||||
"init-proxy" core-init-proxy
|
|
||||||
"get-proxy-class" core-get-proxy-class
|
|
||||||
# Bit operations
|
# Bit operations
|
||||||
"__bit-and" core-bit-and
|
"__bit-and" core-bit-and
|
||||||
"__bit-or" core-bit-or
|
"__bit-or" core-bit-or
|
||||||
|
|
@ -2825,7 +2795,6 @@
|
||||||
"__local-var" core-local-var
|
"__local-var" core-local-var
|
||||||
"__close" core-close-resource
|
"__close" core-close-resource
|
||||||
"avoid-method-too-large" core-avoid-method-too-large
|
"avoid-method-too-large" core-avoid-method-too-large
|
||||||
"uri?" core-uri?
|
|
||||||
"bytes?" core-bytes?
|
"bytes?" core-bytes?
|
||||||
"meta" core-meta
|
"meta" core-meta
|
||||||
"var-get" core-var-get
|
"var-get" core-var-get
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue