Fork me on GitHub
#clojure
<
2023-11-16
>
valerauko01:11:54

Anyone has experience with using JAR layering for OCI images with Clojure? https://github.com/albertattard/presentation-layered-jar/tree/master/examples/clojure-layered-jar is the only example I could find and it doesn't seem to be up-to-date (3y)

p-himik08:11:42

I don't know anything about the topic, but 3 years doesn't sound that long at all. Does the example not work?

valerauko08:11:45

it's not exactly effortless to test which is why i asked first

valerauko13:11:25

awesome, thanks!

mkvlr13:11:19

given a counted? thing (a result from https://docs.datomic.com/pro/clojure/index.html#datomic.api/qseq in our case), what’s the easiest way to return a new thing that does a lazy transformation (map transform-fn counted-thing) that’s also counted?.

Alex Miller (Clojure team)13:11:17

Lazy stuff is usually not counted so probably no easy way

Noah Bogart13:11:37

could probably hack something together with deftype, but then you'd have to reimplement all of the core features you want to support, which is a real pain in the butt

mkvlr13:11:08

yeah, that’s what we looked at and it felt like too much code/work

chrisn14:11:00

Use hamf/lazy-uncached namespace for this type of thing.

chrisn14:11:30

As I have done the 'real pain in the butt' stuff.

chrisn14:11:25

user> (def data [1 2 3 4 5])
#'user/data
user> (lznc/map #(+ % 2) data)
[3 4 5 6 7]
https://cnuernber.github.io/ham-fisted/ham-fisted.lazy-noncaching.html#var-map

👍 1
chrisn14:11:34

This seems pretty suspicious - chunkIteratorSeq does not produced a chunked seq....

user> (def al (hamf/array-list (range 200))) 
#'user/al
user> (type al)
java.util.ArrayList
user> (chunked-seq? (seq al))
false
user> (instance? java.lang.Iterable al)
trueSyntax error reading source at (REPL:65:41).
Unmatched delimiter: )
user> (instance? java.lang.Iterable al)
true
user> (chunked-seq? (clojure.lang.RT/seq al))
false
user> (chunked-seq? (clojure.lang.RT/chunkIteratorSeq (.iterator al)))
false
user> (type (clojure.lang.RT/chunkIteratorSeq (.iterator al)))
clojure.lang.LazySeq
Before you respond that it doesn't matter because the first chunk of the chunkIteratorSeq is an actual chunk - here is the definition of map and there are similar definitions for filter, etc across clojure.core -
([f coll]
   (lazy-seq
    (when-let [s (seq coll)]
      (if (chunked-seq? s)
        (let [c (chunk-first s)
              size (int (count c))
              b (chunk-buffer size)]
          (dotimes [i size]
              (chunk-append b (f (.nth c i))))
          (chunk-cons (chunk b) (map f (chunk-rest s))))
        (cons (f (first s)) (map f (rest s)))))))
So if you are working with literally any java.util datastructure the performance of any clojure.core function is somewhat unnecessarily hampered.

Alex Miller (Clojure team)14:11:01

Can you put it on Ask Clojure?

Jason Bullers17:11:33

Does anyone know the status of spec2? I find the idea of separating the schema of the data from it's various usages via a selector really interesting, but it seems like it's sort of stalled out? The original spec was also alpha, but bundled with Clojure core. Is spec2 in a similar state of usability, or is it significantly less stable? Is there any (rough) timeline for when spec2 will supercede the original? Any specific major hurdles that are preventing it from getting there?

Alex Miller (Clojure team)18:11:15

spec2 is effectively paused and has not had a release (there are known bugs/unfinished parts to it)

Alex Miller (Clojure team)18:11:47

in the spec multiverse, I'm not sure which timeline we are on wrt a future release

kwladyka18:11:21

Will spec be abandoned with high enough probability to consider using spec1 and spec2 as not good idea anymore? It gives such feeling a little. I don’t know how to give this question in other way 🙂

kwladyka18:11:09

last change in code is 8 months ago and project is in progress very long time

Alex Miller (Clojure team)18:11:15

Many people are using spec1 now, and certainly we are not going to take that away. I don’t have a future plan for spec2 - it’s not something we are actively developing at this moment. I consider it “paused” rather than “abandoned”.

👍 1
kwladyka18:11:10

alpha status make it suspicious ;)

Alex Miller (Clojure team)18:11:21

There are many such things in our past dev, we just didn’t make most of them public :)

Alex Miller (Clojure team)18:11:42

Alpha was intended to mean “api not final”

👍 1
kwladyka18:11:19

Do we know reasons behind “pause” ?

Alex Miller (Clojure team)18:11:19

We were last working on integration of specs with defn. Despite trying many such things we never got to a design we were happy with.

Alex Miller (Clojure team)18:11:55

I think my preferred path would be to finish the unfinished work on what exists (which includes a lot of good stuff) and do the integration work to include it in Clojure, saving the defn stuff for the future.

👍 6
2
kwladyka18:11:39

thank you for explanation

vlaaad19:11:28

Would be cool if the Clojure team shared their experiments and explained why the options they tried are not satisfying

Alex Miller (Clojure team)21:11:57

it would be cool, but there are only so many hours in the day :)