Fork me on GitHub
#beginners
<
2020-05-10
>
ssushant14:05:19

Does anyone have experience with clojure kit with Intellij?

salam19:05:44

er… i don’t think it’s true that it’s “super outdated and no longer maintained.” it’s pretty well-maintained and the latest release was from 6 days ago (https://github.com/gregsh/Clojure-Kit/releases). speaking from my personal experience of actually using it, it’s still a pretty good, open-source option that aims to remain minimalistic.

include19:05:45

nice to know. I also thought it was deprecated

salam19:05:46

it might be possible that clojure-kit is getting mixed up with la clojure.

didibus05:05:05

Oh was definitely thinking of la clojure

Michael Thurmond18:05:47

I have a reitit server and a reagent template and I'm trying to allow CORS. I've tried using wrap-cors from ring middleware but am having trouble getting it to work. Has anyone else experience this?

(def app2
  (ring/ring-handler
    (ring/router
      [["/" {:get {:handler index-handler}}]
       ["/items"
        ["" {:get {:handler index-handler}}]
        ["/:item-id" {:get {:handler    index-handler
                            :parameters {:path {:item-id int?}}}}]]
       ["/about" {:get {:handler index-handler}}]]
      {:data {:coercion   reitit.coercion.spec/coercion
              :muuntaja   m/instance
              :middleware [params/wrap-params
                           muuntaja/format-middleware
                           coercion/coerce-exceptions-middleware
                           coercion/coerce-request-middleware
                           coercion/coerce-response-middleware]}})
    (ring/create-default-handler)))

Vishal Gautam21:05:38

Try calling the end points directly I.e ‘/items’, without the <localhost://portnumber/|localhost://portnumber/>

Michael Thurmond21:05:59

thanks, that didn't work because the frontend is on port 3449 and the backend is on 3000

dharrigan18:05:42

Perhaps #reitit would have more answers?

dvingo21:05:03

what's the idiomatic way to determine if a vector contains an element (i know contains? looks up the index, not the val) is it to: (contains? (set ['1 '2 '3]) '3) ?

seancorfield21:05:59

If it's an operation you need to perform repeatedly, I'd consider using a different data structure (than a vector). What's going to be idiomatic as a solution is going to depend on the problem you are trying to solve...?

👍 8
dvingo21:05:50

thanks - i guess my question is better phrased as what are ways to check that a vector contains a value?

phronmophobic22:05:31

(some #{42} my-vec) is a common way to test if my-vec contains the value 42

dvingo00:05:23

thank you!

krzyz06:05:19

Be careful not to check for false or nil that way. Be aware of the “long” version: (some #(= % false) my-vec)