Fork me on GitHub
#beginners
<
2018-02-26
>
derpocious00:02:53

yes, exactly

derpocious00:02:47

so is there another way I can test my code without actually running it on aws? Is planck not the right this for this?

mfikes00:02:12

@derpocious I don't have any experience with AWS Lambda, so I don't know what is entailed in running the server. Having said that, Planck and its planck.http library can make HTTP get calls to any HTTP server.

gonewest81801:02:46

Yes, you absolutely can make HTTP calls from Lambda.

gonewest81801:02:07

You might check #aws-lambda, a very quiet forum but there are people over there with direct experience.

gonewest81801:02:40

There is ring middleware that adapts the inbound AWS events, so you can (if you like) write as if you’re “just” a ring app with compojure routing and so forth.

derpocious00:02:16

hmm will planck.http work if I deploy it to aws?

mfikes00:02:33

There is a Linux version of Planck available, and if you manage to deploy it there, it can make outbound HTTP calls (presuming AWS Lambda allows that). But, I suspect you need to respond to AWS Lambda events of some sort... I don't know how you would get Planck to respond to those. (Ignorance on my part.)

derpocious00:02:47

ok thanks. do I need to change my project.clj to add planck? Or require something special in my core.cljs file which is now using cljs-http?

mfikes01:02:04

@derpocious Hmm. I don't think I understand the overall goal you are trying to achieve.

drewverlee01:02:59

Anyone have a recommendation for learning Java? I feel like most good books would need to be updated to include every new version of java…

drewverlee01:02:52

Like, remember all that stuff we said in the last book. Forget that, we have steams and lambdas now…

seancorfield01:02:44

@drewverlee My recommendation? Don't bother 😆

seancorfield01:02:19

(I have a bunch of Java books lying around -- I try to keep on top of this stuff even tho' I haven't programmed in Java since... maybe Java 5?)

seancorfield01:02:36

I quite enjoyed Java 8 in Action. Let me dig up what else I have...

mfikes01:02:49

Hah, the introduction of lambdas in Java was what finally caused me to decide I couldn't take it any longer and I jumped to Clojure.

seancorfield01:02:12

Hmm, almost everything else I have is fairly language agnostic or polyglot...

mfikes01:02:20

I never learned any Java post generics, really

seancorfield01:02:10

I have a bunch of old Java print books... I'd have to go digging around in the library for those... all the ebooks I keep on my phone, laptop, and desktop.

mfikes01:02:19

Even JCiP, which is awesome, becomes a bit irrelevant once you learn how to use Clojure atoms

mfikes01:02:08

I guess this is a biased channel for such a discussion 🙂

seancorfield01:02:25

Yeah, it's kind of old hat nowadays, with Clojure and even Scala to some extent.

seancorfield01:02:50

And Kotlin has coroutines now...

drewverlee02:02:43

Well, assuming working in Clojure is a goal. 1. I believe I have a better chance of moving a team from java to clojure then getting a job in Clojure. I dont know if ppl are aware but “mid level clojure dev” is basically non existent (maybe if your in cali?) 2. convincing ppl usually means trust and trust is typically earned (in part) by demonstrating mastery in an area the target is interested in. So in this case i believe getting better at java is my best chance of working in clojure. This discussion is quickly moving towards job-dicusss though… That being said, I work in java all of a sudden and my someone on my team just made a website to generate objects we use commonly, something about that is really sad and if i have any hope of doing better though, i need to learn more…

seancorfield02:02:12

Re: 1 -- yup, very aware. It's unfortunate, but understandable with the size of the industry.

seancorfield02:02:08

Re: 2 -- yup, and a lot of (junior) devs get excited about Language X and try and push for it and either get disappointed that no one listens or else it gets adopted and is a disaster (changing tech is hard).

seancorfield02:02:03

I don't think anyone could pay me enough to work in Java again. So much Java work is soul-crushingly rote and mindless, with so much needless ceremony around it.

seancorfield02:02:20

Look at Kotlin or Scala opportunities. Even Groovy. Anything but Java.

derpocious04:02:10

hey, is anyone here experienced with aws lambda? I asked a question in the aws-lambda room. trying to use cljs-http or some clojurescript http client that works on aws-lambda. thanks 🙂

duminda04:02:25

What can I do when lein figwheel dev does not offer the repl? The last line is Prompt will show when Figwheel connects to your application. But even after browser loads the page, I don’t get the prompt.

duminda04:02:32

How to debug the problem?

noisesmith04:02:18

@duminda you could double check the browser console to check if it is trying to connect, or some error happened before it could connect

duminda04:02:09

@noisesmith: Yep: Cannot read property 'chan' of undefined (in async.cljs)

noisesmith04:02:19

sounds like some deps are out of sync, or some error in the code that would bootstrap figwheel?

duminda04:02:00

Ok, running lein clean and then running lein figwheel dev takes care of the problem.

noisesmith04:02:34

haha I guess "lein clean" is the new "turn it off and on again"

duminda05:02:33

What’s the idiomatic way to create a vector from a lazy sequence? i.e. (some-function (take 5))

duminda05:02:26

(into [] (take 5)) doesn’t work

mfikes05:02:59

(into [] (take 5 (range))) or (vec (take 5 (range)))

mfikes05:02:31

