[ANN] Tupelo Clojure I/O Utils - tupelo.io - 0.9.185
I've build up some file input/output utils over the past year that may be of use to the Clojure community. They allow one to do fine-grained I/O with native Java numeric types (both signed & unsigned), as well as create & delete temporary files & directories. Full API docs can be found: - on CljDoc.org: https://cljdoc.org/d/tupelo/tupelo/0.9.186 - and GitHub Pages: https://cloojure.github.io/doc/tupelo/tupelo.io.html The unit tests show the code in action. For all the primitive numeric types, plus byte-array and String, the library can write and read to a DataOutputStream. Note that there are unsigned variants of writing/reading as well as the normal signed numeric versions. (with-open [dos (DataOutputStream. (FileOutputStream. dummy-file))] (doto dos (write-string-bytes "hello") (write-bytes (byte-array [1 2 3 4])) (write-byte 42) (write-byte -42) (write-byte Byte/MIN_VALUE) (write-byte Byte/MAX_VALUE) (write-byte-unsigned 142) (write-byte-unsigned types/BYTE_UNSIGNED_MIN_VALUE) (write-byte-unsigned types/BYTE_UNSIGNED_MAX_VALUE) (write-short ) (write-short -) (write-short Short/MIN_VALUE) (write-short Short/MAX_VALUE) (write-short-unsigned 55999) (write-short-unsigned types/SHORT_UNSIGNED_MIN_VALUE) (write-short-unsigned types/SHORT_UNSIGNED_MAX_VALUE) (write-integer int-val) (write-integer Integer/MIN_VALUE) (write-integer Integer/MAX_VALUE) (write-integer-unsigned int-val) (write-integer-unsigned types/INTEGER_UNSIGNED_MIN_VALUE) (write-integer-unsigned types/INTEGER_UNSIGNED_MAX_VALUE) (write-long long-val) (write-long Long/MIN_VALUE) (write-long Long/MAX_VALUE) (write-long-unsigned long-val) (write-long-unsigned types/LONG_UNSIGNED_MIN_VALUE) (write-long-unsigned types/LONG_UNSIGNED_MAX_VALUE) (write-float pi-float) (write-float Float/MIN_VALUE) (write-float Float/MAX_VALUE) (write-double pi-double) (write-double Double/MIN_VALUE) (write-double Double/MAX_VALUE) )) and the corresponding reads: (with-open [dis (DataInputStream. (io/input-stream dummy-file))] (is= (read-string-bytes 5 dis) "hello") (is= (vec (read-bytes 4 dis)) [1 2 3 4]) (is= (read-byte dis) 42) (is= (read-byte dis) -42) (is= (read-byte dis) Byte/MIN_VALUE) (is= (read-byte dis) Byte/MAX_VALUE) (is= (read-byte-unsigned dis) 142) (is= (read-byte-unsigned dis) types/BYTE_UNSIGNED_MIN_VALUE) (is= (read-byte-unsigned dis) types/BYTE_UNSIGNED_MAX_VALUE) (is= (read-short dis) ) (is= (read-short dis) -) (is= (read-short dis) Short/MIN_VALUE) (is= (read-short dis) Short/MAX_VALUE) (is= (read-short-unsigned dis) 55999) (is= (read-short-unsigned dis) types/SHORT_UNSIGNED_MIN_VALUE) (is= (read-short-unsigned dis) types/SHORT_UNSIGNED_MAX_VALUE) (is= (read-integer dis) int-val) (is= (read-integer dis) Integer/MIN_VALUE) (is= (read-integer dis) Integer/MAX_VALUE) (is= (read-integer-unsigned dis) int-val) (is= (read-integer-unsigned dis) types/INTEGER_UNSIGNED_MIN_VALUE) (is= (read-integer-unsigned dis) types/INTEGER_UNSIGNED_MAX_VALUE) (is= (read-long dis) long-val) (is= (read-long dis) Long/MIN_VALUE) (is= (read-long dis) Long/MAX_VALUE) (is= (read-long-unsigned dis) long-val) (is= (read-long-unsigned dis) types/LONG_UNSIGNED_MIN_VALUE) (is= (read-long-unsigned dis) types/LONG_UNSIGNED_MAX_VALUE) (is= (read-float dis) pi-float) (is= (read-float dis) Float/MIN_VALUE) (is= (read-float dis) Float/MAX_VALUE) (is= (read-double dis) pi-double) (is= (read-double dis) Double/MIN_VALUE) (is= (read-double dis) Double/MAX_VALUE)) ) Other tests show that an Exception is thrown if the supplied value is out of range: ;- (throws? (write-byte dos (inc Byte/MAX_VALUE))) (throws? (write-byte dos (dec Byte/MIN_VALUE))) (throws? (write-short dos (inc Short/MAX_VALUE))) (throws? (write-short dos (dec Short/MIN_VALUE))) (throws? (write-integer dos (inc Integer/MAX_VALUE))) (throws? (write-integer dos (dec Integer/MIN_VALUE))) (throws? (write-long dos (* 2M (bigdec Long/MAX_VALUE (throws? (write-long dos (* -2M (bigdec Long/MIN_VALUE (throws? (write-byte-unsigned dos (inc types/BYTE_UNSIGNED_MAX_VALUE))) (throws? (write-byte-unsigned dos (dec types/BYTE_UNSIGNED_MIN_VALUE))) (throws? (write-short-unsigned dos (inc types/SHORT_UNSIGNED_MAX_VALUE))) (throws? (write-short-unsigned dos (dec types/SHORT_UNSIGNED_MIN_VALUE))) (throws? (write-integer-unsigned dos (inc types/INTEGER_UNSIGNED_MAX_VALUE))) (throws? (write-integer-unsigned dos (dec types/INTEGER_UNSIGNED_MIN_VALUE))) (throws? (write-long-unsigned dos (inc types/LONG_UNSIGNED_MAX_VALUE))) (throws? (write-long-unsigned dos (dec types/LONG_UNSIGNED_MIN_VALUE))) Other useful functions include the ability to make temporary disk files &
Clojupyter 0.3.0 released
Clojupyter-0.3.0 has been released. The focus of the release has been to improve the structure of the implementation, with a much larger share of pure functions resulting in improved testability and clearer separation of layers. The new kernel communicates with its environment exclusively using `core.async` channels with ZeroMQ communication split off in a separate layer and communication with the internally spawned NREPL server based on a combination of interceptors with core logic implemented as pure functions. The release fixes reported issues #94 (Use tools.deps for dependencies), #103 (Imagemagick need to install Clojupyter), #104 (Clojupyter not installable in non-base Conda environment), and #105 (Can't interrupt the kernel on Windows), closing all open bugs in the project issue list. The release also includes support for Jupyter COMM messages (COMM_OPEN, COMM_CLOSE, COMM, COMM_INFO_REQUEST, COMM_INFO_REPLY) which are used in Jupyter to synchronize state between the front-end (Jupyter Notebook and Lab) and language kernel when using interactive widgets. The support will serve as the basis for exploring the possibility of adding support for widgets to Clojupyter. To signify the fairly fundamental changes and additions to Clojupyter in this release the version number is bumped to 0.3.0. The release is available on Anaconda Cloud as the default install, i.e. it can be installed using the command: *conda install -c simplect clojupyter* Enjoy! -Klaus. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/3a20dcdd-27ce-4354-8525-63fd1d5c0efe%40googlegroups.com.