Fork me on GitHub
#beginners
<
2022-06-09
>
popeye06:06:19

how can I improve below code

(if (seq? v)
     "null"
      (or v "null"))

dharrigan06:06:20

Does the string "null" have to be returned?

dharrigan06:06:27

Or is nil acceptable?

craftybones06:06:04

(if (or (seq? v) v) "null" v)

dharrigan06:06:20

(or (seq v) "null")

popeye06:06:27

yes if it is not a seqence and v is nil it should return null

craftybones06:06:16

@U11EL3P9Uā€™s solution will work well but it will change the concretion of v. So if you don't care about that, then it might be the best solution

craftybones06:06:04

not change per se, but it will give you a seq.

oly08:06:19

Just hit this nice error but only when running from a generated jar,

** ERROR: **
Exception: #error {
 :cause No binding factory for namespace  registered.
 :via
 [{:type javax.xml.ws.WebServiceException
   :message org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null
   :at [org.apache.cxf.jaxws.ServiceImpl getPort ServiceImpl.java 344]}
  {:type org.apache.cxf.service.factory.ServiceConstructionException
   :message Could not resolve a binding for null
   :at [org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory createBindingInfo AbstractWSDLBasedEndpointFactory.java 361]}
  {:type org.apache.cxf.BusException
   :message No binding factory for namespace  registered.
   :at [org.apache.cxf.bus.managers.BindingFactoryManagerImpl getBindingFactory BindingFactoryManagerImpl.java 93]}]
Its seems like a bit of a strange error using the bing api via interop and its heavily xml based but I don't even know where to start looking when it runs from clj but not java -cp cli.jar

Alex Miller (Clojure team)12:06:37

In Java, you can define service impls in a jar manifest, possibly that's getting stripped when you make an uberjar. How do you make the jar?

oly18:06:53

So I have this in my deps.edn and run clj -Xuberjar

:uberjar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.278"}}
                     :exec-fn hf.depstar/uberjar
                     :exec-args {:verbose true :aot true :main-class com.atomjuice.car-cli.core :jar "target/car-cli.jar"}}
I will do a bit of googling around what impls are as well see if that helps šŸ™‚

Dad-Shoes11:06:31

I am building a twitter clone just to get myself acquainted with everything Clojure. Any database recommendations?

šŸ™Œ 2
delaguardo11:06:14

stick with the one you know the most šŸ™‚

šŸ‘† 6
robertfw16:06:17

Yup, try to be learning one thing at a time!

kennytilton17:06:42

Clojure offers several decent solutions for Postgres, FWIW.

Dad-Shoes23:06:28

Thank you for replying. I'll continue with mongo unless there is a great reason not to for the moment

Jim Strieter00:06:31

FWIW, I got postgresql working with < 8 hrs of "no suitable drivers found" type errors, and I'm new to SQL, postgres, Java, Clojure, etc.