Fork me on GitHub
#beginners
<
2022-11-12
>
zeitstein07:11:51

Is there a way for

(throw (ex-info msg map))
to print the map to the REPL output outside of try, without moving the map into msg?

zeitstein08:11:35

Or is

(throw (ex-info (str msg map) map))
how it is supposed to be used?

delaguardo10:11:34

you can adjust how some type is being painted by adding method to defmulti https://clojuredocs.org/clojure.core/print-method

gratitude 1
Benjamin09:11:59

Jo how do I set the logger factory for slf4j? I have logback-classic 1.4.4 on the classpath but it doesn't pick it up automatically. I end up with sl4j NOP. slf4j-api 1.4.4 comes with the NOPLogger. On in the manual they say "drop one and only one" binding on your classpath, that is confusing to me. Can I exclude class files from an artifact?

Benjamin09:11:58

hm. The setup automatically works with sl4j 2.0.1. But I have to say on 1.7.32 for datomic ions

Benjamin09:11:58

hm with logkback 1.2.9 at least it works, but there is the issue of 2 logger bindings:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/benj/.m2/repository/ch/qos/logback/logback-classic/1.2.9/logback-classic-1.2.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/benj/.m2/repository/org/slf4j/slf4j-nop/1.7.36/slf4j-nop-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See  for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
this is still tolarable for me right now because it picks the correct logger. I somehow want to remove slf4j-nop from the classpatch but I don't understand how it is added there.

rolt10:11:16

you can print out the deps tree and search it to find the culprit. Or if you're using lein: lein deps :why org.slf4j/slf4j-nop

rolt10:11:45

for both deps CLI and lein the setting is :exclusions [org.slf4j/slf4j-nop]

👀 1
Benjamin13:11:35

its not in the deps tree though for some reason. I am assuming something dynamically ads it maybe

rolt08:11:10

that's quite uncommon, have you checked with the correct profiles/aliases ?

dixie13:11:36

Hello, I tried to answer my question using google, but it was for me a rabbit hole. I would like to create client-side only application in clojurescript which would be deployed like set of static files (html, js) on the webserver. What is actually relevant library for that purpose, reagent, re-frame or something else? Complex answer is not needed, just hint - check XYZ. I'll research it myself 🙂 I just need entry point.

dixie13:11:48

Well, asking here motivated me to re-read what I read already :) My conclusion would be that re-frame is what I need to study/use.

practicalli-johnny15:11:59

Very simplest ClojureScript client side only app doesn't 'need' any libraries. cljbuild will create a JavaScript file from the ClojureScript code. That JavaScript file is included in an index.html file, like any others JavaScript app. This is covered in detail at https://clojurescript.org/guides/quick-start Libraries commonly used fro Client apps: Hiccup - a library provide a way to generate html from ClojureScript data structures (vectors with keywords as tags, etc.) Selmer - to include ClojureScript function calls in html templates (Usually hiccup or Selmer is used) CSS libraries (http://bulma.io, tailwind, etc) styles can be added to hiccup or selmer for responsive design of the web pages, especially across different devices Reagent - widely used ClojureScript library for react-style applications, often using hiccup-style data structures for page content and a reagent atom for managing state changes. reagent automatically updates components when the data they are using from the atom is updated. Re-frame - to build more complex UI with lots of state to manage, so not the simplest place to start It is useful to used a build tool, to provide interactive development. Use Figwheel-main (there is a project template that includes reagent - or rum, react) if mostly using ClojureScript Or use shadow-cljs if lots of npm packages are to be used.

👍 1
sheluchin14:11:39

https://www.braveclojure.com/core-functions-in-depth/#conj > You’ll often see two functions that do the same thing, except one takes a rest parameter (conj) and one takes a seqable data structure (into). What are some other examples of such function pairs?

Alex Miller (Clojure team)15:11:48

that does not seem correct (or "often")

sheluchin15:11:09

Hmm, okay. I have been trying to keep an eye out for function pairs like this since I first read this quite a while ago, but nothing ever really jumped out. I will create an issue for this... maybe the wording can be improved. TY, @U064X3EF3.

Alex Miller (Clojure team)15:11:22

I think making that decision is often is often a critical part of function/api design, but I don't think it's common to do both. If you take individual values, then callers can will need apply if they have a collection

dpsutton16:11:24

vec and vector come to mind.

dpsutton16:11:49

But I don’t think it’s a rule or even valid observation that gives any insight