#clojure log - Dec 20 2015

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:03 rhg135: that was odd

0:10 devth: awesome, lein won't compile: "Parameter declaration missing". time to binary search this thing

0:10 justin_smith: devth: that means a let without the [] block

0:10 or fn without []

0:11 devth: that's what i thought but i can't find it

0:11 justin_smith: no, it's not the let, it's the fn

0:11 devth: it's a pretty huge diff

0:11 i also changed a bunch of bindings

0:11 in the middle of a huge change :(

0:11 justin_smith: let does "wrong number of args", so it's an fn call

0:11 devth: k

0:11 really wish the stack trace told me which file :(

0:12 justin_smith: devth: also if you start a repl in user eg 'lein run -m clojure.main' and then try to require your namespace, you can get a stacktrace with line number and such

0:12 devth: ah, good idea

0:14 ± git diff | grep fn | wc -l

0:14 103

0:14 lol

0:14 rhg135: finally done: https://www.refheap.com/112941 critisize away ;)

0:15 devth: btw `lein run -m clojure.main` hit the same error

0:15 wouldn't start up

0:16 justin_smith: it should not be loading any of your namespaces...

0:16 let me correct that - it won't load any of your namespaces. So your problem is in clojure itself, or in lein / project.clj / one of your plugins

0:17 devth: hm

0:18 i see it loaded my namespaces. even produced a few logs

0:18 justin_smith: umm... lein run -m clojure.main should not be doing any of that...

0:18 I mean lein run will, if you don't provide that arg

0:18 devth: i see a bunch of dep conflict warnings, then "Compiling yetibot.core.init "

0:19 Leiningen 2.5.3 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM

0:20 justin_smith: devth: if you actually provide -m clojure.main as args, it will not load any of your namespaces

0:20 devth: welp not sure what's going on because that's exactly what i'm running

0:21 justin_smith: devth: what about lein check - that explicitly says what ns it is loading as it loads each one

0:22 devth: same. is this because i have aot set?

0:22 rhg135: yup

0:22 devth: crap

0:22 justin_smith: (dec aot)

0:23 devth: o really? i've been out of clj for awhile. what happened

0:24 justin_smith: aot tells lein to aot compile your namespace before running anything else

0:24 which means if your namespace is broken, nothing works

0:24 devth: that's bad

0:24 TEttinger: it's not bad if the namespace is needed to run...

0:24 justin_smith: yeah, I pretty much never use aot, super inconvenient

0:25 devth: ah, lein check helpfully told me exact ns and line number after i turned off aot and used lein check :)

0:25 hiredman: /win 20

0:25 justin_smith: yes, it's a nice tool

0:27 devth: looks like it was a binding with the 2nd line commented out

0:27 (map #(binding [*target* %

0:27 then another binding (commented out) below

0:28 what's wrong with that

0:29 nvm, it was a defn below that

0:29 lein was just giving me a slightly wrong line number

0:47 arrdem: Anyone know of a `re-cond` macro in a library somewhere? Looking thinking of `(re-cond [bindings regexp form]*)` implemented as chained if-lets on the regexp match and thought I'd take a minute to check for prior art.

0:48 justin_smith: arrdem: is this something you could do with condp?

0:48 TEttinger: devth: neat trick for commenting out parts of bindings is #_ , the "discard" reader macro. it causes the reader to completely ignore the next form after figuring out where it starts and ends, like #_ (+ 1 2 (* 3 5))

0:48 arrdem: justin_smith: maybe the critical thing is that I want to bind the pattern's match.

0:49 devth: TEttinger: cool but you'd have to add two #_s for a binding pair right?

0:49 TEttinger: ,(let [not-number #_ (+ 1 2 (* 3 5)) "is a string"] not-number)

0:49 clojurebot: "is a string"

0:49 TEttinger: to take out two? you could also use the semicolon to comment the line

0:49 or!

0:49 devth: in my case the thing on the left ceased to exist

0:49 justin_smith: ,(let [a 0 #_#_ a 42] a)

0:49 clojurebot: 0

0:50 arrdem: that's... horrifying

0:50 TEttinger: ,(let [not-number #_ (+ 1 2 (* 3 5)) "is a string" #_(dumb-binding-unwanted nil)] not-number)

0:50 clojurebot: "is a string"

0:50 arrdem: I wonder if the Ox parser supports that

0:50 TEttinger: I prefer to group, the double discard is kinda terrifying yeah but uh does it work? :D

0:51 justin_smith: ,(str #_#_#_ how is this "not reasonable")

0:51 clojurebot: "not reasonable"

0:51 TEttinger: haha

0:51 devth: whoa

0:51 arrdem: lawl

0:51 devth: i was not aware you could stack them

0:51 TEttinger: this is why justin_smith must be preserved at all costs

0:51 cryogenically

0:51 justin_smith: haha

0:51 TEttinger: justin_smith: what's my last name

0:51 justin_smith: Ettinger

0:51 TEttinger: who invented freezing dead/dying people

0:52 cryonics

0:52 hint, Ettinger

0:52 justin_smith: Herbert West

0:52 wait, I don't know

0:52 haha

0:52 TEttinger: Robert Ettinger

0:52 my dad is a completely different Robert Ettinger

0:52 justin_smith: I had no idea

0:52 TEttinger: also would be in the hilarious wikipedia category of "Atheist Jews"

0:53 "how specific must we get, wikipedia?"

0:53 justin_smith: TEttinger: I once did some research on Atheist Muslims

0:53 TEttinger: "Metrosexual Albanians"

0:53 "Genderfluid Walnuts"

0:54 justin_smith: TEttinger: this was politically important in the southeastern soviet states - their rulers could not be rulers if they were not communists, could not be members of the communist party if they were not atheists, but would not be accepted by their people if they were not muslim

0:54 TEttinger: wow

0:54 justin_smith: so they were officially recognized as athiest muslims

0:54 TEttinger: allatheists

0:55 justin_smith: no word yet as to whether there were any queer black atheist muslim abortionists who spent government grant money to make inflamatory performance art mocking the church

0:55 * arrdem backs away slowly

0:55 TEttinger: haha is that a reference to the famous madonna and child made from elephant dung?

0:56 justin_smith: TEttinger: more to Karen Finley, but it was the same scandal (and ever since that time the government no longer directly gives money to arts btw)

0:57 TEttinger: basically I was trying to throw as many hot button rile up the base conservative hotbutton things into one short phrase as I possibly could

0:58 TEttinger: (to be perfectly honest, elephant dung is not a terribly bad kind of poop to be in contact with. it's vital to several San groups who get the majority of their calories from hard-shelled mongongo nuts that elephants poop out with shell intact but the other stuff already cleaned off, just stick it in a fire and get the outright healthiest food that grows there)

1:01 it's kinda shocking to me, more so than that piece of shock art, that no one has tried to cultivate mongongo nuts outside of the area (I think kalahari)

1:02 they're compact and are like a hyper-charged food for athletes, extremely dense calorie nugget

1:03 justin_smith: TIL elephants poop out hyper dense calorie nuggets

1:03 TEttinger: justin_smith: I can't remember, were you on the west coast or austin? I remember there was at least one austinian around here

1:03 only if they eat mongongo fruit

1:03 justin_smith: west coast

1:04 TEttinger: which taste terrible to people but the nut is the good part

1:04 there was an interview I can paraphrase, someone asked a San man why his people didn't ever try to farm though every group near them did. he replied, "why would we possibly need to farm? We have mongongo nuts"

1:05 like, "are you daft, good sir?"

1:06 arrdem: https://www.refheap.com/112942

1:08 TEttinger: {:style/indent 1} ; ???

1:09 arrdem: it's CIDER shit so that the macro will indent nicely

1:09 https://github.com/clojure-emacs/cider/blob/master/doc/Indent-Spec.md

1:10 justin_smith: , (condp re-matches "foo" #"f(.)o" :>> second #"bar" :bar) ; arrdem

1:10 clojurebot: "o"

1:10 arrdem: right I forgot about that nice one justin_smith

1:11 I suppose we could bicker about if this should be pattern/binding/form or binding/pattern/form

1:11 justin_smith: arrdem: I was just answering the "does anything do this" with the closest answer I could think of. Of course it's not exactly what you described, but the functionality is close.

1:12 TEttinger: what is the keyword :>> doing there?

1:13 condp thing?

1:13 justin_smith: TEttinger: it gives second something to operate on

1:13 arrdem: justin_smith: yeah critically for me it means that I need some inline lambdas to destructure the match and operate on it half the advantage of the macro I wrote is that I get the binding "for free" if not an implicit do

1:13 http://conj.io/store/v1/org.clojure/clojure/1.7.0/clj/clojure.core/condp

1:13 TEttinger: ^

1:13 justin_smith: arrdem: oh, yeah - :>> helps, but isn't everything

1:14 TEttinger: arrdem: heh, I opened your last link and my computer told me "you're running rather low on memory, puny mortal"

1:14 arrdem: hah

1:14 TEttinger: compressing 2.4 million files

1:14 arrdem: th'fuck

1:14 TEttinger: almighty 7zip is amazing

1:15 is there anything better right now?

1:15 I saw boost uses lz as a compressed filetype

1:16 no idea what opens it, in classic boost fashion they don't tell you

1:44 tolstoy: I hate to say it, but that style/indent thing is kinda nice (for my little mess-around macros for debugging).

1:49 Wow. I'm hitting a couple of cool CIDER stuff I usually never do: macro-expand into another buffer (all pretty printed) and evaluation that prints the result in an overlay right at the end of the expression.

1:49 That last is really nice feedback. Better than the way SLIME flash/highlighted the whole expression.

1:51 arrdem: CIDER has gotten _really_ good.

1:51 the debug-defn is amazing

1:52 tolstoy: What I especially like is that you don't have to notice it's doing anything until you decide to integrate that bit. Opt-in. ;)

1:53 debug-defn: Is that the intrumented debugger thing?

1:53 arrdem: yeah my workflow is pretty much restricted to C-c C-k and a few personal tweaks to the REPL but every now and then I reach for some of the other awesome and am greatful for it.

1:53 tolstoy: yeah

1:54 tolstoy: Yeah. Unless I'm writing Java (in which case and IDE is great for massive file management and renaming), I end up turning everything off in an IDE until I wonder why I'm even using it.

3:24 visof: hi guys

3:25 what is the best way and efficient way to convert very big clojure map to some other effiecient format for storng purpose and then get it and convert it again to map then use it inside the code?

3:25 maybe some efficient binary format, or something


4:17 kungi: visof: how big is "very big"?

4:32 visof: kungi: maybe 50mb

4:34 BRODUS: looking at the output from 'lein deps :tree' is it normal for the exclusion suggestions to suggest I use the older version of a dependency?

4:36 lokien_: Is it necessary to know java to become a good clojure dev?

4:36 MJB47: no

4:36 but it helps

4:40 lokien_: MJB47: with what?

4:40 MJB47: its quite useful to know the mutable datastructurs java provides, like arrays, arraylists, treemaps etc

4:40 rarely, but ocasionally

4:40 and then there are times when the best solution to a problem is using interop

4:40 like with startsWith

4:41 and then knowledge of how the JVM works really helps with performance issues

4:41 but really

4:41 you can learn all those things as you go

4:41 lokien_: I know how to do interop, I'm just anxious about making my own java classes/interfaces

4:41 MJB47: you usually dont need to

4:42 lokien_: "Usually" or "almost never"?

4:42 MJB47: the last time i did it was maybe 2 years ago

4:42 * lokien_ sighs

4:42 MJB47: and i would argue that was the wrong way to do it in hindsight

4:43 lokien_: I can live in peace now, thanks

4:53 BRODUS: i've included exclusion statements in my project.clj that I believe should stop the warnings in "lein deps :tree" but it seems theyre not having any effect. that command takes exclusions into account right?

5:11 nvm, was reading an old doc. you specify exclusions with :exclusions not :exclusion

6:03 oracle: I can use (update-in ["1" 2 3] [1] inc)


6:04 but why can't use (update-in ["1" 2 3] [1] Float/parseFloat)

6:04 it throws the error of Caused by: java.lang.RuntimeException: Unable to find static field: parseFloat in class java.lang.Float


6:06 luma: because java methods aren't clojure functions

6:06 ,(update ["0" 1 2] 0 #(Integer/parseInt %))

6:06 clojurebot: [0 1 2]

6:06 luma: you have to wrap the method call in a function

6:37 yenda: I just discovered mount and I wonder if some of you made the switch from component in a project, did you encounter any quirks ? If you were to start a new project would you chose mount over component this time ? It does seem more "clojurish" when reading the readme at least

6:41 I will answer myself with this link http://yogthos.net/posts/2015-12-05-LuminusComponents.html :)

6:45 keep_learning: Hello everyone

6:46 I am trying to simulate the answer by Prashanth Sams http://stackoverflow.com/questions/663034/can-selenium-handle-autocomplete in Clojure for trip advisor.com

6:46 For first two lines

6:47 driver.findElement(By.id("your searchBox")).sendKeys("your partial keyword");

6:47 Thread.sleep(3000);

6:47 (send-keys

6:47 (find-element {:tag :input, :id "GEO_SCOPED_SEARCH_INPUT"}) city)

6:48 (implicit-wait 3000)

6:48 I am facing the problem in By.xpath("your list item locator")

6:49 I don't know to how to select this list because it's generated dynamically

6:49 by javascript

6:50 My question is how to select the the list item location ?

7:37 oracle: Did anybody use postal to send email from yahoo?

7:37 it throw the exception of Unhandled com.sun.mail.smtp.SMTPSendFailedException

7:37 530 5.7.1 Authentication required


7:38 but I have pass the username and password

7:55 keep_learning: http://lpaste.net/147502

7:55 I am getting this weird behaviour

7:55 justin_smith: luma: it's not just that java methods are not functions - they are not Objects so they cannot be used as values. On the vm level they simply are not first class, and rather than implicitly wrapping methods implicitly by constructing lambdas, Clojure makes you do this yourself.

7:55 keep_learning: The code was working a moment ago but now I am getting this error and I think the reason is firefox update

7:56 Any idea on how to solve this problem

7:56 j-pb: keep_learning: my guess would be you have some thing like this in your toplevel (selenium-connect)

7:56 toplevel forms will be evaluated at compile time

7:56 if your selenium is broken now, then that means that this will fail at compile time and prevent compilation

7:57 keep_learning: http://lpaste.net/147503

7:57 j-pb, I have posted the code

7:58 j-pb: keep_learning: is that stuff you do in the repl?

7:59 otherwise your ns declarations are seriously fucked up ^^

7:59 justin_smith: j-pb: not fucked up, just kind of messy and unconventional

7:59 keep_learning: j-pb, :) No, I have written that in editor

7:59 justin_smith: sure, merging into one ns form is cleaner, but what is there works

7:59 j-pb: use (ns foo (:require []) (:import [])) :) it will make your life a lot easier

8:00 line 10

8:00 thats where your problem is

8:00 if upgrading firefox broke it

8:00 justin_smith: j-pb: that's not the cause of the problem

8:00 oh, the set-driver!, never mind

8:00 j-pb: yeah, but you almost don't see it in the exploded ns

8:01 keep_learning: here's what I would try, upgrade selenium to match your new firefox version

8:01 downgrade firefox

8:01 cleanup you code, so you find shit when it breaks ;P

8:04 and put that (set-driver! {:browser :firefox}) into a function so that you can at least start a repl when things go wrong ^^

8:06 keep_learning: j-pb, Thank you

8:36 http://lpaste.net/147506

8:37 I have changed the code as suggest but now I am getting error

8:37 clojure.lang.Keyword cannot be cast to clojure.lang.Symbol

8:40 justin_smith: keep_learning: this probably isn't your issue, but you are using import wrong - see this example https://www.refheap.com/112945

8:43 keep_learning: your error is on line 3 :ehtml needs to be ehtml

8:43 then the next thing is to fix your imports

8:44 keep_learning: justin_smith, Thank you

8:59 yenda: if I need to make simultaneous calls on an API via http, does it make sense to just do them in a pmap ?

9:00 justin_smith: ~pmap

9:00 clojurebot: pmap is not what you want

9:00 yenda: :D

9:02 justin_smith: I wish that factoid included an explanation, but basically the deal is that pmap is lazy, it uses a fixed number of threads but can't know what's ideal for your function...

9:03 yenda: justin_smith: as long as the calls are grouped (not necesseraly all together) it is fine

9:04 justin_smith: yenda: another thing is that pmap always returns items in order, and sometimes you don't care about order and would rather work on the elements that are complete even if things that started before them are still in progress

9:05 j-pb: yenda: pick a werbserver lib that is capable of doing async calls

9:05 yenda: justin_smith: it is perfect then I need order

9:05 justin_smith: j-pb: web client lib?

9:06 j-pb: justin_smith: httpkit is both kinda ^^

9:06 yenda: j-pb: I am consuming an API not serving

9:07 j-pb: http://www.http-kit.org/client.html#async

9:07 yenda: yeah I know, httpkit can do both

9:07 you do a get you get a future back

9:07 and when you want to deref that is your thing

9:08 you can then process stuff syncrhonously or do a check o nthe future if it's resolved yet and if not process the next one

9:08 yenda: I want to trigger a race condition to check for a bug correction and for that I only need to connect many users simultaneously, collect their auth, then do few api calls and checking if they are always the same (with the bug they are not)

9:09 j-pb: so what client lib are you using?

9:09 justin_smith: yenda: pmap is less ideal for that, because it assumes a CPU (not IO) bound task and only uses a small group of threads limited by your number of physical CPUs

9:09 yenda: so i was thinking of simply doing pmap connexion then 10 times pmpap call by comparing the last one to the previous one, so having the results in order is perfect I just to a diff of what is returned

9:09 justin_smith: yenda: also pmap is lazy

9:09 yenda: justin_smith: ok maybe that is more problematic

9:10 j-pb: clj-http.client

9:11 justin_smith: yenda: how about core.async (let [results (chan) requests (chan)] (dotimes [i load] (thread (>! results (http/get (<! requests))))) [results requests])

9:11 j-pb: yenda: httpkit shoud be pretty much a drop in replacement

9:12 justin_smith: then after that you line up the requests on the requests chan, and read results from the results chan

9:12 j-pb: it's the libraries job, why not let the library do it

9:12 justin_smith: load decides how many threads are being used

9:15 yenda: It would be a nice occasion to learn core.async, I know it's not rocket science but never had the time to toy with it

9:15 j-pb: tbh the more I used it the less I liked it

9:15 great in theory horrible in practive

9:16 everything becomes hard to debug, after it has gone through the core.async sausage machine

9:17 yenda: funny that you call it a sausage machine, brave clojure demo it with a hot dog machine

9:17 j-pb: lol

9:17 yenda: j-pb: I think the http-kit link you sent me has an exemple that fits my needs pretty well with "Combined, concurrent requests, handle results synchronously"

9:18 j-pb: nice ^^

10:22 kwladyka: justin_smith, do you use intellij or emacs or ... ?

10:22 sorry i am asking directly you, but i know you are very good Clojure programmer. I know you the best from here :)

10:23 so you spend a lot of time during coding in Clojure

10:23 :)

10:26 yenda: mhm I'm trying to switch clj-http to http-kit client but it seems I can't use the convenient cookie-store there

10:27 galvs: hey. if anyone can help, whats the best way to include bootstrap with figwheel/reagent? put an index.html in resources/public with the imports defined? do i need to change the project build after that?

10:30 sdegutis: kwladyka: hmm yes I could see how you'd come to the conclusion that justin_smith is the best Clojure programmer from this channel

10:55 ridcully: galvs: with a plain figwheel project, put the css/img/... files in resources/public somewhere and reference them in your .html

10:55 you can e.g. use bower and let it put that stuff into resources/public/ext/

11:01 keep_learning: Hello everyone

11:01 I am trying to fill autocomplete list on trip advisor by following the instruction http://stackoverflow.com/questions/663034/can-selenium-handle-autocomplete

11:02 of Prashanth Sams

11:02 (t/set-driver! {:browser :firefox})

11:02 (t/get-url "https://www.tripadvisor.in/&quot;)

11:02 (t/send-keys (t/find-element

11:02 {:tag :input, :id "GEO_SCOPED_SEARCH_INPUT"}) city)

11:02 (t/implicit-wait 3000)

11:02 but I am stuck with how to locate List <WebElement> listItems = driver.findElements(By.xpath("your list item locator"));

11:03 list ?

11:04 BRODUS: are you using a clojure library for selenium or a java library ?

11:05 keep_learning: BRODUS, I am using clojure library

11:05 clj-webdriver

11:05 Let me post the code

11:06 BRODUS, http://lpaste.net/147511

11:06 BRODUS: im working on a project using hte same library, i'll see if i can replicate what you're doing

11:07 keep_learning: BRODUS, It's autocomplete list by ajax

11:08 I have found couple of links but not able to find/understan the complete solution

11:08 http://blog.buberel.org/2010/07/howto-test-jquery-ajax-autocomplete-menus-with-selenium.html

11:08 http://seleniumeasy.com/selenium-tutorials/working-with-ajax-or-jquery-auto-complete-text-box-using-webdriver

11:11 BRODUS: keep_learning: taking a look

11:17 yenda: anybody here successfuly used cookie with httpkit client ?

11:18 BRODUS: i'm having trouble just getting the autocomplete to appear, i wonder if it has to be in-focus first

11:21 keep_learning: BRODUS, Did you run my code ?

11:21 http://lpaste.net/147511

11:21 This one is able to fill the value and pop the list but I am not able to find the id of list to click on it

11:31 kwladyka: sdegutis, the best confirmed. I dont want to say there is no others.... I want to say there he is the one who i can recognise :)

11:45 yenda: I am trying to figure out how to handle cookies with httpkit client because what I tried doesn"t work, is there a way to find out what raw http request it sends, and do the same for clj-http which works, so that I can undersatnd whats going on ?

11:46 BRODUS: keep_learning: ok i got the autocomplete to pop. apparently the window needs to be in focus. are you having trouble selecting the list items?

11:48 ".scopedSearchDisplay li" should select the list items

11:50 keep_learning: http://pastebin.com/U8zqnQR5

11:59 keep_learning: BRODUS, Thank you

12:06 yenda: I read that http-kit doesn't support cookies :(

12:08 is this still relevant ? http://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io/

12:09 I need to do concurrent http calls that require cookies so I think I have to go with core+async + clj-http

12:10 but it says blokcing IO will clog the threads

12:27 keep_learning: BRODUS, How did you figure out (t/click ".scopedSearchDisplay li") ?

12:28 BRODUS: are you familiar with css selectors?

12:28 keep_learning: BRODUS, Not much

12:29 This is my first web project

12:29 BRODUS: ah, they're pretty crucial for web dev

12:29 keep_learning: I can see var scopedSearch = javascript function

12:30 BRODUS: do you know how to use the browser inspector? i just looked at what element the popup list items where being rendered in

12:30 keep_learning: BRODUS, Yes

12:30 clojurebot: No entiendo

12:31 keep_learning: var scopedSearch = get_scoped_typeahead(event, this); if(scopedSearch){ scopedSearch.stopStaticSearch(); scopedSearch.startGeoSearch(false); }

12:31 BRODUS: you don't need to pay attention to the JS

12:32 the container the list items are being rendered in is the div with class scopedSearchDisplay

12:32 you can express that via a CSS selector with ".scopedSearchDisplay li"

12:34 keep_learning: BRODUS, <div style="position: absolute; left: -999em; top: 27px;" class="scopedSearchDisplay geoScopeDisplay whiteCaret"></div>

12:34 BRODUS, Thank you

12:35 Any quick link for these kind of things.

12:35 BRODUS: actually a better expression would be "#GEO_SCOPE_CONTAINER .scopedSearchDisplay li"

12:36 https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started/Selectors

12:38 thats CSS specific but the selector terminology is used in many utilities that interact with the DOM, not just CSS

13:43 LauJensen: Evening gentlemen. Im trying to detox from Lighttable. Whats being developed for Emacs these days, cider, clojure-mode? For debugging?

13:44 BRODUS: i've been using emacs and cider for the past couple weeks, i enjoy it but debugging with cider could be more user friendly

13:45 whats lighttable like?

13:45 LauJensen: Its frustraingly close to good. The built in browser, watches, etc, really rock. The shoddy Emacs-keyboard maps suck and I do miss Macros

13:48 BRODUS: i'll have to check it out at some point. i love and hate emacs

13:49 mainly because its so distracting

13:51 LauJensen: Im a big Emacs fan. but getting started with Lighttable takes about 15 seconds, download included, so when I broke in a new system the temptation was too great

13:59 sdegutis: yeah LT is a great way to get feet wet with clj

14:00 I use Cider and Emacs for a few years. It's great.

14:00 LauJensen: It is. Though in truth Ive been doing Clojure since its first year, so its relevant for all ages I'd say

14:17 BRODUS: i want to generate some defns based on some data, can someone point me to an idiomatic way of doing that ?

14:24 scottj: LauJensen: https://github.com/clojure-emacs/clj-refactor.el/wiki

14:27 ridcully: BRODUS: macro or intern maybe? what is the source of this data?

14:30 BRODUS: a have a config file with some url paths, id like to make a set of functions that wrap around selenium's 'to' function so I can just call (to-path1 ....) (to-path2 ...) etc

14:31 LauJensen: BRODUS: What would the fns do ?

14:32 BRODUS: they would make the selenium browser visit a particular path

14:33 LauJensen: And you need fns for that, and not just function calls to selinium?

14:37 BRODUS: i could, but it would be more verbose

14:39 LauJensen: Ok. Well then the macro which generates the defns is fairly straightforward, but will of course put some clutter in your namespace. You have to decide on a naming strategy and perhaps bundle the names in the config

14:41 Guys Im trying out the new Emacs24 and I still find that when installing from package.el subdirectories of /elpa/ are not automatically added to the load-path. do you guys also manually have to add every path to your .emacs?

14:41 BRODUS: I actually still have a blogpost on macros which should give you more than you need: http://www.bestinclass.dk/blog/tribute-steve-ballmer

14:46 justin_smith: LauJensen: nice

14:48 scottj: LauJensen: if you call (package-initialize) in .emacs they will be added to load-path

15:00 alive876_: hi, newbie question (i tried on clojure-beginners but no luck) i have src/schema/core.clj and src/schema/lib/examples.clj i have a data structure defined in examples.clj, and want to access it in the repl. so i call the examples.clj in core.clj this way (require ['schema.lib.examples :refer :all]))

15:01 however i get an error

15:02 MJB47: remove the '

15:02 alive876_: ok

15:02 MJB47: and in the file its :require

15:02 in the ns declaration

15:02 alive876_: ok

15:05 justin_smith: alive876_: that require will work in a file - what's the error?

15:12 yenda: justin_smith: you gave me an exemple today to make concurrent api calls using core async, I'm not sure I understand how to use it. do I have to make some loop that does (>!! requests request) to fill the request chan ?

15:13 justin_smith: yenda: yes, and I might have left out the loop inside the async thread too

15:14 yenda: it was just a very rough sketch

15:15 yenda: big picture is that you use a parameter to tell it how many threads should be actively doing requests at a time, it creates that many concurrent loops (all using the core.async thread pool) and each of those should loop until their request channel closes

15:21 alive876: newbie here, i now have in schema/core.clj (ns schema.core) (:require [schema.lib.examples :refer :all])) and in schema/lib/examples.clj (:require [schema.core :as s :include-macros true ]))

15:21 MJB47: you cant have 2 namespaces requiring each other

15:21 its a circular dependency

15:22 alive876: ok

15:22 justin_smith: alive876: you are shadowing prismatic's schema lib - I assume schema.lib.examples needs the actual prismatic schema.core

15:22 and that circular dependency is a problem too, yes

15:22 LauJensen: scottj: My goodness, how did I miss that? :) I had it too far down in my .emacs

15:22 MJB47: you can usually get around circular dependencies by moving any functions that need to be used by both to a new namespace and requiring that

15:23 justin_smith: alive876: you can't have two namespaces with the same name, if you make a schema.core namespace, you cannot use the one from the prismatic/schema lib, and that will break everything which uses it

15:23 yenda: justin_smith: http://lpaste.net/147530 this is the sketch you send roughly, is it correct ? (so I don't try building around it if it's not)

15:23 justin_smith: yenda building a more fleshed out example right now

15:25 alive876: so i guess just change name of core.clj to core_prog or something?

15:25 justin_smith: or my-schema.core

15:25 MJB47: typically namespaces are - delimited

15:25 alive876: ok

15:25 justin_smith: this is why java stuff is always com.foo.bar.whatever

15:26 alive876: how does the java thing relate to this?

15:27 i mean how can i use it here?

15:31 justin_smith: alive876: by having a namespace like com.alive876.schema.core

15:31 if you own alive876.com of course

15:32 alive876: ok

15:33 yenda: justin_smith: thanks, suprisingly there is not much info on core.Async online

15:33 BRODUS: can someone help explain why this macro doesn't work

15:33 http://pastebin.com/8zeJazu9

15:34 yenda: *thread

15:34 amalloy: BRODUS: ~@(for ...)

15:35 alive876: i assume the namespace for this at top of file schema/lib/examples.clj be (ns schema.lib.examples) ?

15:36 renart: how do i tell cider that a given REPL connection is a cljs repl?

15:38 BRODUS: amalloy: using that makes sense without the surrounding 'do' since a series of defn's is what I want the output to be. But I didn't think you could use @~ at the outer level of a macro since nothing is being quoted yet

15:39 amalloy: huh? it's still inside your quoted do. `(do ~@(for ...)) is the usual pattern

15:40 justin_smith: yenda: https://gist.github.com/noisesmith/7bfe66ca6f81c2b2eb76 this is a repl session, if you have core.async on the classpath you should be able to replicate it

15:41 BRODUS: ok, that makes sense

15:41 justin_smith: yenda: the idea here is that it starts rq-load real threads for request IO (not just using a core.async thread, those are not for IO), then you can put something on a channel and the first available thread will grab it

15:41 BRODUS: it still doesn't work though, it fails on the 'into' since paths is being treated as a symbol for some reason

15:42 justin_smith: yenda: of course you will probably want to use more than just slurp

15:43 yenda: of course the loop on line 8 is to be replaced by the code that actually processes results (your validator or whatever)

15:45 yenda: and regarding the documentation for core.async, the api is pretty small actually, and once you know the basics (how to create a go block, how to use a channel) the rest are easy to figure out in a repl

15:45 so I personally just use the official api doc https://clojure.github.io/core.async/

15:48 yenda: justin_smith: ok thanks I'm experimenting

16:01 alive876: so now in dataschema/mycore.clj i have (ns dataschema.mycore) (:require [dataschema.lib.examples :refer :all])) and in dataschema/lib/examples.clj i have (ns dataschema.lib.examples) (:require [schema.core :as s :include-macros true ])) but i get ClassNotFoundException: dataschema.lib.examples

16:01 kwladyka: justin_smith, hi. Can you tell me do you use intellij or emacs to work? I know it is subjective, but still i want to know :)

16:02 justin_smith: kwladyka: I've used emacs for decades, but I don't use cider, just clojure mode - you probably don't want to use things the way I do

16:03 alive876: and is that dataschema/lib/examples.clj or src/dataschema/lib/examples.clj?

16:03 because the first one should not work

16:03 kwladyka: justin_smith, thx. Just wanted to know, because what i know about you, you spend a lot of time coding in Clojure and you are very experience :)

16:05 yenda: justin_smith: can I get rid of the goloop since I want to retrieve the threads in order ?

16:05 alive876: well examples.clj is src/dataschema/lib/examples.clj

16:05 and src/datascema/mycore.clj

16:05 justin_smith: yenda: the threads each get multiple results

16:05 alive876: i mean dataschema

16:07 justin_smith: alive876: oh wait (ns dataschema.lib.examples) (:require [schema.core ...])) should be (ns dataschema.lib.examples (:require [schema.core ...]))

16:07 LauJensen: Anybody else only getting outdated versions of Cider from Melpa?

16:07 alive876: ok

16:07 yenda: justin_smith: I meant the request, I have a list of requests and I want a list of results in the same order

16:07 BRODUS: LauJensen: thanks for that link earlier, good explanation

16:08 justin_smith: yenda: there's no go loop for requests

16:09 yenda: potentially you could attach an order to the request, and include the order with the response, to reconstruct later, but I can't see a good way of preserving the order while doing this concurrently otherwise

16:10 yenda: justin_smith: I guess I could just put the request in the response nevermind the order

16:10 I just need to be able to id the request

16:10 LauJensen: BRODUS: Glad you got something out of it

16:11 yenda: but I am still puzzled as how to end the asynchronicity and just end up with a list of results

16:11 since I just wanted to fire the requests all at once

16:12 justin_smith: yenda: if you know how many items you will put on, you can tell the result handler to stop after that many results

16:12 yenda: if you close the request channel, the threads reading it will stop recurring

16:13 alive876: <justin_smith> except for the space in <ns data... they are the same

16:13 justin_smith: alive876: no, they are nested differently

16:13 the (:require ...) has to be inside (ns ...)

16:14 alive876: oh, ok

16:16 yenda: justin_smith: but how can I get a list of the results, is it even possible ?

16:17 justin_smith: yenda: you have a loop consuming the results - it can easily build up the list as it recurs

16:19 and check the size of that list so it knows whether to close the request and results channels and return its result

16:21 yenda: justin_smith: nice I'm starting to get it !*

16:22 can I just return the result and keep the chans for the next list of requests ?

16:23 justin_smith: yenda: whatever you return from the loop ends up being accessible if you read the channel returned by go-loop

16:23 so yes, of course

16:27 alive876: <justin_smith> due to your patience and kind help, it works, thank you!

16:27 justin_smith: alive876: awesome

16:27 alive876: i've made some progress in an area that scares me

16:36 yenda: justin_smith: sorry to bother you again I only changed the go-loop to stop after 4 requests and it just hangs

16:36 https://bpaste.net/show/b2d75030f6e5

16:37 justin_smith: yenda: the loop that is reading results exits immediately and prints an empty list

16:38 your args to >= are backward

16:38 yenda: since the results are not being consumed, the doseq hangs

16:44 yenda: justin_smith: thanks, I guess I'm getting tired because I read this condition over and over again to finally get what was wrong :D

16:45 justin_smith: yenda: the height of the operator follows the expected size of args < - args getting bigger to the right > - args getting smaller to the right

16:45 ,(< 0 1 2 3)

16:45 clojurebot: true

16:45 justin_smith: ,(> 4 3 2)

16:45 clojurebot: true

16:55 TimMc: < and > are still confusing to me sometimes. :-)

