Fork me on GitHub
#beginners
<
2021-11-13
>
João Galrito00:11:22

i'm doing some processing with Java streams turned into Seqs with a dorun, and it seems it batches it up in a couple dozen at a time

hiredman00:11:08

that will depend on how you are turning them in to seqs

João Galrito00:11:24

(defmacro feed [input & body]
  `(->> ~input
        DataSource/getInstance
        .create
        .iterator
        iterator-seq
        (filter (complement nil?))
        ~@body
        dorun))

hiredman00:11:51

strictly speaking seqs are not lazy, they are non-strict, they don't guarantee one element at a time realization

hiredman00:11:09

there is this thing called chunking, which doesn't just magically happen out of thin air

hiredman00:11:51

but certain types of sequences are chunked, and most of the clojure.core seq functions will generated chunked sequences if passed in a chunked sequence

hiredman00:11:08

and chunked sequences are typically in chunks of 32

hiredman00:11:24

I don't recall if iterator-seq is chunked or not

hiredman00:11:12

well, it makes the seq by calling clojure.lang.RT/chunkIteratorSeq which seems like a good indicator it is

hiredman01:11:43

you may want to check out transducers

João Galrito01:11:58

always forget I can build my own lazy-seqs manually 🙂

Alex Miller (Clojure team)01:11:22

If you need to control the time of realization, don't use lazy seqs, as they guarantee nothing about that

Alex Miller (Clojure team)01:11:51

Use transducers or loop/recur

💯 4
João Galrito03:11:37

i'm kind of new to Maven, and I'm trying to setup my current Java project to also compile some .clj code on src/clojure

zackteo04:11:42

I realise I don't really know cause I'm on Linux. But what resource should I point my friend to if they want to install Clojure on Windows? I was looking at maybe pointing him to https://purelyfunctional.tv/guide/how-to-install-clojure/#windows . Any suggestions? I understand some use the Linux subsystem, is there a guide for that?

seancorfield04:11:37

My feeling is that the best approach on Windows 10/11 is WSL2, Ubuntu, and then the regular Linux install for Clojure (although I have LinuxBrew installed and use that for all of my WSL2 needs).

🙌 1
practicalli-johnny04:11:41

There are some windows specific recommendations included in this guide https://practical.li/clojure/clojure-tools/install/

seancorfield04:11:19

The nice thing about using LinuxBrew on WSL2 is that at least then you're at parity with MacOS which is kind of the "gold standard" for most Clojure development (since that's what most Clojure stuff is designed for primarily) and you're relying on an official Clojure team source -- the brew tap.

1
zackteo04:11:16

Thanks everyone 😊

randomm char17:11:43

I would say it would depend on what the persons familiar with, throwing on a new language/os/ide all at once is a recipe for disaster, keep it simple. When I first started I just grabbed a jar file to run clojure repl and used notepad.

seancorfield17:11:40

"grab[bing] a jar file to run clojure" only worked up to Clojure 1.8. From 1.9 onward, Clojure has been three JARs so using some sort of dependency management tool is pretty much required now.

pinkfrog15:11:25

Hi. I saw type hint of being ints. (amap ^ints an-array xxx) . But how come ints is a type?

pinkfrog15:11:52

Hope it has nothing to do with the (definline ints ..) function

Dmitrii Pisarenko16:11:25

Hi! Imagine there is some data represented as Clojure code. I am thinking about creating a (locally running) ClojureScript web application which would allow me to view those data. Whenever I change something in those data, these changes should become available to the ClojureScript application. Are there there any minimal open-source examples for this setup?

Dmitrii Pisarenko19:11:28

@U8LB00QMD Thanks! Very promising.

Bobbi Towers20:11:21

If what you're looking for is just automated builds with hot reloading, I personally use https://github.com/thheller/shadow-cljs. I have a forkable template to quickly get started with Reagent: https://github.com/porkostomus/shadow-reagent

Dmitrii Pisarenko11:11:35

@U8LB00QMD At the moment I am very impressed with devcards. Is there a way in devcards to create a page to which I can make a link? What I want to do is to have a link so that when I click it, I get to a particular devcard.

fabrao20:11:18

hello all, what is the best way to extend this class

public abstract class J4KSDK
{ 
 public abstract void onDepthFrameEvent(short[] paramArrayOfShort, byte[] paramArrayOfByte, float[] paramArrayOfFloat1, float[] paramArrayOfFloat2);
  public abstract void onColorFrameEvent(byte[] paramArrayOfByte);
  public abstract void onSkeletonFrameEvent(boolean[] paramArrayOfBoolean, float[] paramArrayOfFloat1, float[] paramArrayOfFloat2, byte[] paramArrayOfByte);
...}

emccue22:11:08

and deps.edn is the easiest option for including a local jar (a quick google makes it seem like java 4 kinect isn’t on maven)

Dmitrii Pisarenko21:11:28

Hello! In a https://github.com/mentiflectax/hello-devcards I am getting the following error when I try to run lein figwheel:

Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:435)
	at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:69)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
	at clojure.lang.DynamicClassLoader.loadClass(DynamicClassLoader.java:77)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:468)
	at clojure.lang.RT.classForName(RT.java:2168)
	at clojure.lang.RT.classForNameNonLoading(RT.java:2181)
	at cljs.closure$eval11406$loading__5569__auto____11407.invoke(closure.clj:9)
	at cljs.closure$eval11406.invokeStatic(closure.clj:9)
	at cljs.closure$eval11406.invoke(closure.clj:9)
	at clojure.lang.Compiler.eval(Compiler.java:6927)
	at clojure.lang.Compiler.eval(Compiler.java:6916)
	at clojure.lang.Compiler.load(Compiler.java:7379)
	... 146 more
On https://stackoverflow.com/a/56786551/399457 I found a suggestion to add JVM parameter --add-modules java.xml.bindto fix it. I suppose I need to do this in the https://github.com/mentiflectax/hello-devcards/blob/master/project.clj file. How exactly can I add a JVM parameter above so that it is used whenever leinis being run?

Dmitrii Pisarenko21:11:12

Adding :jvm-opts ["--add-modules java.xml.bind"]in the dev compilersection did not help.

Dmitrii Pisarenko21:11:51

Solution found: Adding the dependencies below did the trick.

;; java.xml.bind (start)
                 [jakarta.xml.bind/jakarta.xml.bind-api "2.3.2"]
                 [org.glassfish.jaxb/jaxb-runtime "2.3.2"]
                 ;; java.xml.bind (end)
Source: https://stackoverflow.com/a/43574427/399457