#clojure logs

2015-12-20

00:03rhg135that was odd
00:10devthawesome, lein won't compile: "Parameter declaration missing". time to binary search this thing
00:10justin_smithdevth: that means a let without the [] block
00:10justin_smithor fn without []
00:11devththat's what i thought but i can't find it
00:11justin_smithno, it's not the let, it's the fn
00:11devthit's a pretty huge diff
00:11devthi also changed a bunch of bindings
00:11devthin the middle of a huge change :(
00:11justin_smithlet does "wrong number of args", so it's an fn call
00:11devthk
00:11devthreally wish the stack trace told me which file :(
00:12justin_smithdevth: 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
00:12devthah, good idea
00:14devth± git diff | grep fn | wc -l
00:14devth 103
00:14devthlol
00:14rhg135finally done: https://www.refheap.com/112941 critisize away ;)
00:15devthbtw `lein run -m clojure.main` hit the same error
00:15devthwouldn't start up
00:16justin_smithit should not be loading any of your namespaces...
00:16justin_smithlet 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
00:17devthhm
00:18devthi see it loaded my namespaces. even produced a few logs
00:18justin_smithumm... lein run -m clojure.main should not be doing any of that...
00:18justin_smithI mean lein run will, if you don't provide that arg
00:18devthi see a bunch of dep conflict warnings, then "Compiling yetibot.core.init "
00:19devthLeiningen 2.5.3 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM
00:20justin_smithdevth: if you actually provide -m clojure.main as args, it will not load any of your namespaces
00:20devthwelp not sure what's going on because that's exactly what i'm running
00:21justin_smithdevth: what about lein check - that explicitly says what ns it is loading as it loads each one
00:22devthsame. is this because i have aot set?
00:22rhg135yup
00:22devthcrap
00:22justin_smith(dec aot)
00:23devtho really? i've been out of clj for awhile. what happened
00:24justin_smithaot tells lein to aot compile your namespace before running anything else
00:24justin_smithwhich means if your namespace is broken, nothing works
00:24devththat's bad
00:24TEttingerit's not bad if the namespace is needed to run...
00:24justin_smithyeah, I pretty much never use aot, super inconvenient
00:25devthah, lein check helpfully told me exact ns and line number after i turned off aot and used lein check :)
00:25hiredman /win 20
00:25justin_smithyes, it's a nice tool
00:27devthlooks like it was a binding with the 2nd line commented out
00:27devth(map #(binding [*target* %
00:27devththen another binding (commented out) below
00:28devthwhat's wrong with that
00:29devthnvm, it was a defn below that
00:29devthlein was just giving me a slightly wrong line number
00:47arrdemAnyone 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.
00:48justin_smitharrdem: is this something you could do with condp?
00:48TEttingerdevth: 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))
00:48arrdemjustin_smith: maybe the critical thing is that I want to bind the pattern's match.
00:49devthTEttinger: cool but you'd have to add two #_s for a binding pair right?
00:49TEttinger,(let [not-number #_ (+ 1 2 (* 3 5)) "is a string"] not-number)
00:49clojurebot"is a string"
00:49TEttingerto take out two? you could also use the semicolon to comment the line
00:49TEttingeror!
00:49devthin my case the thing on the left ceased to exist
00:49justin_smith,(let [a 0 #_#_ a 42] a)
00:49clojurebot0
00:50arrdemthat's... horrifying
00:50TEttinger,(let [not-number #_ (+ 1 2 (* 3 5)) "is a string" #_(dumb-binding-unwanted nil)] not-number)
00:50clojurebot"is a string"
00:50arrdemI wonder if the Ox parser supports that
00:50TEttingerI prefer to group, the double discard is kinda terrifying yeah but uh does it work? :D
00:51justin_smith,(str #_#_#_ how is this "not reasonable")
00:51clojurebot"not reasonable"
00:51TEttingerhaha
00:51devthwhoa
00:51arrdemlawl
00:51devthi was not aware you could stack them
00:51TEttingerthis is why justin_smith must be preserved at all costs
00:51TEttingercryogenically
00:51justin_smithhaha
00:51TEttingerjustin_smith: what's my last name
00:51justin_smithEttinger
00:51TEttingerwho invented freezing dead/dying people
00:52TEttingercryonics
00:52TEttingerhint, Ettinger
00:52justin_smithHerbert West
00:52justin_smithwait, I don't know
00:52justin_smithhaha
00:52TEttingerRobert Ettinger
00:52TEttingermy dad is a completely different Robert Ettinger
00:52justin_smithI had no idea
00:52TEttingeralso would be in the hilarious wikipedia category of "Atheist Jews"
00:53TEttinger"how specific must we get, wikipedia?"
00:53justin_smithTEttinger: I once did some research on Atheist Muslims
00:53TEttinger"Metrosexual Albanians"
00:53TEttinger"Genderfluid Walnuts"
00:54justin_smithTEttinger: 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
00:54TEttingerwow
00:54justin_smithso they were officially recognized as athiest muslims
00:54TEttingerallatheists
00:55justin_smithno 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
00:55TEttingerhaha is that a reference to the famous madonna and child made from elephant dung?
00:56justin_smithTEttinger: 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)
00:57justin_smithTEttinger: 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
00:58TEttinger(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)
01:01TEttingerit'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)
01:02TEttingerthey're compact and are like a hyper-charged food for athletes, extremely dense calorie nugget
01:03justin_smithTIL elephants poop out hyper dense calorie nuggets
01:03TEttingerjustin_smith: I can't remember, were you on the west coast or austin? I remember there was at least one austinian around here
01:03TEttingeronly if they eat mongongo fruit
01:03justin_smithwest coast
01:04TEttingerwhich taste terrible to people but the nut is the good part
01:04TEttingerthere 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"
01:05TEttingerlike, "are you daft, good sir?"
01:06arrdemhttps://www.refheap.com/112942
01:08TEttinger{:style/indent 1} ; ???
01:09arrdemit's CIDER shit so that the macro will indent nicely
01:09arrdemhttps://github.com/clojure-emacs/cider/blob/master/doc/Indent-Spec.md
01:10justin_smith, (condp re-matches "foo" #"f(.)o" :>> second #"bar" :bar) ; arrdem
01:10clojurebot"o"
01:10arrdemright I forgot about that nice one justin_smith
01:11arrdemI suppose we could bicker about if this should be pattern/binding/form or binding/pattern/form
01:11justin_smitharrdem: 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.
01:12TEttingerwhat is the keyword :>> doing there?
01:13TEttingercondp thing?
01:13justin_smithTEttinger: it gives second something to operate on
01:13arrdemjustin_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
01:13arrdemhttp://conj.io/store/v1/org.clojure/clojure/1.7.0/clj/clojure.core/condp
01:13arrdemTEttinger: ^
01:13justin_smitharrdem: oh, yeah - :>> helps, but isn't everything
01:14TEttingerarrdem: heh, I opened your last link and my computer told me "you're running rather low on memory, puny mortal"
01:14arrdemhah
01:14TEttingercompressing 2.4 million files
01:14arrdemth'fuck
01:14TEttingeralmighty 7zip is amazing
01:15TEttingeris there anything better right now?
01:15TEttingerI saw boost uses lz as a compressed filetype
01:16TEttingerno idea what opens it, in classic boost fashion they don't tell you
01:44tolstoyI hate to say it, but that style/indent thing is kinda nice (for my little mess-around macros for debugging).
01:49tolstoyWow. 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.
01:49tolstoyThat last is really nice feedback. Better than the way SLIME flash/highlighted the whole expression.
01:51arrdemCIDER has gotten _really_ good.
01:51arrdemthe debug-defn is amazing
01:52tolstoyWhat I especially like is that you don't have to notice it's doing anything until you decide to integrate that bit. Opt-in. ;)
01:53tolstoydebug-defn: Is that the intrumented debugger thing?
01:53arrdemyeah 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.
01:53arrdemtolstoy: yeah
01:54tolstoyYeah. 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.
03:24visofhi guys
03:25visofwhat 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?
03:25visofmaybe some efficient binary format, or something
04:06BRODUSBRODUS
04:17kungivisof: how big is "very big"?
04:32visofkungi: maybe 50mb
04:34BRODUSlooking at the output from 'lein deps :tree' is it normal for the exclusion suggestions to suggest I use the older version of a dependency?
04:36lokien_Is it necessary to know java to become a good clojure dev?
04:36MJB47no
04:36MJB47but it helps
04:40lokien_MJB47: with what?
04:40MJB47its quite useful to know the mutable datastructurs java provides, like arrays, arraylists, treemaps etc
04:40MJB47rarely, but ocasionally
04:40MJB47and then there are times when the best solution to a problem is using interop
04:40MJB47like with startsWith
04:41MJB47and then knowledge of how the JVM works really helps with performance issues
04:41MJB47but really
04:41MJB47you can learn all those things as you go
04:41lokien_I know how to do interop, I'm just anxious about making my own java classes/interfaces
04:41MJB47you usually dont need to
04:42lokien_"Usually" or "almost never"?
04:42MJB47the last time i did it was maybe 2 years ago
04:42MJB47and i would argue that was the wrong way to do it in hindsight
04:43lokien_I can live in peace now, thanks
04:53BRODUSi'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?
05:11BRODUSnvm, was reading an old doc. you specify exclusions with :exclusions not :exclusion
06:03oracleI can use (update-in ["1" 2 3] [1] inc)
06:03oracle
06:04oraclebut why can't use (update-in ["1" 2 3] [1] Float/parseFloat)
06:04oracleit throws the error of Caused by: java.lang.RuntimeException: Unable to find static field: parseFloat in class java.lang.Float
06:04oracle
06:06lumabecause java methods aren't clojure functions
06:06luma,(update ["0" 1 2] 0 #(Integer/parseInt %))
06:06clojurebot[0 1 2]
06:06lumayou have to wrap the method call in a function
06:37yendaI 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
06:41yendaI will answer myself with this link http://yogthos.net/posts/2015-12-05-LuminusComponents.html :)
06:45keep_learningHello everyone
06:46keep_learningI am trying to simulate the answer by Prashanth Sams http://stackoverflow.com/questions/663034/can-selenium-handle-autocomplete in Clojure for trip advisor.com
06:46keep_learningFor first two lines
06:47keep_learningdriver.findElement(By.id("your searchBox")).sendKeys("your partial keyword");
06:47keep_learningThread.sleep(3000);
06:47keep_learning(send-keys
06:47keep_learning (find-element {:tag :input, :id "GEO_SCOPED_SEARCH_INPUT"}) city)
06:48keep_learning (implicit-wait 3000)
06:48keep_learningI am facing the problem in By.xpath("your list item locator")
06:49keep_learningI don't know to how to select this list because it's generated dynamically
06:49keep_learningby javascript
06:50keep_learningMy question is how to select the the list item location ?
07:37oracle Did anybody use postal to send email from yahoo?
07:37oracleit throw the exception of Unhandled com.sun.mail.smtp.SMTPSendFailedException
07:37oracle 530 5.7.1 Authentication required
07:37oracle
07:38oraclebut I have pass the username and password
07:55keep_learninghttp://lpaste.net/147502
07:55keep_learningI am getting this weird behaviour
07:55justin_smithluma: 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.
07:55keep_learningThe code was working a moment ago but now I am getting this error and I think the reason is firefox update
07:56keep_learningAny idea on how to solve this problem
07:56j-pbkeep_learning: my guess would be you have some thing like this in your toplevel (selenium-connect)
07:56j-pbtoplevel forms will be evaluated at compile time
07:56j-pbif your selenium is broken now, then that means that this will fail at compile time and prevent compilation
07:57keep_learninghttp://lpaste.net/147503
07:57keep_learningj-pb, I have posted the code
07:58j-pbkeep_learning: is that stuff you do in the repl?
07:59j-pbotherwise your ns declarations are seriously fucked up ^^
07:59justin_smithj-pb: not fucked up, just kind of messy and unconventional
07:59keep_learningj-pb, :) No, I have written that in editor
07:59justin_smithsure, merging into one ns form is cleaner, but what is there works
07:59j-pbuse (ns foo (:require []) (:import [])) :) it will make your life a lot easier
08:00j-pbline 10
08:00j-pbthats where your problem is
08:00j-pbif upgrading firefox broke it
08:00justin_smithj-pb: that's not the cause of the problem
08:00justin_smithoh, the set-driver!, never mind
08:00j-pbyeah, but you almost don't see it in the exploded ns
08:01j-pbkeep_learning: here's what I would try, upgrade selenium to match your new firefox version
08:01j-pbdowngrade firefox
08:01j-pbcleanup you code, so you find shit when it breaks ;P
08:04j-pband put that (set-driver! {:browser :firefox}) into a function so that you can at least start a repl when things go wrong ^^
08:06keep_learningj-pb, Thank you
08:36keep_learninghttp://lpaste.net/147506
08:37keep_learningI have changed the code as suggest but now I am getting error
08:37keep_learning clojure.lang.Keyword cannot be cast to clojure.lang.Symbol
08:40justin_smithkeep_learning: this probably isn't your issue, but you are using import wrong - see this example https://www.refheap.com/112945
08:43justin_smithkeep_learning: your error is on line 3 :ehtml needs to be ehtml
08:43justin_smiththen the next thing is to fix your imports
08:44keep_learningjustin_smith, Thank you
08:59yendaif I need to make simultaneous calls on an API via http, does it make sense to just do them in a pmap ?
09:00justin_smith~pmap
09:00clojurebotpmap is not what you want
09:00yenda:D
09:02justin_smithI 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...
09:03yendajustin_smith: as long as the calls are grouped (not necesseraly all together) it is fine
09:04justin_smithyenda: 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
09:05j-pbyenda: pick a werbserver lib that is capable of doing async calls
09:05yendajustin_smith: it is perfect then I need order
09:05justin_smithj-pb: web client lib?
09:06j-pbjustin_smith: httpkit is both kinda ^^
09:06yendaj-pb: I am consuming an API not serving
09:07j-pbhttp://www.http-kit.org/client.html#async
09:07j-pbyenda: yeah I know, httpkit can do both
09:07j-pbyou do a get you get a future back
09:07j-pband when you want to deref that is your thing
09:08j-pbyou can then process stuff syncrhonously or do a check o nthe future if it's resolved yet and if not process the next one
09:08yendaI 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)
09:09j-pbso what client lib are you using?
09:09justin_smithyenda: 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
09:09yendaso 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
09:09justin_smithyenda: also pmap is lazy
09:09yendajustin_smith: ok maybe that is more problematic
09:10yendaj-pb: clj-http.client
09:11justin_smithyenda: how about core.async (let [results (chan) requests (chan)] (dotimes [i load] (thread (>! results (http/get (<! requests))))) [results requests])
09:11j-pbyenda: httpkit shoud be pretty much a drop in replacement
09:12justin_smiththen after that you line up the requests on the requests chan, and read results from the results chan
09:12j-pbit's the libraries job, why not let the library do it
09:12justin_smithload decides how many threads are being used
09:15yendaIt 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
09:15j-pbtbh the more I used it the less I liked it
09:15j-pbgreat in theory horrible in practive
09:16j-pbeverything becomes hard to debug, after it has gone through the core.async sausage machine
09:17yendafunny that you call it a sausage machine, brave clojure demo it with a hot dog machine
09:17j-pblol
09:17yendaj-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"
09:18j-pbnice ^^
10:22kwladykajustin_smith, do you use intellij or emacs or ... ?
10:22kwladykasorry i am asking directly you, but i know you are very good Clojure programmer. I know you the best from here :)
10:23kwladykaso you spend a lot of time during coding in Clojure
10:23kwladyka:)
10:26yendamhm I'm trying to switch clj-http to http-kit client but it seems I can't use the convenient cookie-store there
10:27galvshey. 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:30sdegutiskwladyka: hmm yes I could see how you'd come to the conclusion that justin_smith is the best Clojure programmer from this channel
10:55ridcullygalvs: with a plain figwheel project, put the css/img/... files in resources/public somewhere and reference them in your .html
10:55ridcullyyou can e.g. use bower and let it put that stuff into resources/public/ext/
11:01keep_learningHello everyone
11:01keep_learningI am trying to fill autocomplete list on trip advisor by following the instruction http://stackoverflow.com/questions/663034/can-selenium-handle-autocomplete
11:02keep_learningof Prashanth Sams
11:02keep_learning (t/set-driver! {:browser :firefox})
11:02keep_learning (t/get-url "https://www.tripadvisor.in/&quot;)
11:02keep_learning (t/send-keys (t/find-element
11:02keep_learning {:tag :input, :id "GEO_SCOPED_SEARCH_INPUT"}) city)
11:02keep_learning (t/implicit-wait 3000)
11:02keep_learningbut I am stuck with how to locate List <WebElement> listItems = driver.findElements(By.xpath("your list item locator"));
11:03keep_learninglist ?
11:04BRODUSare you using a clojure library for selenium or a java library ?
11:05keep_learningBRODUS, I am using clojure library
11:05keep_learningclj-webdriver
11:05keep_learningLet me post the code
11:06keep_learningBRODUS, http://lpaste.net/147511
11:06BRODUSim working on a project using hte same library, i'll see if i can replicate what you're doing
11:07keep_learningBRODUS, It's autocomplete list by ajax
11:08keep_learningI have found couple of links but not able to find/understan the complete solution
11:08keep_learninghttp://blog.buberel.org/2010/07/howto-test-jquery-ajax-autocomplete-menus-with-selenium.html
11:08keep_learninghttp://seleniumeasy.com/selenium-tutorials/working-with-ajax-or-jquery-auto-complete-text-box-using-webdriver
11:11BRODUSkeep_learning: taking a look
11:17yendaanybody here successfuly used cookie with httpkit client ?
11:18BRODUSi'm having trouble just getting the autocomplete to appear, i wonder if it has to be in-focus first
11:21keep_learningBRODUS, Did you run my code ?
11:21keep_learninghttp://lpaste.net/147511
11:21keep_learningThis 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:31kwladykasdegutis, 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:45yendaI 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:46BRODUSkeep_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:48BRODUS".scopedSearchDisplay li" should select the list items
11:50BRODUSkeep_learning: http://pastebin.com/U8zqnQR5
11:59keep_learningBRODUS, Thank you
12:06yendaI read that http-kit doesn't support cookies :(
12:08yendais this still relevant ? http://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io/
12:09yendaI need to do concurrent http calls that require cookies so I think I have to go with core+async + clj-http
12:10yendabut it says blokcing IO will clog the threads
12:27keep_learningBRODUS, How did you figure out (t/click ".scopedSearchDisplay li") ?
12:28BRODUSare you familiar with css selectors?
12:28keep_learningBRODUS, Not much
12:29keep_learningThis is my first web project
12:29BRODUSah, they're pretty crucial for web dev
12:29keep_learningI can see var scopedSearch = javascript function
12:30BRODUSdo you know how to use the browser inspector? i just looked at what element the popup list items where being rendered in
12:30keep_learningBRODUS, Yes
12:30clojurebotNo entiendo
12:31keep_learning var scopedSearch = get_scoped_typeahead(event, this); if(scopedSearch){ scopedSearch.stopStaticSearch(); scopedSearch.startGeoSearch(false); }
12:31BRODUSyou don't need to pay attention to the JS
12:32BRODUSthe container the list items are being rendered in is the div with class scopedSearchDisplay
12:32BRODUSyou can express that via a CSS selector with ".scopedSearchDisplay li"
12:34keep_learningBRODUS, <div style="position: absolute; left: -999em; top: 27px;" class="scopedSearchDisplay geoScopeDisplay whiteCaret"></div>
12:34keep_learningBRODUS, Thank you
12:35keep_learningAny quick link for these kind of things.
12:35BRODUSactually a better expression would be "#GEO_SCOPE_CONTAINER .scopedSearchDisplay li"
12:36BRODUShttps://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started/Selectors
12:38BRODUSthats CSS specific but the selector terminology is used in many utilities that interact with the DOM, not just CSS
13:43LauJensenEvening gentlemen. Im trying to detox from Lighttable. Whats being developed for Emacs these days, cider, clojure-mode? For debugging?
13:44BRODUSi've been using emacs and cider for the past couple weeks, i enjoy it but debugging with cider could be more user friendly
13:45BRODUSwhats lighttable like?
13:45LauJensenIts frustraingly close to good. The built in browser, watches, etc, really rock. The shoddy Emacs-keyboard maps suck and I do miss Macros
13:48BRODUSi'll have to check it out at some point. i love and hate emacs
13:49BRODUSmainly because its so distracting
13:51LauJensenIm 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:59sdegutisyeah LT is a great way to get feet wet with clj
14:00sdegutisI use Cider and Emacs for a few years. It's great.
14:00LauJensenIt is. Though in truth Ive been doing Clojure since its first year, so its relevant for all ages I'd say
14:17BRODUSi want to generate some defns based on some data, can someone point me to an idiomatic way of doing that ?
14:24scottjLauJensen: https://github.com/clojure-emacs/clj-refactor.el/wiki
14:27ridcullyBRODUS: macro or intern maybe? what is the source of this data?
14:30BRODUSa 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:31LauJensenBRODUS: What would the fns do ?
14:32BRODUSthey would make the selenium browser visit a particular path
14:33LauJensenAnd you need fns for that, and not just function calls to selinium?
14:37BRODUSi could, but it would be more verbose
14:39LauJensenOk. 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:41LauJensenGuys 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:41LauJensenBRODUS: 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:46justin_smithLauJensen: nice
14:48scottjLauJensen: if you call (package-initialize) in .emacs they will be added to load-path
15:00alive876_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:01alive876_however i get an error
15:02MJB47remove the '
15:02alive876_ok
15:02MJB47and in the file its :require
15:02MJB47in the ns declaration
15:02alive876_ok
15:05justin_smithalive876_: that require will work in a file - what's the error?
15:12yendajustin_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:13justin_smithyenda: yes, and I might have left out the loop inside the async thread too
15:14justin_smithyenda: it was just a very rough sketch
15:15justin_smithyenda: 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:21alive876newbie 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:21MJB47you cant have 2 namespaces requiring each other
15:21MJB47its a circular dependency
15:22alive876ok
15:22justin_smithalive876: you are shadowing prismatic's schema lib - I assume schema.lib.examples needs the actual prismatic schema.core
15:22justin_smithand that circular dependency is a problem too, yes
15:22LauJensenscottj: My goodness, how did I miss that? :) I had it too far down in my .emacs
15:22MJB47you 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:23justin_smithalive876: 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:23yendajustin_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:23justin_smithyenda building a more fleshed out example right now
15:25alive876so i guess just change name of core.clj to core_prog or something?
15:25justin_smithor my-schema.core
15:25MJB47typically namespaces are - delimited
15:25alive876ok
15:25justin_smiththis is why java stuff is always com.foo.bar.whatever
15:26alive876how does the java thing relate to this?
15:27alive876i mean how can i use it here?
15:31justin_smithalive876: by having a namespace like com.alive876.schema.core
15:31justin_smithif you own alive876.com of course
15:32alive876ok
15:33yendajustin_smith: thanks, suprisingly there is not much info on core.Async online
15:33BRODUScan someone help explain why this macro doesn't work
15:33BRODUShttp://pastebin.com/8zeJazu9
15:34yenda*thread
15:34amalloyBRODUS: ~@(for ...)
15:35alive876i assume the namespace for this at top of file schema/lib/examples.clj be (ns schema.lib.examples) ?
15:36renarthow do i tell cider that a given REPL connection is a cljs repl?
15:38BRODUSamalloy: 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:39amalloyhuh? it's still inside your quoted do. `(do ~@(for ...)) is the usual pattern
15:40justin_smithyenda: 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:41BRODUSok, that makes sense
15:41justin_smithyenda: 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:41BRODUSit still doesn't work though, it fails on the 'into' since paths is being treated as a symbol for some reason
15:42justin_smithyenda: of course you will probably want to use more than just slurp
15:43justin_smithyenda: of course the loop on line 8 is to be replaced by the code that actually processes results (your validator or whatever)
15:45justin_smithyenda: 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:45justin_smithso I personally just use the official api doc https://clojure.github.io/core.async/
15:48yendajustin_smith: ok thanks I'm experimenting
16:01alive876so 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:01kwladykajustin_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:02justin_smithkwladyka: 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:03justin_smithalive876: and is that dataschema/lib/examples.clj or src/dataschema/lib/examples.clj?
16:03justin_smithbecause the first one should not work
16:03kwladykajustin_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:05yendajustin_smith: can I get rid of the goloop since I want to retrieve the threads in order ?
16:05alive876well examples.clj is src/dataschema/lib/examples.clj
16:05alive876and src/datascema/mycore.clj
16:05justin_smithyenda: the threads each get multiple results
16:05alive876i mean dataschema
16:07justin_smithalive876: oh wait (ns dataschema.lib.examples) (:require [schema.core ...])) should be (ns dataschema.lib.examples (:require [schema.core ...]))
16:07LauJensenAnybody else only getting outdated versions of Cider from Melpa?
16:07alive876ok
16:07yendajustin_smith: I meant the request, I have a list of requests and I want a list of results in the same order
16:07BRODUSLauJensen: thanks for that link earlier, good explanation
16:08justin_smithyenda: there's no go loop for requests
16:09justin_smithyenda: 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:10yendajustin_smith: I guess I could just put the request in the response nevermind the order
16:10yendaI just need to be able to id the request
16:10LauJensenBRODUS: Glad you got something out of it
16:11yendabut I am still puzzled as how to end the asynchronicity and just end up with a list of results
16:11yendasince I just wanted to fire the requests all at once
16:12justin_smithyenda: if you know how many items you will put on, you can tell the result handler to stop after that many results
16:12justin_smithyenda: if you close the request channel, the threads reading it will stop recurring
16:13alive876<justin_smith> except for the space in <ns data... they are the same
16:13justin_smithalive876: no, they are nested differently
16:13justin_smiththe (:require ...) has to be inside (ns ...)
16:14alive876oh, ok
16:16yendajustin_smith: but how can I get a list of the results, is it even possible ?
16:17justin_smithyenda: you have a loop consuming the results - it can easily build up the list as it recurs
16:19justin_smithand check the size of that list so it knows whether to close the request and results channels and return its result
16:21yendajustin_smith: nice I'm starting to get it !*
16:22yendacan I just return the result and keep the chans for the next list of requests ?
16:23justin_smithyenda: whatever you return from the loop ends up being accessible if you read the channel returned by go-loop
16:23justin_smithso yes, of course
16:27alive876 <justin_smith> due to your patience and kind help, it works, thank you!
16:27justin_smithalive876: awesome
16:27alive876i've made some progress in an area that scares me
16:36yendajustin_smith: sorry to bother you again I only changed the go-loop to stop after 4 requests and it just hangs
16:36yendahttps://bpaste.net/show/b2d75030f6e5
16:37justin_smithyenda: the loop that is reading results exits immediately and prints an empty list
16:38justin_smithyour args to >= are backward
16:38justin_smithyenda: since the results are not being consumed, the doseq hangs
16:44yendajustin_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:45justin_smithyenda: the height of the operator follows the expected size of args < - args getting bigger to the right > - args getting smaller to the right
16:45justin_smith,(< 0 1 2 3)
16:45clojurebottrue
16:45justin_smith,(> 4 3 2)
16:45clojurebottrue
16:55TimMc< and > are still confusing to me sometimes. :-)
16:55TimMcI solve that by always just using < and <= so that I don't have to think about it.
16:55justin_smithhaha
16:55TimMcThat way I can just think "these are the relative places on the number line."
16:55TimMc(I've been programming in Clojure for 3+ years.)
16:57amalloyi still sometimes imagine the < and > being a crocodile mouth with little teeth on it. crocodiles like to eat bigger numbers, obviously
16:57ridcullyi am so glad, some pro came out with that
16:57amalloybest 3rd-grade mnemonic
16:58ridcullymy brain totally digs most of all that syntax now
16:58ridcullybut those < > just make me stop and think
16:58justin_smithamalloy: but doesn't work so nicely for prefix notation
16:58MJB47i am 100% wrong to get < > wrong every time
16:58MJB47likely*
16:58amalloyhonestly it shouldn't really work for infix either
16:58amalloyhow does a 1 eat a 5?
16:58justin_smithI swear - the height of the symbol is a chart of the expected number maginitude < goes bigger to the right, super simple
16:59ridcullyi have to place < > between the numbers in my head or else strange things are happening
16:59MJB47agreed
16:59MJB47i do that too
17:00MJB47one day ill write a keybind to rearange it for me
17:00MJB47so i can write (a > b) and it rearanges it to (> a b)
17:00amalloyscheme has some weird notation that lets you write < and > infix if you want
17:01amalloyi forget what it is. something like (a .>. b)
17:01MJB47i saw a library somewhere that lets you do that for clojure
17:01MJB47i forget whats its called
17:01amalloywas it the -> library
17:01amalloy,(-> 5 (> 2))
17:01MJB47idts
17:01clojurebottrue
17:01amalloywell of course not. my point was you don't need a dang library, because -> already works
17:02MJB47i totally just googled for the -> library...
17:02MJB47god dammit
17:02MJB47im sick and tired have mercy :(
17:22yendaI 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:22yendahttps://bpaste.net/show/616efe2721ac
17:22justin_smithyenda: go-loop returns a channel
17:22justin_smithyenda: you can read that channel to get the value the go-loop returns
17:24yenda\o/ ty justin_smith
17:24LauJensenIn 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:25TimMcjustin_smith: That's my fallback. :-)
17:27justin_smithLauJensen: 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:28justin_smithLauJensen: in scope since they are both in the package "example"
17:33LauJensenjustin_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:24ben_vulpesdoes anyone know how to get the equivalent of :init-ns in a weasel repl?
19:33BRODUSi 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:34justin_smithBRODUS: you could look at the class, then find that class' javadoc
19:34justin_smithsometimes you can just do (bean foo) and that gives you sometihng interesting...
19:35BRODUSwhat does #< ... > mean generally?
19:35justin_smithif it has a method getTitle you can do (.getTitle foo) etc.
19:35justin_smithBRODUS: it means an unreadable object
19:35justin_smithsomething you can't just output thne read back in again
19:35justin_smith,(Object.)
19:35amalloymostly #< means you are on an old version of clojure too
19:35clojurebot#object[java.lang.Object 0x5e59612a "java.lang.Object@5e59612a"]
19:35justin_smithamalloy: oh, yeah, that too :)
20:47zererazhi 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:52wombawombahow do I keep clojurescript from munging method names on javascript objects when using advanced compilation?
20:52justin_smithwombawomba: with an externs file
20:53wombawombajustin_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:54wombawomba...and cljs seems to munge 'my-function'
20:54justin_smithzereraz: 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:54justin_smithwombawomba: you need externs for the methods and fields in the extern
20:54zererazjustin_smith: ok thanks
20:55justin_smithwombawomba: err, I mean you need to have declarations for the fields and methods you use in the externs
20:57wombawombajustin_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:59justin_smithwombawomba: window.some_obj = fn () {}; some_obj.someMethod = fn () {}; etc.
20:59wombawombaall I seem to find is guides on how to call external libraries, which is not what I'm doing
21:00justin_smiththe externs file needs to declare every property and method you need to get from an extern
21:02wombawombajustin_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:02wombawombaI wouldn't know what to call the object in the externs file, since it's generated by the library that calls it
21:29wombawombaanyone
21:29wombawomba?
23:43devth_afkwhat'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:44justin_smithdevth: how would you get the value of something unbound?
23:44justin_smithoh, never mind
23:44justin_smith,(def a)
23:44clojurebot#'sandbox/a
23:44justin_smith,a
23:45clojurebot#object[clojure.lang.Var$Unbound 0x3bcac607 "Unbound: #'sandbox/a"]
23:45justin_smith,(type a)
23:45clojurebotclojure.lang.Var$Unbound
23:45justin_smithso there you go
23:45devthlooks like #<Unbound Unbound: #'ns/*foo*>
23:45justin_smithright, it's an instance of Var$Unbound
23:45devthah. so check its type
23:46devth,(instance? clojure.lang.Var$Unbound a)
23:46clojurebottrue
23:46devthcool thx
23:46justin_smith,(= clojure.lang.Var$Unbound (type a))
23:46clojurebottrue
23:47devtha little ugly but it's only for a test case