16:55 I solve that by always just using < and <= so that I don't have to think about it.

16:55 justin_smith: haha

16:55 TimMc: That way I can just think "these are the relative places on the number line."

16:55 (I've been programming in Clojure for 3+ years.)

16:57 amalloy: i still sometimes imagine the < and > being a crocodile mouth with little teeth on it. crocodiles like to eat bigger numbers, obviously

16:57 ridcully: i am so glad, some pro came out with that

16:57 amalloy: best 3rd-grade mnemonic

16:58 ridcully: my brain totally digs most of all that syntax now

16:58 but those < > just make me stop and think

16:58 justin_smith: amalloy: but doesn't work so nicely for prefix notation

16:58 MJB47: i am 100% wrong to get < > wrong every time

16:58 likely*

16:58 amalloy: honestly it shouldn't really work for infix either

16:58 how does a 1 eat a 5?

16:58 justin_smith: I swear - the height of the symbol is a chart of the expected number maginitude < goes bigger to the right, super simple

16:59 ridcully: i have to place < > between the numbers in my head or else strange things are happening

16:59 MJB47: agreed

16:59 i do that too

17:00 one day ill write a keybind to rearange it for me

17:00 so i can write (a > b) and it rearanges it to (> a b)

17:00 amalloy: scheme has some weird notation that lets you write < and > infix if you want

17:01 i forget what it is. something like (a .>. b)

17:01 MJB47: i saw a library somewhere that lets you do that for clojure

17:01 i forget whats its called

17:01 amalloy: was it the -> library

17:01 ,(-> 5 (> 2))

17:01 MJB47: idts

17:01 clojurebot: true

17:01 amalloy: well of course not. my point was you don't need a dang library, because -> already works

17:02 MJB47: i totally just googled for the -> library...

17:02 god dammit

17:02 im sick and tired have mercy :(

17:22 yenda: I made a nice function out of this async code but I still can't figure out how to get my result. for now I just print it but i would like to return it

17:22 https://bpaste.net/show/616efe2721ac

17:22 justin_smith: yenda: go-loop returns a channel

17:22 yenda: you can read that channel to get the value the go-loop returns

17:24 yenda: \o/ ty justin_smith

17:24 LauJensen: In this example, can anyone work out where DataOverTimeFactory is coming from? https://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/v2/DataOverTime/src/example/MainDemo.java

17:25 TimMc: justin_smith: That's my fallback. :-)

17:27 justin_smith: LauJensen: I think it comes from here https://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/v2/DataOverTime/src/example/DataOverTimeFactory.java?r=12

17:28 LauJensen: in scope since they are both in the package "example"

17:33 LauJensen: justin_smith: Right, which doesn't tell me how they're actually using it, like here. https://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/v2/DataOverTime/src/example/MainDemo.java

18:24 ben_vulpes: does anyone know how to get the equivalent of :init-ns in a weasel repl?

19:33 BRODUS: i want to inspect this particular result i've received http://pastebin.com/5cMg9Xb1 but its not a native clojure datastructure, how do I access the fields of this result?

19:34 justin_smith: BRODUS: you could look at the class, then find that class' javadoc

19:34 sometimes you can just do (bean foo) and that gives you sometihng interesting...

19:35 BRODUS: what does #< ... > mean generally?

19:35 justin_smith: if it has a method getTitle you can do (.getTitle foo) etc.

19:35 BRODUS: it means an unreadable object

19:35 something you can't just output thne read back in again

19:35 ,(Object.)

19:35 amalloy: mostly #< means you are on an old version of clojure too

19:35 clojurebot: #object[java.lang.Object 0x5e59612a "java.lang.Object@5e59612a"]

19:35 justin_smith: amalloy: oh, yeah, that too :)

20:47 zereraz: hi I am a beginner, I was doing clojurescript and used figwheel, I told a friend about it and he said all this was already there, he was talking about hot code swapping. He said he has seen it in java. So is there anything extra or something unique that I am missing?

20:52 wombawomba: how do I keep clojurescript from munging method names on javascript objects when using advanced compilation?

20:52 justin_smith: wombawomba: with an externs file

20:53 wombawomba: justin_smith: I thought I only needed that when accessing things by name... I'm basically just doing `(defn ^:export [my-js-object] (.my-function my-js-object))`

20:54 ...and cljs seems to munge 'my-function'

20:54 justin_smith: zereraz: there are propriatary vms that can do hot-reloads in java, but it's definitely not a standard feature. but I don't think hot reloads is the killer app with clojure - the default immutability and simplicity of code are a bigger deal imho.

20:54 wombawomba: you need externs for the methods and fields in the extern

20:54 zereraz: justin_smith: ok thanks

20:55 justin_smith: wombawomba: err, I mean you need to have declarations for the fields and methods you use in the externs

20:57 wombawomba: justin_smith: any pointers on what the externs file should be for this particular case? I'm having a hard time finding anything useful by googling :(

20:59 justin_smith: wombawomba: window.some_obj = fn () {}; some_obj.someMethod = fn () {}; etc.

20:59 wombawomba: all I seem to find is guides on how to call external libraries, which is not what I'm doing

21:00 justin_smith: the externs file needs to declare every property and method you need to get from an extern

21:02 wombawomba: justin_smith: what if I'm doing `(defn a [x] (.foo x)) (defn ^:export b [y] (.bar y) (a y))` in cljs and `myproject.core({foo: function(){}, bar: function(){}})` in js?

21:02 I wouldn't know what to call the object in the externs file, since it's generated by the library that calls it

21:29 anyone

21:29 ?

23:43 devth_afk: what's the value to check for if a var is unbound? I realize i can do (bound? #'*foo*) but what if i only have access to *foo*'s unbound value and not the var itself?

23:44 justin_smith: devth: how would you get the value of something unbound?

23:44 oh, never mind

23:44 ,(def a)

23:44 clojurebot: #'sandbox/a

23:44 justin_smith: ,a

23:45 clojurebot: #object[clojure.lang.Var$Unbound 0x3bcac607 "Unbound: #'sandbox/a"]

23:45 justin_smith: ,(type a)

23:45 clojurebot: clojure.lang.Var$Unbound

23:45 justin_smith: so there you go

23:45 devth: looks like #<Unbound Unbound: #'ns/*foo*>

23:45 justin_smith: right, it's an instance of Var$Unbound

23:45 devth: ah. so check its type

23:46 ,(instance? clojure.lang.Var$Unbound a)

23:46 clojurebot: true

23:46 devth: cool thx

23:46 justin_smith: ,(= clojure.lang.Var$Unbound (type a))

23:46 clojurebot: true

23:47 devth: a little ugly but it's only for a test case

Logging service provided by n01se.net