This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-11
Channels
- # announcements (16)
- # architecture (1)
- # babashka (24)
- # beginners (49)
- # biff (5)
- # calva (13)
- # clerk (3)
- # clj-kondo (4)
- # clojure (46)
- # clojure-dev (1)
- # clojure-europe (22)
- # clojure-losangeles (5)
- # clojure-nl (1)
- # clojure-norway (15)
- # clojure-uk (2)
- # clojurescript (28)
- # code-reviews (2)
- # community-development (6)
- # conjure (10)
- # cursive (8)
- # datalevin (15)
- # datomic (32)
- # events (1)
- # fulcro (9)
- # hyperfiddle (32)
- # introduce-yourself (1)
- # lsp (27)
- # malli (1)
- # matrix (3)
- # missionary (6)
- # off-topic (24)
- # practicalli (2)
- # rdf (1)
- # re-frame (7)
- # reagent (10)
- # reitit (5)
- # rewrite-clj (9)
- # sci (6)
- # scittle (4)
- # shadow-cljs (23)
- # tools-deps (74)
- # vim (19)
- # xtdb (5)
Hello 🙂 I'm trying to get the max from a list: (apply max my-list)
But, it's throwing a stackoverflow. Is there any easy way around this?
How are you building my-list
? This works in a REPL for me:
build=> (apply max '(123 234 128 236))
236
Are you constructing it with concat
?
And how are you constructing data
?
Bottom line: lazy sequences can build up a stack of evaluations so it's possible you are hitting that stack's overflow.
Well, perhaps changing how you build data
might be the best choice...
...but switching to a loop
and explicitly iterating over the lazy sequence might avoid the overflow.
Probably how you're building data
as a lazy sequence...
A reduce perhaps?
(reduce max foo)
It was an actual stackoverflow! There was a circular reference of function calls and it was blowing up on that line
Is some kind of philosophical claim? A stack overflow is not "real" if it's caused by buildup of lazy eval frames?
Even more philosophical. Now we're talking about negative stack frames. :rolling_on_the_floor_laughing:
I don't see one but Pinecone has an: 1. https://docs.pinecone.io/reference 2. https://docs.pinecone.io/docs/python-client (you can use libpython-clj to access that) 3. https://docs.pinecone.io/docs/node-client (you can use it via nbb/clojurescript) 4. There's also a https://github.com/pinecone-io/pinecone-java-client which you can use via interop. You could consider any of the above solutions.
would be great to know what you expect from such library
My computer has an alternative maven repository setup, so I try to specify some repos in deps.edn like this. But I still get the Error building classpath. Could not find artifact integrant:integrant:jar:0.8.0 in central (https://nexus.intern...). Any tips?
{:paths
["src/main"
"src/test"]
:mvn/repos {"central" {:url " "}
"clojars" {:url " "}}
:deps
{org.clojure/clojure {:mvn/version "1.10.3"}
ring/ring {:mvn/version "1.9.4"}
integrant/integrant {:mvn/version "0.8.0"}
environ/environ {:mvn/version "1.2.0"}
metosin/reitit {:mvn/version "0.5.15"}
clj-http/clj-http {:mvn/version "3.12.3"}
ovotech/ring-jwt {:mvn/version "2.2.1"}}
:aliases
{:dev
{:extra-paths ["src/dev"]
:extra-deps {com.datomic/dev-local {:mvn/version "0.9.232"}
ring/ring-mock {:mvn/version "0.4.0"}
integrant/repl {:mvn/version "0.3.2"}}}}}
Where is nexus coming from? Is it configured as a proxy in maven settings? Or a mirror? The deps reference indicates that proxies (and some other things) are pulled from maven setup, so maybe it's getting a mirror configuration from there (a very speculative maybe)
Do you possibly have some custom java repositories configured somewhere in ~/.m2
? This sounds familiar to something I've experienced in the past.
a mirror is setup in .m2/settings.xml yes! Can I get it to circumvent this and use the standard repo?
Not sure! I think I just moved ~/.m2/settings.xml
to ~/.m2/settings.xml.backup
, then moved it back when I needed it next time.
Hmm now it can't find: Error building classpath. Could not find artifact com.datomic:dev-local:jar:1.0.243 in central (https://repo1.maven.org/maven2/)
There were some changes to Datomic distribution recently: https://blog.datomic.com/2023/04/datomic-is-free.html I'd try asking in #C03RZMDSH and see what they say 🙂
I am coming from Python, so I am finding that my lack of JVM/Java library knowledge is becoming my hurdle. Has anyone found some good resources that I should dive into?
I typically deal with data munging and web back-end stuff. For backstory, I went to hit an api, found that it was gziped and then got into a fight with Readers versus Streams. I found clj-http solved that issue for me, but it revealed to me where my gaps were.
I see My personal experience is having no knowledge of java coming into Clojure, but it's fine, I just did a bit of googling and figured it out. The java ecosystem is full of Q&As and the core library's javadoc is informative. In the end you probably want to parse it into something meaningful (json?) and many libraries are happy accepting either a reader or input stream But there's some careful reading needed where you might expect things to "just work"
Thank you! I think I just get nervous when Java pokes its head out. I tossed my "Head First Java" book out ages ago and have been happier ever since.
Knowing java is absolutely not a requirement, but Clojure is hosted and it embraces the JVM, so knowing what an interface is and knowing your way around java.unil.* packages is very useful
Oh, nice. I've found https://medium.com/swlh/understanding-java-streams-e0f2df12441f on Streams and it is making heaps of sense. Thanks for the nudge in the right direction.
Learn to love the official docs 🙂 https://docs.oracle.com/javase/tutorial/essential/io/index.html
One book I found really fun: https://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601. I found it interesting because a) you learn a bunch about java's concurrency model, b) you learn about java.util.concurrent, which we often use in Clojure, and c) you learn about the footguns in Java, and find many new reasons to be thankful for Rich's design decisions
Hi, is there any lib/function I can use to split a long text into manageable pieces with an interface like mentioned here: https://docs.pinecone.io/docs/langchain#building-the-knowledge-base
text_splitter = RecursiveCharacterTextSplitter(
chunk_size=400,
chunk_overlap=20,
length_function=tiktoken_len,
separators=["\n\n", "\n", " ", ""]
)