#clojure logs

2013-10-01

00:23akurilinHas anybody figured out how to do a parameterized SQL IN clause without using a server-specific data structure such as PG arrays?
00:26`cbpdamn reql is not very pleasant to write [an implementation of]
00:29Raynesambrosebs: 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:30RaynesThe whole project doesn't even have a license or a mention of one.
00:30RaynesWhich is worrisome.
00:32RaynesOh, I guess you didn't really expect that.
00:33Raynes"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:33RaynesWell, that sucks.
00:33ambrosebsRaynes: Well it's the ultimate breaking change isn't it?
00:33ambrosebsI don't see anyone taking it lightly
00:34ambrosebsRaynes: yes, I asked Bronsa to organise offering CinC to contrib.
00:35Raynesambrosebs: 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:35ambrosebsRaynes: 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:35RaynesWell, that's good news.
00:35RaynesThat's probably the only project I'm actually happy to see go to contrib. :D
00:36ambrosebsRaynes: :D
00:36ambrosebsRaynes: throwing money to CinC can only possibly be a good thing IMO
00:36ambrosebsRaynes: just an awesome project
00:36ambrosebsRaynes: and IMO Bronsa is on a roll, just needs more pushing :)
00:36RaynesAbsolutely! Either reason for funding that I listed above was totally valid.
00:37ambrosebsyes all of the above
00:37RaynesBronsa is a cool chap, indeed.
00:37ambrosebsand a selfish reason, I'm waist deep in analysis all day every day.
00:38ambrosebsso it's also for me.
00:38ambrosebsI'd guess no-one uses JVM analyser more than me.
00:39Raynes:p
00:39ambrosebsRaynes: also, CinC is a very important piece of standardised AST representation across clojure implementations
00:39ambrosebsRaynes: as in, we all need to sit down and work it out.
00:40RaynesKidnap Rich at the next conj?
00:40technomancyalso: it doesn't have to "officially" replace the java compiler for you to use it
00:41RaynesUgh.
00:41ambrosebstechnomancy: exactly. I want the dependency, wherever it is.
00:41technomancyprobably a lot to be learned from rubinius, pypy, etc here
00:42RaynesIt's great for ambrosebs, but the prospect of multiple popular Clojure compilers makes me nauseous beyond that.
00:43`cbpcallen: ping
00:43ambrosebsRaynes: yes, we should revolt against Compiler.java :)
00:44ambrosebsRaynes: the java compiler hasn't changed in years, so it's not like we'll have multiple moving targets.
00:44Raynesambrosebs: http://www.youtube.com/watch?v=UsnKkXFQYqU
00:44ambrosebs:)
00:44Raynes(this was the first live band I ever saw, opening for KMFDM, amusingly)
00:45Raynes(neither band I was familiar with, I was taken to the show rather spontaneously)
00:46glosoliAnyone here familiar with Emacs and jumping into Java sources from Clojure interop ?
00:46glosoliI 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:47callen`cbp: yes dear?
00:52ivanhas 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:52akhudekhow does one return javascript null from a clojure function?
00:52akhudekI thought it was js/null, but that's giving some weird null$
00:53`cbpcallen: 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:53ambrosebsakhudek: it's it just nil?
00:53ambrosebsakhudek: oh nvm read that wrong.
00:54ambrosebsakhudek: do you mean in cljs?
00:54akhudekyeah, we have cljs code that needs to return an actual null
00:54akhudekrather than nil
00:56akhudekoh, nevermind, you are right, it is nil
00:56`cbpcallen: such that you could do something like (-> (db "test) (table "users") (filter…)) but none of those would be the clojure.core functions
00:56`cbpthat wrapped in a (dsl macro or something
01:00callen`cbp: I don't know reql.
01:01`cbpcallen: 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:05callen`cbp: oh sorry forgot rethinkdb's DSL was called reql
01:06`cbp:-o
01:08callen`cbp: I think you should do it like Korma
01:08callen`cbp: build up maps incrementally with db, table, filter functions
01:08callen`cbp: then have an executor fn for actually dispatching it.
01:11`cbpcallen: Right now I have https://www.refheap.com/19196
01:11`cbpis that ok?
01:14callen`cbp: I was thinking of starting from a plain map format, then turning it into protobuf in the executor
01:15callen`cbp: to keep those worlds separate.
01:16`cbpcallen: mmk
01:53nonubyis 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:57callennonuby: search clojars?
01:58nonubymeh, means leaving command line, may something similar to node.js `npm install library-name --save` that adds to the project.clj deps vector
02:05rasmustononuby: I wonder if there's a lein plugin for it
02:06Raynes$latest midje
02:06lazybot[midje "1.6-beta1"] -- https://clojars.org/midje
02:06Raynesnonuby: ^
02:06RaynesWon't work for things not on clojars.
02:06RaynesBut it exists nontheless.
02:08nonuby$latest compojure
02:08lazybot[compojure "1.1.5"] -- https://clojars.org/compojure
02:08nonubyRaynes, nice! :)
02:09holohi
02:12hologuys/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:13rhg135There are no girls on irc afaik
02:14holohey, you never know
02:15holobtw, don't know why but i uploaded a very old version.. how is it possible? that's 2 weeks old source or something
02:16nonubyrhg135, ssshhh... are you trying to get a conference cancelled!
02:16glosoliDamn it got me paranoid, is Emacs nREPL mode supposed to M-. jump into java source files, or this is just my imagination ?
02:16rhg135Right...
02:22tak/?
02:22holonie
02:32holook, the most recent version is there now
02:36seancorfieldRaynes: seems like you could easily extend $latest to also handle Maven Central for org.clojure stuff too?
02:36seancorfield$latest java.jdbc
02:36lazybotNo project by this name exists on clojars.
02:38seancorfieldurl: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.clojure%22%20a%3A%22java.jdbc%22
02:38seancorfieldyou could pull the latest version from that...?
02:40seancorfieldrhg135: 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:41mtpthere aren't guys on irc either
02:41mtponly nicknames
02:41rhg135not rly, on most chans im in theres no girls
02:41mtpgo to better channels
02:42rhg135the most notable ones, here #openjailbreak and #teamgelato
02:42rhg135i have seen girls but the ratio is like 1:1000
02:42mtpmy condolences
02:42mtpi only see nicknames
02:43rhg135fair enough
02:43mtpdoes this nickname have a dick or a vagina? wait, who cares
02:43mtpam i trying to get laid on irc or talk about programming
02:43rhg135i usually assume a guy until proven otherwise
02:43nonubywhy 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:43gwshttp://cdn.meme.li/i/con66.jpg
02:44rhg135ya idc
02:44nonubyWhen was the last time you hear, Im not getting on that Delta flight - 80% of cabin crew are female!
02:44rhg135i just say ppl
02:45rhg135not 'guys an girls'
02:45nonubyexactly
02:45mtpnonuby‘ i'm not getting on the flight because heavier-than-air flying machines are impossible
02:45holoconference cancellations?
02:46holooh ok
02:47nonubyi 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:48holononuby, following that logic, did you get into the kinds of studies where >80% of girls are at?
02:49nonubyholo, not sure I follow.
02:49dissipateholo, what, like psychology?
02:49holoyou know, language studies … yes psychology
02:51nonubyif I want to study psychology I dont gender would have any influence on admission to course
02:51nonubyI dont -> I doubt
02:51dissipatepsychology... a 1 way ticket to working as a barista in Starbucks
02:51holohaha
03:04wei_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:04wei_example to illustrate the issue: https://github.com/yayitswei/leinwithjava
03:05nonuby$latest clj-http
03:05lazybot[clj-http "0.7.7"] -- https://clojars.org/clj-http
03:21Raynesseancorfield: 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:38seancorfieldyou could search maven if clojars has no results :)
03:39seancorfieldit would be a nice way to show the contrib libs
03:39seancorfieldi guess i could send you a pull request? what's the repo link?
03:47dcunit3danyone used quil before (clj processing)
03:58zanesTrying 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:59john2xdcunit3d: I tried it once, but just as a learning exercise..
04:37ambrosebsis there a function to get the root value of a var?
04:37zanesDoes lein no longer install to .m2 when you lein install?
04:42degambrosebs: I don't know of any clean way, but you could pass identity to alter-var-root.
04:48amalloy$findfn #'inc inc
04:48lazybot[clojure.core/deref clojure.core/var-get]
04:49amalloyambrosebs: lazybot doesn't think such a function exists
04:51ambrosebsamalloy: again a sick usage of findfn.
04:52ambrosebsI just wanted the root binding of a single var so I derefed it an def'ed the result.
04:52ambrosebs(it's a dynamic var)
04:58wei_zanes: what's the actual error you're getting
04:59zaneswei_: Uncaught TypeError: Cannot call method 'call' of undefined
05:00wei_are you using go blocks?
05:00zanesYes.
05:00wei_clojurescript doesn't have <!!
05:00zanesI'm not using <!!.
05:01wei_not sure then, sorry. that was my problem initially, but I've since got it working
05:02zanesWhat version of clojurescript and core.async are you using? Can I see your project.clj?
05:04zanesOh wow. Is that just the error you get if you reference an undefined variable?
05:05ddellacostazanes: 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:05zanes(I didn't :refer 'chan'.)
05:06ddellacostaah, there ya go. :-)
05:06zanesThat's an incredibly unhelpful error.
05:06zanesddellacosta: Thanks anyway.
05:07ddellacostazanes: I find that, in those cases, it is really useful to actually look at the JS that is getting produced.
05:07ddellacostazanes: 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:08ddellacostanot ideal I suppose, but you know, on the other hand you're able to write lisp code for browser dev so, tradeoffs.
05:09zanesOh, totally. It's just unfortunate.
05:09javeI have a funny problem with a mixed java/clojure project
05:10llasramFunny haha?
05:10javeI 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:11javemore or less this code with some tweaks: https://github.com/jave/btc-coffee/blob/master/src/btc_coffee/core.clj
05:12javeso basically i exposed the load-config fn with gen-class to java. Java calls it, but somehow the atom resets
05:13jave(i havent pushed the java interop code yet because its too ugly for human eyes)
05:15llasramjave: By "expose ... with gen-class", you mean you modify your :gen-class to expose the function as a method?
05:15javeas static
05:16jave #^{:static true} [loadConfig [String] void ]
05:16llasramOk. FYI, if you control the Java side, you can just use the Java Clojure API to invoke arbitrary Clojure functions
05:16javeI also tested this: (GET "/btc-coffee/reload-config" [] (fn [r] (-loadConfig "/tmp/btc-coffee.clj")))
05:17javeand if i call loadConfig again, the config doesnt reset
05:17javeso its overall pretty odd
05:18javellasram: but then a call gets to be pretty long-winded right?
05:18llasramI'm not quite following. Your `load-config` function calls `reset!`, which will, well reset the value of the config atom
05:19javereset! just ignores the previous value, which is what i want
05:19javeor did i miss something?
05:19llasramjave: Not really (long-winded). Well, no more than any other Java
05:20llasramYes... I'm just not following either what you're seeing or expect to see :-)
05:20zanesddellacosta: Hmm. Now it seems to think cljs.core.keyword_identical_QMARK_ is undefined. Ever seen that one?
05:20ddellacostazanes: that is indeed a new one to me.
05:21ddellacostawhat is the clojurescript? if you put it in a refheap I'll take a look
05:21javellasram: I expect @config to hold my configuration data after loadConfig is called. its slurped from a file.
05:22llasramjave: "if i call loadConfig again, the config doesnt reset" <- I mean, it calls `reset!`. What does and do you expect to happen
05:22javellasram: okay, i seem to have overloaded the word "reset" confusingly. sorry
05:22zanesddellacosta: refheap, eh? Is gist not cool any more?
05:23javellasram: so, in java I do: btc_coffee.core.loadConfig(btcConf);
05:23ddellacostazanes: 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:23ddellacostaor, "some of us" I guess
05:23javellasram: afterwards I expect @config to be { blablabla }
05:23javellasram: instead it is {}
05:24zanesddellacosta: https://gist.github.com/d3f1d0ca66dabcab70f4
05:25llasramjave: 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:25javellasram: path verified yes
05:25ddellacostazanes: what versions of stuff are you using, the latest?
05:26ddellacostazanes: and, any idea which line is the one that makes it barf?
05:26zanesddellacosta: I think I'm using latest core.async (I had to copy it to .m2 manually).
05:26zanesddellacosta: Using cljs "0.0-1896".
05:27ddellacostazanes: can you tell me the exact core.async version?
05:27zanesddellacosta: It's not an actual release. Just master.
05:28ddellacostahmm…I might try sticking with a specific version if I were you, just to be on the safe side
05:29ddellacostazanes: hold on, I'm going to try your code locally
05:29sm0keone quick weird question... can i kill a (go) or (future) block?
05:30sm0kei want this because the block is waiting on a socket...and i cant set conditional for quitting the block
05:31ddellacostazanes: 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:31llasramsm0ke: If you've still got the future object, you can try to `future-cancel` it
05:31zanesWhy wouldn't that work?
05:31ddellacostazanes: go blocks return a channel
05:32sm0kellasram: what do you mean by try? its not sure shot?
05:33zanesddellacosta: Okay, fine, but it ought to have just logged the channel, no?
05:34zanesddellacosta: Rather than dying horribly?
05:34ddellacostazanes: not sure yet, but I suppose not on the dying horribly. :-)
05:34ddellacostahold on, setting something up now
05:34zanesddellacosta: Anyway, moving back to the latest stable core.async fixed it.
05:34ddellacostazanes: ah
05:34ddellacostazanes: and what does it give you in the console ?
05:35ddellacostanow I'm curious
05:35zanesddellacosta: The channel.
05:35ddellacostazanes: ah, haha. Well, there ya go--at least it's doing something now.
05:36zanesYeah, 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:37ddellacostazanes: 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:39zanesWhat are you doing with it (CLJS)?
05:41ddellacostazanes: building an entire front-end for our legal software startup.
05:44zanesOoo.
05:49degI'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:53ddellacostadeg: what you want is something like (emit* (at (html-resource "somefile.html") [:script] (set-attr :src "abc.js")))
05:54ddellacostadeg: 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:54ddellacostadeg: if you want to give me a specific example in gist/refheap form I'll take a look
05:54degThanks. I have multiple script nodes in the html. How do I select only the one where src=xyz.js?
05:55ddellacostadeg: ah, right…that will require you to do something like [[(html/attr= :src "xyz.js")]]…not sure about the exact syntax
05:56ddellacostadeg: to be clear, that would replace the above, where I have [:script]
05:56degHmm, 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:57ddellacostadeg: the thing that is a bit confusing about the matchers is that you need double brackets [[]] (vector in a vector I guess)
05:58ddellacostadeg: don't know if that's your problem, but it has messed me up in the past.
05:58degThat's probably it. I'll play for a few minutes and post a refheap if I'm still stuck. thanks.
06:00ddellacostadeg: np, good luck!
06:06degddellacosta: Yeah, feeling dumb here, but still lost. Here's what I've got: https://www.refheap.com/19201
06:06ddellacostadeg: okay, one sec
06:16ddellacostadeg: as always, the problem is getting stuff in and out of enlive properly
06:16ddellacostasorry, one sec, preparing example
06:17degok
06:19ddellacostafor 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:19ddellacostadeg: now let me try with template
06:20ddellacostadeg: 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:21ddellacostadeg: I think I'm not doing something completely idiomatic there w/r/t enlive, but that will work at least.
06:22ddellacostadeg: one thing about template, you don't need to pass it the resource, just a string pointer to the file.
06:22ddellacostadeg: …which by default it will assume is in the resources dir of your project.
06:23ddellacostadeg: 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:24ddellacostadeg: (html/deftemplate swap-js "public/foo.html" [] [[:script (html/attr= :src "js/xyz.js")]] (html/set-attr :src "js/abc.js"))
06:24ddellacostadeg: then you can do (swap-js)
06:25ddellacostadeg: 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:27deg(got called away; back now)
06:28degI switched to template instead of deftemplate because I want an anonymous function.
06:29ddellacostadeg: ah, okay, in that case you can just use the template example I gave you I guess.
06:29degMy 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:30ddellacostadeg: ah, gotcha. I did something similar at one point, using exactly this kind of strategy.
06:30ddellacostabut, why do you want an anon function?
06:31degI don't want to name the template for each page; just want to map over all the sites, generating the dev sites.
06:32ambrosebsI've used CinC to customise macroexpansion and I don't ever want to go back http://www.youtube.com/watch?v=g2zts1hW19k
06:32ddellacostadeg: sorta understand, but couldn't you just pass in your data to the same template?
06:33degHmm, 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:33arnabdekaHi guys. New to clojure. In the REPL (both in nrepl inside emacs, or in lein repl) Trying to use repl-utils:
06:34arnabdeka(require 'clojure.contrib.repl-utils)
06:34degBasically, 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:34arnabdekaAnd 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:34arnabdekaDoes repl-utils not come as part of clojure install (do I need to download separately)?
06:34ddellacostaambrosebs: super cool. Will have to watch it again before I really get it, but definitely seems much simpler using CinC...nice
06:35ambrosebsddellacosta: it's badass
06:35ddellacostadeg: did you see David Nolen's? It's got some good stuff: https://github.com/swannodette/enlive-tutorial
06:36degddellacosta: 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:36degAlso, 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:36ddellacostadeg: 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:37chordok guys
06:37degYeah, 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:37chordhere is what i've learned
06:38chordstarcraft 2 has a delaunay triangulation for its navigation mesh on which A* followed by a funnel filter is done
06:39chordbut how does it know a fat thor can't fit through a tiny space
06:39chordcome on guys someone here has to be an expert on pathfinding
06:39chordgive me hints
06:40chordyou guys are still shunning me?
06:40chordis anyone going to talk to me?
06:41ddellacostaarnabdeka: 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:41arnabdeka@ddellacosta Just trying to use show/source etc. (reading Joy of Clojure)
06:42ddellacostaarnabdeka: 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:42ddellacostaarnabdeka: as far as show, I don't know that--what does it do?
06:44arnabdekaAccording 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:44ddellacostaarnabdeka: ah, this is handy: http://dev.clojure.org/plugins/viewsource/viewpagesrc.action?pageId=2687076
06:46ddellacostaarnabdeka: according to that, "reflect" is what you want: http://clojure.github.io/clojure/clojure.reflect-api.html
06:46ddellacosta(for show replacement)
06:46arnabdekaAh that explains it. Thanks @ddellacosta - trying to figure reflect out now.
06:46ddellacostaarnabdeka: np, best of luck.
06:52chordi hate you all
06:52chordI put in all this effort trying to understand starcraft 2's path finding
06:52chordand you all don't help me
06:52chordyou all ignore me
06:52chordyou all hate starcraft
06:59chordi hate you all for that
07:22chordwho here is dumb and not stupid
07:32sm0kehello can i read from a core.async channel with timeout?
07:34jonasensm0ke: yes you can.. take a look at alt! and alts!
07:35sm0kejonasen: aha nice..a timeout block with alts inside..a little bit verbose but
07:36milanjhi, having issues with macros and namespaces/symbols
07:36milanjwhy is
07:36milanjif you are in namespace user
07:36milanj(= 'user/foo 'user/foo) => true
07:36milanj(= 'foo 'user/foo) => false
07:40clgvmilanj: because you explicitly specify the symbols and there is no resolving of them
07:41clgvtry (= `foo 'user/foo) in namespace "user"
07:43milanjcool, thanks
07:43milanjI was expecting CL behavior, need to read more about clojure symbols
07:44clgvis there a guide on how to add custom components to support seesaws functions?
07:44clgv,'user
07:44clojurebotuser
07:44clgv,`foo
07:44clojurebotsandbox/foo
07:44clgv,'foo
07:44clojurebotfoo
07:48milanjclgv, thanks
07:48degddellacosta: 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:02ddellacostadeg: 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:03jonasensm0ke: more like (alts! (timeout 1000) your-chan), but maybe that's what you meant
08:06jonasensm0ke: or really (alts! [(timeout 1000) your-chan])
08:10degddellacosta: 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:10degddellacosta: Or, maybe the right question is: what is the correct lib to define a transform to be applied to many web pages?
08:35dnolenjonasen: cljsfiddle being able to load anyone else's namespace is pretty sweet!
08:36jonasendnolen: thanks
08:38jonasendnolen: 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:38dnolenjonasen: whoa
08:38dnolenjonasen: awesome
08:38jonasendnolen: the idea is that if you depend on someone elses code they can't mess with your fiddle even if they tried
08:38dnolenjonasen: yes
09:19oholiabhello, 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:19oholiabor 3) ????
09:19oholiabI'm stuck as to what is the "right" thing to do
09:19oholiabor at least the most sensible
09:21vijaykiranoholiab: depends on the domain I guess e.g. is not having the :optional-attr and {:optional-attr nil} mean the same ?
09:24oholiabvijaykiran: 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:24oholiabi.e. there's a superfluous bit of information that I can just put in there which still kind of makes sense
09:25oholiabI'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:27vijaykiranoholiab: 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:28vijaykiranoholiab: 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:28vijaykiranoholiab: IMHO ^ :)
09:29oholiabyeah, I suppose you're right
09:29pyrw/in2
09:29pyroops
09:29oholiabno point in pretending that two records that are slightly different are the same
09:53octei have a map where each value is a list that i want to sort, what would be the easiest way to do that?
09:53octekeeping the map
09:54clgvocte: reduce-kv
09:54clgvocte: in immutable land you will end up with a new map anyway if you modify each value
09:55octeyes, i know, i just didn't express myself well
09:55octethanks :)
09:55octe(reduce-kv #(assoc %1 %2 (sort-by :name %3)) {} m))
09:55octethat seemed to do the trick
10:00kralnamaste
10:01wakeuphi all
10:02wakeupis there an idomatic way to get my leiningen project's version
10:02wakeupstring at compile-time?
10:02wakeupE.g. I want to write a macro that will expand to the current project version string.
10:19wakeupIf I do a def in my project.clj, in which namespace will it end up?`
10:24gfredericks"Key must be integer" could be extended with "when assoc'ing with a vector"
10:30jonasendnolen: ping
10:32wakeupOk so there is server-socket, is there also client-socket?
10:49clgvwhat do I do wrong when I get an UnsupportedOperationException for proxy?
10:54borkdudeWrath of the unmatched delimiter
11:13seangrov`That can't be good...
11:13`cbp:-o?
11:14seangrov`Is irccloud legit? Looks like it's stocking up a lot of nicks in the channel...
11:15CoconutCrabthe names look randomly generated
11:20Kruppeseangrov`: seems to be happening in a lot of channels right now
11:34wakeupOk I need to work with sockets: I need a server that can multiplex a socket and read/write strings.
11:34wakeupand a client that can connect to a network socket and rea/write strings
11:34wakeupI know of server-socket, what is the client counterpart called?
11:43allenj12hey guys
11:43s4muelo/
11:44allenj12has anyone tried the clojure.typed
11:44allenj12just saw it on reddit seems cool
11:46allenj12pretty quite :)
11:47wakeupis there a simple rpc library for clojure?
11:47allenj12rpc?
11:49clgvwakeup: did you try that one? https://github.com/sunng87/slacker
11:50dgrnbrghello clojurians, I have a question about throwing exceptions in futures--how can I set the default exception handler for all clojure futures?
11:50dgrnbrgit seems that the jvm default exception handler doesn't see exceptions in futures
11:51wakeupclgv: I looked into it, but it exposes a namespace, I don't want to do that.
11:51clgvwakeup: what's the problem with having a dedicated namespace as api?
11:52wakeupclgv: It's not functional.
11:52clgvwakeup: huh?
11:54sm0kehello..i have this snippent which updates an atom by deleting a key value ##(swap! (atom {:k1 #{:v1}}) update-in [:k1] (fnil disj #{}) :v1)
11:54lazybot⇒ {:k1 #{}}
11:54clgvwakeup: I guess you misunderstood the description of the lib
11:54wakeupclgv: A namespace implies some global state.
11:55sm0kebut the problem is that i want to completely remove key from map if the corresponding set becomes empty
11:55clgvwakeup: well, the library only exposes functions in the given namespace to be called in an RPC fashion
11:55sm0keany elegant solution for this?
11:56wakeupclgv: what if I want multiple instances of the server?
11:57wakeupwhich different state
11:57wakeupwith*
11:57clgvwell there you introduce the nonfunctional state yourself ;)
11:58wakeupclgv: "the nonfunctional state"
11:58wakeupwhat is that supposed to mean
11:58clgvwell that is anarchitectural question. would you have multiple instances of the same api on other plattforms as well?
12:09yedihttp://pong.clojurecup.com/
12:14clgvyedi: nice :D
12:14yedinot mine, but yea it's pre cool
12:34Pupnik_i get crazy input lag on that
12:34Pupnik_with firefox/ubuntu
12:35mdrogalistbaldridge: ping
12:35yediPupnik_: i get some input lag as well
12:35tbaldridgemdrogalis: pong
12:35Pupnik_oh its multiplayer
12:35Pupnik_with very simple netcode
12:35Pupnik_that explains that
12:39wakeupwhat do I have to put in my project.clj to use this: http://richhickey.github.io/clojure-contrib/server-socket-api.html
12:42nDuffwakeup: clojure-contrib is long dead.
12:42nDuffwakeup: ...that said, that library is now available as https://github.com/technomancy/server-socket
12:42stuartsierraclojurebot: contrib?
12:42clojurebotMonolithic 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:43nDuffwakeup: https://clojars.org/server-socket
12:46noncomhi, 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:54clgvnoncom: yeah the "e" in "repl" stands for `eval` ;)
13:02noncomclgv: i just wonder how does it manage to work with (ns) macro without problems
13:02noncomapparently there is something different from the simple clojure function (eval)
13:03noncomcurrently 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:04clgvnoncom: you have a look at the built-in repl here: https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L254
13:07noncomthanks! im looking at it!
13:09noncomumm, what is strange, i do not see anything special about it. it simply uses (eval) )_o
13:11noncommaybe i'm missing somethin...
13:17clgvnoncom: how do you use eval and what goes wrong?
13:20glosoliAnyone using nREPL with Emacs knows if there is some way to jump into Java sources using M-. ?
13:26technomancyglosoli: I think you need ritz?
13:28kendallbuchananI just started using Clojurescript, and I feel like I'm missing something simple: How do you use .indexOf with a vector?
13:28kendallbuchananConsole returns "Uncaught TypeError: Object [object Object] has no method 'indexOf'".
13:29justin_smithkendallbuchanan: with cljs sometimes you need .- instead of .
13:29jmlis there a thing where I can be always running a server and then very quickly get access to a new repl?
13:29technomancyjml: https://github.com/technomancy/grenchman
13:29jmltechnomancy: ta, much obliged.
13:30noncomclgv: it says something like "cant set root binding of *ns* with set!"
13:30hyPiRionjml: depends on what you mean by server, I guess?
13:30jmltechnomancy: also, achewood. Yes. Very yes.
13:30noncomi know what it means, but i wonder how repl work
13:31noncomhow repl works that it has no problems with that
13:31hyPiRiongrenchman gives you a fast repl for an open leiningen connection, but not a specific server you have implemented yourself
13:31kendallbuchananjustin_smith: What does ".-" mean?
13:31kendallbuchananIn cljs, am I using "." and ".-", or just one?
13:31jmlhyPiRion: how so?
13:32glosolitechnomancy: 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:32nathanickendallbuchanan: .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:32clgvnoncom: when do you get this? I did not encounter the error with (eval '(ns bla.blubb))
13:32kendallbuchanannathanic: Okay, that makes sense.
13:33justin_smithkendallbuchanan: .- is for fields
13:33justin_smith. is for methods
13:33justin_smithin clojurescript only
13:33kendallbuchananSo, is there no .indexOf method for vectors in cljs?
13:33glosolitechnomancy: I should mention I tried jacking in with nrepl-ritz-jack-in, still it failed to open any java source :)
13:34justin_smithkendallbuchanan: 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:34justin_smiththe thing may have a different name in js, I don't know
13:34technomancyglosoli: oh no idea then; haven't used it. maybe try the ritz mailing list.
13:35nathanickendallbuchanan: 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:35glosolitechnomancy: but you use emacs yes ?
13:35technomancyglosoli: yeah, but I don't know Java, so jumping to Java source is not very useful for me
13:36kendallbuchanannathanic: You mind showing me what you made?
13:36glosolitechnomancy: Hmm I have been told that it's impossible to know Clojure very well without learning java, seems like folks lied to me
13:37Foxboronglosoli: partly lies
13:37technomancyyes, that's rubbish
13:37technomancyyou just need to know the standard library
13:37glosoliaah happy to hear that! :)
13:37Foxboronglosoli: sooner or later you might have to stumble into some java, but you can go far without ever touching it.
13:37bbloom_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:38hiredmanexcept STG has a way cooler name
13:38glosolilol
13:39noncomclgv: well, first i (read-string) the form from a text field, then imply (eval)
13:39nathanickendallbuchanan: https://gist.github.com/nathanic/6781788 no promises of perfection etc. but that's what i was using.
13:39nathanickendallbuchanan: again, if you find something better, i welcome correction :-)
13:39noncomclgv: just this... i found the problem description on stackoverflow.. som someone too had it
13:40kendallbuchanannathanic: 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:40clgvnoncom: try to build a minimal example that still fails
13:40noncomare you sure you don't have it with first read-string then eval it? all other forms except for (ns) eval prperly
13:40noncomok wait
13:42noncomclgv: 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:44noncomhere is it on SO: http://stackoverflow.com/questions/7684656/clojure-eval-code-in-different-namespace
13:44clgvnoncom: the accepted answer is correct. I played with it a while ago
13:45jmlhyPiRion: ah right. I don't particularly care for a specific server at this stage.
13:45noncomyes it is and it works. but repls do not have that problem. i doubt they do some kind of binding like that...
13:45jmljust want to experiment with using clojure in the same way I use ipython atm
13:46noncomrepls simply evaluate (ns) like if there is no issue
13:46technomancyjml: usually people just keep a repl open in emacs or lein repl. tooling around direct quick CLI access is still very immature.
13:46noncomgmmm
13:46hyPiRionyeah
13:46noncomi guess im missing something
13:47jmltechnomancy: hmm, ok. I'm pretty terrible about keeping things open normally
13:47TimMcnoncom: So why not just use binding?
13:47jmlbut I guess my emacs is a daemon so it shouldn't be too bad.
13:48technomancyI 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:51jmltechnomancy: heh, ok. I might skip it for now :)
13:51jmlthanks for the warning
13:51noncomTimMc: 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:58rasmusto,(map #{nil 1 false true} [1 2 3 nil false true])
13:58clojurebot(1 nil nil nil false ...)
14:00hyPiRionif you compile grenchman though, you'll have heat for the rest of the winter
14:03sm0kehello how do i convert a string to "bytes"
14:03sm0kewhat is bytes anyways?
14:04`cbpsm0ke: .getBytes
14:04s4muelan encoded representation of a string
14:04sm0keumm i dont understand... ##(map byte "ss")
14:04lazybotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
14:05`cbp,(.getBytes "hello")
14:05clojurebot#<byte[] [B@1c9e59a>
14:05`cbp,(seq (.getBytes "hello"))
14:05clojurebot(104 101 108 108 111)
14:06`cbp(map char (.getBytes "hello"))
14:06sm0ke`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:06clojurebot(\h \e \l \l \o)
14:06hyPiRion,(map int "hello")
14:06clojurebot(104 101 108 108 111)
14:06hyPiRion,(seq "hello")
14:06clojurebot(\h \e \l \l \o)
14:07`cbpsm0ke: I'm pretty sure ^bytes means byte array
14:07sm0ke`cbp: i will take your word on that..thanks
14:08sm0ke,(= bytes (class (.getBytes "ss")))
14:08clojurebotfalse
14:10llasramsm0ke: 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:10llasramwhen in hinting metadata, that is
14:11technomancybecause the literal java syntax for arrays is too horrible for words
14:11llasramsm0ke: Hinting metadata tags are just symbols. ##(let [x ^WhatIsThisWeirdThing {}] [x (meta x)])
14:11lazybot⇒ [{} nil]
14:12llasramWell, didn't quite go as planned
14:12llasramtechnomancy: Yeah, that too. Blech
14:12sm0kellasram: thanks that makes sense
14:13`cbpI think lazybot shouldve thrown an exception there
14:14llasram`cbp: Try it in your REPL
14:14`cbpllasram: yeah
14:15`cbp,(let [x ^WhatIsThisWeirdThing {}] [x (meta x)])
14:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: WhatIsThisWeirdThing in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:15`cbpsuperior bot
14:15llasramhmm
14:15sm0kedoes that mean i could also use ##(map byte "ss"); as it feels more idiomatic?
14:15lazybotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
14:16`cbp##*clojure-version*
14:16sm0keeh i dont get it that runs on my repl just fine
14:16llasramsm0ke: No. Even if that worked, it would return a seq of Byte objects
14:16llasramYou need a primitive byte array
14:16llasramend of story
14:16sm0keok got it thanks
14:17`cbp##(let [x #^WhatIsThisWeirdThing {}] [x (meta x)])
14:17lazybot⇒ [{} nil]
14:18TimMcnoncom: Well, that's probably what the REPL does as well. :-P
14:18llasram,(-> '[^WhatNowLazybot? {}] first meta)
14:18clojurebot{:tag WhatNowLazybot?}
14:18llasram&(-> '[^WhatNowLazybot? {}] first meta)
14:18lazybot⇒ {:tag WhatNowLazybot?}
14:18llasramGee, thanks
14:19`cbpyou could do (byte-array 5 (map byte "hello")) if it really rustles your jimmies to use java methods
14:20sm0ke`cbp: umm..no i would rather stick with .getBytes then
14:25sm0kecrap github's down!
14:25tgoossensso it has come to this
14:26geoffegsm0ke: part of the US government shut down.
14:26fbernierand here comes the HN submission about github being down ... wtf
14:27mtp"America is now a global military empire with a nonfunctioning civilian government"
14:27piranhais there a better solution for changing all keys of a hashmap than (into {} (map (fn [[k v]] [(some-fn k) v]) data))?
14:27sm0keyea what with america shutting down over obamacare?
14:27geoffegpiranha: update-in?
14:27piranhageoffeg: hm, not sure I understand your idea... how do I do that?
14:27technomancypiranha: not really. it's a bizarre omission from clojure IMO.
14:28technomancyzipmap is arguably slightly cleaner
14:28piranhatechnomancy: that's really annoying :( and slow also... :\
14:28piranhahmmm, how do I do it with zipmap?
14:29technomancy(zipmap (map f (keys m)) (vals m))
14:29hyPiRionpiranha: (into {} (for [[k v] m] [(f k) v])) works too
14:29piranhaheh, 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:30piranhahyPiRion: yeah, a bit less code as well, thanks
14:30technomancyIIRC there's also keywordize-keys if that's what you need, but it's bizarre why the more general form is omitted
14:30piranhanope, I need to transform dashed-keys into camelCase
14:31technomancy(with-redefs [keyword camelcase] (keywordize-keys m)) ; wooooooo
14:31piranha:)))
14:31piranhahm, nope, there is no keywordize-keys
14:32piranhaah!
14:32piranhaclojure.walk
14:33piranha,(with-redefs [keyword name] (keywordize-keys {:a "b"}))
14:33clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: keywordize-keys in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:33piranha,(with-redefs [keyword name] (clojure.walk/keywordize-keys {:a "b"}))
14:33clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>
14:34piranhadamn
14:34piranhaanyway, it's not working )
14:34piranhasince it's checks inside that argument is a string
14:35technomancyahahahaa yeah don't do that =P
14:35rasmustopiranha: you could also redef string? to keyword? :P
14:35piranha:DDDDDDD
14:35rasmusto(don't do that)
14:35piranhadamn now I'm really laughing
14:37sm0keHow do i convert a clojure map to bytes? map conly contains strings and keywords?
14:38sm0keand how do i convert it back from bytes?
14:39technomancysm0ke: you'll have to be more specific
14:39TimMcsm0ke: Your question is ill-specified; there are many possible meanings of what you just said.
14:39scriptorhi guys
14:39TimMcAre you trying to serialize a map to disk?
14:39scriptorcan someone point me to what the loop* in https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4156 refers to?
14:39technomancyscriptor: I think it's hard-coded into the compiler
14:39sm0keyes i want to serialize a map to byte array and write to a zmq socket
14:40sm0keand want to construct it back too
14:40scriptorah, makes sense
14:40scriptortime to go digging
14:40sm0kedoes that makes sense?
14:40llasramsm0ke: Yes. And I would like to formally welcome you to the serialization rabbit hole :-)
14:41llasramsm0ke: If you don't have any particular requirements for your project, the flat-out easiest thing to do is use EDN
14:41sm0kellasram: aha edn..yes i am using it for config already
14:41sm0kelet me dig around
14:47sm0kehey guys does this makes sense ##(clojure.edn/read-string (String. (.getBytes (pr-str {:a "sss" :b "cc"})))); for ser/de ?
14:47lazybotjava.lang.ClassNotFoundException: clojure.edn
14:48sm0kefeel very hacky
14:48TimMcWhy .getBytes?
14:48TimMcAnd if you use that, you'll want to specify UTF-8.
14:48sm0keup to .getByte is the ser...outside form is deser
14:49llasramTimMc: They're pushing data over 0mq IIRC
14:50sm0kethat is weird way to serialize i feel
14:50technomancysm0ke: there are more efficient ways to do it, but not simpler ways
14:50llasramsm0ke: The only "hacky" part is the bytes to/from transition. EDN is a character-wise format, so you've got an extra step.
14:50llasram(inc technomancy)
14:50lazybot⇒ 79
14:51llasramsm0ke: If you want something directly byte-oriented, you have a ton of options. Here's mine: https://github.com/damballa/abracad
14:52sm0kellasram: hey isnt that for avro? i am using that already in one project
14:52llasramYes
14:52llasramIf you're already using Avro, then might actually be a good fit
14:53sm0keno i am not using avro here..its not a very schema oriented thingy
14:53sm0kei just want some fool proof serialization of simple clojure data
14:54llasramIt's not well tested, but abracad actually will generate schemas for you which will serialize all the basic Clojure data structures
14:54llasramIn the abracad readme, jump down to "EDN-in-Avro"
15:01sm0kewell it needs a schema..i think its too qualified for my purpose
15:01sm0kei saw this nippy library
15:02sm0kedont know if it fits
15:11weavejesterI've had good experiences with Nippy.
15:13sm0keyes there stress-data test is pretty comprehensive..more than good enough for my purpose
15:13noncomweavejester: if you have time, could you tell a little about your experience on combining jmonkeyengine Controls with clojure paradigm?
15:14sm0kecool jmonkey on clojure!
15:14weavejesternoncom: Controls?
15:14sm0keis it on github?
15:14noncomyeah, you know, jmonkey prescribes updates to all the entities in the world by linking instances of Control class to them..
15:15drorbemetHi, does someone of you know if there is a clojure library for parsing org-mode files?
15:15weavejestersm0ke: I might release some code on my implementation after EuroClojure. I've been holding off, however, as it's still unfinished.
15:15noncomthese cotrols have state and they lurk into the main apps update loop
15:15jtoyI 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:15sm0keweavejester: awesome
15:15weavejesternoncom: Oh right! Yes, I know them, but I don't make use of those at all.
15:15weavejesterThere's really little point.
15:16jtoywhen I run from cron I run it as so: lein trampoline run -m air.campaigns/jobs
15:16noncomsm0ke: some people, including me, have worked on using jme in clojure.. but nothing definite as of yet, i guess.. you can try too!
15:16jtoywhat that code does is just pull out a string from a database and call it with some arguments
15:16noncomi mean, it is definitely viable, but no production-ready thing is there yet
15:17noncomweavejester: so you just plug into the update loop directy?
15:17weavejesternoncom: Yep
15:17weavejesternoncom: Each update, I sync the nodes with a Clojure data structure representing the scene.
15:18noncomo i see
15:18weavejesterI'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:19noncomtrue...
15:19callenJME?
15:19noncomyou think plain lwjgl might be the way?
15:19callenoh, jmonkeyengine
15:20jtoyI think it must have to do with something not loading properly, but i have no idea how to debug this
15:21weavejesternoncom: Yes, possibly. It would be more work, but it would be easier to fit it in to work with Clojure.
15:21weavejesterjMonkey is a pain when you bump up against its structure.
15:22weavejesterWhich isn't really a criticism of the library, I'm just using it in a weird way
15:22weavejesterIt's a very OOP framework, so there's some translation involved.
15:24weavejesterjtoy: Does it depend on a specific current directory?
15:24jtoyweavejester: no, but i dont really understand that question
15:25noncomyeah, 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:25weavejesterAnother 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:26weavejesterjtoy: Well, maybe cron is running it with a different current directory?
15:26noncomoh i do not have problems with installation now. i simply put it in leins resources path, and for jar distribution i use nativot.
15:26mtpcron runs things with a wildly different PATH
15:26mtpand yes, it defaults to your $HOME
15:26jtoyweavejester: cron code loads clojure runs code,the problem started when I added this line: ((resolve (read-string (:code experiment) )) user-id (last groups)))
15:27noncomgood to hear your opinions, wanted to ask you for some time already
15:27weavejesternoncom: 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:28jtoyif i use resolve, does it matter if the string I read in is myns/func vs func ? I am currently using func
15:28noncomwow, that is cool! so you keep it up-to-date?
15:28`cbpjtoy: yes it matters, qualify it properly
15:29weavejesternoncom: 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:29noncomcool!
15:30weavejesterI had some issues with running older versions as standalone due to a bug in LWJGL on Mac OSX.
15:31weavejesterLWJGL 2.9.0 looks like it's a lot better for OSX than 2.8.x
15:31noncomhmm, i mainly window so no know that of.. but heard of
15:31`cbpwat
15:32weavejesternoncom: 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:33weavejesterWhich sounds horribly slow
15:33weavejesterBut is actually pretty performant.
15:33noncomhaha
15:33noncomwell, i guess it depends on what you have in the scene graph
15:33TimMc`cbp: "Hmm, I mainly use Microsoft Windows, so I'm not familiar with it... but I've heard of it."
15:33TimMcThat's my best guess.
15:34`cbpo.o
15:34noncomTimMc: that's true!
15:35weavejesternoncom: 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:35weavejesternoncom: With caching, it's sufficiently quick for a lot of tasks.
15:35weavejesterBut eventually I suspect I might move to LWJGL directly.
15:37weavejesterEssentially I just have a reference to an immutable data structure that describes the scene. Camera, objects, background, window size, etc.
15:37weavejesterI'm using Reagi to make the scene changable.
15:38Jardahas someone used https://github.com/pelle/clauth
15:38JardaI'm having this issue: https://github.com/pelle/clauth/issues/11
15:39noncomthat is definitely very interesting. sounds like partly unprobed ground. havent seen it done for a real 3d thing
15:39noncomnice to see reagi growing. last time i was visiting it was somehting like 0.3.0..!
15:42noncomso you get the better picture of what reagi will be? i remember you were still researching it back then
15:52jtoy`cbp: that fixed it, thanks
15:53`cbpjtoy: np
16:01edwMy .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`cbpmy .emacs is (or used to be before i switched to emacs live) just a bunch of load-files :P
16:05edwI may still have some stuff in mine from emacs 19.
16:05callenedw: I have a tricked out Emacs environment, but ac-nrepl is too fookin' slow for me mate.
16:06edwcallen: I hear you. It's been getting faster with newer builds of Emacs 24. I used to be mollasses-slow.
16:07dgrnbrgis there a way to catch uncaught exceptions thrown in futures?
16:08callenedw: I've tried it in Emacs 24. Still unacceptably slow :P
16:08callendgrnbrg: deref future, catch the exception.
16:08callendgrnbrg: boom.
16:08callenalternately, handle the exception in the code the future is executing.
16:09edwcallen: 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:09dgrnbrg_callen: I can't do that, because the futures hold async computations
16:09callenedw: I have a '13 Retina MBP and it's still irritating as fuck.
16:09dgrnbrg_there's no point that I can safely deref them
16:10callendgrnbrg_: if you cannot dereference your futures then they are not futures and you should not be using futures.
16:10callendgrnbrg_: future is not a dispatch mechanism, it's a retrieval mechanism.
16:10calleneither fire off a raw thread or write real async code.
16:10callenall they win you if you're not @'ing is use of the thread pool
16:14dgrnbrg_callen: Where does the future swallow the exception?
16:14mpenetdgrnbrg_: lamina has facilities to handle errors in situations like this
16:15mpenetdgrnbrg_: see run-pipeline and its error-handler option, it will do for "nested" async scenarios
16:15callendgrnbrg_: future doesn't swallow the exception.
16:15callendgrnbrg_: it simply waits for you to deref to allow it to continue to bubble.
16:15dgrnbrg_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:17dgrnbrg_callen: I don't see anywhere that future catches the exception and holds it for late
16:17dgrnbrg_hold it for later retrieval from deref
16:17callendgrnbrg_: stop using futures for this.
16:17callendgrnbrg_: use agents or an actual async library.
16:18dgrnbrg_callen: regardless of what i'm using, I want to understand where the exceptions are being caught
16:19stuartsierradgrnbrg_: 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:20callendgrnbrg_: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6311-L6336
16:21dgrnbrg_stuartsierra: is it using Java's future implementation to catch and retain the exception?
16:21callenthe answer is in the code I just linked.
16:21callenstuartsierra: how did AOT bite you earlier?
16:21stuartsierradgrnbrg_: yes
16:22dgrnbrg_stuartsierra: what's the right way to use a thread pool in which exceptions should bubble to a global exception handler?
16:22dgrnbrg_is there such a way?
16:23stuartsierradgrnbrg_: Java Executors allow you to specify a thread factory, where you can set an uncaught exception handler on the thread.
16:23dgrnbrg_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:24dgrnbrg_and that is irrespective of an uncaughtExceptionHandler I specify
16:24stuartsierradgrnbrg_: oh, yes
16:24podviaznikovhi, does anyone know library for collecting code quality metrics for clojure projects?
16:24stuartsierrathat's right
16:24dgrnbrg_I'm trying to figure out a technique to catch exceptions in futures that I'm not properly checking the result of
16:24stuartsierraCatch them. :)
16:24dgrnbrg_ugh
16:25stuartsierra"If you throw an exception in the woods, …"
16:25dgrnbrg_I just like the idea of not needing to deal with that directly
16:25dgrnbrg_particularly for the parts of the code that don't have any instrumentation like that in them
16:30ztellmandgrnbrg_ so wrap each function and submit the errors to queue
16:30ztellmanor just log them, if they're that unimportant
16:48akurilinFor Korma, would I use transform/prepare to change from dashes to underscores and vice-versa in column names?
16:49akurilinAnd on a related note, is there a way to tell Korma to transform joda time to sql time automatically ?
16:50bitemyapprkneufeld: I can't do the Korma chapter with lein-try, it breaks things.
16:51bitemyapprkneufeld: c3p0 can't find the JDBC driver if I use lein-try.
16:51bitemyappI don't really have time for a fix, so I'm writing the instructions with a fresh demo project.
16:52bitemyappakurilin: you would, @ transform/prepare.
16:53akurilinbitemyapp, so loop through all the values and check for joda time type?
16:53bitemyappakurilin: sure
16:53akurilinbitemyapp, k thx.
16:54akurilinbitemyapp, 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:54akurilinfor a table like foo_bar in PG, and foo-bar in clj.
16:55bitemyappdo whatcha want.
16:55bitemyappyou can transform 'em back and forth. or not.
16:56akurilinbitemyapp, 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:57bitemyappgf3: <3
16:57bitemyappakurilin: oh oh oh, table name.
16:57bitemyappakurilin: you can alias the thing.
16:57gf3bitemyapp: Ahaha—ACCEPTABLE
16:58bitemyappI'm offering bottles of whiskey to anybody willing to give their library a better name.
16:58arrdembitemyapp: the "better" criteria being...
16:58bitemyappFuck, this deserves a tumblr wall-of-shame/open offer blog.
16:58gf3bitemyapp: My libraries are already perfectly named
16:58bitemyapparrdem: no clj-* or *jure in the name.
16:58bitemyappgf3: you're fine, some idiots actually name their shit stuff like clj-dstore
16:59akurilinbitemyapp, could you be more specific about what you mean by alias? Haven't gotten my coffee yet.
16:59arrdembitemyapp: 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:59gf3bitemyapp: clj-jure
16:59arrdem(inc gf3)
16:59lazybot⇒ 2
17:00bitemyapparrdem: dakrone gets a reprieve .
17:00bitemyappeverybody else can DIAF
17:00bitemyappakurilin: http://sqlkorma.com/docs#entities
17:00bitemyapp(defentity muhhhh-table (pk :id) (table :muhhhh_table))
17:01bitemyapparrdem: I guess we can't all be technomancy.
17:01arrdembitemyapp: a fate to which I aspire nonetheless
17:01akurilinbitemyapp, oh I found it, brilliant
17:02akurilinthx
17:02akurilinbrb
17:02bitemyapparrdem: suck-up.
17:02arrdembitemyapp: I'm a nub. what do you want from me.
17:03arrdembitemyapp: also way to change your IRC name. now I have to go add more aliases to my cc project.
17:03rhg135incase anybody finds it useful, here's a date macro i wrote
17:04rhg135https://www.refheap.com/19227
17:04rhg135hmm, the staticness might be a problem
17:04bitemyapprhg135: why is this a macro?
17:05arrdembitemyapp: because macros are awesome!
17:05bitemyappthat's not a reason.
17:05AimHereMaybe his aot compilation is going to be VERY aot
17:05bitemyapplol @ AimHere
17:07gf3Raynes: I just realised that I put your email in me README like 2 years ago
17:07gf3Raynes: Whoops → https://github.com/gf3/clavatar-js
17:08gyimHi, a newbie question: what is the idiomatic way to run long-running asynchronous tasks, but with a bounded input queue?
17:08gyimI'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:09gyimI 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:10arrdemgyim: what's your structure? you have a worker thread for every client with a shared input queue?
17:11seangrov`Hrm, but when will clojure have its *rails*?
17:11seangrov`I see no future for clojure without it
17:11bitemyappseangrov`: this may be the first time I've seen you troll in IRC.
17:11technomancyseangrov`: right after it gets whitespace-sensitive syntax, duh
17:11seangrov`Heh, sorry, porting rails -> clojure right now
17:11seangrov`technomancy: hah!
17:11gyimarrdem: i was thinking about a simple blocking function per task (connect to server, send command, close connection)
17:12gf3technomancy, seangrov`: Can you give me an ETA
17:12tbaldridgeseangrov`: rails, really?
17:12gf3technomancy, seangrov`: I have deadlines and clients
17:12gf3THX
17:12tbaldridge(dec seangrov`)
17:12lazybot⇒ 0
17:12tbaldridge:-P
17:12seangrov`I guess it can't go negative
17:12gyimarrdem: and allocate a custom ExecutorService for all of these tasks to limit the number of parallel tasks
17:13seangrov`tbaldridge: I did say I was porting from rail to clojure right now :P
17:13tbaldridgeseangrov`: ah I thought you were saying that you were porting rails to clojure.
17:13seangrov`A considerably reduction in LOC, and it's much more explicit to boot
17:13rhg135bitemyapp: to not quote the fieldnames when calling
17:13bitemyappNot sure if serious.
17:16Raynesgf3: Whoa, you made a clojurescript port of clavatar and that was 2 years ago? How long have I been doing this shit?
17:16gf3Raynes: Too damn long
17:16Raynesgf3: You just made a teenager feel old. Congratulations.
17:16gf3Raynes: And yes we've know each other for basically decades now
17:16RaynesBasically
17:17RaynesAnyways, the email address thing is fine. It's in more easily accessible places if a bot wanted it bad enough.
17:17gf3The bots want it sooo bad
17:17RaynesFor example: proudly displayed on my Github page.
17:18gf3But they do some janky stuff, non?
17:18gf3Yeah
17:18gf3<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:23gyim[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:25gyim(i mean when things go wrong, for example the network slows down and all of the connections block for a minute)
17:26bitemyappgyim: async code.
17:27Jardahey struggling with syntax
17:27mtpstart struggling with semantics instead
17:27gyimi 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:27Jardawith hickup, how can I have a function that returns <p>Foo</p><p>Bar</p>
17:28bitemyappJarda: hiccup
17:28JardaI tried (defn foobar [] [:p "Foo"] [:p "Bar"]) but that obviously just return <p>Bar</p>
17:28Jardabitemyapp: yeah sorry
17:28tbaldridgegyim: core.async with a limited number of processing thread blocks.
17:28tbaldridgegyim: this is exactly what core.async is for.
17:28hyPiRionJarda: (list [:p "Foo"] [:p "Bar"])
17:30JardahyPiRion: oh thanks of course
17:31hyPiRionJarda: just be aware that [[:p "Foo"] [:p "Bar"]] is not the same as (list [:p "Foo"] [:p "Bar"]) is not the same thing
17:31hyPiRionthen you should be fine
17:31JardahyPiRion: yeah with hiccup you can't even write [[...]]
17:31gyimtbalridge: 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:31Jardabecause it will complain about [...] not being a valid element name
17:31JardaI already tried that
17:32hyPiRionheh, yeah
17:33tbaldridgegyim: 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:35ToBeReplacedtbaldridge: do you find yourself using futures in conjunction with core.async often?
17:35bsavoyI'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:35tbaldridgeToBeReplaced: thread = future, future returns a promise, thread returns a channel. So no.
17:35bsavoyAny help much appreciated
17:36ToBeReplacedtbaldridge: i do something like (assoc system (future (loop [] (>!! chan work) (recur))))
17:37ToBeReplacedthe future is helpful so that i can query for errors instead of needing to write error handling into the hcannel work
17:37gyimtbaldridge: 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:39stuartsierrabsavoy: `eval` tries to resolve everything in the current namespace, not the namespace containing the function in which you called `eval`.
17:39ToBeReplacedi guess i could/should just create error handling `ethread` and the like to wrap up errors and put them on the channel
17:41bsavoystuartsierra: 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:41logic_progright 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:41bsavoySomething to do with lazy-sequencing?
17:41logic_progi'd like a single lein comand to both start cljs auto compilation and provide a nrepl for me to connect to
17:42ToBeReplacedlogic_prog: you could use an alias, see :aliases on leiningen sample project
17:43stuartsierrabsavoy: 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:43logic_progalias lets me run two plugins at once?
17:43logic_progToBeReplaced: how does alias help with using two plugins at once
17:43bsavoystuartsierra: Ah thanks, that makes sense.
17:44ToBeReplacedlogic_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:44logic_progI don't even know what the "non-aliased" version is
17:45rhg135why must java be so complex? https://www.refheap.com/19227 and still wrong output
17:45rhg135today isn't sept. 1 right
17:46ToBeReplacedlogic_prog: `lein do cljsbuild auto, repl`
17:46hyPiRionrhg135: use clj-time?
17:46logic_progtried it
17:46logic_progemacs can't connect
17:46logic_prognrepl does not appear to be started
17:46logic_progi'm sure I'm doing something stupid
17:46rhg135thank goodness
17:46rhg135but idk i just want to get a timestamp
17:47ToBeReplacedlogic_prog: that's because auto never returns :)
17:47logic_progI think it might be easiest
17:47logic_progif I just embed a nrepl server :-)
17:48rhg135i don't want to shell out though, i could just call date
17:48rhg135from un ix
17:50logic_progokay, embed success :-)
18:11meliponehello! 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:11ToBeReplacedmelipone: (assoc mymap :firstkey 0 :secondkey 1)
18:12meliponeToBeReplaced: you can do that? thanks!
18:12AimHereAlso consider merge and merge-with depending on what you're trying to do
18:19recursor94I know I could probably find the answer to this online, but why doesn't clojure contrib officially exist anymore?
18:20hiredmanit does, it just isn't a single entity anymore
18:20recursor94but why?
18:20nDuffrecursor94: because the old way was an almost-unmaintained mess.
18:20nDuffs/was/resulted in/
18:21hiredmanbecause it is frustrating to have a dependency management system and not be able to pull out just the bits you want
18:21recursor94are most of those libraries still well maintained?
18:22arohnermany. some were abandoned
18:22hiredmanany that exist are mantained in some sense, anything that no one was interested in taking care of died with the single artifact contrib
18:23hiredmanwhich was the other problem, the single contrib repo was full of stuff that had been "contributed" but then ignored
18:24recursor94Does anybody have an opinion on what the best free learning resource is for clojure?
18:25bitemyapprecursor94: clojure.contrib was a bad idea. Free market of libraries ftw.
18:25recursor94I see.
18:25`cbprecursor94: github :P
18:25bitemyapprecursor94: github
18:25recursor94Most of what's on github is library code though. Some of it is difficult to decipher.
18:25hiredmanrecursor94: how I learned is reading the docs on clojure.org and writing clojure code, and I think that has served me pretty well
18:26recursor94hiredman: Were you a lisper before clojure?
18:27recursor94err, a lisp programmer?
18:27`cbprecursor94: is clojure your first language?
18:27recursor94No.
18:27akurilinWhen 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:27hiredmanno, 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:27bitemyappakurilin: porque no los dos?
18:28`cbprecursor94: then you have some domain knowledge, just look up a library on that domain imho
18:28akurilinbitemyapp, why have 2 if 1 is enough?
18:28bitemyappakurilin: 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:28bitemyappakurilin: because I slather myself with repls prodigally.
18:29akurilinbitemyapp, what's the difference between a clean-room and a test nrepl?
18:29hiredmanlots 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:29technomancyakurilin: a separate repl makes no sense
18:29hiredmanemacs and lein will just smooth out rough edges
18:29bitemyappakurilin: main nrepl and test nrepl are both clean-room
18:29bitemyappthe non-clean-room is the server nrepl
18:30bitemyapptechnomancy: only because you don't work like I do.
18:31ucbbitemyapp: callen?
18:31technomancya separate process to do a sanity check full test run before merging/deploying makes lots of sense though
18:31technomancybut the whole point of "clean room" is to not allow new definitions, so interactivity isn't as necessary
18:31bitemyapptechnomancy: I have c.t.n.r/refresh and (run-all-tests) in my test nrepl ready for the up-arrow.
18:32bitemyappI do it for speed
18:32bitemyappno waiting for lein/grench test start time
18:32bitemyappup-arrow -> return -> bang answers
18:32bitemyapp"guard rail programming" (bang bang bang)
18:32technomancyyou can still get stale state left around in memory
18:32bitemyappI accept this possibility and choose to pretend it won't happen to me.
18:33technomancyhokay
18:34indigoHeh, every day I program in PHP I think "I wish I could do this in a REPL"
18:34technomancybut 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:34bitemyappnot to try to accommodate PHP "programming", but I'm pretty sure there are PHP REPL'ish things.
18:34scriptorindigo: there's one or two repl implementations for the php, aren't there?
18:35indigoscriptor & bitemyapp: There are, but they're not really there
18:35recursor94hiredman: Was that tooling comment directed towards me?
18:35hiredmanrecursor94: sure, or whoever
18:35scriptorindigo: are we talking existentialism now?
18:36`cbpsometimes you're just forced to write with outdated php that won't be able to use any 3rd party libraries
18:36recursor94oh okay. already have emacs and lein setup. I just need to learn the skill now.
18:36indigoscriptor: Just not as easy to use or complete as Clojure's :P
18:37indigoThen again, PHP doesn't really lend itself to REPL-based programming
18:38indigoHeh, 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:38scriptorheh
18:39scriptorI bet that's going to include autocomplete and taking in statements over multiple lines, of course
18:39indigoAnd not crashing the entire REPL in case PHP has a fatal error
18:40mtpphp often embodies a fatal error
18:40indigoLmao
18:40dobry-denrecursor94: 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`cbplisp repl takes 4 symbols :-D
18:40indigo`cbp: Yeah, it's fantastic
18:46recursor94Is there a clojure irc bot library?
18:47recursor94I know of clojure bot.
18:47recursor94But I'm wondering if there are any true libraries
18:48scriptortry this https://github.com/flatland/irclj
18:48logic_progis 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:48scriptor(for future reference, I found it on http://www.clojure-toolbox.com/)
18:48recursor94Thank you scriptor.
18:49nDufflogic_prog: there are a few approaches; nothing I'd describe as _good_.
18:49nDufflogic_prog: ...see for instance https://github.com/lynaghk/cljx
18:49logic_proghow about a symbolic link? :-D
18:49Jardahey guys, any feedback on https://gist.github.com/nnarhinen/6786086
18:49gfredericksI love how derive is side-effecting in the 2-arg version but not the 3-arg version.
18:49logic_proglol
18:49logic_progthe problem to having two file extensions, is to invent a third file extension
18:50nDufflogic_prog: ...see also https://github.com/emezeske/lein-cljsbuild/blob/0.3.3/doc/CROSSOVERS.md
18:50logic_prognDuff: is your nick based on duff's device?
18:50nDuffNope.
18:50mtpHOW ABOUT DUFF BEER
18:50mtpoh
18:50logic_progyou know what?
18:50logic_progthe shared code is very small
18:50logic_progI will keep two copies
18:50Jardahave I understood core.async channels right..
18:51logic_progI'm suddenly very happy wtih slight code dup[lication
19:06CommandBotGreetings! 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:07akurilinSometimes I'm deeply confused by this channel.
19:07akurilinBetween the bots and the starcraft guy, I just don't know.
19:08TEttinger&(apply str (map char (repeat 80 7)))
19:08lazybot⇒ ""
19:08hyPiRionakurilin: those things have happened very recently only, though
19:08TEttingerhm which is \07
19:09akurilinhyPiRion, is this Clojure hitting critical mass ?
19:09TEttinger,(apply str (map char (repeat 10 11)) "this char should really be stripped out")
19:09clojurebot"clojure.lang.LazySeq@42f449a1this char should really be stripped out"
19:10bitemyappakurilin: we've had more people in the IRC channel than Scala for awhile.
19:10TEttinger,(apply str "this char should really be stripped out" (map char (repeat 10 11)))
19:10clojurebot"this char should really be stripped out "
19:10TEttingerif that displayed across multiple lines, congratulations, you have a nice client
19:11hyPiRionakurilin: gaining more traction, probably. Not sure if it's critical mass, but we're getting closer to it at least?
19:11bitemyappif seangrove is to be believed, we need Rails first.
19:12logic_progis clojure's cond guaranteed to be sequential?
19:12logic_prog(in the order the conditionals appear)
19:12technomancyyes
19:12bitemyapplogic_prog: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/cond
19:13hyPiRionaccording to the (doc cond), eys
19:13logic_progtechnomancy, bitemyapp, hyPirion: noted, thanks
19:14akurilinbitemyapp, 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:14akurilinit's been sizzling hot in the past couple of months at least
19:14hyPiRionakurilin: and go, and any fancy JS thing
19:14akurilinoh Go, of course.
19:14akurilinlet me check their channel
19:14bitemyappWhat passes for fancy in JS-landia ain't fancy.
19:15akurilinI forgot SEO for that word.
19:15TEttingerhttps://attractivechaos.wordpress.com/2012/03/24/two-interesting-polls-on-programming-languages/
19:15akurilinGood gosh...
19:15akurilin840+
19:15akurilinso apparently the HN push is working for them.
19:17hyPiRionTEttinger: 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:19hyPiRionIt would be more interesting to track submissions with a programming language in the title, and measure that
19:19hyPiRiongranted, "Go" would have quite some false positives
19:21TEttingerI really liked Argo, it was a great film <-- vote for Go
19:21TEttingerI got an iPhone today! <-- vote for go
19:22hyPiRionTEttinger: you can probably do splits and stuff to only match for go and golang
19:23TEttingerI would hope so!
19:23hyPiRionI mean, C, D and J would obviously win otherwise
19:23TEttinger\bgo\b
19:23TEttingerhaha
19:28Morgawrwow, I'm probably getting a brain fart at the moment but.. how do I remove a key/value pair from a simple map?
19:28ambrosebsMorgawr: dissoc
19:29Morgawrambrosebs: damn, thanks!
19:29Morgawrambrosebs: you're the one working on typed clojure, right?
19:30ambrosebsMorgawr: that's me
19:30Morgawrambrosebs: 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:31ambrosebsMorgawr: thanks! agreed
19:57logic_progis there something like "flttten" but only does it one level?
19:57logic_progconcat
19:57Apage43mapcat identity?
19:58logic_proglogic_prog: thanks
19:58technomancyapply concat would be better I think
19:58logic_progApage43: that sounds equiv to concat
19:58Apage43,(mapcat identity [[1 2 3] [4 5 6] [7 [8 9]]])
19:58clojurebot(1 2 3 4 5 ...)
19:58Apage43,(apply concat [[1 2 3] [4 5 6] [7 [8 9]]])
19:58clojurebot(1 2 3 4 5 ...)
19:58Apage43yes
20:05chordlets talk about starcraft
20:07technomancylet's talk about how everyone would be a lot happier if chord either 0) changed his behaviour dramatically or 1) got kickbanned
20:07arrdem:D
20:08chordtechnomancy: I've been putting all this effort trying to understand starcraft 2 pathfinding why you guys all hate me
20:08nDufftechnomancy: aren't you one of the people with the necessary ACL to implement (1)?
20:09mtplet's all upgrade to IRC clients with fools lists
20:09mtpchord‘ nobody likes you because you contribute nothing but noise and heat
20:09arrdemmtp: most support /ignore, which is close enough
20:09mtptry exhibiting a little bit of light
20:09technomancynDuff: yes, but as a relatively new op I'm inclined to err on the side of grace
20:10mtparrdem‘ ignore destroys the conversation whereas fools just hides the foolish text under the rug, to be swept out later
20:10mtpso no, it's not close enough
20:10technomancynDuff: said policy is probably nearing its expiry though
20:10mtpsometimes, sweeping it under the rug /is/ the right thing to do
20:10chordmtp: once I have a working pathfinding are you going to admit you're wrong
20:14indigomtp: TIL fools lists
20:15mtpindigo: they're the best thing for irc
20:15bitemyappmtp: you can ignore replies, but there are still ghost conversations.
20:15indigoWhat IRC clients support it?
20:15bitemyappindigo: irssi
20:15indigoOh nice
20:15indigoI'm using that
20:15arrdemindigo: apparently ERC has one but I'm not using it
20:15indigoI assume it's a plugin
20:16mtpindigo: most of the emacs ones
20:16mtpcirce supports it well
20:16mtpbitemyapp‘ there's the same problem with ignore, so...
20:16Morgawrman 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:18hyPiRionMorgawr: take a break from it. grab a coffee or go to bed, depending on where you live
20:19hyPiRionSometimes, the way to solve a problem is by not solving it.
20:19mtpsmoke legal psychoactives
20:19rasmustoMorgawr: draw some diagrams and try to explain it verbally
20:20MorgawrhyPiRion: 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:20hyPiRionMorgawr: ah, that's tough
20:20bitemyappMorgawr: hi
20:20MorgawrI 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:21MorgawrWrote the multithreaded version in Java, it works as intended (I got the pseudocode and it's trivial to port)
20:21MorgawrI wrote the multithreaded clojure one... it works for 90% of the input, sometimes it just doesn't though and that's so frustrating
20:21bitemyappMorgawr: poast coade.
20:22Morgawrhttp://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:22Morgawrbut yeah, it's just too specific for my case so I doubt anyone is able to help me
20:22Morgawr(and I don't expect you guys to, I was just ranting, sorry)
20:23bitemyappMorgawr: working case and breaking case plz.
20:23bitemyappalso wtf pastie
20:23bitemyappMorgawr: use refheap next time plz ;_;
20:23Morgawrbe glad it's not pastebin :P
20:23bitemyappthose white-background pastebins burn my soul
20:24Morgawrworking 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:24bitemyappMorgawr: ...
20:24Morgawrwhich is why it's hard as hell to fix
20:24chordomg
20:24bitemyappMorgawr: write unit tests that work and unit tests that break
20:24bitemyappMorgawr: create a dumpable form of the data that is generated
20:24Morgawrcan't do it in this case, sorry
20:24bitemyappMorgawr: short-circuit on failure and dump the "world" given to you.
20:25bitemyappMorgawr: if it's not a nuanced comprehension across terabytes of data (and even then) you can always dump fixture data.
20:25Morgawrhow 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:25bitemyappMorgawr: the size doesn't matter!
20:25technomancyset your heap size very small? =)
20:26bitemyapp<3 technomancy
20:26bitemyappMorgawr: make a tiny test-case that works. then make a tiny one that breaks.
20:27bitemyappMorgawr: you cannot work on problems like this without reproducible tests and regressions.
20:27Morgawrit's okay, I don't expect anyone to help me, sorry
20:27bitemyappMorgawr: you understand that your code breaks because of the nature of the data, not the size of it, right?
20:27bitemyappMorgawr: at least chuck me the black-box magic generator you're using and the origin data.
20:29Morgawrbitemyapp: 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:29Morgawras I said, it's not testable
20:29Morgawrit either works or doesn't
20:29bitemyappoh bullshit.
20:29bitemyappyou can produce regressions for non-deterministic sources of data through snapshotting.
20:30Morgawryou 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:31bitemyappreproducibility uber alles.
20:31bitemyappMorgawr: doing things the right way is hard. News at 11.
20:31Morgawryou're missing the point though
20:31bitemyappI almost always do.
20:31Morgawrthis is a simple implementation of an algorithm, it's not some complex massive system for "production" (or whatever) that needs to be tested
20:32Morgawreither the algorithm is correct or is not
20:32Morgawrand in this case it's not
20:32Morgawrthe way to fix it? look at the algorithm
20:32Morgawrit's justa graph traversal (double graph, but whatever)
20:33bitemyappMorgawr: was this an exercise of some sort?
20:33Morgawrbitemyapp: the java part yes, it's part of my multithreading class
20:33MorgawrI'm expanding it because I want to see how clojure performs
20:34Morgawrit's not something that has anything to do (anymore) with my clas
20:34Morgawrclass*
20:34Morgawrjust doing it for fun
20:34Morgawrand to gather some performance comparisons
20:34bitemyappahhh paper starts out by mentioning the death of Moore's Law
20:34bitemyappit's almost like academics have to justify making something multi-core/concurrent to their colleagues.
20:34bitemyappMorgawr: well post the java code that works pelase.
20:34bitemyappMorgawr: please*
20:35rasmustoheat death of the universe (cmos)
20:35bitemyappMorgawr: also, was the second paste supposed to be generator? I want to be able to run this.
20:35bitemyappbe a generator*
20:36Morgawrhttps://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:36Morgawrand 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:37bitemyappMorgawr: can you just put this into a github that 'runs'?
20:38bitemyappMorgawr: or am I just going to have to try to reproduce your environment through guessing?
20:38mtpwhy do i have an empty pm window on my screen all of a sudden???
20:38lazybotmtp: How could that be wrong?
20:38Morgawrit'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:38bitemyappMorgawr: come back with the answer when you have one please.
20:38Morgawrdon't take it wrong bitemyapp, I do appreciate the help
20:39MorgawrI certainly will
20:39bitemyappMorgawr: I just want to know the answerrrrr ;_;
20:39bitemyappMorgawr: thank you :)
20:48seangrov`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:50chordcan anyone hear me?
20:50akurilinJust 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:51akurilin<3
20:52chordwhich clojure cookbook
20:52akurilinNo idea how I'm ever going to pay it forward for all the stuff you people put together...
20:53dobry-densomeone posted this in r/clojure: http://i.imgur.com/4avtGfg.gif
20:55technomancydobry-den: ooh; /me does grabby-hands
20:55dobry-denit's hickey after some hammock-time
20:55technomancyit will go well with my collection: http://p.hagelb.org/9grin.gif http://p.hagelb.org/10sad.gif
20:56ambrosebshahaha
20:56arrdem/11-rhicky.gif?
20:57bitemyappakurilin: I'm working on the Korma chapter of the cookbook right now
20:57bitemyappI'm also going fucking mad trying to idiot proof it.
20:58bitemyappI would just like to state that H2 sucks.
20:58indigoI don't understand why everyone uses H2
20:58indigoWhy not use SQLite instead
20:58`cbp:P I use h2
20:58technomancyindigo: sqlite's jdbc drivers are junk
20:59akurilinbitemyapp, 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:59dobry-dendatomic-free uses h2 ;)
20:59clojurebotCool story bro.
20:59technomancythey don't work concurrently, even though the underlying DB does
20:59bitemyappakurilin: yes, you can be my test subject.
20:59hiredmanh2 also has concurrency issues
20:59akurilinbitemyapp, I gotta learn it anyway so, might as well.
20:59hiredman(use derby)
20:59akurilin*updates todo list.
20:59bitemyapphiredman: derby is slow. I'd rather go fast and break things. It's what Zuckerberg sed.
20:59akurilinok
21:00bitemyappIf that last statement made your eye twitch, please (inc bitemyapp)
21:00kcinj #lowendbox
21:00akurilinbitemyapp, is the chapter up on github already or are you hugging at atm?
21:00`cbp(inc callen)
21:00lazybot⇒ 15
21:01hiredmanwhen h2 throws exceptions due to concurrent access, you can't go fast enough to break anything
21:01dobry-denindigo: isnt topic difference that h2 is a java lib while sqlite is a c lib?
21:02dobry-dentopical
21:03`cbp(inc bitemyapp) ; ahem quite the typo there
21:03lazybot⇒ 1
21:15bitemyappYou know how I know this Clojure Cookbook is going to be good?
21:15bitemyapp{:NAME "Dmitri" :TENTACLES false}
21:15bitemyappbecause tentacles are involved.
21:15bitemyappAlways a good time.
21:30LordQuasIs clojure-mode + nrepl the preferred way to do clojure with emacs?
21:30LordQuas\join #emacs
21:30rasmustoLordQuas: grab paredit.el too
21:32LordQuasyup yup, used to it with elisp editing. I read some posts about slime and wondered which was better
21:32rasmustonrepl is the new standard afaik
21:33LordQuasGotcha, thanks.
21:33LordQuasOh and what about ritz?
21:33rasmustoLordQuas: I have this thing if you want something to look at: https://github.com/rasmusto/vim-emacs-clojure-starter-kit
21:33rasmustoLordQuas: can't speak to ritz
21:35LordQuasrasmusto: Thank you, I will gladly plunder this =D
21:35rasmustoLordQuas: I just learned emacs a few weeks ago, so don't take anything as doctorine ;p
21:36technomancythe guide on clojure-doc.org is very good too http://clojure-doc.org/articles/tutorials/emacs.html
21:36technomancyif vebose
21:43bitemyappH2's capitalization bullshit is really ruining my day.
21:44bitemyappof course, Korma already has something for this and I was being a moron.
21:49TimMcbitemyapp: Technically, tentacles *aren't* involved.
21:49TimMcIt says so right there, :TENTACLES false.
21:51bitemyappTimMc: the faces I am making at you right now would crack a mirror.
21:56devnin-place fisher-yates -- got a good clojure version?
22:02devnmy versions all look nasty
22:03Apage43heh
22:04Apage43i decided to look at clojure.core/shuffle
22:04Apage43it just calls java.util.Collections/shuffle
22:04Apage43(after dumping the collection into an ArrayList
22:21amalloydevn: i have one in useful
22:22amalloyaside 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:36gfredericks,(format "lib-%04d" (rand-int 10000))
22:36clojurebot"lib-7607"
22:39mercwithamouthhow would one go about calculating an average functionally?
22:40gfredericks(fn avg [nums] {:pre [(seq nums)]} (/ (apply + nums) (count nums)))
22:41mercwithamouthgfredericks: o_O
22:41gfrederickssomething wrong?
22:41mercwithamouthnot that i would know =P
22:41mercwithamouthtrying it out now
22:42mercwithamouthwhat does ':pre' do?
22:43gfredericksit's a precondition; if (seq nums) is falsy, i.e. if nums is empty, it will throw an assertion error
22:43mercwithamouthahh i see
22:43gfredericksslightly more readable is {:pre [(not (empty? nums))]}, but we have this silly idiom
22:44mercwithamouthhrmm any way to do it parallel?
22:44gfredericksuse reducers for the apply + I guess
22:44mercwithamouth<- not a math person but discussing an issue with a friend
22:45gfredericksif you're thinking about functional programming abstractly, the parallelism is somewhat of an implementation detail
22:45gfredericksbut yes the addition part is parallelizable
22:47mercwithamouthhrmm
22:49mercwithamouthgfredericks: and is that possible without keeping a count? holding state?
22:50gfredericksum. huh? yes? not sure what you mean exactly.
22:50`cbpI gotta say multiple cursors on emacs is the sexiest thing
22:50`cbpespecially with paredit omg
22:55ghadiBefore 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:56ghadiI think there is an issue with two dependencies that silently shadow each other
22:57ghadiclojurescript 0.0-1909 requires tools.reader, as does clj-http 0.7.x
22:58ghadiWhen 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:59gfredericksthat might be expected
22:59ghadibut 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:59ghadihi gary
22:59gfrederickshi
22:59gfredericksghadi
23:00gfredericksoh wait so you're saying the tree prints it under one but it's actually using the version required by the other?
23:00ghadisi senor
23:00gfredericksdoes tree print a version for tools.reader?
23:01hiredmanghadi: what version of tools.reader shows up in lein classpath?
23:01gfredericks(`lein classpath`)
23:02ghadilein deps :tree shows tools.reader under clojurescript as the latest ver (0.7.8) but classpath shows 0.7.7
23:02ghadino conflict warning on lein deps :tree
23:04ghadiin clj-http's pom, tools.reader is listed with a org.clojure/clojure exclusion
23:05ghadiin clojurescript's pom, no exclusion -- not sure if this fact matters, but it's a fact
23:06ghadi[org.clojure/clojurescript "0.0-1909"]
23:06ghadi[clj-http "0.7.7"] you can reproduce the behavior with these deps in an empty project
23:07gfredericksthis is out of my realm of expertise; if nobody else is around I'm sure a github issue would be appreciated
23:09ghadiI'll open one up. thanks
23:11AieshaDott
23:14dobry-denHow come running mvn goals from ~ dir don't complain about pom.xml but they do in non-~ folders
23:16ghadiLucky issue # https://github.com/technomancy/leiningen/issues/1337
23:16gfredericksghadi: you get internet money!
23:16ghadiwhat do I win
23:16gfredericks1337 internet dollars
23:17gfredericksredeemable at your local internet location
23:17TEttingerhttp://i.imgur.com/dOLkgVR.png <-- not related to issue #1337, but relevant to some questions we've had in here lately
23:25gfredericksso I was trying to be helpful to myself by throwing an ex-info from one of my test helpers
23:25gfrederickswith stuff that I could use to debug why the test failed
23:26gfredericksbut I'm not sure clojure.test is going to let me see the exception?
23:29logic_progis there a way to tell "lein cljsbuild auto" to also "require main.clj" ?
23:36ddellacostalogic_prog: why do you need main.clj? Is it crossover code? If so, just put it in the source-paths list
23:37logic_progno
23:37logic_progI just want a single lein
23:37logic_progthat both runs my clojure server and also do "cljsbuild auto"
23:38technomancylogic_prog: trampoline combines chained tasks
23:38technomancy`lein trampoline do run -m my.main, cljsbuild auto`
23:38technomancy"When in doubt, use combinators."
23:42muhoowhy combinators?
23:42logic_progtechnomancy: who are you and what makes you qualified?
23:42logic_progI'm kidding, it worked, thanks. :-)
23:42gfrederickscombinators are the monads of programming
23:43logic_progha ha
23:43logic_progY Combinators
23:43logic_prog:-)
23:51logic_progwhen I do (:require-macros [blahblah :as ..]), does it only pull in defmacros or does it pull in defns too ?
23:54gfrederickspulling in defns wouldn't make sense? because it's compile-time?
23:54gfredericksthe defns are written in clojure presumably, not clojurescript