Fork me on GitHub
#beginners
<
2019-02-24
>
masta15:02:55

hi. how to take 5 from a lazy stream, but only unique ones?

dpsutton15:02:24

(take 5 (distinct (range)))

thiru013016:02:56

Hey guys, what editor/IDE (other than Emacs or Vim) would you recommend for absolute Clojure beginners?

thiru013003:02:32

@ Thanks I'll check it out! The two guys on my team actually did start with VS Code but found the Calva plugin didn't play that well with our setup: figwheel-main, parinfer, tools.deps. I'm not sure if it's one or more of the above. One guy stuck with VS Code and the other is using vim + fireplace like me.

zane17:02:28

@ Please report back on whether Atom works out for you! I'd love to know what to recommend folks in the future.

tabidots03:03:59

@ I am firmly in the Atom camp. Booting up Proto-REPL is always a little awkward (maybe I just don't know what I'm doing) but other than that it's seamless.

zane14:03:23

@ Hey, nice! Glad you're digging it.

thiru013016:02:59

I use vim + fireplace myself and got a couple devs on my team to do the same. But other devs are curious and I know they would not want to learn Vim or Emacs. They're used to graphical IDE's like Visual Studio..

jamesthibaudeau16:02:25

IntelliJ with the Cursive plugin served me well

thiru013016:02:28

thx @ Are you using tools.deps or lein/boot?

cbowdon16:02:33

Some of my colleagues use Cursive (it seems to work well with tools deps)

srijayanth17:02:48

Isn’t Cursive paid?

cbowdon17:02:51

I think it is for commercial use. Money well spent though

jamesthibaudeau01:02:23

@thiru was using lein, Cursive is paid, there is a free non commercial license. Sadly I'm not working with it anymore. I am trying out VS code with Calva for my personal stuff, not really used to it yet so I might just spring for Intellij and Cursive

heblevi20:02:48

Hey everyone, I am writing a small API client library, and was wondering what the most common way of handling exceptional status codes. clj-http, by default, throws exceptions. Would the prefer behavior for my library be to allow the exception, or to catch it and return the actual response?

henrik05:02:44

Maybe have a whack at http-kit: http://www.http-kit.org/ I believe it delivers the error as a key in a map rather than throwing. Another alternative is to create a wrapper function using try around the request, and then deliver it back in the way you want.

heblevi18:02:11

Henrik, thanks for your help. Those are great options if I do want to return a response map instead of throwing error. clj-http does also allow passing the map {:throw-exceptions false} to return a map instead of an error. I guess I was asking more existentially, if it is preferred in the clojure community for an api client to throw an exception on unexpected status codes, or if it is better to silently return the response map with a status code of 40x or what have you.

risinglight21:02:55

I wanted to use transients to see if I could speed up some code for kicks. I’m using a vector as a stack, an wondered what happened if I used a transient. After changing to (transient []) though, I found empty? breaks. I reworked to not need to call empty, but now peek errors out as well. Would I have been better off dropping down to java.util.Stack at this point?

mfikes22:02:15

@risinglight Looks like there is a workaround for peek on transient vectors in https://dev.clojure.org/jira/browse/CLJ-2464

risinglight04:02:08

Thanks! I feel better knowing my line of reasoning wasn’t unreasonable