2013-10-01
| 00:23 | akurilin | Has anybody figured out how to do a parameterized SQL IN clause without using a server-specific data structure such as PG arrays? |
| 00:26 | `cbp | damn reql is not very pleasant to write [an implementation of] |
| 00:29 | Raynes | ambrosebs: Is Bronsa doing the whole contributors agreement for contributions, etc, etc, that is necessary for this to eventually become a part of Clojure? It's interesting, but I sure hope that the thing is actually intended to hopefully replace Clojure's compiler at some point, otherwise it just makes me sad. |
| 00:30 | Raynes | The whole project doesn't even have a license or a mention of one. |
| 00:30 | Raynes | Which is worrisome. |
| 00:32 | Raynes | Oh, I guess you didn't really expect that. |
| 00:33 | Raynes | "Officially replacing the JVM compiler won't happen any time soon. It will take years of experimentation with compilers like Clojurescript and CinC to really nail the "Clojure-in-Clojure" style compilers." |
| 00:33 | Raynes | Well, that sucks. |
| 00:33 | ambrosebs | Raynes: Well it's the ultimate breaking change isn't it? |
| 00:33 | ambrosebs | I don't see anyone taking it lightly |
| 00:34 | ambrosebs | Raynes: yes, I asked Bronsa to organise offering CinC to contrib. |
| 00:35 | Raynes | ambrosebs: Yes, I agree. I was just curious about what the intentions of the funding you're trying to get and his project was. I couldn't tell if it was a "we should fund this cool stepping stone to CinC by this awesome guy, but it is unlikely to ever actually replace Clojure's compiler" vs a "let's help get CinC done, in Clojure, etc" |
| 00:35 | ambrosebs | Raynes: he's confirming with the original author of CinC, who has already said multiple times (but quite awhile ago) that it's going to go to contrib. |
| 00:35 | Raynes | Well, that's good news. |
| 00:35 | Raynes | That's probably the only project I'm actually happy to see go to contrib. :D |
| 00:36 | ambrosebs | Raynes: :D |
| 00:36 | ambrosebs | Raynes: throwing money to CinC can only possibly be a good thing IMO |
| 00:36 | ambrosebs | Raynes: just an awesome project |
| 00:36 | ambrosebs | Raynes: and IMO Bronsa is on a roll, just needs more pushing :) |
| 00:36 | Raynes | Absolutely! Either reason for funding that I listed above was totally valid. |
| 00:37 | ambrosebs | yes all of the above |
| 00:37 | Raynes | Bronsa is a cool chap, indeed. |
| 00:37 | ambrosebs | and a selfish reason, I'm waist deep in analysis all day every day. |
| 00:38 | ambrosebs | so it's also for me. |
| 00:38 | ambrosebs | I'd guess no-one uses JVM analyser more than me. |
| 00:39 | Raynes | :p |
| 00:39 | ambrosebs | Raynes: also, CinC is a very important piece of standardised AST representation across clojure implementations |
| 00:39 | ambrosebs | Raynes: as in, we all need to sit down and work it out. |
| 00:40 | Raynes | Kidnap Rich at the next conj? |
| 00:40 | technomancy | also: it doesn't have to "officially" replace the java compiler for you to use it |
| 00:41 | Raynes | Ugh. |
| 00:41 | ambrosebs | technomancy: exactly. I want the dependency, wherever it is. |
| 00:41 | technomancy | probably a lot to be learned from rubinius, pypy, etc here |
| 00:42 | Raynes | It's great for ambrosebs, but the prospect of multiple popular Clojure compilers makes me nauseous beyond that. |
| 00:43 | `cbp | callen: ping |
| 00:43 | ambrosebs | Raynes: yes, we should revolt against Compiler.java :) |
| 00:44 | ambrosebs | Raynes: the java compiler hasn't changed in years, so it's not like we'll have multiple moving targets. |
| 00:44 | Raynes | ambrosebs: http://www.youtube.com/watch?v=UsnKkXFQYqU |
| 00:44 | ambrosebs | :) |
| 00:44 | Raynes | (this was the first live band I ever saw, opening for KMFDM, amusingly) |
| 00:45 | Raynes | (neither band I was familiar with, I was taken to the show rather spontaneously) |
| 00:46 | glosoli | Anyone here familiar with Emacs and jumping into Java sources from Clojure interop ? |
| 00:46 | glosoli | I am kinda confused if it's something I am missing in my config or what, but any time I try to jump into Java class, I get this http://bpaste.net/show/i18oeBXJ7aZkKpQTNmyL/ |
| 00:47 | callen | `cbp: yes dear? |
| 00:52 | ivan | has anyone build La Clojure recently? IDEA seems to be not seeing any sources in the la-clojure/jps-plugin/src/org/jetbrains/jps/clojure/build/ folder |
| 00:52 | akhudek | how does one return javascript null from a clojure function? |
| 00:52 | akhudek | I thought it was js/null, but that's giving some weird null$ |
| 00:53 | `cbp | callen: you prolly know reql right? and it's pretty much concatenating methods on an object which is not really clojure style i guess. Would it be ok to "redefine" clojure.core functions and macros to get a similar effect and then maybe add a convenience macro that would qualify those functions used inside of it with the corresponding namespace? |
| 00:53 | ambrosebs | akhudek: it's it just nil? |
| 00:53 | ambrosebs | akhudek: oh nvm read that wrong. |
| 00:54 | ambrosebs | akhudek: do you mean in cljs? |
| 00:54 | akhudek | yeah, we have cljs code that needs to return an actual null |
| 00:54 | akhudek | rather than nil |
| 00:56 | akhudek | oh, nevermind, you are right, it is nil |
| 00:56 | `cbp | callen: such that you could do something like (-> (db "test) (table "users") (filter…)) but none of those would be the clojure.core functions |
| 00:56 | `cbp | that wrapped in a (dsl macro or something |
| 01:00 | callen | `cbp: I don't know reql. |
| 01:01 | `cbp | callen: what I wrote would be like db('test').table('users').filter(..) on python, that's pretty much reql and behind it is all the protobuf insanity |
| 01:05 | callen | `cbp: oh sorry forgot rethinkdb's DSL was called reql |
| 01:06 | `cbp | :-o |
| 01:08 | callen | `cbp: I think you should do it like Korma |
| 01:08 | callen | `cbp: build up maps incrementally with db, table, filter functions |
| 01:08 | callen | `cbp: then have an executor fn for actually dispatching it. |
| 01:11 | `cbp | callen: Right now I have https://www.refheap.com/19196 |
| 01:11 | `cbp | is that ok? |
| 01:14 | callen | `cbp: I was thinking of starting from a plain map format, then turning it into protobuf in the executor |
| 01:15 | callen | `cbp: to keep those worlds separate. |
| 01:16 | `cbp | callen: mmk |
| 01:53 | nonuby | is there a lein command to see version number of a package e.g. `lein tell-me-stable-version-available-of midje` returns 1.5.1 |
| 01:57 | callen | nonuby: search clojars? |
| 01:58 | nonuby | meh, means leaving command line, may something similar to node.js `npm install library-name --save` that adds to the project.clj deps vector |
| 02:05 | rasmusto | nonuby: I wonder if there's a lein plugin for it |
| 02:06 | Raynes | $latest midje |
| 02:06 | lazybot | [midje "1.6-beta1"] -- https://clojars.org/midje |
| 02:06 | Raynes | nonuby: ^ |
| 02:06 | Raynes | Won't work for things not on clojars. |
| 02:06 | Raynes | But it exists nontheless. |
| 02:08 | nonuby | $latest compojure |
| 02:08 | lazybot | [compojure "1.1.5"] -- https://clojars.org/compojure |
| 02:08 | nonuby | Raynes, nice! :) |
| 02:09 | holo | hi |
| 02:12 | holo | guys/girls, check this new library: https://github.com/ccfontes/namban . It converts text between hiragana / katakana / romaji (hepburn) / kunrei-shiki. I hope you like it. It's still half quality though |
| 02:13 | rhg135 | There are no girls on irc afaik |
| 02:14 | holo | hey, you never know |
| 02:15 | holo | btw, don't know why but i uploaded a very old version.. how is it possible? that's 2 weeks old source or something |
| 02:16 | nonuby | rhg135, ssshhh... are you trying to get a conference cancelled! |
| 02:16 | glosoli | Damn it got me paranoid, is Emacs nREPL mode supposed to M-. jump into java source files, or this is just my imagination ? |
| 02:16 | rhg135 | Right... |
| 02:22 | tak | /? |
| 02:22 | holo | nie |
| 02:32 | holo | ok, the most recent version is there now |
| 02:36 | seancorfield | Raynes: seems like you could easily extend $latest to also handle Maven Central for org.clojure stuff too? |
| 02:36 | seancorfield | $latest java.jdbc |
| 02:36 | lazybot | No project by this name exists on clojars. |
| 02:38 | seancorfield | url: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.clojure%22%20a%3A%22java.jdbc%22 |
| 02:38 | seancorfield | you could pull the latest version from that...? |
| 02:40 | seancorfield | rhg135: depends on which channel you're in... several of the channels i've been hanging out in lately have "girls"... probably more accurate to say that clojure's community is more swm-dominated than many other tech communities... but i hope we can change that... |
| 02:41 | mtp | there aren't guys on irc either |
| 02:41 | mtp | only nicknames |
| 02:41 | rhg135 | not rly, on most chans im in theres no girls |
| 02:41 | mtp | go to better channels |
| 02:42 | rhg135 | the most notable ones, here #openjailbreak and #teamgelato |
| 02:42 | rhg135 | i have seen girls but the ratio is like 1:1000 |
| 02:42 | mtp | my condolences |
| 02:42 | mtp | i only see nicknames |
| 02:43 | rhg135 | fair enough |
| 02:43 | mtp | does this nickname have a dick or a vagina? wait, who cares |
| 02:43 | mtp | am i trying to get laid on irc or talk about programming |
| 02:43 | rhg135 | i usually assume a guy until proven otherwise |
| 02:43 | nonuby | why does it matter? its shouldnt even factor in, we're here discussing/debating tech, gender is irrelevant, its annoying how programmers have taken it on themselves to declare this a problem (and the sad action that folllow, twitter memes, conference cancellations, discount tickets for female participates etc..) |
| 02:43 | gws | http://cdn.meme.li/i/con66.jpg |
| 02:44 | rhg135 | ya idc |
| 02:44 | nonuby | When was the last time you hear, Im not getting on that Delta flight - 80% of cabin crew are female! |
| 02:44 | rhg135 | i just say ppl |
| 02:45 | rhg135 | not 'guys an girls' |
| 02:45 | nonuby | exactly |
| 02:45 | mtp | nonuby‘ i'm not getting on the flight because heavier-than-air flying machines are impossible |
| 02:45 | holo | conference cancellations? |
| 02:46 | holo | oh ok |
| 02:47 | nonuby | i think britruby was one of them, then there was the incident at pycon because someone told their friend a joke and someone overheard and got swept away in the equality wars, and several others incidents seem to flash by twitter in past few months |
| 02:48 | holo | nonuby, following that logic, did you get into the kinds of studies where >80% of girls are at? |
| 02:49 | nonuby | holo, not sure I follow. |
| 02:49 | dissipate | holo, what, like psychology? |
| 02:49 | holo | you know, language studies … yes psychology |
| 02:51 | nonuby | if I want to study psychology I dont gender would have any influence on admission to course |
| 02:51 | nonuby | I dont -> I doubt |
| 02:51 | dissipate | psychology... a 1 way ticket to working as a barista in Starbucks |
| 02:51 | holo | haha |
| 03:04 | wei_ | I'm using :java-source-paths and it's compiling the java source every run. Is there a way for leiningen to tell if it hasn't changed? |
| 03:04 | wei_ | example to illustrate the issue: https://github.com/yayitswei/leinwithjava |
| 03:05 | nonuby | $latest clj-http |
| 03:05 | lazybot | [clj-http "0.7.7"] -- https://clojars.org/clj-http |
| 03:21 | Raynes | seancorfield: I imagine it wouldn't be terribly difficult. Just that there are much fewer maven-only Clojure repos than there are non-maven-only. |
| 03:38 | seancorfield | you could search maven if clojars has no results :) |
| 03:39 | seancorfield | it would be a nice way to show the contrib libs |
| 03:39 | seancorfield | i guess i could send you a pull request? what's the repo link? |
| 03:47 | dcunit3d | anyone used quil before (clj processing) |
| 03:58 | zanes | Trying to get cljs working with core.async. Creating a channel yields an error of the following form. Thoughts? var c_12392 = <my namespace>.chan.call(null); |
| 03:59 | john2x | dcunit3d: I tried it once, but just as a learning exercise.. |
| 04:37 | ambrosebs | is there a function to get the root value of a var? |
| 04:37 | zanes | Does lein no longer install to .m2 when you lein install? |
| 04:42 | deg | ambrosebs: I don't know of any clean way, but you could pass identity to alter-var-root. |
| 04:48 | amalloy | $findfn #'inc inc |
| 04:48 | lazybot | [clojure.core/deref clojure.core/var-get] |
| 04:49 | amalloy | ambrosebs: lazybot doesn't think such a function exists |
| 04:51 | ambrosebs | amalloy: again a sick usage of findfn. |
| 04:52 | ambrosebs | I just wanted the root binding of a single var so I derefed it an def'ed the result. |
| 04:52 | ambrosebs | (it's a dynamic var) |
| 04:58 | wei_ | zanes: what's the actual error you're getting |
| 04:59 | zanes | wei_: Uncaught TypeError: Cannot call method 'call' of undefined |
| 05:00 | wei_ | are you using go blocks? |
| 05:00 | zanes | Yes. |
| 05:00 | wei_ | clojurescript doesn't have <!! |
| 05:00 | zanes | I'm not using <!!. |
| 05:01 | wei_ | not sure then, sorry. that was my problem initially, but I've since got it working |
| 05:02 | zanes | What version of clojurescript and core.async are you using? Can I see your project.clj? |
| 05:04 | zanes | Oh wow. Is that just the error you get if you reference an undefined variable? |
| 05:05 | ddellacosta | zanes: I see that error a lot when I have a typo and I'm trying to call a function that doesn't exist, or if I am trying to call a var as a function that is not a function, etc. |
| 05:05 | zanes | (I didn't :refer 'chan'.) |
| 05:06 | ddellacosta | ah, there ya go. :-) |
| 05:06 | zanes | That's an incredibly unhelpful error. |
| 05:06 | zanes | ddellacosta: Thanks anyway. |
| 05:07 | ddellacosta | zanes: I find that, in those cases, it is really useful to actually look at the JS that is getting produced. |
| 05:07 | ddellacosta | zanes: if you look at the JS, you'll see that what you have is an object that is calling the "call" property as a function. And so when it's not working, it's pretty clear--if you look at the JS--what is happening. |
| 05:08 | ddellacosta | not ideal I suppose, but you know, on the other hand you're able to write lisp code for browser dev so, tradeoffs. |
| 05:09 | zanes | Oh, totally. It's just unfortunate. |
| 05:09 | jave | I have a funny problem with a mixed java/clojure project |
| 05:10 | llasram | Funny haha? |
| 05:10 | jave | I have a configuration atom that is loaded from a file. It works well in a dev env, but packaged in a jar, the configuration is mysteriously lost |
| 05:11 | jave | more or less this code with some tweaks: https://github.com/jave/btc-coffee/blob/master/src/btc_coffee/core.clj |
| 05:12 | jave | so basically i exposed the load-config fn with gen-class to java. Java calls it, but somehow the atom resets |
| 05:13 | jave | (i havent pushed the java interop code yet because its too ugly for human eyes) |
| 05:15 | llasram | jave: By "expose ... with gen-class", you mean you modify your :gen-class to expose the function as a method? |
| 05:15 | jave | as static |
| 05:16 | jave | #^{:static true} [loadConfig [String] void ] |
| 05:16 | llasram | Ok. FYI, if you control the Java side, you can just use the Java Clojure API to invoke arbitrary Clojure functions |
| 05:16 | jave | I also tested this: (GET "/btc-coffee/reload-config" [] (fn [r] (-loadConfig "/tmp/btc-coffee.clj"))) |
| 05:17 | jave | and if i call loadConfig again, the config doesnt reset |
| 05:17 | jave | so its overall pretty odd |
| 05:18 | jave | llasram: but then a call gets to be pretty long-winded right? |
| 05:18 | llasram | I'm not quite following. Your `load-config` function calls `reset!`, which will, well reset the value of the config atom |
| 05:19 | jave | reset! just ignores the previous value, which is what i want |
| 05:19 | jave | or did i miss something? |
| 05:19 | llasram | jave: Not really (long-winded). Well, no more than any other Java |
| 05:20 | llasram | Yes... I'm just not following either what you're seeing or expect to see :-) |
| 05:20 | zanes | ddellacosta: Hmm. Now it seems to think cljs.core.keyword_identical_QMARK_ is undefined. Ever seen that one? |
| 05:20 | ddellacosta | zanes: that is indeed a new one to me. |
| 05:21 | ddellacosta | what is the clojurescript? if you put it in a refheap I'll take a look |
| 05:21 | jave | llasram: I expect @config to hold my configuration data after loadConfig is called. its slurped from a file. |
| 05:22 | llasram | jave: "if i call loadConfig again, the config doesnt reset" <- I mean, it calls `reset!`. What does and do you expect to happen |
| 05:22 | jave | llasram: okay, i seem to have overloaded the word "reset" confusingly. sorry |
| 05:22 | zanes | ddellacosta: refheap, eh? Is gist not cool any more? |
| 05:23 | jave | llasram: so, in java I do: btc_coffee.core.loadConfig(btcConf); |
| 05:23 | ddellacosta | zanes: ah, gist is fine too. :-) I just know a lot of folks on here use refheap, since it was built by "one of us." |
| 05:23 | ddellacosta | or, "some of us" I guess |
| 05:23 | jave | llasram: afterwards I expect @config to be { blablabla } |
| 05:23 | jave | llasram: instead it is {} |
| 05:24 | zanes | ddellacosta: https://gist.github.com/d3f1d0ca66dabcab70f4 |
| 05:25 | llasram | jave: Ah, ok. Hmm. No obvious ideas, I'm afraid. If you're not getting an exception, can only assume everything is wired up right. Path you're passing contains what you think it does? |
| 05:25 | jave | llasram: path verified yes |
| 05:25 | ddellacosta | zanes: what versions of stuff are you using, the latest? |
| 05:26 | ddellacosta | zanes: and, any idea which line is the one that makes it barf? |
| 05:26 | zanes | ddellacosta: I think I'm using latest core.async (I had to copy it to .m2 manually). |
| 05:26 | zanes | ddellacosta: Using cljs "0.0-1896". |
| 05:27 | ddellacosta | zanes: can you tell me the exact core.async version? |
| 05:27 | zanes | ddellacosta: It's not an actual release. Just master. |
| 05:28 | ddellacosta | hmm…I might try sticking with a specific version if I were you, just to be on the safe side |
| 05:29 | ddellacosta | zanes: hold on, I'm going to try your code locally |
| 05:29 | sm0ke | one quick weird question... can i kill a (go) or (future) block? |
| 05:30 | sm0ke | i want this because the block is waiting on a socket...and i cant set conditional for quitting the block |
| 05:31 | ddellacosta | zanes: also, I'm not sure what you're trying to do--why are you putting a value into a channel in one go block, and then taking the value out in the next? that log line is not going to do anything I don't think |
| 05:31 | llasram | sm0ke: If you've still got the future object, you can try to `future-cancel` it |
| 05:31 | zanes | Why wouldn't that work? |
| 05:31 | ddellacosta | zanes: go blocks return a channel |
| 05:32 | sm0ke | llasram: what do you mean by try? its not sure shot? |
| 05:33 | zanes | ddellacosta: Okay, fine, but it ought to have just logged the channel, no? |
| 05:34 | zanes | ddellacosta: Rather than dying horribly? |
| 05:34 | ddellacosta | zanes: not sure yet, but I suppose not on the dying horribly. :-) |
| 05:34 | ddellacosta | hold on, setting something up now |
| 05:34 | zanes | ddellacosta: Anyway, moving back to the latest stable core.async fixed it. |
| 05:34 | ddellacosta | zanes: ah |
| 05:34 | ddellacosta | zanes: and what does it give you in the console ? |
| 05:35 | ddellacosta | now I'm curious |
| 05:35 | zanes | ddellacosta: The channel. |
| 05:35 | ddellacosta | zanes: ah, haha. Well, there ya go--at least it's doing something now. |
| 05:36 | zanes | Yeah, I'm happy. I suppose there's an art to diagnosing cljs problems by inspecting the js that I'll have to work on. |
| 05:37 | ddellacosta | zanes: I've just done a ton of it 'cause I write a lot of CLJS. It's less an art (in my case at least) than a, "oh, I've seen that ten times, I realize it means X" kinda thing |
| 05:39 | zanes | What are you doing with it (CLJS)? |
| 05:41 | ddellacosta | zanes: building an entire front-end for our legal software startup. |
| 05:44 | zanes | Ooo. |
| 05:49 | deg | I'm looking for a simple example of using enlive (or any other lib) to tweak some html. I need to find a node <script src="xyz.js"> and convert it to <script src="abc.js">, but I'm getting lost in the enlive docs. |
| 05:53 | ddellacosta | deg: what you want is something like (emit* (at (html-resource "somefile.html") [:script] (set-attr :src "abc.js"))) |
| 05:54 | ddellacosta | deg: but depends on your context. The confusing thing about enlive is how it loads up html, turns it into data structures, and makes it back into html. Well, that's one confusing thing about enlive... |
| 05:54 | ddellacosta | deg: if you want to give me a specific example in gist/refheap form I'll take a look |
| 05:54 | deg | Thanks. I have multiple script nodes in the html. How do I select only the one where src=xyz.js? |
| 05:55 | ddellacosta | deg: ah, right…that will require you to do something like [[(html/attr= :src "xyz.js")]]…not sure about the exact syntax |
| 05:56 | ddellacosta | deg: to be clear, that would replace the above, where I have [:script] |
| 05:56 | deg | Hmm, so looks like I'm pretty close. I found attr=, but must not have the syntax right yet. It compiles, but doesn't do anything yet. |
| 05:57 | ddellacosta | deg: the thing that is a bit confusing about the matchers is that you need double brackets [[]] (vector in a vector I guess) |
| 05:58 | ddellacosta | deg: don't know if that's your problem, but it has messed me up in the past. |
| 05:58 | deg | That's probably it. I'll play for a few minutes and post a refheap if I'm still stuck. thanks. |
| 06:00 | ddellacosta | deg: np, good luck! |
| 06:06 | deg | ddellacosta: Yeah, feeling dumb here, but still lost. Here's what I've got: https://www.refheap.com/19201 |
| 06:06 | ddellacosta | deg: okay, one sec |
| 06:16 | ddellacosta | deg: as always, the problem is getting stuff in and out of enlive properly |
| 06:16 | ddellacosta | sorry, one sec, preparing example |
| 06:17 | deg | ok |
| 06:19 | ddellacosta | for example: (html/at (html/xml-resource (clojure.java.io/resource "public/foo.html")) [[:script (html/attr= :src "js/xyz.js")]] (html/set-attr :src "js/abc.js")) |
| 06:19 | ddellacosta | deg: now let me try with template |
| 06:20 | ddellacosta | deg: okay, right--template returns a seq of strings, so you have to do something like this to realize it: (doall ((html/template "public/foo.html" [] [[:script (html/attr= :src "js/xyz.js")]] (html/set-attr :src "js/abc.js")))) |
| 06:21 | ddellacosta | deg: I think I'm not doing something completely idiomatic there w/r/t enlive, but that will work at least. |
| 06:22 | ddellacosta | deg: one thing about template, you don't need to pass it the resource, just a string pointer to the file. |
| 06:22 | ddellacosta | deg: …which by default it will assume is in the resources dir of your project. |
| 06:23 | ddellacosta | deg: you may want to try using deftemplate instead, as it's meant to return a function that you will call with values--that is more idiomatic compared to what I showed you above. |
| 06:24 | ddellacosta | deg: (html/deftemplate swap-js "public/foo.html" [] [[:script (html/attr= :src "js/xyz.js")]] (html/set-attr :src "js/abc.js")) |
| 06:24 | ddellacosta | deg: then you can do (swap-js) |
| 06:25 | ddellacosta | deg: I should write all of this up so there is a cookbook for enlive. It's really hard to get going with that library, but it's promoted as the one to start with. |
| 06:27 | deg | (got called away; back now) |
| 06:28 | deg | I switched to template instead of deftemplate because I want an anonymous function. |
| 06:29 | ddellacosta | deg: ah, okay, in that case you can just use the template example I gave you I guess. |
| 06:29 | deg | My use case is a set of websites that each have dev and production versions. I only want to maintain one copy, so need to inject the dev cruft into each one. |
| 06:30 | ddellacosta | deg: ah, gotcha. I did something similar at one point, using exactly this kind of strategy. |
| 06:30 | ddellacosta | but, why do you want an anon function? |
| 06:31 | deg | I don't want to name the template for each page; just want to map over all the sites, generating the dev sites. |
| 06:32 | ambrosebs | I've used CinC to customise macroexpansion and I don't ever want to go back http://www.youtube.com/watch?v=g2zts1hW19k |
| 06:32 | ddellacosta | deg: sorta understand, but couldn't you just pass in your data to the same template? |
| 06:33 | deg | Hmm, yes, you are right I think. I came from a different mindset and haven't yet really grokked that enlive is creating templates rather than doing immediate html conversions. |
| 06:33 | arnabdeka | Hi guys. New to clojure. In the REPL (both in nrepl inside emacs, or in lein repl) Trying to use repl-utils: |
| 06:34 | arnabdeka | (require 'clojure.contrib.repl-utils) |
| 06:34 | deg | Basically, enlive is huge overkill for what I was doing, and I'm not fully taking advantage of it. Are there any good enlive tutorials anywhere? |
| 06:34 | arnabdeka | And the error I get is: FileNotFoundException Could not locate clojure/contrib/repl_utils__init.class or clojure/contrib/repl_utils.clj on classpath: clojure.lang.RT.load (RT.java:443) |
| 06:34 | arnabdeka | Does repl-utils not come as part of clojure install (do I need to download separately)? |
| 06:34 | ddellacosta | ambrosebs: super cool. Will have to watch it again before I really get it, but definitely seems much simpler using CinC...nice |
| 06:35 | ambrosebs | ddellacosta: it's badass |
| 06:35 | ddellacosta | deg: did you see David Nolen's? It's got some good stuff: https://github.com/swannodette/enlive-tutorial |
| 06:36 | deg | ddellacosta: Yes, looked quickly at that one, but only skimmed looking for my exact case. Didn't find a match in two minutes and moved on. Will read it again. |
| 06:36 | deg | Also, wondering now where I first found the code that introduced me to enlive. It gave me the (io/resource ..) stuff. Looks like it was an over-haired example. |
| 06:36 | ddellacosta | deg: yeah, there isn't much in the way of "cookbook" kind of resources, unfortunately--and the API docs (are there API docs?) are lacking. I mostly find myself reading the code to figure out how to do stuff. |
| 06:37 | chord | ok guys |
| 06:37 | deg | Yeah, I know the feeling. Was hoping to avoid it here 'cuz this is a really minor side-task from where I want to be focusing. |
| 06:37 | chord | here is what i've learned |
| 06:38 | chord | starcraft 2 has a delaunay triangulation for its navigation mesh on which A* followed by a funnel filter is done |
| 06:39 | chord | but how does it know a fat thor can't fit through a tiny space |
| 06:39 | chord | come on guys someone here has to be an expert on pathfinding |
| 06:39 | chord | give me hints |
| 06:40 | chord | you guys are still shunning me? |
| 06:40 | chord | is anyone going to talk to me? |
| 06:41 | ddellacosta | arnabdeka: sorry I'm not sure, but I think a lot of the contrib stuff has gotten replaced with more recent libs. What are you trying to do specifically? |
| 06:41 | arnabdeka | @ddellacosta Just trying to use show/source etc. (reading Joy of Clojure) |
| 06:42 | ddellacosta | arnabdeka: ooh, you don't need anything for source, that's part of clojure.repl, which is loaded as soon as you start up a repl |
| 06:42 | ddellacosta | arnabdeka: as far as show, I don't know that--what does it do? |
| 06:44 | arnabdeka | According to JoC: "The clojure-contrib library also has a function show in the clojure.contrib.repl-utils namespace that allows for more useful printouts of class members than we show using for." |
| 06:44 | ddellacosta | arnabdeka: ah, this is handy: http://dev.clojure.org/plugins/viewsource/viewpagesrc.action?pageId=2687076 |
| 06:46 | ddellacosta | arnabdeka: according to that, "reflect" is what you want: http://clojure.github.io/clojure/clojure.reflect-api.html |
| 06:46 | ddellacosta | (for show replacement) |
| 06:46 | arnabdeka | Ah that explains it. Thanks @ddellacosta - trying to figure reflect out now. |
| 06:46 | ddellacosta | arnabdeka: np, best of luck. |
| 06:52 | chord | i hate you all |
| 06:52 | chord | I put in all this effort trying to understand starcraft 2's path finding |
| 06:52 | chord | and you all don't help me |
| 06:52 | chord | you all ignore me |
| 06:52 | chord | you all hate starcraft |
| 06:59 | chord | i hate you all for that |
| 07:22 | chord | who here is dumb and not stupid |
| 07:32 | sm0ke | hello can i read from a core.async channel with timeout? |
| 07:34 | jonasen | sm0ke: yes you can.. take a look at alt! and alts! |
| 07:35 | sm0ke | jonasen: aha nice..a timeout block with alts inside..a little bit verbose but |
| 07:36 | milanj | hi, having issues with macros and namespaces/symbols |
| 07:36 | milanj | why is |
| 07:36 | milanj | if you are in namespace user |
| 07:36 | milanj | (= 'user/foo 'user/foo) => true |
| 07:36 | milanj | (= 'foo 'user/foo) => false |
| 07:40 | clgv | milanj: because you explicitly specify the symbols and there is no resolving of them |
| 07:41 | clgv | try (= `foo 'user/foo) in namespace "user" |
| 07:43 | milanj | cool, thanks |
| 07:43 | milanj | I was expecting CL behavior, need to read more about clojure symbols |
| 07:44 | clgv | is there a guide on how to add custom components to support seesaws functions? |
| 07:44 | clgv | ,'user |
| 07:44 | clojurebot | user |
| 07:44 | clgv | ,`foo |
| 07:44 | clojurebot | sandbox/foo |
| 07:44 | clgv | ,'foo |
| 07:44 | clojurebot | foo |
| 07:48 | milanj | clgv, thanks |
| 07:48 | deg | ddellacosta: Ok, looking now to move to deftemplate from template. Not 100% clear of the semantics. In yoour swap-js example above, how can I parameterize "public/foo.html" so I can use the same template on multiple pages? |
| 08:02 | ddellacosta | deg: sorry, was offline. Ah, so you want to pass in the template itself, huh…yah, that may be the one thing that deftemplate isn't going to help you with, as it defines a function with the html resource loaded already. |
| 08:03 | jonasen | sm0ke: more like (alts! (timeout 1000) your-chan), but maybe that's what you meant |
| 08:06 | jonasen | sm0ke: or really (alts! [(timeout 1000) your-chan]) |
| 08:10 | deg | ddellacosta: Ok, or maybe I'm just asking the wrong question. I want to apply the same transformation to multiple web pages. In that context, are my web pages always the enlive templates, or is there a way to flip the logic? |
| 08:10 | deg | ddellacosta: Or, maybe the right question is: what is the correct lib to define a transform to be applied to many web pages? |
| 08:35 | dnolen | jonasen: cljsfiddle being able to load anyone else's namespace is pretty sweet! |
| 08:36 | jonasen | dnolen: thanks |
| 08:38 | jonasen | dnolen: it also supports datomic style ?as-of=<date> so you can get real permalinks. Though I haven't really exposed that feature in the ui yet |
| 08:38 | dnolen | jonasen: whoa |
| 08:38 | dnolen | jonasen: awesome |
| 08:38 | jonasen | dnolen: the idea is that if you depend on someone elses code they can't mess with your fiddle even if they tried |
| 08:38 | dnolen | jonasen: yes |
| 09:19 | oholiab | hello, if I've got a record defined and one of the fields is "optional", which of the following ways is considered better to do: 1) apply the fields from a map so that the optional remains nil or 2) leave the field out and assoc it in afterwards |
| 09:19 | oholiab | or 3) ???? |
| 09:19 | oholiab | I'm stuck as to what is the "right" thing to do |
| 09:19 | oholiab | or at least the most sensible |
| 09:21 | vijaykiran | oholiab: depends on the domain I guess e.g. is not having the :optional-attr and {:optional-attr nil} mean the same ? |
| 09:24 | oholiab | vijaykiran: it's kind of a design question because in my particular case that I'm working on I can solve the problem in another way in that I can make the optional part mandatory and it just makes the whole thing more consistent |
| 09:24 | oholiab | i.e. there's a superfluous bit of information that I can just put in there which still kind of makes sense |
| 09:25 | oholiab | I'm more curious as to whether you'd want to design it so that you effectively had two different, minorly different record types or if you'd just want one where the extra optional field got left as nil and the rest of the program was designed to handle that gracefully |
| 09:27 | vijaykiran | oholiab: depends on how you are going to lookup the key e.g. (get {:what nil} :what 0) => nil where as (get {:wat nil} :what 0) => 0 |
| 09:28 | vijaykiran | oholiab: so you might want to drop the key completely - having it as nil valued doesn't make much sense unless the domain differentiates between non-existant vs. nil |
| 09:28 | vijaykiran | oholiab: IMHO ^ :) |
| 09:29 | oholiab | yeah, I suppose you're right |
| 09:29 | pyr | w/in2 |
| 09:29 | pyr | oops |
| 09:29 | oholiab | no point in pretending that two records that are slightly different are the same |
| 09:53 | octe | i have a map where each value is a list that i want to sort, what would be the easiest way to do that? |
| 09:53 | octe | keeping the map |
| 09:54 | clgv | octe: reduce-kv |
| 09:54 | clgv | octe: in immutable land you will end up with a new map anyway if you modify each value |
| 09:55 | octe | yes, i know, i just didn't express myself well |
| 09:55 | octe | thanks :) |
| 09:55 | octe | (reduce-kv #(assoc %1 %2 (sort-by :name %3)) {} m)) |
| 09:55 | octe | that seemed to do the trick |
| 10:00 | kral | namaste |
| 10:01 | wakeup | hi all |
| 10:02 | wakeup | is there an idomatic way to get my leiningen project's version |
| 10:02 | wakeup | string at compile-time? |
| 10:02 | wakeup | E.g. I want to write a macro that will expand to the current project version string. |
| 10:19 | wakeup | If I do a def in my project.clj, in which namespace will it end up?` |
| 10:24 | gfredericks | "Key must be integer" could be extended with "when assoc'ing with a vector" |
| 10:30 | jonasen | dnolen: ping |
| 10:32 | wakeup | Ok so there is server-socket, is there also client-socket? |
| 10:49 | clgv | what do I do wrong when I get an UnsupportedOperationException for proxy? |
| 10:54 | borkdude | Wrath of the unmatched delimiter |
| 11:13 | seangrov` | That can't be good... |
| 11:13 | `cbp | :-o? |
| 11:14 | seangrov` | Is irccloud legit? Looks like it's stocking up a lot of nicks in the channel... |
| 11:15 | CoconutCrab | the names look randomly generated |
| 11:20 | Kruppe | seangrov`: seems to be happening in a lot of channels right now |
| 11:34 | wakeup | Ok I need to work with sockets: I need a server that can multiplex a socket and read/write strings. |
| 11:34 | wakeup | and a client that can connect to a network socket and rea/write strings |
| 11:34 | wakeup | I know of server-socket, what is the client counterpart called? |
| 11:43 | allenj12 | hey guys |
| 11:43 | s4muel | o/ |
| 11:44 | allenj12 | has anyone tried the clojure.typed |
| 11:44 | allenj12 | just saw it on reddit seems cool |
| 11:46 | allenj12 | pretty quite :) |
| 11:47 | wakeup | is there a simple rpc library for clojure? |
| 11:47 | allenj12 | rpc? |
| 11:49 | clgv | wakeup: did you try that one? https://github.com/sunng87/slacker |
| 11:50 | dgrnbrg | hello clojurians, I have a question about throwing exceptions in futures--how can I set the default exception handler for all clojure futures? |
| 11:50 | dgrnbrg | it seems that the jvm default exception handler doesn't see exceptions in futures |
| 11:51 | wakeup | clgv: I looked into it, but it exposes a namespace, I don't want to do that. |
| 11:51 | clgv | wakeup: what's the problem with having a dedicated namespace as api? |
| 11:52 | wakeup | clgv: It's not functional. |
| 11:52 | clgv | wakeup: huh? |
| 11:54 | sm0ke | hello..i have this snippent which updates an atom by deleting a key value ##(swap! (atom {:k1 #{:v1}}) update-in [:k1] (fnil disj #{}) :v1) |
| 11:54 | lazybot | ⇒ {:k1 #{}} |
| 11:54 | clgv | wakeup: I guess you misunderstood the description of the lib |
| 11:54 | wakeup | clgv: A namespace implies some global state. |
| 11:55 | sm0ke | but the problem is that i want to completely remove key from map if the corresponding set becomes empty |
| 11:55 | clgv | wakeup: well, the library only exposes functions in the given namespace to be called in an RPC fashion |
| 11:55 | sm0ke | any elegant solution for this? |
| 11:56 | wakeup | clgv: what if I want multiple instances of the server? |
| 11:57 | wakeup | which different state |
| 11:57 | wakeup | with* |
| 11:57 | clgv | well there you introduce the nonfunctional state yourself ;) |
| 11:58 | wakeup | clgv: "the nonfunctional state" |
| 11:58 | wakeup | what is that supposed to mean |
| 11:58 | clgv | well that is anarchitectural question. would you have multiple instances of the same api on other plattforms as well? |
| 12:09 | yedi | http://pong.clojurecup.com/ |
| 12:14 | clgv | yedi: nice :D |
| 12:14 | yedi | not mine, but yea it's pre cool |
| 12:34 | Pupnik_ | i get crazy input lag on that |
| 12:34 | Pupnik_ | with firefox/ubuntu |
| 12:35 | mdrogalis | tbaldridge: ping |
| 12:35 | yedi | Pupnik_: i get some input lag as well |
| 12:35 | tbaldridge | mdrogalis: pong |
| 12:35 | Pupnik_ | oh its multiplayer |
| 12:35 | Pupnik_ | with very simple netcode |
| 12:35 | Pupnik_ | that explains that |
| 12:39 | wakeup | what do I have to put in my project.clj to use this: http://richhickey.github.io/clojure-contrib/server-socket-api.html |
| 12:42 | nDuff | wakeup: clojure-contrib is long dead. |
| 12:42 | nDuff | wakeup: ...that said, that library is now available as https://github.com/technomancy/server-socket |
| 12:42 | stuartsierra | clojurebot: contrib? |
| 12:42 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go |
| 12:43 | nDuff | wakeup: https://clojars.org/server-socket |
| 12:46 | noncom | hi, how do I handle (ns) macro properly with (eval)? the error says can't set root binding of *ns* with (set!) and internet says that I shuld use (binding) to eval in a particular namespace, however, I wonder, how things like evaluation in repl or nrepl handles (ns) calls? does it use (eval) at all? |
| 12:54 | clgv | noncom: yeah the "e" in "repl" stands for `eval` ;) |
| 13:02 | noncom | clgv: i just wonder how does it manage to work with (ns) macro without problems |
| 13:02 | noncom | apparently there is something different from the simple clojure function (eval) |
| 13:03 | noncom | currently i manually parse the inbound form and if it has 'ns as its first member, i do (binding) to the (find-ns) secondmember, which is to be the symbol of the name of the namespace |
| 13:04 | clgv | noncom: you have a look at the built-in repl here: https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L254 |
| 13:07 | noncom | thanks! im looking at it! |
| 13:09 | noncom | umm, what is strange, i do not see anything special about it. it simply uses (eval) )_o |
| 13:11 | noncom | maybe i'm missing somethin... |
| 13:17 | clgv | noncom: how do you use eval and what goes wrong? |
| 13:20 | glosoli | Anyone using nREPL with Emacs knows if there is some way to jump into Java sources using M-. ? |
| 13:26 | technomancy | glosoli: I think you need ritz? |
| 13:28 | kendallbuchanan | I just started using Clojurescript, and I feel like I'm missing something simple: How do you use .indexOf with a vector? |
| 13:28 | kendallbuchanan | Console returns "Uncaught TypeError: Object [object Object] has no method 'indexOf'". |
| 13:29 | justin_smith | kendallbuchanan: with cljs sometimes you need .- instead of . |
| 13:29 | jml | is there a thing where I can be always running a server and then very quickly get access to a new repl? |
| 13:29 | technomancy | jml: https://github.com/technomancy/grenchman |
| 13:29 | jml | technomancy: ta, much obliged. |
| 13:30 | noncom | clgv: it says something like "cant set root binding of *ns* with set!" |
| 13:30 | hyPiRion | jml: depends on what you mean by server, I guess? |
| 13:30 | jml | technomancy: also, achewood. Yes. Very yes. |
| 13:30 | noncom | i know what it means, but i wonder how repl work |
| 13:31 | noncom | how repl works that it has no problems with that |
| 13:31 | hyPiRion | grenchman gives you a fast repl for an open leiningen connection, but not a specific server you have implemented yourself |
| 13:31 | kendallbuchanan | justin_smith: What does ".-" mean? |
| 13:31 | kendallbuchanan | In cljs, am I using "." and ".-", or just one? |
| 13:31 | jml | hyPiRion: how so? |
| 13:32 | glosoli | technomancy: I did install it, though I am not sure if there is some special way to load it to get navigating into sources working :) Been trying to find something with no luck ;/ |
| 13:32 | nathanic | kendallbuchanan: .indexOf is part of a java interface, and isn't in JS. and ".-" in clojurescript means to access a member's value rather than to call a method, so it won't help you with indexOf. |
| 13:32 | clgv | noncom: when do you get this? I did not encounter the error with (eval '(ns bla.blubb)) |
| 13:32 | kendallbuchanan | nathanic: Okay, that makes sense. |
| 13:33 | justin_smith | kendallbuchanan: .- is for fields |
| 13:33 | justin_smith | . is for methods |
| 13:33 | justin_smith | in clojurescript only |
| 13:33 | kendallbuchanan | So, is there no .indexOf method for vectors in cljs? |
| 13:33 | glosoli | technomancy: I should mention I tried jacking in with nrepl-ritz-jack-in, still it failed to open any java source :) |
| 13:34 | justin_smith | kendallbuchanan: I don't know, but I know that if indexOf is a field, it will be .-indexOf, if it is a method it would be .indexOf |
| 13:34 | justin_smith | the thing may have a different name in js, I don't know |
| 13:34 | technomancy | glosoli: oh no idea then; haven't used it. maybe try the ritz mailing list. |
| 13:35 | nathanic | kendallbuchanan: I couldn't find one, so I ended up writing a simple one myself. I welcome correction if there is a "real" one though. :-) |
| 13:35 | glosoli | technomancy: but you use emacs yes ? |
| 13:35 | technomancy | glosoli: yeah, but I don't know Java, so jumping to Java source is not very useful for me |
| 13:36 | kendallbuchanan | nathanic: You mind showing me what you made? |
| 13:36 | glosoli | technomancy: Hmm I have been told that it's impossible to know Clojure very well without learning java, seems like folks lied to me |
| 13:37 | Foxboron | glosoli: partly lies |
| 13:37 | technomancy | yes, that's rubbish |
| 13:37 | technomancy | you just need to know the standard library |
| 13:37 | glosoli | aah happy to hear that! :) |
| 13:37 | Foxboron | glosoli: sooner or later you might have to stumble into some java, but you can go far without ever touching it. |
| 13:37 | bbloom_ | glosoli: it's worth knowing something about the JVM, but that's no different than learning about python's VM or ruby's MRI or haskell's STG machine |
| 13:38 | hiredman | except STG has a way cooler name |
| 13:38 | glosoli | lol |
| 13:39 | noncom | clgv: well, first i (read-string) the form from a text field, then imply (eval) |
| 13:39 | nathanic | kendallbuchanan: https://gist.github.com/nathanic/6781788 no promises of perfection etc. but that's what i was using. |
| 13:39 | nathanic | kendallbuchanan: again, if you find something better, i welcome correction :-) |
| 13:39 | noncom | clgv: just this... i found the problem description on stackoverflow.. som someone too had it |
| 13:40 | kendallbuchanan | nathanic: Awesome, thank you. I just thought for sure I was missing something basic. Thanks justin_smith, I'll be mindful of methods vs. objects. |
| 13:40 | clgv | noncom: try to build a minimal example that still fails |
| 13:40 | noncom | are you sure you don't have it with first read-string then eval it? all other forms except for (ns) eval prperly |
| 13:40 | noncom | ok wait |
| 13:42 | noncom | clgv: very strange, it work ok from repl or if i ctrl+enter the code from counterclockwise, but it does not work inside the running program |
| 13:44 | noncom | here is it on SO: http://stackoverflow.com/questions/7684656/clojure-eval-code-in-different-namespace |
| 13:44 | clgv | noncom: the accepted answer is correct. I played with it a while ago |
| 13:45 | jml | hyPiRion: ah right. I don't particularly care for a specific server at this stage. |
| 13:45 | noncom | yes it is and it works. but repls do not have that problem. i doubt they do some kind of binding like that... |
| 13:45 | jml | just want to experiment with using clojure in the same way I use ipython atm |
| 13:46 | noncom | repls simply evaluate (ns) like if there is no issue |
| 13:46 | technomancy | jml: usually people just keep a repl open in emacs or lein repl. tooling around direct quick CLI access is still very immature. |
| 13:46 | noncom | gmmm |
| 13:46 | hyPiRion | yeah |
| 13:46 | noncom | i guess im missing something |
| 13:47 | jml | technomancy: hmm, ok. I'm pretty terrible about keeping things open normally |
| 13:47 | TimMc | noncom: So why not just use binding? |
| 13:47 | jml | but I guess my emacs is a daemon so it shouldn't be too bad. |
| 13:48 | technomancy | I mean you can try grenchman, but it hasn't seen a lot of use yet, and it'll take like half an hour to compile the toolchain |
| 13:51 | jml | technomancy: heh, ok. I might skip it for now :) |
| 13:51 | jml | thanks for the warning |
| 13:51 | noncom | TimMc: i do not mind using binding. the problem is that the target ns is not known before evaluation. curerently i read-string and see if the first symbol is 'ns and then i do binding for the second symbol. but i feel this is wrong and fragile |
| 13:58 | rasmusto | ,(map #{nil 1 false true} [1 2 3 nil false true]) |
| 13:58 | clojurebot | (1 nil nil nil false ...) |
| 14:00 | hyPiRion | if you compile grenchman though, you'll have heat for the rest of the winter |
| 14:03 | sm0ke | hello how do i convert a string to "bytes" |
| 14:03 | sm0ke | what is bytes anyways? |
| 14:04 | `cbp | sm0ke: .getBytes |
| 14:04 | s4muel | an encoded representation of a string |
| 14:04 | sm0ke | umm i dont understand... ##(map byte "ss") |
| 14:04 | lazybot | java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number |
| 14:05 | `cbp | ,(.getBytes "hello") |
| 14:05 | clojurebot | #<byte[] [B@1c9e59a> |
| 14:05 | `cbp | ,(seq (.getBytes "hello")) |
| 14:05 | clojurebot | (104 101 108 108 111) |
| 14:06 | `cbp | (map char (.getBytes "hello")) |
| 14:06 | sm0ke | `cbp: hmm isnt that a bytes array? actually i am using cljzmq a clojure library for zmq..and i see type hints of ^bytes in source code |
| 14:06 | `cbp | ,(map char (.getBytes "hello")) |
| 14:06 | clojurebot | (\h \e \l \l \o) |
| 14:06 | hyPiRion | ,(map int "hello") |
| 14:06 | clojurebot | (104 101 108 108 111) |
| 14:06 | hyPiRion | ,(seq "hello") |
| 14:06 | clojurebot | (\h \e \l \l \o) |
| 14:07 | `cbp | sm0ke: I'm pretty sure ^bytes means byte array |
| 14:07 | sm0ke | `cbp: i will take your word on that..thanks |
| 14:08 | sm0ke | ,(= bytes (class (.getBytes "ss"))) |
| 14:08 | clojurebot | false |
| 14:10 | llasram | sm0ke: The Clojure compiler has special handling for the symbols "bytes" "ints" etc to treat them as 1-dimensional arrays of the associated primitive type |
| 14:10 | llasram | when in hinting metadata, that is |
| 14:11 | technomancy | because the literal java syntax for arrays is too horrible for words |
| 14:11 | llasram | sm0ke: Hinting metadata tags are just symbols. ##(let [x ^WhatIsThisWeirdThing {}] [x (meta x)]) |
| 14:11 | lazybot | ⇒ [{} nil] |
| 14:12 | llasram | Well, didn't quite go as planned |
| 14:12 | llasram | technomancy: Yeah, that too. Blech |
| 14:12 | sm0ke | llasram: thanks that makes sense |
| 14:13 | `cbp | I think lazybot shouldve thrown an exception there |
| 14:14 | llasram | `cbp: Try it in your REPL |
| 14:14 | `cbp | llasram: yeah |
| 14:15 | `cbp | ,(let [x ^WhatIsThisWeirdThing {}] [x (meta x)]) |
| 14:15 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: WhatIsThisWeirdThing in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:15 | `cbp | superior bot |
| 14:15 | llasram | hmm |
| 14:15 | sm0ke | does that mean i could also use ##(map byte "ss"); as it feels more idiomatic? |
| 14:15 | lazybot | java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number |
| 14:16 | `cbp | ##*clojure-version* |
| 14:16 | sm0ke | eh i dont get it that runs on my repl just fine |
| 14:16 | llasram | sm0ke: No. Even if that worked, it would return a seq of Byte objects |
| 14:16 | llasram | You need a primitive byte array |
| 14:16 | llasram | end of story |
| 14:16 | sm0ke | ok got it thanks |
| 14:17 | `cbp | ##(let [x #^WhatIsThisWeirdThing {}] [x (meta x)]) |
| 14:17 | lazybot | ⇒ [{} nil] |
| 14:18 | TimMc | noncom: Well, that's probably what the REPL does as well. :-P |
| 14:18 | llasram | ,(-> '[^WhatNowLazybot? {}] first meta) |
| 14:18 | clojurebot | {:tag WhatNowLazybot?} |
| 14:18 | llasram | &(-> '[^WhatNowLazybot? {}] first meta) |
| 14:18 | lazybot | ⇒ {:tag WhatNowLazybot?} |
| 14:18 | llasram | Gee, thanks |
| 14:19 | `cbp | you could do (byte-array 5 (map byte "hello")) if it really rustles your jimmies to use java methods |
| 14:20 | sm0ke | `cbp: umm..no i would rather stick with .getBytes then |
| 14:25 | sm0ke | crap github's down! |
| 14:25 | tgoossens | so it has come to this |
| 14:26 | geoffeg | sm0ke: part of the US government shut down. |
| 14:26 | fbernier | and here comes the HN submission about github being down ... wtf |
| 14:27 | mtp | "America is now a global military empire with a nonfunctioning civilian government" |
| 14:27 | piranha | is there a better solution for changing all keys of a hashmap than (into {} (map (fn [[k v]] [(some-fn k) v]) data))? |
| 14:27 | sm0ke | yea what with america shutting down over obamacare? |
| 14:27 | geoffeg | piranha: update-in? |
| 14:27 | piranha | geoffeg: hm, not sure I understand your idea... how do I do that? |
| 14:27 | technomancy | piranha: not really. it's a bizarre omission from clojure IMO. |
| 14:28 | technomancy | zipmap is arguably slightly cleaner |
| 14:28 | piranha | technomancy: that's really annoying :( and slow also... :\ |
| 14:28 | piranha | hmmm, how do I do it with zipmap? |
| 14:29 | technomancy | (zipmap (map f (keys m)) (vals m)) |
| 14:29 | hyPiRion | piranha: (into {} (for [[k v] m] [(f k) v])) works too |
| 14:29 | piranha | heh, that's certainly cleaner, but probably slower... I think I should stop trying to optimize that piece of code and just drop to JS directly :\ |
| 14:30 | piranha | hyPiRion: yeah, a bit less code as well, thanks |
| 14:30 | technomancy | IIRC there's also keywordize-keys if that's what you need, but it's bizarre why the more general form is omitted |
| 14:30 | piranha | nope, I need to transform dashed-keys into camelCase |
| 14:31 | technomancy | (with-redefs [keyword camelcase] (keywordize-keys m)) ; wooooooo |
| 14:31 | piranha | :))) |
| 14:31 | piranha | hm, nope, there is no keywordize-keys |
| 14:32 | piranha | ah! |
| 14:32 | piranha | clojure.walk |
| 14:33 | piranha | ,(with-redefs [keyword name] (keywordize-keys {:a "b"})) |
| 14:33 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: keywordize-keys in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:33 | piranha | ,(with-redefs [keyword name] (clojure.walk/keywordize-keys {:a "b"})) |
| 14:33 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk> |
| 14:34 | piranha | damn |
| 14:34 | piranha | anyway, it's not working ) |
| 14:34 | piranha | since it's checks inside that argument is a string |
| 14:35 | technomancy | ahahahaa yeah don't do that =P |
| 14:35 | rasmusto | piranha: you could also redef string? to keyword? :P |
| 14:35 | piranha | :DDDDDDD |
| 14:35 | rasmusto | (don't do that) |
| 14:35 | piranha | damn now I'm really laughing |
| 14:37 | sm0ke | How do i convert a clojure map to bytes? map conly contains strings and keywords? |
| 14:38 | sm0ke | and how do i convert it back from bytes? |
| 14:39 | technomancy | sm0ke: you'll have to be more specific |
| 14:39 | TimMc | sm0ke: Your question is ill-specified; there are many possible meanings of what you just said. |
| 14:39 | scriptor | hi guys |
| 14:39 | TimMc | Are you trying to serialize a map to disk? |
| 14:39 | scriptor | can someone point me to what the loop* in https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4156 refers to? |
| 14:39 | technomancy | scriptor: I think it's hard-coded into the compiler |
| 14:39 | sm0ke | yes i want to serialize a map to byte array and write to a zmq socket |
| 14:40 | sm0ke | and want to construct it back too |
| 14:40 | scriptor | ah, makes sense |
| 14:40 | scriptor | time to go digging |
| 14:40 | sm0ke | does that makes sense? |
| 14:40 | llasram | sm0ke: Yes. And I would like to formally welcome you to the serialization rabbit hole :-) |
| 14:41 | llasram | sm0ke: If you don't have any particular requirements for your project, the flat-out easiest thing to do is use EDN |
| 14:41 | sm0ke | llasram: aha edn..yes i am using it for config already |
| 14:41 | sm0ke | let me dig around |
| 14:47 | sm0ke | hey guys does this makes sense ##(clojure.edn/read-string (String. (.getBytes (pr-str {:a "sss" :b "cc"})))); for ser/de ? |
| 14:47 | lazybot | java.lang.ClassNotFoundException: clojure.edn |
| 14:48 | sm0ke | feel very hacky |
| 14:48 | TimMc | Why .getBytes? |
| 14:48 | TimMc | And if you use that, you'll want to specify UTF-8. |
| 14:48 | sm0ke | up to .getByte is the ser...outside form is deser |
| 14:49 | llasram | TimMc: They're pushing data over 0mq IIRC |
| 14:50 | sm0ke | that is weird way to serialize i feel |
| 14:50 | technomancy | sm0ke: there are more efficient ways to do it, but not simpler ways |
| 14:50 | llasram | sm0ke: The only "hacky" part is the bytes to/from transition. EDN is a character-wise format, so you've got an extra step. |
| 14:50 | llasram | (inc technomancy) |
| 14:50 | lazybot | ⇒ 79 |
| 14:51 | llasram | sm0ke: If you want something directly byte-oriented, you have a ton of options. Here's mine: https://github.com/damballa/abracad |
| 14:52 | sm0ke | llasram: hey isnt that for avro? i am using that already in one project |
| 14:52 | llasram | Yes |
| 14:52 | llasram | If you're already using Avro, then might actually be a good fit |
| 14:53 | sm0ke | no i am not using avro here..its not a very schema oriented thingy |
| 14:53 | sm0ke | i just want some fool proof serialization of simple clojure data |
| 14:54 | llasram | It's not well tested, but abracad actually will generate schemas for you which will serialize all the basic Clojure data structures |
| 14:54 | llasram | In the abracad readme, jump down to "EDN-in-Avro" |
| 15:01 | sm0ke | well it needs a schema..i think its too qualified for my purpose |
| 15:01 | sm0ke | i saw this nippy library |
| 15:02 | sm0ke | dont know if it fits |
| 15:11 | weavejester | I've had good experiences with Nippy. |
| 15:13 | sm0ke | yes there stress-data test is pretty comprehensive..more than good enough for my purpose |
| 15:13 | noncom | weavejester: if you have time, could you tell a little about your experience on combining jmonkeyengine Controls with clojure paradigm? |
| 15:14 | sm0ke | cool jmonkey on clojure! |
| 15:14 | weavejester | noncom: Controls? |
| 15:14 | sm0ke | is it on github? |
| 15:14 | noncom | yeah, you know, jmonkey prescribes updates to all the entities in the world by linking instances of Control class to them.. |
| 15:15 | drorbemet | Hi, does someone of you know if there is a clojure library for parsing org-mode files? |
| 15:15 | weavejester | sm0ke: I might release some code on my implementation after EuroClojure. I've been holding off, however, as it's still unfinished. |
| 15:15 | noncom | these cotrols have state and they lurk into the main apps update loop |
| 15:15 | jtoy | I have a weird problem, I can run this code from the repl fine and it works, when I run it from cron though I get a null pointer exception, can anyone point me to waht I am doing wrong: ((resolve (read-string (:code experiment) )) user-id (last groups))) |
| 15:15 | sm0ke | weavejester: awesome |
| 15:15 | weavejester | noncom: Oh right! Yes, I know them, but I don't make use of those at all. |
| 15:15 | weavejester | There's really little point. |
| 15:16 | jtoy | when I run from cron I run it as so: lein trampoline run -m air.campaigns/jobs |
| 15:16 | noncom | sm0ke: some people, including me, have worked on using jme in clojure.. but nothing definite as of yet, i guess.. you can try too! |
| 15:16 | jtoy | what that code does is just pull out a string from a database and call it with some arguments |
| 15:16 | noncom | i mean, it is definitely viable, but no production-ready thing is there yet |
| 15:17 | noncom | weavejester: so you just plug into the update loop directy? |
| 15:17 | weavejester | noncom: Yep |
| 15:17 | weavejester | noncom: Each update, I sync the nodes with a Clojure data structure representing the scene. |
| 15:18 | noncom | o i see |
| 15:18 | weavejester | I'm actually still not completely sold on jME. It provides a lot of code I don't need to write, but is ultimately written for a different paradigm. |
| 15:19 | noncom | true... |
| 15:19 | callen | JME? |
| 15:19 | noncom | you think plain lwjgl might be the way? |
| 15:19 | callen | oh, jmonkeyengine |
| 15:20 | jtoy | I think it must have to do with something not loading properly, but i have no idea how to debug this |
| 15:21 | weavejester | noncom: Yes, possibly. It would be more work, but it would be easier to fit it in to work with Clojure. |
| 15:21 | weavejester | jMonkey is a pain when you bump up against its structure. |
| 15:22 | weavejester | Which isn't really a criticism of the library, I'm just using it in a weird way |
| 15:22 | weavejester | It's a very OOP framework, so there's some translation involved. |
| 15:24 | weavejester | jtoy: Does it depend on a specific current directory? |
| 15:24 | jtoy | weavejester: no, but i dont really understand that question |
| 15:25 | noncom | yeah, it is from a different paradigm... in my approach, im trying to find a proper synthesis of the two paradigms, when neither has to give up, so i have jme-centered part, which is oop-ish and such and clojure-centered part which is clojuric (at least as much as i can), and they are very loosesly coupled.. |
| 15:25 | weavejester | Another pain with jME is there aren't any up-to-date Maven artifacts. I had to adapt a third-party project and install locally to get it to work. |
| 15:26 | weavejester | jtoy: Well, maybe cron is running it with a different current directory? |
| 15:26 | noncom | oh i do not have problems with installation now. i simply put it in leins resources path, and for jar distribution i use nativot. |
| 15:26 | mtp | cron runs things with a wildly different PATH |
| 15:26 | mtp | and yes, it defaults to your $HOME |
| 15:26 | jtoy | weavejester: cron code loads clojure runs code,the problem started when I added this line: ((resolve (read-string (:code experiment) )) user-id (last groups))) |
| 15:27 | noncom | good to hear your opinions, wanted to ask you for some time already |
| 15:27 | weavejester | noncom: I wanted to use Maven packages and do it properly. There are some Maven packages in Sonotype, but they're out of date. There's also a jme3-maven-helper project, but it's also out of date, so I updated it: https://github.com/weavejester/jme3-maven-helper |
| 15:28 | jtoy | if i use resolve, does it matter if the string I read in is myns/func vs func ? I am currently using func |
| 15:28 | noncom | wow, that is cool! so you keep it up-to-date? |
| 15:28 | `cbp | jtoy: yes it matters, qualify it properly |
| 15:29 | weavejester | noncom: The install.sh script will grab the latest jME 3.0final branch from SVN, then packages it up as a maven package and installs it locally as [com.jme3/jmonkeyengine "3.0.0-SNAPSHOT"] |
| 15:29 | noncom | cool! |
| 15:30 | weavejester | I had some issues with running older versions as standalone due to a bug in LWJGL on Mac OSX. |
| 15:31 | weavejester | LWJGL 2.9.0 looks like it's a lot better for OSX than 2.8.x |
| 15:31 | noncom | hmm, i mainly window so no know that of.. but heard of |
| 15:31 | `cbp | wat |
| 15:32 | weavejester | noncom: My approach to jME3 is to brute force the node system. So in my system whenever a data structure changes, I destroy the associated node, and recreate it with the new data. |
| 15:33 | weavejester | Which sounds horribly slow |
| 15:33 | weavejester | But is actually pretty performant. |
| 15:33 | noncom | haha |
| 15:33 | noncom | well, i guess it depends on what you have in the scene graph |
| 15:33 | TimMc | `cbp: "Hmm, I mainly use Microsoft Windows, so I'm not familiar with it... but I've heard of it." |
| 15:33 | TimMc | That's my best guess. |
| 15:34 | `cbp | o.o |
| 15:34 | noncom | TimMc: that's true! |
| 15:35 | weavejester | noncom: Yeah. It turns out that it's not very expensive to add or remove objects from the scene graph. Basically just a hash change and the cost of creating a new object. |
| 15:35 | weavejester | noncom: With caching, it's sufficiently quick for a lot of tasks. |
| 15:35 | weavejester | But eventually I suspect I might move to LWJGL directly. |
| 15:37 | weavejester | Essentially I just have a reference to an immutable data structure that describes the scene. Camera, objects, background, window size, etc. |
| 15:37 | weavejester | I'm using Reagi to make the scene changable. |
| 15:38 | Jarda | has someone used https://github.com/pelle/clauth |
| 15:38 | Jarda | I'm having this issue: https://github.com/pelle/clauth/issues/11 |
| 15:39 | noncom | that is definitely very interesting. sounds like partly unprobed ground. havent seen it done for a real 3d thing |
| 15:39 | noncom | nice to see reagi growing. last time i was visiting it was somehting like 0.3.0..! |
| 15:42 | noncom | so you get the better picture of what reagi will be? i remember you were still researching it back then |
| 15:52 | jtoy | `cbp: that fixed it, thanks |
| 15:53 | `cbp | jtoy: np |
| 16:01 | edw | My .emacs is so filled with ac-nrepl cruft; does anyone have a good example of a minimal, clean ac-tricked-out nrepl .emacs file? |
| 16:03 | `cbp | my .emacs is (or used to be before i switched to emacs live) just a bunch of load-files :P |
| 16:05 | edw | I may still have some stuff in mine from emacs 19. |
| 16:05 | callen | edw: I have a tricked out Emacs environment, but ac-nrepl is too fookin' slow for me mate. |
| 16:06 | edw | callen: I hear you. It's been getting faster with newer builds of Emacs 24. I used to be mollasses-slow. |
| 16:07 | dgrnbrg | is there a way to catch uncaught exceptions thrown in futures? |
| 16:08 | callen | edw: I've tried it in Emacs 24. Still unacceptably slow :P |
| 16:08 | callen | dgrnbrg: deref future, catch the exception. |
| 16:08 | callen | dgrnbrg: boom. |
| 16:08 | callen | alternately, handle the exception in the code the future is executing. |
| 16:09 | edw | callen: Now that you mention it, it's still too slow on my '10 MacBook Air. Only on my MBP '12 Retina is it tolerable. |
| 16:09 | dgrnbrg_ | callen: I can't do that, because the futures hold async computations |
| 16:09 | callen | edw: I have a '13 Retina MBP and it's still irritating as fuck. |
| 16:09 | dgrnbrg_ | there's no point that I can safely deref them |
| 16:10 | callen | dgrnbrg_: if you cannot dereference your futures then they are not futures and you should not be using futures. |
| 16:10 | callen | dgrnbrg_: future is not a dispatch mechanism, it's a retrieval mechanism. |
| 16:10 | callen | either fire off a raw thread or write real async code. |
| 16:10 | callen | all they win you if you're not @'ing is use of the thread pool |
| 16:14 | dgrnbrg_ | callen: Where does the future swallow the exception? |
| 16:14 | mpenet | dgrnbrg_: lamina has facilities to handle errors in situations like this |
| 16:15 | mpenet | dgrnbrg_: see run-pipeline and its error-handler option, it will do for "nested" async scenarios |
| 16:15 | callen | dgrnbrg_: future doesn't swallow the exception. |
| 16:15 | callen | dgrnbrg_: it simply waits for you to deref to allow it to continue to bubble. |
| 16:15 | dgrnbrg_ | I use futures in several places in my code where they should normally behave correctly, but I want the exceptions to reach the global uncaughtexceptionhandler |
| 16:17 | dgrnbrg_ | callen: I don't see anywhere that future catches the exception and holds it for late |
| 16:17 | dgrnbrg_ | hold it for later retrieval from deref |
| 16:17 | callen | dgrnbrg_: stop using futures for this. |
| 16:17 | callen | dgrnbrg_: use agents or an actual async library. |
| 16:18 | dgrnbrg_ | callen: regardless of what i'm using, I want to understand where the exceptions are being caught |
| 16:19 | stuartsierra | dgrnbrg_: Clojure's future catches any exception thrown in its body and re-throws it when you deref the future. Just like java.util.concurrent.Future |
| 16:20 | callen | dgrnbrg_: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6311-L6336 |
| 16:21 | dgrnbrg_ | stuartsierra: is it using Java's future implementation to catch and retain the exception? |
| 16:21 | callen | the answer is in the code I just linked. |
| 16:21 | callen | stuartsierra: how did AOT bite you earlier? |
| 16:21 | stuartsierra | dgrnbrg_: yes |
| 16:22 | dgrnbrg_ | stuartsierra: what's the right way to use a thread pool in which exceptions should bubble to a global exception handler? |
| 16:22 | dgrnbrg_ | is there such a way? |
| 16:23 | stuartsierra | dgrnbrg_: Java Executors allow you to specify a thread factory, where you can set an uncaught exception handler on the thread. |
| 16:23 | dgrnbrg_ | stuartsierra: but from my interpretation of the code, it's the fact that I'm running by `submit`ing to an Executor, and that usage of `submit` will hold the exception in the resultant future |
| 16:24 | dgrnbrg_ | and that is irrespective of an uncaughtExceptionHandler I specify |
| 16:24 | stuartsierra | dgrnbrg_: oh, yes |
| 16:24 | podviaznikov | hi, does anyone know library for collecting code quality metrics for clojure projects? |
| 16:24 | stuartsierra | that's right |
| 16:24 | dgrnbrg_ | I'm trying to figure out a technique to catch exceptions in futures that I'm not properly checking the result of |
| 16:24 | stuartsierra | Catch them. :) |
| 16:24 | dgrnbrg_ | ugh |
| 16:25 | stuartsierra | "If you throw an exception in the woods, …" |
| 16:25 | dgrnbrg_ | I just like the idea of not needing to deal with that directly |
| 16:25 | dgrnbrg_ | particularly for the parts of the code that don't have any instrumentation like that in them |
| 16:30 | ztellman | dgrnbrg_ so wrap each function and submit the errors to queue |
| 16:30 | ztellman | or just log them, if they're that unimportant |
| 16:48 | akurilin | For Korma, would I use transform/prepare to change from dashes to underscores and vice-versa in column names? |
| 16:49 | akurilin | And on a related note, is there a way to tell Korma to transform joda time to sql time automatically ? |
| 16:50 | bitemyapp | rkneufeld: I can't do the Korma chapter with lein-try, it breaks things. |
| 16:51 | bitemyapp | rkneufeld: c3p0 can't find the JDBC driver if I use lein-try. |
| 16:51 | bitemyapp | I don't really have time for a fix, so I'm writing the instructions with a fresh demo project. |
| 16:52 | bitemyapp | akurilin: you would, @ transform/prepare. |
| 16:53 | akurilin | bitemyapp, so loop through all the values and check for joda time type? |
| 16:53 | bitemyapp | akurilin: sure |
| 16:53 | akurilin | bitemyapp, k thx. |
| 16:54 | akurilin | bitemyapp, since you're here, any idea if I can do a dashes -> underscores transformation for defentity, or is my only option at this point to use underscores directly in clojure? |
| 16:54 | akurilin | for a table like foo_bar in PG, and foo-bar in clj. |
| 16:55 | bitemyapp | do whatcha want. |
| 16:55 | bitemyapp | you can transform 'em back and forth. or not. |
| 16:56 | akurilin | bitemyapp, what I'm trying to figure out is if I can do this transform for the table name itself, not just the results. I could technically just override defentity to do that. |
| 16:57 | bitemyapp | gf3: <3 |
| 16:57 | bitemyapp | akurilin: oh oh oh, table name. |
| 16:57 | bitemyapp | akurilin: you can alias the thing. |
| 16:57 | gf3 | bitemyapp: Ahaha—ACCEPTABLE |
| 16:58 | bitemyapp | I'm offering bottles of whiskey to anybody willing to give their library a better name. |
| 16:58 | arrdem | bitemyapp: the "better" criteria being... |
| 16:58 | bitemyapp | Fuck, this deserves a tumblr wall-of-shame/open offer blog. |
| 16:58 | gf3 | bitemyapp: My libraries are already perfectly named |
| 16:58 | bitemyapp | arrdem: no clj-* or *jure in the name. |
| 16:58 | bitemyapp | gf3: you're fine, some idiots actually name their shit stuff like clj-dstore |
| 16:59 | akurilin | bitemyapp, could you be more specific about what you mean by alias? Haven't gotten my coffee yet. |
| 16:59 | arrdem | bitemyapp: eh clj-http and soforth could be better but I'm not bothered by it so long as there isn't a name colision. |
| 16:59 | gf3 | bitemyapp: clj-jure |
| 16:59 | arrdem | (inc gf3) |
| 16:59 | lazybot | ⇒ 2 |
| 17:00 | bitemyapp | arrdem: dakrone gets a reprieve . |
| 17:00 | bitemyapp | everybody else can DIAF |
| 17:00 | bitemyapp | akurilin: http://sqlkorma.com/docs#entities |
| 17:00 | bitemyapp | (defentity muhhhh-table (pk :id) (table :muhhhh_table)) |
| 17:01 | bitemyapp | arrdem: I guess we can't all be technomancy. |
| 17:01 | arrdem | bitemyapp: a fate to which I aspire nonetheless |
| 17:01 | akurilin | bitemyapp, oh I found it, brilliant |
| 17:02 | akurilin | thx |
| 17:02 | akurilin | brb |
| 17:02 | bitemyapp | arrdem: suck-up. |
| 17:02 | arrdem | bitemyapp: I'm a nub. what do you want from me. |
| 17:03 | arrdem | bitemyapp: also way to change your IRC name. now I have to go add more aliases to my cc project. |
| 17:03 | rhg135 | incase anybody finds it useful, here's a date macro i wrote |
| 17:04 | rhg135 | https://www.refheap.com/19227 |
| 17:04 | rhg135 | hmm, the staticness might be a problem |
| 17:04 | bitemyapp | rhg135: why is this a macro? |
| 17:05 | arrdem | bitemyapp: because macros are awesome! |
| 17:05 | bitemyapp | that's not a reason. |
| 17:05 | AimHere | Maybe his aot compilation is going to be VERY aot |
| 17:05 | bitemyapp | lol @ AimHere |
| 17:07 | gf3 | Raynes: I just realised that I put your email in me README like 2 years ago |
| 17:07 | gf3 | Raynes: Whoops → https://github.com/gf3/clavatar-js |
| 17:08 | gyim | Hi, a newbie question: what is the idiomatic way to run long-running asynchronous tasks, but with a bounded input queue? |
| 17:08 | gyim | I'm writing an app that sends commands to a bunch of servers. The simplest solution is to create an agent per server, and start the command sender function with `send-off`. But if a server slows down, I want to detect it and prevent sending more tasks to it. |
| 17:09 | gyim | I guess I could create a bunch of refs to store the number of outgoing messages, etc, but I wonder if there is an easier solution |
| 17:10 | arrdem | gyim: what's your structure? you have a worker thread for every client with a shared input queue? |
| 17:11 | seangrov` | Hrm, but when will clojure have its *rails*? |
| 17:11 | seangrov` | I see no future for clojure without it |
| 17:11 | bitemyapp | seangrov`: this may be the first time I've seen you troll in IRC. |
| 17:11 | technomancy | seangrov`: right after it gets whitespace-sensitive syntax, duh |
| 17:11 | seangrov` | Heh, sorry, porting rails -> clojure right now |
| 17:11 | seangrov` | technomancy: hah! |
| 17:11 | gyim | arrdem: i was thinking about a simple blocking function per task (connect to server, send command, close connection) |
| 17:12 | gf3 | technomancy, seangrov`: Can you give me an ETA |
| 17:12 | tbaldridge | seangrov`: rails, really? |
| 17:12 | gf3 | technomancy, seangrov`: I have deadlines and clients |
| 17:12 | gf3 | THX |
| 17:12 | tbaldridge | (dec seangrov`) |
| 17:12 | lazybot | ⇒ 0 |
| 17:12 | tbaldridge | :-P |
| 17:12 | seangrov` | I guess it can't go negative |
| 17:12 | gyim | arrdem: and allocate a custom ExecutorService for all of these tasks to limit the number of parallel tasks |
| 17:13 | seangrov` | tbaldridge: I did say I was porting from rail to clojure right now :P |
| 17:13 | tbaldridge | seangrov`: ah I thought you were saying that you were porting rails to clojure. |
| 17:13 | seangrov` | A considerably reduction in LOC, and it's much more explicit to boot |
| 17:13 | rhg135 | bitemyapp: to not quote the fieldnames when calling |
| 17:13 | bitemyapp | Not sure if serious. |
| 17:16 | Raynes | gf3: Whoa, you made a clojurescript port of clavatar and that was 2 years ago? How long have I been doing this shit? |
| 17:16 | gf3 | Raynes: Too damn long |
| 17:16 | Raynes | gf3: You just made a teenager feel old. Congratulations. |
| 17:16 | gf3 | Raynes: And yes we've know each other for basically decades now |
| 17:16 | Raynes | Basically |
| 17:17 | Raynes | Anyways, the email address thing is fine. It's in more easily accessible places if a bot wanted it bad enough. |
| 17:17 | gf3 | The bots want it sooo bad |
| 17:17 | Raynes | For example: proudly displayed on my Github page. |
| 17:18 | gf3 | But they do some janky stuff, non? |
| 17:18 | gf3 | Yeah |
| 17:18 | gf3 | <a class="email js-obfuscate-email" data-email="%67%69%61%6e%6e%69%40%72%75%6e%6c%65%76%65%6c%36%2e%6f%72%67" href="mailto:{email}">{email}</a> |
| 17:23 | gyim | [agents] so basically my question is: if i want to run a lot of IO in the background, how do i prevent (a) 10000 commands to pile up, or (b) to have 10000 background threads running simultaneously |
| 17:25 | gyim | (i mean when things go wrong, for example the network slows down and all of the connections block for a minute) |
| 17:26 | bitemyapp | gyim: async code. |
| 17:27 | Jarda | hey struggling with syntax |
| 17:27 | mtp | start struggling with semantics instead |
| 17:27 | gyim | i think the same applies here if i use agents to run async code or netty to connect to servers. I still have to maintain some kind of command queue |
| 17:27 | Jarda | with hickup, how can I have a function that returns <p>Foo</p><p>Bar</p> |
| 17:28 | bitemyapp | Jarda: hiccup |
| 17:28 | Jarda | I tried (defn foobar [] [:p "Foo"] [:p "Bar"]) but that obviously just return <p>Bar</p> |
| 17:28 | Jarda | bitemyapp: yeah sorry |
| 17:28 | tbaldridge | gyim: core.async with a limited number of processing thread blocks. |
| 17:28 | tbaldridge | gyim: this is exactly what core.async is for. |
| 17:28 | hyPiRion | Jarda: (list [:p "Foo"] [:p "Bar"]) |
| 17:30 | Jarda | hyPiRion: oh thanks of course |
| 17:31 | hyPiRion | Jarda: just be aware that [[:p "Foo"] [:p "Bar"]] is not the same as (list [:p "Foo"] [:p "Bar"]) is not the same thing |
| 17:31 | hyPiRion | then you should be fine |
| 17:31 | Jarda | hyPiRion: yeah with hiccup you can't even write [[...]] |
| 17:31 | gyim | tbalridge: i was thinking about core.async, especially because it has a dropping queue and such. But I should not use IO there, right? So I should probably have a "frontend" go block that accepts commands via channels, and spawns worker threads for IO |
| 17:31 | Jarda | because it will complain about [...] not being a valid element name |
| 17:31 | Jarda | I already tried that |
| 17:32 | hyPiRion | heh, yeah |
| 17:33 | tbaldridge | gyim: just do IO inside of a "thread" block instead of a "go" block. Thread blocks give you dedicated threads. So start threads at the start of your program and have them pull from a channel, then you can put! dozens on requests into that channel and the threads can process them as neeed. |
| 17:35 | ToBeReplaced | tbaldridge: do you find yourself using futures in conjunction with core.async often? |
| 17:35 | bsavoy | I'm having trouble finding the appropriate resources to help me understand what's happening in the following code. Why can't a symbol from the same namespace be resolved? Is there a completely different way of doing this? https://gist.github.com/anonymous/6785059 |
| 17:35 | tbaldridge | ToBeReplaced: thread = future, future returns a promise, thread returns a channel. So no. |
| 17:35 | bsavoy | Any help much appreciated |
| 17:36 | ToBeReplaced | tbaldridge: i do something like (assoc system (future (loop [] (>!! chan work) (recur)))) |
| 17:37 | ToBeReplaced | the future is helpful so that i can query for errors instead of needing to write error handling into the hcannel work |
| 17:37 | gyim | tbaldridge: great, thanks! I thought that i could read from a channel only from go blocks. Seems like I should read more about it then. |
| 17:39 | stuartsierra | bsavoy: `eval` tries to resolve everything in the current namespace, not the namespace containing the function in which you called `eval`. |
| 17:39 | ToBeReplaced | i guess i could/should just create error handling `ethread` and the like to wrap up errors and put them on the channel |
| 17:41 | bsavoy | stuartsierra: But then this eval is declared in ns2, and it's eval'ing (bang "foo") which is declared in that one namespace. How is that? |
| 17:41 | logic_prog | right now, when doing clojurescript + clojure dev, I need to, from the same directoyr, run both (1) "lein cljsbuild auto" (for the cljs auto compilation) and (2) "lein repl' (so emacs can connect via nrepl). I never read the output of window (2), though I offen looka t window (1) for errors. Is there some way, so that I need only run one command, i.e. "lein cljsbuiod auto for cljs + nrepl" ? |
| 17:41 | bsavoy | Something to do with lazy-sequencing? |
| 17:41 | logic_prog | i'd like a single lein comand to both start cljs auto compilation and provide a nrepl for me to connect to |
| 17:42 | ToBeReplaced | logic_prog: you could use an alias, see :aliases on leiningen sample project |
| 17:43 | stuartsierra | bsavoy: When you run your code, the current namespace is either `tests.ns1` or `user`. That's the namespace `eval` is using to search for `bang`. |
| 17:43 | logic_prog | alias lets me run two plugins at once? |
| 17:43 | logic_prog | ToBeReplaced: how does alias help with using two plugins at once |
| 17:43 | bsavoy | stuartsierra: Ah thanks, that makes sense. |
| 17:44 | ToBeReplaced | logic_prog: i think "lein do cljsbuild-auto, repl" is the command you want, or something close to that... then you could alias to it |
| 17:44 | logic_prog | I don't even know what the "non-aliased" version is |
| 17:45 | rhg135 | why must java be so complex? https://www.refheap.com/19227 and still wrong output |
| 17:45 | rhg135 | today isn't sept. 1 right |
| 17:46 | ToBeReplaced | logic_prog: `lein do cljsbuild auto, repl` |
| 17:46 | hyPiRion | rhg135: use clj-time? |
| 17:46 | logic_prog | tried it |
| 17:46 | logic_prog | emacs can't connect |
| 17:46 | logic_prog | nrepl does not appear to be started |
| 17:46 | logic_prog | i'm sure I'm doing something stupid |
| 17:46 | rhg135 | thank goodness |
| 17:46 | rhg135 | but idk i just want to get a timestamp |
| 17:47 | ToBeReplaced | logic_prog: that's because auto never returns :) |
| 17:47 | logic_prog | I think it might be easiest |
| 17:47 | logic_prog | if I just embed a nrepl server :-) |
| 17:48 | rhg135 | i don't want to shell out though, i could just call date |
| 17:48 | rhg135 | from un ix |
| 17:50 | logic_prog | okay, embed success :-) |
| 18:11 | melipone | hello! I want to update several keys in a map. Is there a better way of doing that than (assoc (assoc mymap :firstkey 0) :secondkey 1)? |
| 18:11 | ToBeReplaced | melipone: (assoc mymap :firstkey 0 :secondkey 1) |
| 18:12 | melipone | ToBeReplaced: you can do that? thanks! |
| 18:12 | AimHere | Also consider merge and merge-with depending on what you're trying to do |
| 18:19 | recursor94 | I know I could probably find the answer to this online, but why doesn't clojure contrib officially exist anymore? |
| 18:20 | hiredman | it does, it just isn't a single entity anymore |
| 18:20 | recursor94 | but why? |
| 18:20 | nDuff | recursor94: because the old way was an almost-unmaintained mess. |
| 18:20 | nDuff | s/was/resulted in/ |
| 18:21 | hiredman | because it is frustrating to have a dependency management system and not be able to pull out just the bits you want |
| 18:21 | recursor94 | are most of those libraries still well maintained? |
| 18:22 | arohner | many. some were abandoned |
| 18:22 | hiredman | any that exist are mantained in some sense, anything that no one was interested in taking care of died with the single artifact contrib |
| 18:23 | hiredman | which was the other problem, the single contrib repo was full of stuff that had been "contributed" but then ignored |
| 18:24 | recursor94 | Does anybody have an opinion on what the best free learning resource is for clojure? |
| 18:25 | bitemyapp | recursor94: clojure.contrib was a bad idea. Free market of libraries ftw. |
| 18:25 | recursor94 | I see. |
| 18:25 | `cbp | recursor94: github :P |
| 18:25 | bitemyapp | recursor94: github |
| 18:25 | recursor94 | Most of what's on github is library code though. Some of it is difficult to decipher. |
| 18:25 | hiredman | recursor94: how I learned is reading the docs on clojure.org and writing clojure code, and I think that has served me pretty well |
| 18:26 | recursor94 | hiredman: Were you a lisper before clojure? |
| 18:27 | recursor94 | err, a lisp programmer? |
| 18:27 | `cbp | recursor94: is clojure your first language? |
| 18:27 | recursor94 | No. |
| 18:27 | akurilin | When you guys are developing ring apps, do you generally nrepl straight into the running server instance or do you use a separate repl? I've always spun a spun a separate lein repl, but I feel like that's unnecessary if you already have a server instance running. |
| 18:27 | hiredman | no, I had seen the sicp videos and tried to write a lisp interpreter in ruby (based on just the videos) but I had not used lisp in anger before |
| 18:27 | bitemyapp | akurilin: porque no los dos? |
| 18:28 | `cbp | recursor94: then you have some domain knowledge, just look up a library on that domain imho |
| 18:28 | akurilin | bitemyapp, why have 2 if 1 is enough? |
| 18:28 | bitemyapp | akurilin: it depends on what I'm doing. I generally have a clean-room non-server nrepl and a non-server test nrepl. I'll add a third server with embedded nrepl if I'm doing deep-magick. |
| 18:28 | bitemyapp | akurilin: because I slather myself with repls prodigally. |
| 18:29 | akurilin | bitemyapp, what's the difference between a clean-room and a test nrepl? |
| 18:29 | hiredman | lots of people will point you at tooling "install emacs, install lein, etc etc" but you can write clojure with notepad and java -jar clojure.jar |
| 18:29 | technomancy | akurilin: a separate repl makes no sense |
| 18:29 | hiredman | emacs and lein will just smooth out rough edges |
| 18:29 | bitemyapp | akurilin: main nrepl and test nrepl are both clean-room |
| 18:29 | bitemyapp | the non-clean-room is the server nrepl |
| 18:30 | bitemyapp | technomancy: only because you don't work like I do. |
| 18:31 | ucb | bitemyapp: callen? |
| 18:31 | technomancy | a separate process to do a sanity check full test run before merging/deploying makes lots of sense though |
| 18:31 | technomancy | but the whole point of "clean room" is to not allow new definitions, so interactivity isn't as necessary |
| 18:31 | bitemyapp | technomancy: I have c.t.n.r/refresh and (run-all-tests) in my test nrepl ready for the up-arrow. |
| 18:32 | bitemyapp | I do it for speed |
| 18:32 | bitemyapp | no waiting for lein/grench test start time |
| 18:32 | bitemyapp | up-arrow -> return -> bang answers |
| 18:32 | bitemyapp | "guard rail programming" (bang bang bang) |
| 18:32 | technomancy | you can still get stale state left around in memory |
| 18:32 | bitemyapp | I accept this possibility and choose to pretend it won't happen to me. |
| 18:33 | technomancy | hokay |
| 18:34 | indigo | Heh, every day I program in PHP I think "I wish I could do this in a REPL" |
| 18:34 | technomancy | but if you can get a running repl to match what's on disk with refresh, can't you do that on the primary repl process? |
| 18:34 | bitemyapp | not to try to accommodate PHP "programming", but I'm pretty sure there are PHP REPL'ish things. |
| 18:34 | scriptor | indigo: there's one or two repl implementations for the php, aren't there? |
| 18:35 | indigo | scriptor & bitemyapp: There are, but they're not really there |
| 18:35 | recursor94 | hiredman: Was that tooling comment directed towards me? |
| 18:35 | hiredman | recursor94: sure, or whoever |
| 18:35 | scriptor | indigo: are we talking existentialism now? |
| 18:36 | `cbp | sometimes you're just forced to write with outdated php that won't be able to use any 3rd party libraries |
| 18:36 | recursor94 | oh okay. already have emacs and lein setup. I just need to learn the skill now. |
| 18:36 | indigo | scriptor: Just not as easy to use or complete as Clojure's :P |
| 18:37 | indigo | Then again, PHP doesn't really lend itself to REPL-based programming |
| 18:38 | indigo | Heh, when I showed my coworker a PHP repl I found he told me it was too bloated and that he could write one in five lines |
| 18:38 | scriptor | heh |
| 18:39 | scriptor | I bet that's going to include autocomplete and taking in statements over multiple lines, of course |
| 18:39 | indigo | And not crashing the entire REPL in case PHP has a fatal error |
| 18:40 | mtp | php often embodies a fatal error |
| 18:40 | indigo | Lmao |
| 18:40 | dobry-den | recursor94: clojure-contrib doesnt really come up for me in google searches, so if youre exposed to it, you may be following old tutorials. anything i've wanted from contrib has a maintained surrogate. |
| 18:40 | `cbp | lisp repl takes 4 symbols :-D |
| 18:40 | indigo | `cbp: Yeah, it's fantastic |
| 18:46 | recursor94 | Is there a clojure irc bot library? |
| 18:47 | recursor94 | I know of clojure bot. |
| 18:47 | recursor94 | But I'm wondering if there are any true libraries |
| 18:48 | scriptor | try this https://github.com/flatland/irclj |
| 18:48 | logic_prog | is there a way to define a *.clj files that is used from both clj and cljs? (it's a set of helper functions / macros that are portable) |
| 18:48 | scriptor | (for future reference, I found it on http://www.clojure-toolbox.com/) |
| 18:48 | recursor94 | Thank you scriptor. |
| 18:49 | nDuff | logic_prog: there are a few approaches; nothing I'd describe as _good_. |
| 18:49 | nDuff | logic_prog: ...see for instance https://github.com/lynaghk/cljx |
| 18:49 | logic_prog | how about a symbolic link? :-D |
| 18:49 | Jarda | hey guys, any feedback on https://gist.github.com/nnarhinen/6786086 |
| 18:49 | gfredericks | I love how derive is side-effecting in the 2-arg version but not the 3-arg version. |
| 18:49 | logic_prog | lol |
| 18:49 | logic_prog | the problem to having two file extensions, is to invent a third file extension |
| 18:50 | nDuff | logic_prog: ...see also https://github.com/emezeske/lein-cljsbuild/blob/0.3.3/doc/CROSSOVERS.md |
| 18:50 | logic_prog | nDuff: is your nick based on duff's device? |
| 18:50 | nDuff | Nope. |
| 18:50 | mtp | HOW ABOUT DUFF BEER |
| 18:50 | mtp | oh |
| 18:50 | logic_prog | you know what? |
| 18:50 | logic_prog | the shared code is very small |
| 18:50 | logic_prog | I will keep two copies |
| 18:50 | Jarda | have I understood core.async channels right.. |
| 18:51 | logic_prog | I'm suddenly very happy wtih slight code dup[lication |
| 19:06 | CommandBot | Greetings! Send me a PM and I'll echo it back to you. If it contains the word 'die', I'll die as a bonus! |
| 19:07 | akurilin | Sometimes I'm deeply confused by this channel. |
| 19:07 | akurilin | Between the bots and the starcraft guy, I just don't know. |
| 19:08 | TEttinger | &(apply str (map char (repeat 80 7))) |
| 19:08 | lazybot | ⇒ "" |
| 19:08 | hyPiRion | akurilin: those things have happened very recently only, though |
| 19:08 | TEttinger | hm which is \07 |
| 19:09 | akurilin | hyPiRion, is this Clojure hitting critical mass ? |
| 19:09 | TEttinger | ,(apply str (map char (repeat 10 11)) "this char should really be stripped out") |
| 19:09 | clojurebot | "clojure.lang.LazySeq@42f449a1this char should really be stripped out" |
| 19:10 | bitemyapp | akurilin: we've had more people in the IRC channel than Scala for awhile. |
| 19:10 | TEttinger | ,(apply str "this char should really be stripped out" (map char (repeat 10 11))) |
| 19:10 | clojurebot | "this char should really be stripped out" |
| 19:10 | TEttinger | if that displayed across multiple lines, congratulations, you have a nice client |
| 19:11 | hyPiRion | akurilin: gaining more traction, probably. Not sure if it's critical mass, but we're getting closer to it at least? |
| 19:11 | bitemyapp | if seangrove is to be believed, we need Rails first. |
| 19:12 | logic_prog | is clojure's cond guaranteed to be sequential? |
| 19:12 | logic_prog | (in the order the conditionals appear) |
| 19:12 | technomancy | yes |
| 19:12 | bitemyapp | logic_prog: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/cond |
| 19:13 | hyPiRion | according to the (doc cond), eys |
| 19:13 | logic_prog | technomancy, bitemyapp, hyPirion: noted, thanks |
| 19:14 | akurilin | bitemyapp, hyPiRion well if you were to use Hacker News as your only window into the world, you'd think that Clojure is hot as hell right now |
| 19:14 | akurilin | it's been sizzling hot in the past couple of months at least |
| 19:14 | hyPiRion | akurilin: and go, and any fancy JS thing |
| 19:14 | akurilin | oh Go, of course. |
| 19:14 | akurilin | let me check their channel |
| 19:14 | bitemyapp | What passes for fancy in JS-landia ain't fancy. |
| 19:15 | akurilin | I forgot SEO for that word. |
| 19:15 | TEttinger | https://attractivechaos.wordpress.com/2012/03/24/two-interesting-polls-on-programming-languages/ |
| 19:15 | akurilin | Good gosh... |
| 19:15 | akurilin | 840+ |
| 19:15 | akurilin | so apparently the HN push is working for them. |
| 19:17 | hyPiRion | TEttinger: huh, https://news.ycombinator.com/item?id=3746692 and https://news.ycombinator.com/item?id=3748961 isn't exactly the "truth" out there though. I didn't know of those polls beforen ow |
| 19:19 | hyPiRion | It would be more interesting to track submissions with a programming language in the title, and measure that |
| 19:19 | hyPiRion | granted, "Go" would have quite some false positives |
| 19:21 | TEttinger | I really liked Argo, it was a great film <-- vote for Go |
| 19:21 | TEttinger | I got an iPhone today! <-- vote for go |
| 19:22 | hyPiRion | TEttinger: you can probably do splits and stuff to only match for go and golang |
| 19:23 | TEttinger | I would hope so! |
| 19:23 | hyPiRion | I mean, C, D and J would obviously win otherwise |
| 19:23 | TEttinger | \bgo\b |
| 19:23 | TEttinger | haha |
| 19:28 | Morgawr | wow, I'm probably getting a brain fart at the moment but.. how do I remove a key/value pair from a simple map? |
| 19:28 | ambrosebs | Morgawr: dissoc |
| 19:29 | Morgawr | ambrosebs: damn, thanks! |
| 19:29 | Morgawr | ambrosebs: you're the one working on typed clojure, right? |
| 19:30 | ambrosebs | Morgawr: that's me |
| 19:30 | Morgawr | ambrosebs: great job, I love how it's coming up. I've always been fascinated by strong type systems like Haskell and having it fully integrated (and not forced) into clojure would be the best thing ever |
| 19:31 | ambrosebs | Morgawr: thanks! agreed |
| 19:57 | logic_prog | is there something like "flttten" but only does it one level? |
| 19:57 | logic_prog | concat |
| 19:57 | Apage43 | mapcat identity? |
| 19:58 | logic_prog | logic_prog: thanks |
| 19:58 | technomancy | apply concat would be better I think |
| 19:58 | logic_prog | Apage43: that sounds equiv to concat |
| 19:58 | Apage43 | ,(mapcat identity [[1 2 3] [4 5 6] [7 [8 9]]]) |
| 19:58 | clojurebot | (1 2 3 4 5 ...) |
| 19:58 | Apage43 | ,(apply concat [[1 2 3] [4 5 6] [7 [8 9]]]) |
| 19:58 | clojurebot | (1 2 3 4 5 ...) |
| 19:58 | Apage43 | yes |
| 20:05 | chord | lets talk about starcraft |
| 20:07 | technomancy | let's talk about how everyone would be a lot happier if chord either 0) changed his behaviour dramatically or 1) got kickbanned |
| 20:07 | arrdem | :D |
| 20:08 | chord | technomancy: I've been putting all this effort trying to understand starcraft 2 pathfinding why you guys all hate me |
| 20:08 | nDuff | technomancy: aren't you one of the people with the necessary ACL to implement (1)? |
| 20:09 | mtp | let's all upgrade to IRC clients with fools lists |
| 20:09 | mtp | chord‘ nobody likes you because you contribute nothing but noise and heat |
| 20:09 | arrdem | mtp: most support /ignore, which is close enough |
| 20:09 | mtp | try exhibiting a little bit of light |
| 20:09 | technomancy | nDuff: yes, but as a relatively new op I'm inclined to err on the side of grace |
| 20:10 | mtp | arrdem‘ ignore destroys the conversation whereas fools just hides the foolish text under the rug, to be swept out later |
| 20:10 | mtp | so no, it's not close enough |
| 20:10 | technomancy | nDuff: said policy is probably nearing its expiry though |
| 20:10 | mtp | sometimes, sweeping it under the rug /is/ the right thing to do |
| 20:10 | chord | mtp: once I have a working pathfinding are you going to admit you're wrong |
| 20:14 | indigo | mtp: TIL fools lists |
| 20:15 | mtp | indigo: they're the best thing for irc |
| 20:15 | bitemyapp | mtp: you can ignore replies, but there are still ghost conversations. |
| 20:15 | indigo | What IRC clients support it? |
| 20:15 | bitemyapp | indigo: irssi |
| 20:15 | indigo | Oh nice |
| 20:15 | indigo | I'm using that |
| 20:15 | arrdem | indigo: apparently ERC has one but I'm not using it |
| 20:15 | indigo | I assume it's a plugin |
| 20:16 | mtp | indigo: most of the emacs ones |
| 20:16 | mtp | circe supports it well |
| 20:16 | mtp | bitemyapp‘ there's the same problem with ignore, so... |
| 20:16 | Morgawr | man this is so weird.. I've been staring at this 1:1 copy/port of a java algorithm to clojure and in 90% of the cases the clojure one works properly but the sometimes it doesn't and reports wrong values.. I know you guys can't help me (too specific problem), but it's so frustrating :( |
| 20:18 | hyPiRion | Morgawr: take a break from it. grab a coffee or go to bed, depending on where you live |
| 20:19 | hyPiRion | Sometimes, the way to solve a problem is by not solving it. |
| 20:19 | mtp | smoke legal psychoactives |
| 20:19 | rasmusto | Morgawr: draw some diagrams and try to explain it verbally |
| 20:20 | Morgawr | hyPiRion: heh, I've been working on this thing for days, I took my fair share of breaks.. I've even re-written this algorithm 3 times (different code, no copying) and the same "bug" keeps presenting |
| 20:20 | hyPiRion | Morgawr: ah, that's tough |
| 20:20 | bitemyapp | Morgawr: hi |
| 20:20 | Morgawr | I just wanted to port a multithreaded implementation of a nested depth-first search algorithm for cycle detection, I wrote the sequential (non-multi) version in Java and Clojure, they work fine. |
| 20:21 | Morgawr | Wrote the multithreaded version in Java, it works as intended (I got the pseudocode and it's trivial to port) |
| 20:21 | Morgawr | I wrote the multithreaded clojure one... it works for 90% of the input, sometimes it just doesn't though and that's so frustrating |
| 20:21 | bitemyapp | Morgawr: poast coade. |
| 20:22 | Morgawr | http://pastie.org/private/f0m66s85ea3x6szmqk2gmw this is the algorithm and this is the reference paper http://www.cs.vu.nl/~tcs/cm/mc-nndfs.pdf with pseudocode |
| 20:22 | Morgawr | but yeah, it's just too specific for my case so I doubt anyone is able to help me |
| 20:22 | Morgawr | (and I don't expect you guys to, I was just ranting, sorry) |
| 20:23 | bitemyapp | Morgawr: working case and breaking case plz. |
| 20:23 | bitemyapp | also wtf pastie |
| 20:23 | bitemyapp | Morgawr: use refheap next time plz ;_; |
| 20:23 | Morgawr | be glad it's not pastebin :P |
| 20:23 | bitemyapp | those white-background pastebins burn my soul |
| 20:24 | Morgawr | working case... breaking case... it's hard to say, it's a very intensive and specific problem, it operates on promela graph generators on-the-fly so I don't really have a "breaking case" |
| 20:24 | bitemyapp | Morgawr: ... |
| 20:24 | Morgawr | which is why it's hard as hell to fix |
| 20:24 | chord | omg |
| 20:24 | bitemyapp | Morgawr: write unit tests that work and unit tests that break |
| 20:24 | bitemyapp | Morgawr: create a dumpable form of the data that is generated |
| 20:24 | Morgawr | can't do it in this case, sorry |
| 20:24 | bitemyapp | Morgawr: short-circuit on failure and dump the "world" given to you. |
| 20:25 | bitemyapp | Morgawr: if it's not a nuanced comprehension across terabytes of data (and even then) you can always dump fixture data. |
| 20:25 | Morgawr | how do you unit-test on a depth-first search algorithm that operates on data that is too big to fit in memory? The only thing you can test is if it returns "true" or "false" upon detecting a cycle (which is the point of the algorithm) |
| 20:25 | bitemyapp | Morgawr: the size doesn't matter! |
| 20:25 | technomancy | set your heap size very small? =) |
| 20:26 | bitemyapp | <3 technomancy |
| 20:26 | bitemyapp | Morgawr: make a tiny test-case that works. then make a tiny one that breaks. |
| 20:27 | bitemyapp | Morgawr: you cannot work on problems like this without reproducible tests and regressions. |
| 20:27 | Morgawr | it's okay, I don't expect anyone to help me, sorry |
| 20:27 | bitemyapp | Morgawr: you understand that your code breaks because of the nature of the data, not the size of it, right? |
| 20:27 | bitemyapp | Morgawr: at least chuck me the black-box magic generator you're using and the origin data. |
| 20:29 | Morgawr | bitemyapp: https://www.refheap.com/a2c864b3a316c7ae4170d1231 this is the input graph that sometimes works and sometimes doesn't (it's based on the shuffle operation in the post walk of the graph, which is there to ensure entropy when multiple threads walk the graph) |
| 20:29 | Morgawr | as I said, it's not testable |
| 20:29 | Morgawr | it either works or doesn't |
| 20:29 | bitemyapp | oh bullshit. |
| 20:29 | bitemyapp | you can produce regressions for non-deterministic sources of data through snapshotting. |
| 20:30 | Morgawr | you do realize that writing complex unit testing for this algorithm is actually harder and more troublesome (and more prone to errors) than actually finding the issue in the algorithm, right? |
| 20:31 | bitemyapp | reproducibility uber alles. |
| 20:31 | bitemyapp | Morgawr: doing things the right way is hard. News at 11. |
| 20:31 | Morgawr | you're missing the point though |
| 20:31 | bitemyapp | I almost always do. |
| 20:31 | Morgawr | this is a simple implementation of an algorithm, it's not some complex massive system for "production" (or whatever) that needs to be tested |
| 20:32 | Morgawr | either the algorithm is correct or is not |
| 20:32 | Morgawr | and in this case it's not |
| 20:32 | Morgawr | the way to fix it? look at the algorithm |
| 20:32 | Morgawr | it's justa graph traversal (double graph, but whatever) |
| 20:33 | bitemyapp | Morgawr: was this an exercise of some sort? |
| 20:33 | Morgawr | bitemyapp: the java part yes, it's part of my multithreading class |
| 20:33 | Morgawr | I'm expanding it because I want to see how clojure performs |
| 20:34 | Morgawr | it's not something that has anything to do (anymore) with my clas |
| 20:34 | Morgawr | class* |
| 20:34 | Morgawr | just doing it for fun |
| 20:34 | Morgawr | and to gather some performance comparisons |
| 20:34 | bitemyapp | ahhh paper starts out by mentioning the death of Moore's Law |
| 20:34 | bitemyapp | it's almost like academics have to justify making something multi-core/concurrent to their colleagues. |
| 20:34 | bitemyapp | Morgawr: well post the java code that works pelase. |
| 20:34 | bitemyapp | Morgawr: please* |
| 20:35 | rasmusto | heat death of the universe (cmos) |
| 20:35 | bitemyapp | Morgawr: also, was the second paste supposed to be generator? I want to be able to run this. |
| 20:35 | bitemyapp | be a generator* |
| 20:36 | Morgawr | https://www.refheap.com/5fce6f68da0fb9e5018c2c3b5 this is the java implementation, it's not that great and incomplete (didn't paste all the classes etc etc), it's just faster to read the actual paper pseudocode implementation which is where the clojure algorithm comes from |
| 20:36 | Morgawr | and yeah, that was the graph generator, it's a promela file and is read into memory and generates a spinja graph or whatever (not familiar with that stuff tbh, it's just the input model that was provided and is not relevant) |
| 20:37 | bitemyapp | Morgawr: can you just put this into a github that 'runs'? |
| 20:38 | bitemyapp | Morgawr: or am I just going to have to try to reproduce your environment through guessing? |
| 20:38 | mtp | why do i have an empty pm window on my screen all of a sudden??? |
| 20:38 | lazybot | mtp: How could that be wrong? |
| 20:38 | Morgawr | it's okay, I appreciate the help but I can't really be arsed to put everything on github, I'll just try to fix the weird issue (it's most likely a shitty typo I made or something) |
| 20:38 | bitemyapp | Morgawr: come back with the answer when you have one please. |
| 20:38 | Morgawr | don't take it wrong bitemyapp, I do appreciate the help |
| 20:39 | Morgawr | I certainly will |
| 20:39 | bitemyapp | Morgawr: I just want to know the answerrrrr ;_; |
| 20:39 | bitemyapp | Morgawr: thank you :) |
| 20:48 | seangrov` | Hrm, think I'm about 40% done porting the rails app to clojure after ~1.5 days. I assume the last 10% will be killer as always, but it's been a fun exercise. |
| 20:50 | chord | can anyone hear me? |
| 20:50 | akurilin | Just wanted to let you guys know that the clojure cookbook stuff is super awesome, the contributors and awesome, and you guys should keep making more of them if you know what you're doing. |
| 20:51 | akurilin | <3 |
| 20:52 | chord | which clojure cookbook |
| 20:52 | akurilin | No idea how I'm ever going to pay it forward for all the stuff you people put together... |
| 20:53 | dobry-den | someone posted this in r/clojure: http://i.imgur.com/4avtGfg.gif |
| 20:55 | technomancy | dobry-den: ooh; /me does grabby-hands |
| 20:55 | dobry-den | it's hickey after some hammock-time |
| 20:55 | technomancy | it will go well with my collection: http://p.hagelb.org/9grin.gif http://p.hagelb.org/10sad.gif |
| 20:56 | ambrosebs | hahaha |
| 20:56 | arrdem | /11-rhicky.gif? |
| 20:57 | bitemyapp | akurilin: I'm working on the Korma chapter of the cookbook right now |
| 20:57 | bitemyapp | I'm also going fucking mad trying to idiot proof it. |
| 20:58 | bitemyapp | I would just like to state that H2 sucks. |
| 20:58 | indigo | I don't understand why everyone uses H2 |
| 20:58 | indigo | Why not use SQLite instead |
| 20:58 | `cbp | :P I use h2 |
| 20:58 | technomancy | indigo: sqlite's jdbc drivers are junk |
| 20:59 | akurilin | bitemyapp, if you want me to proof-read it I can try to help, although I'm not very useful on the technical side since I haven't used it at all yet. |
| 20:59 | dobry-den | datomic-free uses h2 ;) |
| 20:59 | clojurebot | Cool story bro. |
| 20:59 | technomancy | they don't work concurrently, even though the underlying DB does |
| 20:59 | bitemyapp | akurilin: yes, you can be my test subject. |
| 20:59 | hiredman | h2 also has concurrency issues |
| 20:59 | akurilin | bitemyapp, I gotta learn it anyway so, might as well. |
| 20:59 | hiredman | (use derby) |
| 20:59 | akurilin | *updates todo list. |
| 20:59 | bitemyapp | hiredman: derby is slow. I'd rather go fast and break things. It's what Zuckerberg sed. |
| 20:59 | akurilin | ok |
| 21:00 | bitemyapp | If that last statement made your eye twitch, please (inc bitemyapp) |
| 21:00 | kcin | j #lowendbox |
| 21:00 | akurilin | bitemyapp, is the chapter up on github already or are you hugging at atm? |
| 21:00 | `cbp | (inc callen) |
| 21:00 | lazybot | ⇒ 15 |
| 21:01 | hiredman | when h2 throws exceptions due to concurrent access, you can't go fast enough to break anything |
| 21:01 | dobry-den | indigo: isnt topic difference that h2 is a java lib while sqlite is a c lib? |
| 21:02 | dobry-den | topical |
| 21:03 | `cbp | (inc bitemyapp) ; ahem quite the typo there |
| 21:03 | lazybot | ⇒ 1 |
| 21:15 | bitemyapp | You know how I know this Clojure Cookbook is going to be good? |
| 21:15 | bitemyapp | {:NAME "Dmitri" :TENTACLES false} |
| 21:15 | bitemyapp | because tentacles are involved. |
| 21:15 | bitemyapp | Always a good time. |
| 21:30 | LordQuas | Is clojure-mode + nrepl the preferred way to do clojure with emacs? |
| 21:30 | LordQuas | \join #emacs |
| 21:30 | rasmusto | LordQuas: grab paredit.el too |
| 21:32 | LordQuas | yup yup, used to it with elisp editing. I read some posts about slime and wondered which was better |
| 21:32 | rasmusto | nrepl is the new standard afaik |
| 21:33 | LordQuas | Gotcha, thanks. |
| 21:33 | LordQuas | Oh and what about ritz? |
| 21:33 | rasmusto | LordQuas: I have this thing if you want something to look at: https://github.com/rasmusto/vim-emacs-clojure-starter-kit |
| 21:33 | rasmusto | LordQuas: can't speak to ritz |
| 21:35 | LordQuas | rasmusto: Thank you, I will gladly plunder this =D |
| 21:35 | rasmusto | LordQuas: I just learned emacs a few weeks ago, so don't take anything as doctorine ;p |
| 21:36 | technomancy | the guide on clojure-doc.org is very good too http://clojure-doc.org/articles/tutorials/emacs.html |
| 21:36 | technomancy | if vebose |
| 21:43 | bitemyapp | H2's capitalization bullshit is really ruining my day. |
| 21:44 | bitemyapp | of course, Korma already has something for this and I was being a moron. |
| 21:49 | TimMc | bitemyapp: Technically, tentacles *aren't* involved. |
| 21:49 | TimMc | It says so right there, :TENTACLES false. |
| 21:51 | bitemyapp | TimMc: the faces I am making at you right now would crack a mirror. |
| 21:56 | devn | in-place fisher-yates -- got a good clojure version? |
| 22:02 | devn | my versions all look nasty |
| 22:03 | Apage43 | heh |
| 22:04 | Apage43 | i decided to look at clojure.core/shuffle |
| 22:04 | Apage43 | it just calls java.util.Collections/shuffle |
| 22:04 | Apage43 | (after dumping the collection into an ArrayList |
| 22:21 | amalloy | devn: i have one in useful |
| 22:22 | amalloy | aside from the poor decision i made to combine lazy-shuffle with take into a single take-shuffled, https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L149 is IMO pretty good |
| 22:36 | gfredericks | ,(format "lib-%04d" (rand-int 10000)) |
| 22:36 | clojurebot | "lib-7607" |
| 22:39 | mercwithamouth | how would one go about calculating an average functionally? |
| 22:40 | gfredericks | (fn avg [nums] {:pre [(seq nums)]} (/ (apply + nums) (count nums))) |
| 22:41 | mercwithamouth | gfredericks: o_O |
| 22:41 | gfredericks | something wrong? |
| 22:41 | mercwithamouth | not that i would know =P |
| 22:41 | mercwithamouth | trying it out now |
| 22:42 | mercwithamouth | what does ':pre' do? |
| 22:43 | gfredericks | it's a precondition; if (seq nums) is falsy, i.e. if nums is empty, it will throw an assertion error |
| 22:43 | mercwithamouth | ahh i see |
| 22:43 | gfredericks | slightly more readable is {:pre [(not (empty? nums))]}, but we have this silly idiom |
| 22:44 | mercwithamouth | hrmm any way to do it parallel? |
| 22:44 | gfredericks | use reducers for the apply + I guess |
| 22:44 | mercwithamouth | <- not a math person but discussing an issue with a friend |
| 22:45 | gfredericks | if you're thinking about functional programming abstractly, the parallelism is somewhat of an implementation detail |
| 22:45 | gfredericks | but yes the addition part is parallelizable |
| 22:47 | mercwithamouth | hrmm |
| 22:49 | mercwithamouth | gfredericks: and is that possible without keeping a count? holding state? |
| 22:50 | gfredericks | um. huh? yes? not sure what you mean exactly. |
| 22:50 | `cbp | I gotta say multiple cursors on emacs is the sexiest thing |
| 22:50 | `cbp | especially with paredit omg |
| 22:55 | ghadi | Before I try to get help for a possible lein bug, I want to thank technomancy and all the leiningen contributors for such a fine tool. |
| 22:56 | ghadi | I think there is an issue with two dependencies that silently shadow each other |
| 22:57 | ghadi | clojurescript 0.0-1909 requires tools.reader, as does clj-http 0.7.x |
| 22:58 | ghadi | When you list both of them in :dependencies and then run lein deps :tree to find conflicts, tools.reader only shows up as a transitive dep of clojurescript, not of clj-http |
| 22:59 | gfredericks | that might be expected |
| 22:59 | ghadi | but when you require the clojurescript code -- it silently picks up the incompatible tools.reader version that clj-http uses, and barfs out on arity on a constructor |
| 22:59 | ghadi | hi gary |
| 22:59 | gfredericks | hi |
| 22:59 | gfredericks | ghadi |
| 23:00 | gfredericks | oh wait so you're saying the tree prints it under one but it's actually using the version required by the other? |
| 23:00 | ghadi | si senor |
| 23:00 | gfredericks | does tree print a version for tools.reader? |
| 23:01 | hiredman | ghadi: what version of tools.reader shows up in lein classpath? |
| 23:01 | gfredericks | (`lein classpath`) |
| 23:02 | ghadi | lein deps :tree shows tools.reader under clojurescript as the latest ver (0.7.8) but classpath shows 0.7.7 |
| 23:02 | ghadi | no conflict warning on lein deps :tree |
| 23:04 | ghadi | in clj-http's pom, tools.reader is listed with a org.clojure/clojure exclusion |
| 23:05 | ghadi | in clojurescript's pom, no exclusion -- not sure if this fact matters, but it's a fact |
| 23:06 | ghadi | [org.clojure/clojurescript "0.0-1909"] |
| 23:06 | ghadi | [clj-http "0.7.7"] you can reproduce the behavior with these deps in an empty project |
| 23:07 | gfredericks | this is out of my realm of expertise; if nobody else is around I'm sure a github issue would be appreciated |
| 23:09 | ghadi | I'll open one up. thanks |
| 23:11 | AieshaDot | t |
| 23:14 | dobry-den | How come running mvn goals from ~ dir don't complain about pom.xml but they do in non-~ folders |
| 23:16 | ghadi | Lucky issue # https://github.com/technomancy/leiningen/issues/1337 |
| 23:16 | gfredericks | ghadi: you get internet money! |
| 23:16 | ghadi | what do I win |
| 23:16 | gfredericks | 1337 internet dollars |
| 23:17 | gfredericks | redeemable at your local internet location |
| 23:17 | TEttinger | http://i.imgur.com/dOLkgVR.png <-- not related to issue #1337, but relevant to some questions we've had in here lately |
| 23:25 | gfredericks | so I was trying to be helpful to myself by throwing an ex-info from one of my test helpers |
| 23:25 | gfredericks | with stuff that I could use to debug why the test failed |
| 23:26 | gfredericks | but I'm not sure clojure.test is going to let me see the exception? |
| 23:29 | logic_prog | is there a way to tell "lein cljsbuild auto" to also "require main.clj" ? |
| 23:36 | ddellacosta | logic_prog: why do you need main.clj? Is it crossover code? If so, just put it in the source-paths list |
| 23:37 | logic_prog | no |
| 23:37 | logic_prog | I just want a single lein |
| 23:37 | logic_prog | that both runs my clojure server and also do "cljsbuild auto" |
| 23:38 | technomancy | logic_prog: trampoline combines chained tasks |
| 23:38 | technomancy | `lein trampoline do run -m my.main, cljsbuild auto` |
| 23:38 | technomancy | "When in doubt, use combinators." |
| 23:42 | muhoo | why combinators? |
| 23:42 | logic_prog | technomancy: who are you and what makes you qualified? |
| 23:42 | logic_prog | I'm kidding, it worked, thanks. :-) |
| 23:42 | gfredericks | combinators are the monads of programming |
| 23:43 | logic_prog | ha ha |
| 23:43 | logic_prog | Y Combinators |
| 23:43 | logic_prog | :-) |
| 23:51 | logic_prog | when I do (:require-macros [blahblah :as ..]), does it only pull in defmacros or does it pull in defns too ? |
| 23:54 | gfredericks | pulling in defns wouldn't make sense? because it's compile-time? |
| 23:54 | gfredericks | the defns are written in clojure presumably, not clojurescript |