2014-07-19
| 00:15 | bryanmaass | So, I'm trying the cider 0.7.0-snapshot kool aid |
| 00:15 | bryanmaass | when I start a repl via cider-jack-in (on emacs 24) I get this message: |
| 00:15 | bryanmaass | ; 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:15 | bryanmaass | WARNING: The following required nREPL ops are not supported: |
| 00:15 | bryanmaass | macroexpand macroexpand-1 macroexpand-all resource |
| 00:15 | bryanmaass | Please, install (or update) cider-nrepl 0.7.0-snapshot and restart CIDER |
| 00:19 | bryanmaass | Here's the plugins k/v from my project.clj :plugins [[weavejester/cider-nrepl "0.7.0-SNAPSHOT"]] |
| 00:24 | jeremyheiler | why aren't you using the cider/cider-nrepl one? |
| 05:03 | pholey | has anybody here used lazybot? (clojure ircbot), i've been trying to get him to run commands, but have been failing awfully |
| 05:04 | pholey | https://github.com/Raynes/lazybot |
| 05:04 | pholey | @help |
| 05:05 | pholey | i see clojurebot in here, i mainly want the repl service it offers |
| 05:10 | AimHere | ,(+ 3 4) |
| 05:10 | clojurebot | 7 |
| 05:10 | AimHere | &(+ 3 4) |
| 05:10 | lazybot | ⇒ 7 |
| 05:10 | AimHere | Both bots working as intended |
| 05:12 | pholey | ah, finally something |
| 05:13 | pholey | i've been trying to get him set up on my own channel |
| 05:13 | pholey | granted, that something was a security error, but i think that is fixable |
| 05:15 | pholey | there we are, thanks! |
| 05:57 | TurkActivist | 240 Gaza targets attacked since Thursday: Israeli army http://www.aa.com.tr/en/news/361136--240-gaza-targets-attacked-since-thursday-israeli-army |
| 06:26 | luxbock | how would I write this macro without eval? https://gist.github.com/luxbock/8784c3b80111825802e2 |
| 06:26 | luxbock | it works as I want atm |
| 06:29 | Chousuke | luxbock: that ~ in front of m seems extra |
| 06:29 | Chousuke | and then you should be able to remove one layer of quasiquoting |
| 06:30 | mthvedt | luxbock: macros are like any other fn, you can execute code that makes code and return it directly |
| 06:30 | mthvedt | there’s no rule that says “macros have to use syntax quoted templates" |
| 06:30 | luxbock | Chousuke: that's what I tried at first but it complains about `m` being a symbol in that case |
| 06:31 | luxbock | mthvedt: so you are basically saying that my appraoch is fine? |
| 06:31 | Chousuke | hm |
| 06:31 | Chousuke | I'd need a clojure repl |
| 06:31 | mthvedt | luxbock: no, you have an extra layer of templating and an eval |
| 06:32 | mthvedt | so you’re just wrapping a template then unwrapping it with eval |
| 06:32 | Chousuke | luxbock: wait, you're passing a variable to the fns-from-map macro instead of a literal map? |
| 06:33 | Chousuke | if that's the case you will need eval. no way around it. |
| 06:33 | Chousuke | since you need to eval the variable to get at the actual map structure :p |
| 06:34 | mthvedt | ,(doc resolve) |
| 06:34 | mthvedt | what’s the thing for |
| 06:34 | mthvedt | documentation |
| 06:34 | clojurebot | eval service is offline |
| 06:35 | mthvedt | &(doc resolve) |
| 06:35 | lazybot | java.lang.SecurityException: You tripped the alarm! resolve is bad! |
| 06:35 | mthvedt | =/ |
| 06:36 | luxbock | I updated the gist with how I'd like to use it |
| 06:36 | mthvedt | luxbock: use resolve to get the map |
| 06:36 | Chousuke | yeah, you'll need to manually resolve the symbol into the map in the macro |
| 06:37 | luxbock | ok, I did not know about resolve |
| 06:37 | Chousuke | well, a (let [map (eval m)] ...) should do |
| 06:37 | Chousuke | except not map |
| 06:38 | Chousuke | but something that doesn't shadow the function :P |
| 06:38 | mthvedt | eval is evil |
| 06:39 | Chousuke | you can do a resolve and deref too but it's not that different in this case. |
| 06:41 | luxbock | I don't think I know how to use this: `(do ~@(map named-fn (resolve m))) <-- still isn't working |
| 06:43 | luxbock | I tried a few different ways to use it but no luck |
| 06:45 | Chousuke | luxbock: https://gist.github.com/Chousuke/be7c9ad94c314c51a16b untested |
| 06:45 | Chousuke | instead of eval you can use @(resolve m) |
| 06:46 | luxbock | ah |
| 06:46 | Chousuke | also I made a typo. that should be amap as a parameter to the map, not m |
| 06:46 | luxbock | yeah that works, thanks |
| 10:21 | john2x | geting java.lang.IllegalAccessError: in-seconds does not exist, compiling:(ring/middleware/cookies.clj:1:1).. |
| 10:22 | john2x | it 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:23 | john2x | how do I work around this? |
| 10:25 | mthvedt | john2x: add 0.7.0 to project.clj |
| 10:35 | john2x | mthvedt: thanks |
| 12:01 | benkay | i'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:02 | benkay | specifically, i'm having trouble with the binding of the data store and the queried entity ID. |
| 12:03 | benkay | oh. *sigh*. PEBKAC. |
| 12:22 | donkey_boy | burn all jews in oven |
| 12:22 | donkey_boy | death to infidels |
| 12:22 | donkey_boy | god bless allah |
| 12:22 | donkey_boy | allahu akhbar |
| 12:22 | donkey_boy | i throw stones to jews |
| 12:23 | nobodyzzz | wtf? |
| 12:23 | donkey_boy | ? |
| 12:23 | donkey_boy | CLOJURE IS INFIDEL PROGRAMMING LANGUAGE |
| 12:23 | donkey_boy | I THROW STONES TO JEWS |
| 12:23 | donkey_boy | MY STONES CRUSH ISRAELI TANKS |
| 12:23 | donkey_boy | i am a holy warrior of allah |
| 12:24 | nobodyzzz | lol ok |
| 12:24 | systemfault | Wow, that retard isn’t even a bot. |
| 12:24 | systemfault | Gotta admit he’s dedicated to his shitty cause. |
| 12:24 | Bronsa | technomancy: ^ |
| 12:24 | systemfault | technomancy: Yo, time to take out the garbage man :( |
| 12:25 | donkey_boy | ALLAHU AKHBAR |
| 12:25 | systemfault | Wow, he’s from Finland… expected egypt |
| 12:26 | donkey_boy | yes but i am mohammed hussein 16 year old palestinian boy |
| 12:27 | nobodyzzz | http://cdn.ebaumsworld.com/picture/Antfish/poster84762152.jpg |
| 12:52 | catern | why does this happen to #clojure |
| 12:52 | catern | WHY |
| 12:53 | hyPiRion | catern: It's been a very long time since last incident really |
| 12:53 | catern | there are never incidents in the other large channels i'm in |
| 12:54 | hyPiRion | catern: There was one in #haskell 2 days ago – not sure if you frequent there or not |
| 12:54 | catern | ok ok fine |
| 12:55 | catern | we are not above the base rate of bots and crazy things being said |
| 13:00 | bbloom | sometimes i'm impressed by the crazy |
| 13:00 | bbloom | i don't think i could even invent such stupid shit to say |
| 13:36 | Shayanjm | has anyone implemented a k-means algorithm on text data in clojure before? |
| 13:45 | Jaood | Is there anything wrong in using ns within the repl? |
| 13:47 | Jaood | is easier than doing in-ns and the referring to clojure.core |
| 13:48 | awwaiid | Jaood: 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:49 | Jaood | s/the/then/ |
| 13:49 | Jaood | awwaiid: ok |
| 13:50 | jeremyheiler | tho. just ns'ing into one of your namespaces doesn't require it |
| 13:50 | Jaood | jeremyheiler: that was my next question ;) |
| 13:51 | Shayanjm | Jaood: if you want to test one ns within the context of another, just use (use 'namespace) |
| 13:54 | Jaood | Shayanjm: 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:55 | Jaood | I wonder why switching to a ns doesn't require the ns itself, any reaons? |
| 13:56 | jeremyheiler | Jaood: i generally just work from separate namespace when working on a library, and reload the library namespace when i need to |
| 13:56 | jeremyheiler | Jaood: well, switching is different than requiring :-) |
| 14:00 | Jaood | jeremyheiler: yeah I guess requiring/referring to you lib in the user ns and working from there with :reload is not a bad workflow |
| 14:02 | jeremyheiler | Jaood: check this out http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded |
| 14:03 | Jaood | jeremyheiler: 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:04 | Jaood | cool |
| 14:05 | jeremyheiler | i 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:51 | timsg | Anyone know how to intercept *warn-on-reflection*’s warnings? They don’t seem to be on either *out* or *err* |
| 14:54 | bbloom | timsg: they are definitely written to *err* |
| 14:54 | bbloom | something else must be capturing that, maybe your repl/edit/whatever |
| 14:58 | timsg | bbloom: yeah I think I was positioning something incorrectly |
| 15:18 | ro_st | where 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:19 | ro_st | currently using clojure.java.shell/sh but will probably have to use something else |
| 15:19 | boxed | if it ain’t broke, don’t fix it? |
| 15:22 | ro_st | aha looks like https://github.com/hozumi/clj-commons-exec has a stream option for :out |
| 15:24 | fifosine | What are the differences between seq, list, and vector? |
| 15:24 | ro_st | http://clojure.org/data_structures http://clojure.org/sequences |
| 15:25 | ro_st | seq is an abstraction. list and vector are two implementations of seq |
| 15:25 | ro_st | with different semantics and performance characteristics |
| 15:27 | fifosine | ro_st: Ok, thanks. |
| 15:45 | timsg | are type-hints resolved before macroexpansion? |
| 15:48 | justin_smith | timsg: yes, they are reader-macros |
| 15:49 | bbloom | huh? what? no |
| 15:49 | bbloom | metadata is not evaluated |
| 15:49 | bbloom | at least not immediately |
| 15:49 | bbloom | ,^{:x (prn 1)} [] |
| 15:49 | clojurebot | 1\n[] |
| 15:49 | bbloom | ,(quote ^{:x (prn 1)} []) |
| 15:49 | clojurebot | [] |
| 15:49 | Bronsa | well depends where it's attached to |
| 15:50 | Bronsa | metadata on the def symbol IS evaluated |
| 15:50 | bbloom | right, but that's after expansion |
| 15:50 | Bronsa | yeah |
| 15:50 | bbloom | timsg: macroexpansion and the compiler are orthogonal |
| 15:51 | bbloom | you can macroexpand w/o compiling, and the type hints are entirely ignored unless the macro itself does something with it |
| 15:51 | fifosine | Is 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:51 | fifosine | (continually execing func on return of last func call) |
| 15:51 | fifosine | I know I can write one, I'm just curious if it already exists |
| 15:53 | timsg | bbloom: 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:54 | bbloom | timsg: what is a "redundant type hint" |
| 15:54 | bbloom | you mean like at multiple places? |
| 15:54 | bbloom | ie you want type inference? |
| 15:56 | timsg | bbloom: 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:56 | timsg | bbloom: ya type inference would be nice |
| 15:56 | timsg | bbloom: this is kind of a stupid hack in the absence of stronger type inference |
| 15:56 | bbloom | do you only want *local* type inference? ie C#'s var? |
| 15:57 | bbloom | and is it only for initialization of locals? |
| 15:58 | timsg | Rather than (… ^FancyComponent (.GetComponent entity FancyComponent)), we would like (get-component entity FancyComponent) to work without reflection |
| 15:58 | clojurebot | Pardon? |
| 15:58 | bbloom | timsg: ok, gotcha |
| 15:58 | bbloom | hm... |
| 16:00 | bbloom | ,(defmacro m [hint & xs] (with-meta `(~@xs) {:tag hint})) |
| 16:00 | clojurebot | #'sandbox/m |
| 16:00 | bbloom | ,(let [x ^long (inc 5)] x) ; works |
| 16:00 | clojurebot | 6 |
| 16:00 | bbloom | ,(let [x ^int (inc 5)] x) ; fails |
| 16:00 | clojurebot | #<VerifyError java.lang.VerifyError: (class: sandbox$eval76, method: invoke signature: ()Ljava/lang/Object;) Expecting to find integer on stack> |
| 16:00 | bbloom | ,(let [x (m long inc 5)] x) ; also works |
| 16:00 | clojurebot | 6 |
| 16:00 | bbloom | ,(let [x (m int inc 5)] x) ; also fails |
| 16:00 | clojurebot | #<VerifyError java.lang.VerifyError: (class: sandbox$eval124, method: invoke signature: ()Ljava/lang/Object;) Expecting to find integer on stack> |
| 16:01 | bbloom | timsg: does that solve your problem? you just have a macro AND a function |
| 16:02 | bbloom | ,(defmacro m [hint & xs] (with-meta xs {:tag hint})) |
| 16:02 | clojurebot | #'sandbox/m |
| 16:02 | bbloom | ,(let [x (m long inc 5)] x) ; also works |
| 16:02 | clojurebot | 6 |
| 16:02 | bbloom | i didn't need the `(~@...) but it was illustrative :-) |
| 16:02 | timsg | bbloom: think I tried that but my syntax was a little different, I’ll check against CLR |
| 16:03 | bbloom | but yeah, that should cover the very limited case of inferring the type when the type name appears on the rhs |
| 16:37 | bbloom | timsg: success? |
| 17:08 | timsg | bbloom: sorry about pause, yep, much success, just verified. Think this is what we were looking for: https://www.refheap.com/88374 |
| 17:08 | timsg | thanks for help! |
| 17:09 | timsg | bbloom: 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:10 | bbloom | timsg: ah, yes, reified generics |
| 17:11 | timsg | bbloom: unfamiliar but nifty feature. C#’s a lot more fun than Java |
| 17:19 | andonilsson | Trying to learn some clojurescript, but having problems with the build. |
| 17:19 | andonilsson | I have a combined clj/cljs project. When running 'lein cljsbuild', all that is written to my js output file is: |
| 17:19 | andonilsson | goog.addDependency("base.js", ['goog'], []); |
| 17:19 | andonilsson | Isn't cljsbuild picking up my src-cljs directory, or what could be the problem? |
| 17:33 | andonilsson | hmm...could've been some issue with compiler settings :optimizations :none... |
| 18:00 | andonilsson | note to self: next time, remember to verify that clojurescript files are named .cljs, and NOT .clj |
| 18:20 | mdeboard | andonilsson: :P |
| 18:33 | bzzz | was wondering, what's the best lightweight web framework for clojure |
| 18:33 | bzzz | I just want a web server that I can develop a RESTful api on, the rest is going to be in javascript with React |
| 18:34 | bzzz | currently checking out luminus, but it's based on clojure 1.3.0, what gives? why isn't it using the latest? |
| 18:35 | jeremyheiler | buzz: check out compojure |
| 18:36 | jeremyheiler | and check out ring, which is the http abstraction that most clojure-based web apps use. |
| 18:36 | Frozenlock | bzzz: compojure + liberator is probably your best option |
| 18:37 | jeremyheiler | most things, including compojure, are build on ring. |
| 18:37 | jeremyheiler | built* |
| 18:37 | bzzz | Frozenlock: is there a simple template I can download? like lein new comp-lib blah |
| 18:39 | Frozenlock | bzzz: there is one for compojure https://github.com/weavejester/compojure/wiki/Getting-Started |
| 18:40 | Frozenlock | bzzz: do you intend to use cljs, or simply js? |
| 19:55 | irctc | Hi 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:03 | cyansea | hi 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:03 | cyansea | that have many other functions nested. thanks in advance for any help! |
| 21:05 | jeremyheiler | cyansea: your best bet is to use the cursive plugin for intellij. |
| 21:05 | jeremyheiler | https://cursiveclojure.com/ |
| 21:07 | cyansea | would 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:07 | bbloom | cyansea: nothing against graphical debuggers, but you may want to try to program with your REPL on hand |
| 21:07 | cyansea | and thanks for the link, i will check it out |
| 21:07 | jeremyheiler | i'd say it isn't. break apart each function call and see what it otuputs |
| 21:08 | jeremyheiler | in a repl, like bbloom said |
| 21:08 | bbloom | generally, you have lots of small functions without side effects, so you can just test them instantly in your repl |
| 21:08 | bbloom | cyansea: if you're used to the Intermediate window or Edit & Continue in VB, then you're half way to a good Clojure workflow |
| 21:08 | cyansea | so basically work inside out? |
| 21:09 | bbloom | the 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:09 | bbloom | but 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:10 | bbloom | such that you can use the scientific method to find the issue, without lots of extraneous noise of a running system |
| 21:10 | cyansea | yeah that defintely makes sense |
| 21:11 | bbloom | LightTable's inline evaluation & "instarepl" are great for beginners |
| 21:11 | bbloom | especially if you're used to Visual Studio |
| 21:12 | bbloom | (or worse: that weird VBA IDE thing... *cringe*) |
| 21:12 | cyansea | i am currently using lighttable but i am not used to having the whole function evaluated all at once |
| 21:12 | cyansea | or i could just not be using it effectively |
| 21:12 | bbloom | a common trick is to put a big (comment ...) block at the bottom of your file |
| 21:13 | bbloom | then you can evaluate a test form quickly |
| 21:13 | bbloom | for example: https://github.com/clojure/clojure/blob/master/src/clj/clojure/zip.clj#L281-L318 |
| 21:14 | cyansea | interesting, this is all really good info |
| 21:14 | bbloom | lighttable will do the load-file & refer stuff for you automatically when you eval the file |
| 21:20 | cyansea | thanks again all, i will most likely come back with more questions as i progress |