#clojure logs

2014-07-19

00:15bryanmaassSo, I'm trying the cider 0.7.0-snapshot kool aid
00:15bryanmaasswhen I start a repl via cider-jack-in (on emacs 24) I get this message:
00:15bryanmaass; CIDER 0.7.0-snapshot (Java 1.7.0_51, Clojure 1.5.1, nREPL 0.2.3, cider-nrepl 0.7.0-snapshot)
00:15bryanmaassWARNING: The following required nREPL ops are not supported:
00:15bryanmaassmacroexpand macroexpand-1 macroexpand-all resource
00:15bryanmaassPlease, install (or update) cider-nrepl 0.7.0-snapshot and restart CIDER
00:19bryanmaassHere's the plugins k/v from my project.clj :plugins [[weavejester/cider-nrepl "0.7.0-SNAPSHOT"]]
00:24jeremyheilerwhy aren't you using the cider/cider-nrepl one?
05:03pholeyhas anybody here used lazybot? (clojure ircbot), i've been trying to get him to run commands, but have been failing awfully
05:04pholeyhttps://github.com/Raynes/lazybot
05:04pholey@help
05:05pholeyi see clojurebot in here, i mainly want the repl service it offers
05:10AimHere,(+ 3 4)
05:10clojurebot7
05:10AimHere&(+ 3 4)
05:10lazybot⇒ 7
05:10AimHereBoth bots working as intended
05:12pholeyah, finally something
05:13pholeyi've been trying to get him set up on my own channel
05:13pholeygranted, that something was a security error, but i think that is fixable
05:15pholeythere we are, thanks!
05:57TurkActivist240 Gaza targets attacked since Thursday: Israeli army http://www.aa.com.tr/en/news/361136--240-gaza-targets-attacked-since-thursday-israeli-army
06:26luxbockhow would I write this macro without eval? https://gist.github.com/luxbock/8784c3b80111825802e2
06:26luxbockit works as I want atm
06:29Chousukeluxbock: that ~ in front of m seems extra
06:29Chousukeand then you should be able to remove one layer of quasiquoting
06:30mthvedtluxbock: macros are like any other fn, you can execute code that makes code and return it directly
06:30mthvedtthere’s no rule that says “macros have to use syntax quoted templates"
06:30luxbockChousuke: that's what I tried at first but it complains about `m` being a symbol in that case
06:31luxbockmthvedt: so you are basically saying that my appraoch is fine?
06:31Chousukehm
06:31ChousukeI'd need a clojure repl
06:31mthvedtluxbock: no, you have an extra layer of templating and an eval
06:32mthvedtso you’re just wrapping a template then unwrapping it with eval
06:32Chousukeluxbock: wait, you're passing a variable to the fns-from-map macro instead of a literal map?
06:33Chousukeif that's the case you will need eval. no way around it.
06:33Chousukesince you need to eval the variable to get at the actual map structure :p
06:34mthvedt,(doc resolve)
06:34mthvedtwhat’s the thing for
06:34mthvedtdocumentation
06:34clojureboteval service is offline
06:35mthvedt&(doc resolve)
06:35lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
06:35mthvedt=/
06:36luxbockI updated the gist with how I'd like to use it
06:36mthvedtluxbock: use resolve to get the map
06:36Chousukeyeah, you'll need to manually resolve the symbol into the map in the macro
06:37luxbockok, I did not know about resolve
06:37Chousukewell, a (let [map (eval m)] ...) should do
06:37Chousukeexcept not map
06:38Chousukebut something that doesn't shadow the function :P
06:38mthvedteval is evil
06:39Chousukeyou can do a resolve and deref too but it's not that different in this case.
06:41luxbockI don't think I know how to use this: `(do ~@(map named-fn (resolve m))) <-- still isn't working
06:43luxbockI tried a few different ways to use it but no luck
06:45Chousukeluxbock: https://gist.github.com/Chousuke/be7c9ad94c314c51a16b untested
06:45Chousukeinstead of eval you can use @(resolve m)
06:46luxbockah
06:46Chousukealso I made a typo. that should be amap as a parameter to the map, not m
06:46luxbockyeah that works, thanks
10:21john2xgeting java.lang.IllegalAccessError: in-seconds does not exist, compiling:(ring/middleware/cookies.clj:1:1)..
10:22john2xit seems ring is depends on clj-time 0.6.0 which has `in-secs`, but in its source it's using `in-seconds` from 0.7.0
10:23john2xhow do I work around this?
10:25mthvedtjohn2x: add 0.7.0 to project.clj
10:35john2xmthvedt: thanks
12:01benkayi'm attempting to implement a datomic query using the :with functionality so that i can get a 'bag' instead of a 'set' of results for aggregating, but i'm having trouble wrapping my tiny little brain around the example in Day of Datomic and how to make that work with a database. it's probably a simple mistake that i'm making, but i can't quite figure out how to make this function work: https://www.refheap.com/88366
12:02benkayspecifically, i'm having trouble with the binding of the data store and the queried entity ID.
12:03benkayoh. *sigh*. PEBKAC.
12:22donkey_boyburn all jews in oven
12:22donkey_boydeath to infidels
12:22donkey_boygod bless allah
12:22donkey_boyallahu akhbar
12:22donkey_boyi throw stones to jews
12:23nobodyzzzwtf?
12:23donkey_boy?
12:23donkey_boyCLOJURE IS INFIDEL PROGRAMMING LANGUAGE
12:23donkey_boyI THROW STONES TO JEWS
12:23donkey_boyMY STONES CRUSH ISRAELI TANKS
12:23donkey_boyi am a holy warrior of allah
12:24nobodyzzzlol ok
12:24systemfaultWow, that retard isn’t even a bot.
12:24systemfaultGotta admit he’s dedicated to his shitty cause.
12:24Bronsatechnomancy: ^
12:24systemfaulttechnomancy: Yo, time to take out the garbage man :(
12:25donkey_boyALLAHU AKHBAR
12:25systemfaultWow, he’s from Finland… expected egypt
12:26donkey_boyyes but i am mohammed hussein 16 year old palestinian boy
12:27nobodyzzzhttp://cdn.ebaumsworld.com/picture/Antfish/poster84762152.jpg
12:52caternwhy does this happen to #clojure
12:52caternWHY
12:53hyPiRioncatern: It's been a very long time since last incident really
12:53caternthere are never incidents in the other large channels i'm in
12:54hyPiRioncatern: There was one in #haskell 2 days ago – not sure if you frequent there or not
12:54caternok ok fine
12:55caternwe are not above the base rate of bots and crazy things being said
13:00bbloomsometimes i'm impressed by the crazy
13:00bbloomi don't think i could even invent such stupid shit to say
13:36Shayanjmhas anyone implemented a k-means algorithm on text data in clojure before?
13:45JaoodIs there anything wrong in using ns within the repl?
13:47Jaoodis easier than doing in-ns and the referring to clojure.core
13:48awwaiidJaood: I see nothing at all wrong with using ns within the repl -- easily lets you jump into the existing ns of your code for example
13:49Jaoods/the/then/
13:49Jaoodawwaiid: ok
13:50jeremyheilertho. just ns'ing into one of your namespaces doesn't require it
13:50Jaoodjeremyheiler: that was my next question ;)
13:51ShayanjmJaood: if you want to test one ns within the context of another, just use (use 'namespace)
13:54JaoodShayanjm: yeah, I do that all the time from the user ns in the repl but was wondering of a workflow for developing a library
13:55JaoodI wonder why switching to a ns doesn't require the ns itself, any reaons?
13:56jeremyheilerJaood: i generally just work from separate namespace when working on a library, and reload the library namespace when i need to
13:56jeremyheilerJaood: well, switching is different than requiring :-)
14:00Jaoodjeremyheiler: yeah I guess requiring/referring to you lib in the user ns and working from there with :reload is not a bad workflow
14:02jeremyheilerJaood: check this out http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
14:03Jaoodjeremyheiler: was figuring out how to the cider thing manually, in cider when you evaluate a form it switches the repl to ns where the form was and also requires/refers it
14:04Jaoodcool
14:05jeremyheileri suppose from cider, you would have the namespace you care about open in another buffer and would do C-c C-l to load it
14:51timsgAnyone know how to intercept *warn-on-reflection*’s warnings? They don’t seem to be on either *out* or *err*
14:54bbloomtimsg: they are definitely written to *err*
14:54bbloomsomething else must be capturing that, maybe your repl/edit/whatever
14:58timsgbbloom: yeah I think I was positioning something incorrectly
15:18ro_stwhere should i look to find out how i might stream a `tail -f logfile` to a web browser? i'm using HTTP SSE which is already working. i need the magic to do the tail and stream the output somehow
15:19ro_stcurrently using clojure.java.shell/sh but will probably have to use something else
15:19boxedif it ain’t broke, don’t fix it?
15:22ro_staha looks like https://github.com/hozumi/clj-commons-exec has a stream option for :out
15:24fifosineWhat are the differences between seq, list, and vector?
15:24ro_sthttp://clojure.org/data_structures http://clojure.org/sequences
15:25ro_stseq is an abstraction. list and vector are two implementations of seq
15:25ro_stwith different semantics and performance characteristics
15:27fifosinero_st: Ok, thanks.
15:45timsgare type-hints resolved before macroexpansion?
15:48justin_smithtimsg: yes, they are reader-macros
15:49bbloomhuh? what? no
15:49bbloommetadata is not evaluated
15:49bbloomat least not immediately
15:49bbloom,^{:x (prn 1)} []
15:49clojurebot1\n[]
15:49bbloom,(quote ^{:x (prn 1)} [])
15:49clojurebot[]
15:49Bronsawell depends where it's attached to
15:50Bronsametadata on the def symbol IS evaluated
15:50bbloomright, but that's after expansion
15:50Bronsayeah
15:50bbloomtimsg: macroexpansion and the compiler are orthogonal
15:51bbloomyou can macroexpand w/o compiling, and the type hints are entirely ignored unless the macro itself does something with it
15:51fifosineIs there a higher-order function that takes a function, a value, and a predicate and executes the function on the value until the predicate is false?
15:51fifosine(continually execing func on return of last func call)
15:51fifosineI know I can write one, I'm just curious if it already exists
15:53timsgbbloom: I ask because, in what’s probably a bad idea anyway, we’re seeing if we can macro away some redundant type hints for a particular interop situation on Clojure-CLR…
15:54bbloomtimsg: what is a "redundant type hint"
15:54bbloomyou mean like at multiple places?
15:54bbloomie you want type inference?
15:56timsgbbloom: There’s a kind of strange API in Unity where you lookup components in game entities by their type. My understanding is it always returns an instance of that type, but then you have to type-hint that, too, so you wind up typing (keyboard) the type (semantic) twice; which some find onerous.
15:56timsgbbloom: ya type inference would be nice
15:56timsgbbloom: this is kind of a stupid hack in the absence of stronger type inference
15:56bbloomdo you only want *local* type inference? ie C#'s var?
15:57bbloomand is it only for initialization of locals?
15:58timsgRather than (… ^FancyComponent (.GetComponent entity FancyComponent)), we would like (get-component entity FancyComponent) to work without reflection
15:58clojurebotPardon?
15:58bbloomtimsg: ok, gotcha
15:58bbloomhm...
16:00bbloom,(defmacro m [hint & xs] (with-meta `(~@xs) {:tag hint}))
16:00clojurebot#'sandbox/m
16:00bbloom,(let [x ^long (inc 5)] x) ; works
16:00clojurebot6
16:00bbloom,(let [x ^int (inc 5)] x) ; fails
16:00clojurebot#<VerifyError java.lang.VerifyError: (class: sandbox$eval76, method: invoke signature: ()Ljava/lang/Object;) Expecting to find integer on stack>
16:00bbloom,(let [x (m long inc 5)] x) ; also works
16:00clojurebot6
16:00bbloom,(let [x (m int inc 5)] x) ; also fails
16:00clojurebot#<VerifyError java.lang.VerifyError: (class: sandbox$eval124, method: invoke signature: ()Ljava/lang/Object;) Expecting to find integer on stack>
16:01bbloomtimsg: does that solve your problem? you just have a macro AND a function
16:02bbloom,(defmacro m [hint & xs] (with-meta xs {:tag hint}))
16:02clojurebot#'sandbox/m
16:02bbloom,(let [x (m long inc 5)] x) ; also works
16:02clojurebot6
16:02bbloomi didn't need the `(~@...) but it was illustrative :-)
16:02timsgbbloom: think I tried that but my syntax was a little different, I’ll check against CLR
16:03bbloombut yeah, that should cover the very limited case of inferring the type when the type name appears on the rhs
16:37bbloomtimsg: success?
17:08timsgbbloom: sorry about pause, yep, much success, just verified. Think this is what we were looking for: https://www.refheap.com/88374
17:08timsgthanks for help!
17:09timsgbbloom: the type inferencer is less broken than we’d somehow made it seem, so now the macro’s really just abbreviating type-args, a quirk of Clojure-CLR and C# generic methods.
17:10bbloomtimsg: ah, yes, reified generics
17:11timsgbbloom: unfamiliar but nifty feature. C#’s a lot more fun than Java
17:19andonilssonTrying to learn some clojurescript, but having problems with the build.
17:19andonilssonI have a combined clj/cljs project. When running 'lein cljsbuild', all that is written to my js output file is:
17:19andonilssongoog.addDependency("base.js", ['goog'], []);
17:19andonilssonIsn't cljsbuild picking up my src-cljs directory, or what could be the problem?
17:33andonilssonhmm...could've been some issue with compiler settings :optimizations :none...
18:00andonilssonnote to self: next time, remember to verify that clojurescript files are named .cljs, and NOT .clj
18:20mdeboardandonilsson: :P
18:33bzzzwas wondering, what's the best lightweight web framework for clojure
18:33bzzzI just want a web server that I can develop a RESTful api on, the rest is going to be in javascript with React
18:34bzzzcurrently checking out luminus, but it's based on clojure 1.3.0, what gives? why isn't it using the latest?
18:35jeremyheilerbuzz: check out compojure
18:36jeremyheilerand check out ring, which is the http abstraction that most clojure-based web apps use.
18:36Frozenlockbzzz: compojure + liberator is probably your best option
18:37jeremyheilermost things, including compojure, are build on ring.
18:37jeremyheilerbuilt*
18:37bzzzFrozenlock: is there a simple template I can download? like lein new comp-lib blah
18:39Frozenlockbzzz: there is one for compojure https://github.com/weavejester/compojure/wiki/Getting-Started
18:40Frozenlockbzzz: do you intend to use cljs, or simply js?
19:55irctcHi clojure friends, I have a question about compiling clojure projects. I know it is possible to turn all my .clj files into .class files. However, does anyone know an easy way of turning all .clj files in the dependency libraries into .class files too? (so that the resulting jar will not have any .clj files.) Thanks in advance!
21:03cyanseahi all, clojure and functional programming newbie here, having only really programmed in VB. when debugging i like stepping through my code and watch the state changes of my locals. i understand that there arent any state changes with functional programming but is there some way step through a function call to see how elements in a sequence are passed around and binded. i am having trouble understanding how data moves through functions
21:03cyanseathat have many other functions nested. thanks in advance for any help!
21:05jeremyheilercyansea: your best bet is to use the cursive plugin for intellij.
21:05jeremyheilerhttps://cursiveclojure.com/
21:07cyanseawould you say this is an effective way to learn clojure to understand how data moves through a function, or is there a better way with regards to clojure and functional programming?
21:07bbloomcyansea: nothing against graphical debuggers, but you may want to try to program with your REPL on hand
21:07cyanseaand thanks for the link, i will check it out
21:07jeremyheileri'd say it isn't. break apart each function call and see what it otuputs
21:08jeremyheilerin a repl, like bbloom said
21:08bbloomgenerally, you have lots of small functions without side effects, so you can just test them instantly in your repl
21:08bbloomcyansea: if you're used to the Intermediate window or Edit & Continue in VB, then you're half way to a good Clojure workflow
21:08cyanseaso basically work inside out?
21:09bbloomthe primary value of a debugger is that it lets you climb inside the environment as it's running, and see what exactly is going on
21:09bbloombut a major benefit of functional programming is that you can break up your system in to small enough parts that you can look at them in isolation
21:10bbloomsuch that you can use the scientific method to find the issue, without lots of extraneous noise of a running system
21:10cyanseayeah that defintely makes sense
21:11bbloomLightTable's inline evaluation & "instarepl" are great for beginners
21:11bbloomespecially if you're used to Visual Studio
21:12bbloom(or worse: that weird VBA IDE thing... *cringe*)
21:12cyanseai am currently using lighttable but i am not used to having the whole function evaluated all at once
21:12cyanseaor i could just not be using it effectively
21:12bblooma common trick is to put a big (comment ...) block at the bottom of your file
21:13bbloomthen you can evaluate a test form quickly
21:13bbloomfor example: https://github.com/clojure/clojure/blob/master/src/clj/clojure/zip.clj#L281-L318
21:14cyanseainteresting, this is all really good info
21:14bbloomlighttable will do the load-file & refer stuff for you automatically when you eval the file
21:20cyanseathanks again all, i will most likely come back with more questions as i progress