Fork me on GitHub
#clojure
<
2016-10-11
>
fenak00:10:43

yeah, exactly.. that’s my app

iku00088804:10:32

Hi, is there a idiomatic way to check whether a sequence contains a nil element?

Alex Miller (Clojure team)04:10:15

dunno, maybe (seq (filter nil? s))

iku00088805:10:47

Ah, that will do it. Thanks!

arrdem05:10:48

alternatively (some nil? s)

iku00088806:10:59

Oh, that looks good too, thanks!

deas07:10:46

Did anyone try Atomist with Clojure yet?

mpenet08:10:01

also (.contains x nil)

mpenet08:10:52

I think this might be the fastest of the 3, if that's something you care about

abdullahibra09:10:44

i'm using lein 2.7, when i try lein uberjar, it hangs up at compiling foo.bar and never terminate what this refer?

robert-stuttaford10:10:46

there’s a paid service that hosts private maven deps for you, i can’t remember, the name. it’s not jfrog, sonatype, cloudbees. i know the name had a j in it. anyone?

yrgl10:10:34

jcenter?

robert-stuttaford10:10:43

tha’ts not it. gah. tip of my tongue.

borkdude11:10:30

all the other ones you mentioned probably too 😉

borkdude11:10:45

services ending with .io are usually hipper

dima12:10:34

@danielstockton it doesn’t for me. It only fails if i add (stest/instrument) and change fn args:

(stest/instrument)

(t [1])

danielstockton13:10:01

It also only fails when i instrument, [1 1] conforms to ::pattern

danielstockton13:10:25

but it fails also with [1 1] as an argument, it looks like [1 1] gets passed to int? instead of just 1

danielstockton13:10:15

@trybeee what version of clojure?

dima13:10:24

Clojure 1.9.0-alpha13

danielstockton13:10:14

same as me then

dima13:10:22

@danielstockton you’re right, it fails (i forgot to call (stest/instrument) before). let’s see what #clojure-spec answers about that

lvh16:10:09

trybeee danielstockton You’re nesting cats

lvh16:10:13

cat is a regex op, they nest

lvh16:10:27

throw a s/spec on ::pattern

lvh16:10:43

(s/def ::pattern (s/spec (s/cat :a int? :b int?)))

lvh16:10:58

also you may want to try #clojure-spec

danielstockton17:10:24

knew it was something simple, thanks

danielstockton17:10:49

I tried in spec first but thought I might increase my chances here

bcbradley18:10:58

Do you guys know anything about Aleph?

bcbradley18:10:36

It seems well designed, but I'm wondering if anyone here has experience with it

pvinis18:10:42

hello. i have a function with [req & opt]

pvinis18:10:51

then i wanna pass those to another function, which is called like (.bla something req) or (.bla something req opt1)`, or (.bla something req opt1 opt2)

pvinis18:10:08

opt is a vector or opt1, opt2 etc

pvinis18:10:17

how can i do that?

pvinis18:10:50

apply should help, but i cannot write (apply .bla something req opt)

bcbradley18:10:31

I'm not certain, but if .bla isn't a native clojure function (if its a javascript or java method), it might not satisfy all the interfaces that clojure functions satisfy

bcbradley18:10:42

its possible that is causing a conflict

bcbradley18:10:59

you could work around that with a macro

bcbradley18:10:15

instead of having a function that takes [req & port], have a macro that takes those things

bcbradley18:10:23

the macro can change that code into code of a different form

bcbradley18:10:35

namely (.blah something req stuf stuf stuf stuf stuf)

bcbradley18:10:12

if you don't have the ability to change your function into a macro, perhaps its possible to have it invoke a macro that does what I just said

bcbradley18:10:52

I'm kind of new at this too, so take what I've said with a grain of salt

bfabry18:10:56

@pvinis what is the arity of the java function?

pvinis18:10:20

its one required

pvinis18:10:24

and up to 4

pvinis18:10:30

3 optionals

bfabry18:10:56

so as in, the java function is defined multiple times? or it's defined using the elipsis operator?

roelofw18:10:04

Hello, I have installed leiningen and cursive on my Windows 10 box and installed then the clojure koans

pvinis18:10:27

this alert function

roelofw18:10:35

but when I do koans run by using the run option , I see no output at all

roelofw18:10:52

someone who can help me to solve this annoying problem

bfabry18:10:43

ohhh you're working in clojurescript... man I don't know that much about the interop there =/ there may be a better way to do it but personally I would just write (cond (= 1 (length opts)) (.alert something (first opts)) ... etc)

pvinis18:10:55

dnolen answered in the clojurescript channel. but thanks bfabry 🙂

tdrgabi18:10:11

it's been a long time since I used clojure. is there an up to date page on how to set up the environment (emacs + some plugin) ?

tdrgabi18:10:27

what's used in the community now?

bfabry18:10:51

@tdrgabi there's a bit of variety these days, but primarily Cursive (intellij plugin) and Emacs+CIDER. both have pretty decent "getting started" guides out there

tdrgabi18:10:26

thank you. I'll check out emacs + cider.

roelofw19:10:00

@tdrgabi I m testing Cursive now and I like it

bfabry19:10:31

ya personally love cursive

roelofw19:10:48

IM now trying to figure out how to see output of clojure koans

blueberry19:10:22

@tdrgabi Also checkout Prelude, from the creator of CIDER, which is basically Emacs + CIDER + everything else you need for programming, nicely set up and configured.

borkdude19:10:19

I was wondering, is there a construction in clojure that lets you do something like: (if-not-locked obj body else) vs (locking obj body)?

borkdude19:10:55

reading a Java post from 2008 by a guy named Alex Miller: https://dzone.com/articles/reentrantlock-and-dining-philo

aaelony22:10:42

Hi, how can I filter for only the :my/kw key in the collection [{:my/kw "test" :your/kw "blah"} {:your/kw "foo"}] ? This is what I get:

(filterv :my/kw [{:my/kw "test" :your/kw "blah"} {:your/kw "foo"}]) 
=> [{:my/kw "test", :your/kw "blah"}] 

aaelony22:10:30

this is with "1.9.0-alpha12"

jjfine22:10:49

what are you trying to get?

aaelony22:10:21

a vector of the values for :my/kw

jjfine22:10:01

(map :my/kw [{:my/kw "test" :your/kw "blah"} {:your/kw "foo"}])?

jjfine22:10:24

=> ("test" nil)

tomjkidd22:10:29

(->> [{:my/kw “test” :your/kw “blah”} {:your/kw “foo”}] (filter :my/kw) (map :my/kw))

tomjkidd22:10:36

filter first, then map

jjfine22:10:03

if you change map to keep it will remove nil

donaldball23:10:51

I haven’t used gen-class before to implement an interface with multiple overloaded arities, e.g. this connect method: https://maven.apache.org/wagon/apidocs/org/apache/maven/wagon/Wagon.html

donaldball23:10:06

What’s the correct way to go about it?

hiredman23:10:01

I think what I have done in the past there is instance? checks on the arguments in the implementing function

donaldball23:10:19

So something like

(defn connect
  ([this source & vargs]))
should compile and dispatch all the connect methods