Move seq-of def

This commit is contained in:
Joshua Suskalo 2021-09-16 15:14:33 -05:00
parent e3292bdff4
commit 6dd90d279c

View file

@ -123,17 +123,6 @@
[scope action] [scope action]
(.addCloseAction ^ResourceScope scope action)) (.addCloseAction ^ResourceScope scope action))
#_(defn seq-of
"Constructs a lazy sequence of `type` elements deserialized from `segment`."
[type segment]
(let [size (size-of type)]
(letfn [(rec [segment]
(lazy-seq
(when (>= (.byteSize ^MemorySegment segment) size)
(cons (deserialize-from type segment)
(rec (slice segment size))))))]
(rec segment))))
(def primitive-types (def primitive-types
"A set of keywords representing all the primitive types which may be passed to "A set of keywords representing all the primitive types which may be passed to
or returned from native functions." or returned from native functions."
@ -405,6 +394,16 @@
deserialize-from) deserialize-from)
obj type))) obj type)))
#_(defn seq-of
"Constructs a lazy sequence of `type` elements deserialized from `segment`."
[type segment]
(let [size (size-of type)]
(letfn [(rec [segment]
(lazy-seq
(when (>= (.byteSize ^MemorySegment segment) size)
(cons (deserialize-from type segment)
(rec (slice segment size))))))]
(rec segment))))
(defn load-system-library (defn load-system-library
"Loads the library named `libname` from the system's load path." "Loads the library named `libname` from the system's load path."