(By saying (take 5) you are creating a transducer.)

mfikes05:02:14

So, (into [] (take 5) (range)) works, if you want to use (take 5)

duminda06:02:12

Is there a ready-made function which would let me traverse a vector along with the indices? i.e.

(traverse-vec (fn [index elem] (println index elem)) [5 2 9 8])
-> 
0 5
1 2
2 9
3 8

rymndhng06:02:43

@duminda you're looking for map-indexed i believe.

duminda06:02:10

@rymndhng: Yep, thanks

neoshadybeat09:02:29

Hi, does anyone using sonarqube with clojure for CI?, Wich plugin are you usinig?

naylyn.gaffney11:02:24

Can anyone point me in the right direction to get this to work (derive MyClass cljs.core.LazySeq)? It's failing in my repl. Thanks!

delaguardo11:02:32

I think you can start from documentation) https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/derive second argument (parent) must be a namespace-qualified keyword or keyword but not a class

delaguardo11:02:21

by the way - what kind of relation you want to make?

naylyn.gaffney03:02:40

I want to build a new type or record that behaves almost exactly the same as inbuilt clojure data structures, and then use multimethods to change some particular behaviour.

naylyn.gaffney03:02:21

From the docs "You can also use a class as the child (but not the parent, the only way to make something the child of a class is via Java inheritance)." Does this mean I can't use derive with clojure.lang.PersistentVector and similar as the parent?

joshkh15:02:56

i'm getting a pretty strange compilation error, specifically around / (division). has anyone seen this before?

(/ screen-width 2)
produces the compilation error:
cljs.core//, all arguments must be numbers, got [#{nil clj-nil} number] instead.

curlyfry15:02:35

@joshkh Looks weird, have you tried printing screen-width?

joshkh15:02:09

yes, however it never has a chance to print. the compiler comes back with that error message when it tries to compile

joshkh15:02:41

and yet it's fixable by wrapping screen-width with js/parseInt, which is even more confusing because that would return NaN if screen width didn't have a value (as indicated by the error message), and the division would surely fail (which it doesn't).

joshkh15:02:01

and it's not a run time error...

curlyfry15:02:23

True, that's really strange.

joshkh15:02:03

thanks for confirming that. i thought i was going crazy. ¯\(ツ)

curlyfry15:02:55

I'd try: clearing browser cache, stop figwheel, lein clean, start figwheel again

joshkh15:02:16

no dice 🙂

joshkh15:02:44

right, so my assumption is that the compiler can't know what the width function returns as it's interop with an external js library so it fails pessimistically. however, it would know that js/parseInt returns a number.

joshkh16:02:05

the following modification compiles as well when using core javascript functions (getClientWidth), so that must be it

(defn left-or-right [dom-node]
  (let [{x :x} (obj->clj (ocall dom-node :getBoundingClientRect))
        screen-width (ocall js/window :getClientWidth)]
    (> x (/ screen-width 2))))

mfikes17:02:44

@joshkh That might be a compiler bug. The intent is that it be fairly conservative if it can't infer the type of something and not emit warnings. But it seems something is making it think screen-width is nil... Hrm.

mfikes17:02:48

It might also be possible to suppress whatever is going on by adding a ^number hint.

chris87917:02:13

Hey there! I’m pretty new to cljs and clojure, and I’m trying to get codox to work with a project. So far I am able to generate the API documentation, but I’d like to have it generate docs for a certain namespace. I’ve been following along on the GH page, but I am running into this error:

codox: unknown option(s): :namespaces

mfikes17:02:45

@joshkh Are you using a ClojureScript compiler prior to 1.9.456? (You might be seeing https://github.com/clojure/clojurescript/commit/0436a318a6e05db3d8d93d74384e374c4781afbf)

seancorfield21:02:55

@chris879 Are you sure you're using the latest version of Codox? The :namespaces change was only in 0.9.

seancorfield21:02:22

(although I figure you're using 0.10.3 per the readme)

chris87921:02:55

@seancorfield Yep, I’m using 0.10.3, I should have mentioned that I’m using boot too. I was able to figure it out by using the -f flag. Thanks!

seancorfield21:02:22

I wonder if Codox could be made to read options from a file with Boot, to save having to specify command line options for everything?

chris87922:02:05

So I actually found that I can pass :filter-namespaces through build.boot. Looks like it just acts as a wrapper of sorts here https://github.com/weavejester/codox/blob/master/boot-codox/src/codox/boot.clj#L52

seancorfield23:02:43

@chris879 Yup, the deftask defines the command-line arguments in short form and long form and the values are bound to variables with the long form name. https://github.com/weavejester/codox/blob/master/boot-codox/src/codox/boot.clj#L16-L28

seancorfield23:02:29

And when you're invoking a Boot task from another task, you use named keyword arguments that match the long form name.

seancorfield23:02:33

Boot's CLI is pretty nice...

aviflax23:02:13

Hi all… I’m not exactly a beginner but today I feel like one… Can anyone explain what I’m doing wrong here?

user=> (doseq [s ['doc '+]] (doc s))
nil
What am I missing? Doesn’t doc expect a symbol? Why can’t I give it a symbol? Thanks!

greg31623:02:49

doc is a macro

greg31623:02:58

so it’s literally trying to find documentation for the var s