#clojure log - Feb 24 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

11:19 pbostrom: CookedGryphon: in general, you have to manage the javascript dependencies yourself like you described, but you can look at https://github.com/swannodette/om/blob/master/project.clj to see how dnolen_ handles Om's react dependecy

11:20 teslanick: Though that's because dnolen_ posted react to clojars

11:20 Though it's not clear to me how (because clojars doesn't point back to a repo)

11:25 alandipert: CookedGr1phon, http://www.webjars.org/ is another approach

11:26 CookedGr2phon: sorry, lost my ssh connection there. So how do I know what I can get from the google clojure dependency system? Or is that just stuff built into closure

11:27 dnolen_: CookedGr2phon: IME there are not that many useful libs that follow Google Closure's conventions, Closure itself provides a ton functionality http://docs.closure-library.googlecode.com/git/index.html

11:28 CookedGr2phon: pretty much everything outside of the UI library seems solid

11:29 CookedGr2phon: for JS libs (which typically cannot go through the Closure Compilation) I find it simplest to package them up into a JAR and include externs and prepend them via the :preamble compiler option

11:29 pbostrom: teslanick: he deployed a jar containing react

11:29 dnolen_: If you're doing Node.js then you just use NPM

11:37 lvh: hi

11:37 I'm getting WARNING: Use of undeclared Var hexlife.coords/x at line 13 src/hexlife/coords.cljs when compiling cljs

11:38 the vars it's complaining about are declared in a let

11:38 CookedGr2phon: dnolen_: thanks, that helps

11:38 `cbp: lvh: paste?

11:42 jjl`_: hi folks. where can i read about benchmarking properly in clojure? do people use things like JMH? I've seen criterium being used by a couple of projects, but I've really no idea where to start

11:56 lvh: `cbp: https://gist.github.com/lvh/24c8e75f10f9d367c1ef

11:56 `cbp: lvh: on line 13 the vector should be inside the right parenthesis before it

11:57 lvh: https://www.refheap.com/46447

11:59 michaniskin: using lein-marg 0.7.1: how do you configure marginalia to generate separate links to clj and cljs namespaces with the same name?

12:03 example: the tailrecursion.hoplon namespaces here http://tailrecursion.github.io/hoplon/

12:34 seangrove: $seen noprompt

12:34 lazybot: noprompt was last seen quitting 9 hours and 29 minutes ago.

12:44 jballanc: quit

12:44 d'oh :(

12:48 TravisD: Does anyone know why there have been so many mass connects / disconnects that last few days?

12:48 technomancy: there's some insane ddos attack on freenode

12:48 best to turn off join/part messages

12:49 I mean, you should do that anyway, but especially now =)

12:49 TravisD: Ah, that's sad :(

12:49 technomancy: yeah

12:49 the theory is it's some crime syndicate ineptly attempting a show of force

12:50 and they don't realize "check out how we took down this volunteer-run nonprofit network" isn't actually impressive

12:50 TravisD: heh

12:50 michaniskin: also they probably need help in #php, those guys

12:51 so they're only hurting themselves

12:51 technomancy: michaniskin: well you didn't see these attacks back in the day before stackoverflow

12:51 just sayin'

12:52 `cbp: heh

12:52 TravisD: Hmm, it appears that the only way to disable event messages is by modifying some CSS file deep in the configuration of my IRC client

12:53 seems odd

12:53 jweiss: oh how i miss clojure and #clojure. all i get from python is excuses. it doesn't do lots of stuff and according to #python I'm wrong for even wanting it in the first place.

12:54 sdegutis: Sounds about right.

12:54 seangrove: Ugh, I'm banging my head against this, and there's obviously something simple: Could not locate cemerick/cljs/test__init.class or cemerick/cljs/test.clj on classpath

12:55 What have I forgotten/left out?

12:55 sdegutis: jweiss: Many (all?) languages require a certain level of buy-in for the features they lack, and it's easy to go overboard with that mentality.

12:55 cemerick: seangrove: make sure you're requiring the CLJS side of cemerick.cljs.test

12:55 not just :require-macros for deftest/is/etc

12:55 jweiss: sdegutis: yeah, what bothers me is not the actual lacking, it's the willful ignorance of what's missing.

12:56 cemerick: oh, classpath

12:56 seangrove: your deps or :require-macros decl are screwed up somehow

12:58 sdegutis: jweiss: reminds me of someone was talking somewhere on IRC about how the folks in #twisted (Python's famous networking lib) were trying to convince themselves to him that async networking is the best way to do it, or something

12:58 jweiss: the whole "trying to convince themselves" part is what I remembered most, because it's so accurate, they'll argue with you about it but they're really arguing with themselves about it

12:59 Y'all'z: what technique do you use to compile, bundle, and deploy your web stuff to the net?

12:59 technomancy: jweiss: I do miss using clojure, but I don't miss hanging out in #clojure because I never stopped =)

12:59 sdegutis: er, "Everyone:"

13:00 seangrove: cemerick: Thanks, I'll try to dig around a bit more

13:00 TravisD: technomancy: Do you have some specific reasons for not using clojure anymore?

13:00 seangrove: technomancy: I saw some of the React/IG guys tweeting about how much they liked OCaml

13:00 jweiss: technomancy: i still lurk here too :) i just miss having a channel with friendly knowledgeable people who can advise me on the language i have to use at work :)

13:00 sdegutis: seangrove, technomancy: is OCaml even suitable for a scalable web app?

13:01 technomancy: TravisD: just that we don't have any need to start any new projects at work right now

13:01 seangrove: sdegutis: Can't tell if you're trolling...

13:01 sdegutis: seangrove: I'm still trying to decide.

13:01 TravisD: technomancy: Ah, I see. Do you work on any personal projects in clojure still?

13:01 technomancy: sdegutis: no, I wouldn't say that's a good fit

13:01 sdegutis: though supposedly the ocaml->js compiler is really good

13:01 self hosted even

13:02 TravisD: sure; here and there. been doing more hardware stuff recently though.

13:02 TravisD: Yeah, those cool keyboards. Cool :) I thought maybe you left it for more philosophical reasons

13:02 sdegutis: My deployment plan is to create a lein task that compiles the ring uberjar, compiles an nREPL jar, compiles a few static .html files, compiles our ClojureScript and GardenCSS static files, bundles them together somehow, so I can upload them to the remote server.

13:02 What's a good technique for doing all this in one swift move?

13:03 technomancy: TravisD: these days lein is pretty stable; not a lot of new development going on there, so it felt like a good time to try something new.

13:04 seangrove: This look like the right ns form? https://github.com/sgrove/omchaya/blob/tests/test-cljs/omchaya/test.cljs

13:04 pjstadig: sdegutis: the only webscale language is assembly https://twitter.com/joewalnes/status/437397649546022912/photo/1

13:04 sdegutis: I'm not at the top of my IRC game this morning, been phrasing questions all wrong and stuff.

13:05 seangrove: cemerick: Nevermind, I think I'm making progress

13:05 TravisD: technomancy: Makes sense :)

13:05 sdegutis: seangrove: was it you who switched from clojure.test to Expectations in the whole project?

13:06 seangrove: sdegutis: No, I'm fine with clojure.test

13:06 * sdegutis tries to remember which sean

13:06 seangrove: Only thing I'm considering switching around would be something like *-check

13:06 locks: sean lock? sean penn?

13:06 sdegutis: Oh, it was sean corfield.

13:08 seangrove: Arr, now I'm getting `Invalid :test-command, contains non-string value: [runners/phantomjs.js :runner window.literal_js_executed=true test-cljs/vendor/es5-shim.js test-cljs/vendor/es5-sham.js test-cljs/vendor/console-polyfill.js resources/private/js/unit-test.js]`

13:09 cemerick: seangrove: you probably have cljs.test set up as a dev dependency, instead of a plugin

13:09 seangrove: cemerick: If I don't have it as a dependency, it doesn't end up on the classpath (hence the error from before), and if I do, it's not able to modify project.clj

13:10 cemerick: seangrove: it adds itself as a dependency when added as a :plugin

13:11 sdegutis: jweiss: reminds me of how emacs folk will tell me that not having a tab-bar is a good thing, and you should just memorize all your project file names and switch buffers to them instead of relying on spatial memory like tabs would have you doing

13:12 jweiss: sdegutis: hehe i can understand the argument that a tab-bar isn't necessary, but saying you should memorize buffer names doesn't sound good. anyway, doesn't emacs actually have a tab bar?

13:12 i mean, not by default, but it's not like you can't have it

13:12 technomancy: sdegutis: or like telling clojure programmers they should do file IO with lazy seqs of lines, right?

13:12 seangrove: https://www.refheap.com/46472 That stack trace comes from this project.clj https://github.com/sgrove/omchaya/blob/tests/project.clj running `lein cljsbuild test`

13:13 Ah, plugins is specified twice... nevermind

13:13 sdegutis: technomancy: naturally

13:13 technomancy: I mean, what's wrong with loading everything into memory at once all the time? it works great for me.

13:13 sdegutis: jweiss: there is a plugin that lets you use the ruler-bar for tabs, yes

13:13 seangrove: I expect it should work now. I knew it was something obvious and stupid.

13:13 cemerick: seangrove: hah, that's a good one.

13:13 sdegutis: jweiss: it's so hacky.

13:14 technomancy: of course

13:14 seangrove: technomancy: Fix lein to throw an error if the same key is specified twice in project.clj :P

13:14 jweiss: sdegutis: fwiw, my completion lib just sorts by last use, so i can tab backwards in time to previous buffers i had switched to

13:14 technomancy: learning to use something that scales beyond the trivial case is booooring

13:15 seangrove: didn't that change in clojure itself?

13:15 seangrove: ,{:a 10 :a 20}

13:15 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>

13:15 jweiss: ah i was about to say, did they change that?

13:15 technomancy: oh, it changed the other way

13:16 seangrove: technomancy: I believe it did, but defproject doesn't take a straight hashmap

13:16 sdegutis: What's a good technique to compile a bunch of stuff in a Clojure web app all at once?

13:16 seangrove: sdegutis: Something like dieter or whatever its successor from circleci is now

13:17 sdegutis: ah, stefon

13:17 technomancy: seangrove: ah yeah, it goes through clojure.walk

13:18 sdegutis: technomancy: wait, why isn't OCaml a good fit for web?

13:18 technomancy: err, no it's :as that's collapsing it into one map

13:18 sdegutis: weak libraries and no concurrency

13:19 seangrove: might make a reasonable patch to take it as a seq and macro splice it in between {}, assuming that's even possible

13:27 hyPiRion: technomancy: oh yeah, that's fully possible

13:27 ,`{~@[:foo :bar :baz :quux] ~@[]}

13:27 clojurebot: {:foo :bar, :baz :quux}

13:28 technomancy: ,`{~@[:foo :bar :baz :quux :foo :dupe] ~@[]}

13:28 clojurebot: {:foo :dupe, :baz :quux}

13:28 technomancy: dang it

13:28 makes sense if it's done at read time

13:29 hyPiRion: oh dang

13:29 technomancy: would need an explicit check then, but that's probably fine too

13:29 hyPiRion: ,(distinct? (take-nth 2 [:foo :bar :baz :quux :foo :dupe]))

13:29 clojurebot: true

13:30 technomancy: not bad at all

13:30 hyPiRion: oh, it's apply distinct

13:30 ,(apply distinct? (take-nth 2 [:foo :bar :baz :quux :foo :dupe]))

13:30 clojurebot: false

13:31 hyPiRion: (problem is of course the zero-arg case, but I don't know if it's a reasonable thing to expect in a defproject)

13:36 sdegutis: This seems like an interesting project: https://github.com/mylesmegyesi/clojure.core

13:36 Anyone seen this before? I haven't heard of it until now.

13:38 technomancy: neat idea, but it'll probably never go anywhere since it takes pull requests

13:38 sdegutis: How else could it work?

13:38 dsrx: well all the pull requests are from one person it looks like

13:38 so probably some collaboration between coworkers or something

13:38 bbloom: cool

13:40 technomancy: pull requests mean that anything could get merged

13:40 even ... communism

13:41 sdegutis: One of the few times I can say "LOL".

13:42 technomancy: eventually there will probably need to be some kind of core spec you can rely upon for portable code

13:42 but it seems unlikely to come from "the outside"

13:42 sdegutis: If enough ambitious/smart people are working on it, it could happen sooner.

13:59 pcn: Is anyone here particularly good with core.async?

14:00 teslanick: The answer to that is probably. But you should ask the question you have rather than asking if someone can answer your question. ;)

14:01 dsrx: can someone answer my question on whether i should ask my question or ask to ask my question?

14:01 teslanick: I had a teacher once who, when someone raised their hand and said, "I have a question," he'd respond, "well I have an answer."

14:01 pcn: Yeah yeah. Give me a second to push my current branch you bunch of jokers :)

14:03 So I've got code where I'm setting up a tcp listener, and I'm using aleph to read lines of text off of a socket, and pass that data as a map of the data, and the socket info into an async channel.

14:04 Then I'm reading that channel, validating that the data fits a particular format, and then writing that data back to another channel, as a json-formatted string.

14:04 Then I'm reading that second channel, and writing each line to disk.

14:04 That's all at https://github.com/pcn/carbon-relaj/blob/more-config-symbol-for-string-replacements/src/carbon_relaj/core.clj

14:04 bobwilliams: hello! what's the express, play, flask equivalent for clojure? Noir?

14:05 pcn: My goal is to be able to read lots and lots of data from lots of clients, and to read lots and lots of data from individual clients (backfill)

14:05 sdegutis: dsrx: I can.

14:05 wink: bobwilliams: noir is dead, but have a look at luminus

14:05 bobwilliams: thanks wink!!

14:05 wink: bobwilliams: it also uses libnoir, basically the leftovers ;)

14:05 pcn: When I test the small number of clients with a large amount of data test case, I seem to end up blocking and the whole pipeline just stops ding anything.

14:05 bobwilliams: nice!

14:06 technomancy: "noir, the good parts" =)

14:06 wink: hehe

14:06 I wouldn't dare to judge

14:06 both worked fine for me so far

14:06 pcn: I'd like to know how to determine why a blocking channel may freeze up when I'm not getting e.g. any exceptions from the channel-to-disk process

14:06 bobwilliams: yea, i noticed noir hasn't been updated in a while

14:09 jjl`_: is there a really simple way to just get a full stacktrace in the repl?

14:09 sdegutis: bobwilliams: I'd say probably Compojure + Ring.

14:10 bobwilliams: thanks sdeguits!

14:10 seancorfield: jjl`_: (clojure.stacktrace/print-stacktrace *e) ;; prints the stack trace from the last exception

14:10 bobwilliams: i've used hiccup some but looking for more of a framework

14:10 sdegutis: seancorfield: Do you still use Expectations?

14:10 seancorfield: sdegutis: yes we do

14:10 sdegutis: How are you liking it after all this time?

14:11 seancorfield: jjl`_: or just (pst *e) ;; clojure.repl function

14:11 sdegutis: we still love Expectations

14:11 sdegutis: Okay.

14:11 devn: seancorfield: hey dude

14:11 jjl`_: seancorfield: thanks :)

14:11 wish i'd asked that ages ago, of course

14:11 devn: seancorfield: jdbc is still on postgres 8.4. What's the holdup on getting to 9.x?

14:12 Anything I can do?

14:13 seancorfield: someone testing it?

14:13 I don't use PostgreSQL and don't even have it installed

14:13 devn: seancorfield: ha! I didn't know if there was something bigger that needed to be done.

14:13 I'm pretty sure it's broken with 9.x

14:13 seancorfield: It's "supported" only by virtue of people testing it and providing me with patches for any bugs...

14:14 devn: k

14:14 seancorfield: I test MySQL and SQL Server, as well as the embedded DBs. But Oracle and Postgres rely on the community

14:15 devn: seancorfield: ive been playing with honeysql. i really like it. there are some things to learn there, but overall it's pretty nice.

14:15 the only annoying thing in general is dealing with quoting

14:16 but that seems to be a problem all over the place

14:16 AeroNotix: in which situations will a single-threaded call where a lower binding call (on the stack) lose it's binding further up the stack?

14:16 devn: especially because the data im working with is a mess

14:16 seancorfield: devn: yeah, the quoting / stropping stuff is a pain... that's what I was trying to address with the entities / identifiers stuff in the DSL I briefly added to java.jdbc (but have since moved to a separate project)

14:17 devn: seancorfield: oh, one other jdbc related thing. since I'm using honeysql I wanted to wrap up (sql/query db (honey/format (honey/build ...)) opts), but the sql/query unrolled options makes that a little tedious

14:17 abp: devn: Is the issue about no IS NULL nonsense?

14:17 devn: abp: nah, honeysql takes care of that for me

14:18 {:select :%count.* :from :foo :where [:= :foo nil]}

14:18 or just [:= :foo]

14:18 seancorfield: and even java.jdbc handles nil / NULL in where clauses

14:18 abp: devn: too bad the maintainer doesn't even get rid of such crazy misifnormation: https://github.com/jkk/honeysql/issues/12

14:18 ah that makes sense, never thought about it

14:19 devn: i kind of expected to see: [:is-null :foo]

14:19 abp: but obviously that would be a crazy limitation for a sql dsl and i wouldn't know how you would've used it for quite a while seancorfield

14:19 devn: and seancorfield swoops in with the comment :)

14:20 seancorfield: :)

14:20 devn: abp: there are other annoying things

14:20 abp: devn: heh, we use korma ;)

14:20 devn: like for instance, i haven't puzzled out how to do COUNT(DISTINCT foo)

14:20 you can do {:modifiers [:distinct]} or (modifiers :distinct), depending on which syntax you prefer

14:21 borkdude_: How do I add a type hint to this line? (.setScale ^java.math.BigDecimal ratio decimal-places java.math.BigDecimal/ROUND_HALF_UP)

14:21 the type hint I have now doesn't seem to help the reflection warning

14:21 devn: borkdude_: perhaps the warning comes from further up? it's hard to help without seeing the context

14:21 jjl`_: seancorfield: you forgot the corollary to that, "if you then run a successful statement, *e isn't upset and jjl` will chase a nonexistent error for 10 minutes :) )

14:22 unset/*

14:22 borkdude_: devn I'm getting: line 113:32, and this is what I have there

14:22 abp: devn: subselect? :P

14:22 amalloy: borkdude_: that should be fine

14:22 pcn: So, does anyone have an example of something that uses core.async with a lot of small messages from the newtork?

14:22 devn: abp: :) yeah just haven't figured out how to do that! :)

14:22 wrgwg: تحذير warning you may be watched do usa & israel use the internet ( youtube, facebook, twitter, chat rooms,ect...)to collect informations,,,,can we call that spying ?do they record&analyse everything you type????why they ask for ur name,age,gender,occupation,place of work,ur mobile number.............ect, can they use these informations harming you?!!

14:22 warning you may be watched do usa & israel use the internet ( youtube, facebook, twitter, chat rooms,ect...)to collect informations,,,,can we call that spying ?do they record&analyse everything you type????why they ask for ur name,age,gender,occupation,place of work,ur mobile number.............ect, can they use these informations

14:22 harming you?! warning you may be watched ! do usa & israel use the internet ( youtube, facebook, twitter, chat rooms,ect...)to collect informations,,,,do they record&analyse everything you type????can we call that spying ?why they ask for ur name,age,gender,occupation,place of work,ur mobile number.............ect, can they use these

14:22 informations harming you?!! warning you may be watched do usa & israel use the internet ( youtube, facebook, twitter, chat rooms,ect...)to collect informations,,,,can we call that spying ?do they record&analyse everything you type????why they ask for ur name,age,gender,occupation,place of work,ur mobile number.............ect, can they use

14:22 these informations harming you?!

14:23 devn: oh god

14:23 pcn: Thank you freenode

14:24 AeroNotix: "Spam is off topic"

14:24 love it <3

14:24 abp: devn: https://github.com/jkk/honeysql/issues/10 ?

14:24 devn: abp: bah, i give up on the internet

14:24 thanks :)

14:25 amalloy: borkdude_: interesting. i get the warning there too, but i don't think i should

14:25 abp: devn: i don't even use a lib without looking through issues and skimming source at least brief, and you're welcome :)

14:26 devn: abp: same here, although i think in this case I was just like: "omg i need to stop concatenating strings"

14:26 so i just dove in

14:26 AeroNotix: https://github.com/AeroNotix/closchema/commit/a416ace66757015e8d6ffcabce6ec5cb7e869398 Thoughts / Review?

14:27 it's a PR, want to see if that's the right way to do what I wanted to do.

14:27 gfredericks: so defmulti is somewhat of a noop on reload

14:27 devn: gfredericks: yes

14:27 borkdude_: amalloy maybe I should also typehint the second arg?

14:28 amalloy: borkdude_: (.setScale ^java.math.BigDecimal x (int y) java.math.BigDecimal/ROUND_HALF_UP) fixes it, although java would prefer you use (fn [x y] (.setScale ^java.math.BigDecimal x (int y) java.math.RoundingMode/HALF_UP)) these days

14:28 abp: devn: erm yes, everything is better than that

14:28 borkdude_: amalloy cool thanks :)

14:29 amalloy: the compiler ought to be able to figure out the method to call without your help, but it doesn't try very hard when there are two overloads with the same name and arg count

14:31 jjl`_: http://pastebin.com/9BiXh6Wf anyone know why this results in "ClassCastException clojure.lang.MapEntry cannot be cast to clojure.lang.IPersistentMap" ?

14:32 amalloy: jjl`_: probably 'up is not a map

14:33 note also that (apply (partial f x) ys) is just (apply f x ys)

14:33 jjl`_: oh, i didn't realise you could supply multiple arguments and avoid the partial

14:34 oh i see, i've iterated over the map instead of the keys. thanks

14:35 gfredericks: so my guess is that it's a noop because you might not want to clobber defmethods that aren't about to be reloaded

14:35 but that doesn't preclude at least reloading the dispatch function; maybe that's not done because it's sketchy to redefine the dispatch function but not all the defmethods as well?

14:36 just trying to suss out the justification

14:36 technomancy: gfredericks: yeah, I am not a fan of that behaviour, but I can see the reasoning behind it

14:36 gfredericks: technomancy: you'd prefer redefining the dispatch fn and crossing fingers?

14:37 juliobar_: Asked over the weekend but few were online, Anybody have an idea of why "lein ring uberwar" with an untouched compojure project will take ~5 seconds but adding require datomic will make it go up over 1 minute and actually trying to use datomic will make it take a long time (if ever) to complete for me?

14:37 technomancy: gfredericks: yeah

14:37 abp: would it be feasible to embed elasticsearch with elastisch into a desktop app for fulltext search?

14:38 technomancy: gfredericks: IME redefining dispatch fn doesn't usually mean a completely different set of semantics for dispatch values

14:38 turbofail: abp: seems like it'd be kind of a silly use of elasticsearch

14:38 technomancy: gfredericks: I guess the justification is better safe than sorry since you can't tell

14:38 abp: turbofail: what would be more suitable?

14:39 turbofail: abp: maybe just raw lucene

14:39 via clucy

14:39 technomancy: yeah, elasticsearch makes more sense in a distributed context

14:39 sdegutis: Seems to be that clojure.java.io/resource likes to make the process hang around for a few minute when it would have quit.

14:40 AeroNotix: technomancy: when deploying with lein, why does it ask for my GPG password twice?

14:40 abp: ok, honestly i don't even know the exact differences yet ;) elastic search was just "serves json" for me until now reading it's good for distributed apps

14:40 sdegutis: Nope wait, that's not it.

14:41 technomancy: AeroNotix: it needs to sign both the jar and the pom. if you have the gpg agent set up it should just cache the first request; that's the recommended way

14:41 AeroNotix: technomancy: gotcha, ok

14:43 rplaca: juliobar_: 2 thoughts: either the require is doing something more than just compiling the code (this happens when you have top-level defs that do real work) or there's a huge AOT compile step being called.

14:44 juliobar_: rplaca: I was worried about 1) so took out any top level defs and for 2) the cpu is idle for many many minutes before it completes or I get bored. Is there any kind of verbose flag? I could not find anything.

14:44 sdegutis: Dang!

14:45 Found what makes my process hang around: (:require [datomic.api :as d])

14:45 Dang.

14:48 juliobar_: sdegutis: ??? what are you trying to do? I get a hang in uberwar when I try to use datomic. Could they be related?

14:48 xpera: i'd like to use 1.6alpha from a plain `lein repl`. I tried changin ~/.lein/profiles.clj but that isn't working or I'm doing it wrong

14:48 technomancy: xpera: repls outside projects are hard coded to lein's version of clojure

14:49 amalloy: really? why's that, technomancy?

14:49 xpera: technomancy: oh, so some of the comments are off track: https://github.com/technomancy/leiningen/issues/1035

14:49 technomancy: amalloy: startup time, mostly

14:49 usually you want something quick

14:50 xpera: technomancy: thanks. will work around

14:50 technomancy: there's probably a way to use a profile as a fake project to do this, but you can't just put :dependencies in the user profile

14:50 xpera: that issue is about an in-project repl

14:50 amalloy: man, i want something quick, but i use clojure anyway

14:51 technomancy: hehe

14:51 xpera: amalloy: groan

14:51 technomancy: should do a blog post or a faq on how to do that with profiles

14:53 xpera: technomancy I think the ticket that discusses it is https://github.com/technomancy/leiningen/issues/966

14:54 technomancy: xpera: it's not really the same

14:54 you can use :dependencies to add things to the non project repl

14:54 pcn: So, let me ask my question differently

14:54 technomancy: you just can't use it to replace things that have already been loaded

14:55 xpera: ok

14:55 pcn: I thought that with blocking channels with core.async, once a channel is read from, it un-blocks.

14:55 In my attempts, it seems like it just gums up and doesn't recover.

14:56 Is there something I'm missing when using blocking channels?

14:56 pbostrom: pcn: I can't say for sure if this is your problem, but the thing that stands out is >!! and <!! inside of a go block

14:57 pcn: Hmm... OK, so go blocks are only for non-blocking channel ops?

14:58 amalloy: pcn: you're supposed to use those in (thread ...) instead of (go ...)

14:58 `cbp: pcn: yes, <!! block a thread. go blocks don't use threads they use callbacks

14:58 amalloy: blocking ops, that is

14:58 sdegutis: juliobar_: I'm just trying to write a little one-off function that happens to use a ns tha happens to require datomic.

14:59 pcn: amalloy: e.g. per line 97 https://github.com/pcn/carbon-relaj/blob/more-config-symbol-for-string-replacements/src/carbon_relaj/core.clj#L97

14:59 The reason that I went from ! -> !! there was because I was getting a backlog that resulted in a different error

14:59 xpera: @pcn Re: "I thought that with blocking channels with core.async, once a channel is read from, it un-blocks." That's not how I think about it: I don't think of channels themselves being blocking. I think of operations on them as being blocking or not. I could be wrong.

14:59 pcn: Let me create that again

15:00 xpera: @pcn So my understanding is that *operations* on channels may block, but the channel itself is not 'blocked' or 'unblocked'

15:00 pcn: xpera: that may be key. I set up the channels a few months ago when I started this, and that sort of thing isn't fresh in my mind now :-/

15:01 xpera: @pcn I think of a channel as just a queue

15:04 amalloy: xpera: the tradition in irc is "person: message", rather than the twittery "@person message"

15:05 xpera: amalloy: right thanks

15:05 pcn: xpera: that makes sense... I think the model I have in my head is that the operations on a channel should be synchronous on both ends or asynchronous on both ends. Is that something I shouldn't worry about?

15:05 amalloy: pcn: i don't think that's true

15:06 xpera: pcn: I'm rusty, but I'm pretty sure you can mix things up

15:06 pcn: see "Mixing modes" on http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html

15:09 pcn: Thanks, that's clear

15:09 pbostrom: pcn: did you see my comment?

15:11 pcn: pbostrom: yes, thanks. I was responding to you when I said taht I'd gone to ! -> !! because of a different error.

15:11 pbostrom: I'm trying to reproduce that error since as you pointed out that is wrong.

15:19 sdegutis: What's the status of clojuredocs.org? Is it going to support 1.5.1 soon?

15:20 amalloy: i don't think it's changed in years. probably not

15:20 ToBeReplaced: plug to the crowd, looking for feedback: https://github.com/ToBeReplaced/jetty9-websockets-async

15:21 `cbp: it's probably time to do some work on the wiki

15:22 gfredericks: technomancy: yeah the whole idea of redefining a dispatch function is kind of inherently edge-casey

15:23 a note in the docstring might be nice :)

15:26 sdegutis: I heard there was a new API in the works to replace clojuredocs.. can't find it on github though

15:28 Oh right: https://github.com/clojuredocs

15:30 xpera: ToBeReplaced: I just read over the code. FWIW, I was a little confused by the use of the keyword :go-loop

15:31 ToBeReplaced: if it also confuses others, maybe a few words about it would help

15:32 ToBeReplaced: xpera: thanks for reading -- what would you use there? haven't found consistent usage among the community for "this key refers to the channel that will receive the output of an underlying go-loop"

15:32 xpera: ToBeReplaced: do you ever want to expose :go-loop as an option to change via your API?

15:33 ToBeReplaced: xpera: actually, i find that most libraries just drop the reference, but that's broken

15:33 xpera: no, that is not a goal

15:33 xpera: ToBeReplaced: are you saying the only purpose of it is to hold the reference?

15:34 ToBeReplaced: xpera: correct

15:34 xpera: ToBeReplaced: ok, that's what confused me. I was expecting to see it used again. Maybe just saying what you told me would clear it up

15:35 ToBeReplaced: okay, thanks for the feedback

15:35 tazz: Hey guys how do i add a negative filter? Like (filter #(not= "HttpStatusCode.200" (:service %)))

15:35 is that correct?

15:35 use not= instead of = ?

15:35 michaniskin: or clojure.core/remove?

15:37 tazz: http://clojuredocs.org/clojure_core/clojure.core/remove

15:38 tazz: thanks michaniskin checking

15:41 trying (remove #(= "HttpStatusCode.200" (:service %)))

15:45 michaniskin: tazz: the way you were doing it is also fine, was it not working for you?

15:45 pbostrom: pcn: did you not see my comment, or my comment to see my comment?

15:46 michaniskin: tazz: in your example you don't have the second argument to filter or remove… they take two args, the predicate and the collection

15:46 pbostrom: yes, they have a fixed thread pool, it's like 2 threads I think

15:47 tazz: actually i was not sure if this was the correct way to use not=, also I was wondering if people use any other way to accomplish this.

15:48 <---- clojure newbie.

15:48 pbostrom: number of cores + 2

15:48 michaniskin: tazz: not= is fine, and remove is another way. you can also look at the source for remove, and you'll see it uses "complement"

15:49 S11001001: remove is better

15:49 johnnyblaze: hello I am learning clojure. Can someone explain what this is doing (let [[p & col :as all] stream]) the p & col :as all part. I don't understand. Thanks!

15:49 gfredericks: johnnyblaze: destructuring

15:49 michaniskin: tazz: complement is another way to negate a predicate

15:50 `cbp: ,(let [[p & col :as all] [1 2 3]] (print "p:" p "col:" col "all:" all))

15:50 clojurebot: p: 1 col: (2 3) all: [1 2 3]

15:50 tazz: :) Now I know of 3 ways to negate in clojure. I feel slightly more enlightened. :)

15:50 johnnyblaze: ahh i see... thank you!

15:51 tazz: damn double smilie.

15:52 michaniskin: tazz: there is also http://clojuredocs.org/clojure_core/clojure.core/keep which is part of that gang, too

15:53 tazz: http://clojure.org/sequences this page has a nicely organized list of all the various functions that operate on sequences

15:54 tazz: woha I just learned about "distinct" neat.

15:55 technomancy: gfredericks: I don't agree; changing the dispatch function is something I do a lot early on

15:56 n0n3such: noob curious question of the day: how many of you here now are paid to write clojure code and how many years of experience using clojure do you have ?

15:56 mdrogalis: With you on that, technomancy.

15:57 michaniskin: n0n3such: about 3 years experience here

15:58 n0n3such: mechaniskin: ty

15:59 gfredericks: n0n3such: 4+ years

15:59 n0n3such: gredericks: tyt

16:00 gfredericks: technomancy: workaround (def my-multi-fn :not-a-multi-method)

16:01 jjl`_: what's the simplest ring middleware to just give me text access to the request body?

16:05 michaniskin: (defn wrap-doit [continue] (fn [req] (continue (do-something (slurp (:body req))))))

16:06 jjl`_: thanks :)

16:06 * sdegutis checks out GardenCSS

16:08 pbostrom: pcn: you can try just changing >!! and <!! in the go blocks to >! and <!

16:16 jjttjj: anyone know what i might be doing wrong with datomic here:

16:16 https://www.refheap.com/46587

16:16 just trying to add a schema and it's not working

16:16 i realize it's probably a best practice to have a schema in an edn file

16:16 seangrove: $seen noprompt

16:16 lazybot: noprompt was last seen quitting 13 hours and 11 minutes ago.

16:18 seangrove: $mail noprompt Loving ankha, we've pulled it into one of our components and bound it so we can use it as we develop https://www.dropbox.com/s/p8f4wzboxhiyb5y/omchaya_inspector_keybindings.mov

16:18 lazybot: Message saved.

16:26 sdegutis: "It is designed for stylesheet authors who are interested in what's possible when you trade a preprocessor for a programming language." - https://github.com/noprompt/garden

16:27 Heh, preprocessors are becoming really simplistic programming languages lately. Nice to see that Clojure is embracing the full language for these things rather than creating new mini-ones.

16:29 abp: seangrove: so cool, keep the videos coming. :)

16:38 dnolen_: seangrove: awesome

16:40 seangrove: abp dnolen_: Yeah, it was pretty awesome to develop the draggable-window component with the ankha component in it

16:41 pcn: Hmm... pbostrom that worked when I tested it

16:46 abp: seangrove: inspection inception :)

16:49 _bart: Hello, I'm trying to run this 3-year-old project: https://github.com/dwu/ClojureVST

16:49 The guy is not using leiningen, so I have no idea how to boot this thing

16:51 mikerod: I see that Clojure data persistent structures, say APersistentVector, cache the hashCode after it has been calculated once. On the surface, I thought this was obvious, since the structure cannot change. However, if it holds mutable objects, I can easily set up a scenario where 2 #equals collections do not have the same #hashCode; violating the Object#equals contract.

16:51 Is this observation correct? Is there any discussion related to this?

16:52 And what would be the suggestion for a collection of mutable items; don't use persistent data structures for them? realize the contract of equals/hashCode is no longer trustworthy?

16:53 tim_: mikerod: I don't think mutable objects hash their contents

16:53 tbaldridge: ,(hash (atom 42))

16:53 clojurebot: 32367841

16:53 tbaldridge: ,(hash (atom 44))

16:53 clojurebot: 10531718

16:53 tbaldridge: ,(hash (atom 44))

16:53 clojurebot: 9997918

16:53 mikerod: tbaldridge: no, I mean arbitrary mutable objects

16:53 amalloy: tbaldridge: that's not really demonstrating the point, although you're right

16:53 tbaldridge: yeah, the hash is based off the atom, not the contents of the atom

16:53 mikerod: Outside of my control

16:54 someone gives me objects from Java-land

16:54 I put them in a persistent collection

16:54 tbaldridge: yeah, then it's up to them to hash correctly.

16:54 mikerod: now I cannot trust the #hashCode #equals contract

16:54 tbaldridge: Or more correctly, don't do that.

16:54 amalloy: mikerod: clojure's collections will have the same problems that any other collection has if you put mutable stuff in it

16:54 mikerod: tbaldridge: yeah... I don't think that is always a viable option haha

16:54 tbaldridge: If a object wants to change its hash on the fly, that's just wrong.

16:54 mikerod: amalloy: but regular collections will recalculate the hasCode

16:54 hashCode

16:55 amalloy: "don't use mutable objects as hash keys", for example, is standard advice

16:55 mikerod: ok

16:55 tbaldridge: mikerod: this is why you can't use lists as keys in Python, you have to use immutable values like strings or tuples.

16:55 mikerod: ok, so mutable objects in my persistent data structure contaminate it

16:55 if I can't guarantee they aren't changing

16:55 tbaldridge: yeah, assuming they change their hash code depending on their contents

16:56 mikerod: and that means don't use it in a setting where I'd need to rely on its hashCode/equals contract

16:56 I guess that's fair; the behavior just scared me a bit

16:56 tbaldridge: How would you solve this in Java?

16:56 technomancy: it's weird that clojure is really careful to never allow two mutable arrays to compare as equal but doesn't do the same for hashmaps and such

16:56 mikerod: A Java ArrayList would just recalculate all the elements hashCode over again on each call; no caching

16:57 Well Java AbstractList

16:57 I like that the hashing is cached; that can be nice for performance. I just see that mutable objects in there can ruin it for everyone.

16:58 *performance in some cases*

16:58 technomancy: I was not aware of this

16:58 technomancy: mikerod: it bothers me more than it should

16:59 tbaldridge: technomancy: so you're saying Clojure should somehow detect when you put a mutable value into a immutable collection?

16:59 technomancy: tbaldridge: I'm actually just talking about clojure.core/=

17:00 tbaldridge: ah

17:00 technomancy: it seems to have a blacklist approach towards mutability where a whitelist would be safer

17:00 though that's an oversimplification

17:00 mikerod: interesting

17:01 tbaldridge: yeah, too bad objects can't tell you they are mutable; maybe the JVM will build that in since it has realized how defaulting to mutability is morally wrong and it needs to change its ways

17:01 xuser: so two mutable maps can return true when compared for equality?

17:02 technomancy: ,(let [a (doto (java.util.HashMap.) (.put 1 2)) b (doto (java.util.HashMap.) (.put 1 2))] (future (Thread/sleep 10) (.put a 1 3)) (= a b))

17:02 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

17:02 technomancy: oh, duh

17:02 sdegutis: &(let [a (doto (java.util.HashMap.) (.put 1 2)) b (doto (java.util.HashMap.) (.put 1 2))] (future (Thread/sleep 10) (.put a 1 3)) (= a b))

17:02 lazybot: java.lang.SecurityException: You tripped the alarm! future-call is bad!

17:02 technomancy: ,(let [a (doto (java.util.HashMap.) (.put 1 2)) b (doto (java.util.HashMap.) (.put 1 2))] (= a b))

17:02 clojurebot: true

17:03 bob2: aha

17:03 technomancy: welp

17:03 the point stands without the future

17:03 sdegutis: Why does lein-cljsbuild recommend putting source paths in "src-cljs" but lein-garden puts them right in "src"?

17:04 technomancy: sdegutis: there's nothing that says src/ has to contain files of only a specific extension

17:04 bit silly if you ask me

17:04 sdegutis: technomancy: I thought it was something to do with how leiningen defaults to compiling every file in "src" or something?

17:05 Thus I wouldn't want to compile cljs files along with my clj files in one jar, so I put them in "src-cljs"

17:05 technomancy: every .clj file

17:05 sdegutis: Oh!

17:05 Well, now I know what my next task is.

17:05 Oh wait, will lein-cljsbuild look for only .cljs files?

17:05 I mean, regarding :source-paths

17:05 Because I don't want it to compile all my .clj files into the .js file too

17:05 technomancy: ,tias

17:05 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: tias in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:06 sdegutis: Oh yes.

17:06 technomancy: oops

17:06 ~tias

17:06 clojurebot: Try it and see! You'll get results faster than asking someone in #clojure to evaluate it for you, and you'll get that warm, fuzzy feeling of self-reliance.

17:06 sdegutis: Right, I could try it, and if it fails, or if the compiled .js file is different, then dang, but if not, woo.

17:06 Seems legit.

17:06 amalloy: technomancy: (doto (HashMap.) (.put x y)) is needlessly verbose, by the way: you can just write (HashMap. {x y})

17:06 `cbp: you need .clj files for macros right?

17:07 technomancy: amalloy: thanks; my lack of java education is holding me back =)

17:29 jjl`_: does anyone know the incantation to get a postgres bignum into a clojure number through jdbc?

17:32 pbostrom: jjttjj: you probably a duplicate column in ns-columns

17:32 rplaca: juliobar_: sorry, I did a hit and run before

17:33 juliobar_: my next guess that that datomic is firing up a thread that's not marked "daemon" at top level (maybe in a future) and that's making the JVM hang hoping it will go away

17:36 shoepie: newb question, if i have an application state map with a collection of objects, say "events", and they are associated with "event-types"

17:36 is the clojure way to normalize the event-type of each event or is there a better way to associate them?

17:38 ie, :events [ { :description "foo" :event-type "type.a" } { :description "bar" :event-type "type.b"}]

17:40 pbostrom: jjttjj: actually, I think you need to supply unique negative indicies to #db/id[:db.part/db]

17:44 bob2: shoepie, what will you do with them?

17:47 shoepie: bob2: i'm curious what the clojure way to structure my application data so if I have a lot of event's of type "type.b" and I want to rename the event-type to "type.c" i'd have to go update all events of that type

17:48 bob2: basically normalized vs. de-normalized

17:50 bob2: i guess I dont know how (or if i should) i'd do something in a de-normalized way in clojure

17:50 sdegutis: Personally I'm not even sure there *is* a nil.

17:50 I mean, if there is, wouldn't it have a value?

17:50 technomancy:

17:53 pbostrom: pcn: what's that, using <! and !>?

18:01 bob2: shoepie, none of that sounds very clojure-specific

18:01 pbostrom: jjttjj: ok, the real answer: #db/id[:db.part/db] is a tagged element, so it gets turned into a unique negative id by the reader

18:17 pcn: pbostrom: It seems to be. I must have been inconsistent in that earlier. I'll keep trying to test it

18:18 seangrove: dnolen_: Any chance of including the ReactWithAddons in future React jars? I'd like to use the ReactTestUtils to trigger some synthetic events cleanly

18:20 pcn: If it continued to work well, I'll start profiling it. I think it should be able to handle more than 10k of these per second

18:20 Ah, no

18:20 There it goes

18:21 It's saying this: http://pastebin.com/xW7UetFu

18:22 amalloy: pcn: you're using >!! to put, and <! to take, right? it sounds like whatever is putting is producing elements faster than they can be taken

18:23 pcn: Yeah, that could be, so is there an example of a windowed buffer that this message is talking about that I can look at?

18:23 amalloy: i mean, i think you can just (chan 5) to create a channel with a 5-element internal buffer

18:24 but that's likely not going to solve the problem of too many puts, just delay it for a while

18:25 pcn: Yeah... the channels should be created with a 128 element buffer. The 1024 is surprising me a bit.

18:26 amalloy: 1024 is how many attempts to put are having to wait because the channel's 128-element buffer is full

18:37 greg`: who uses emacs with clojure?

18:38 johnwalker: i do

18:39 greg`: what plugins do you use to support development

18:39 johnwalker: clojure-mode/cider

18:39 greg`: is that the best one?

18:40 im trying to install it with el-get, but el-get is just ignoring me

18:40 johnwalker: weird. show me a pastie of what you're trying

18:40 but yeah, cider and clojure-mode are great

18:40 greg`: literally M-x el-get-install [RETURN] cider

18:41 amalloy: greg`: M-x package-list-packages RET

18:41 greg`: ah i will try that

18:41 johnwalker: it might already be installed

18:41 greg`: true i will try it thanks

18:42 johnwalker: good luck, let me know how it goes

18:43 greg`: sorry whats the best way to install lein? from src?

18:43 johnwalker: use wget to get the lein shell script

18:43 itll install binaries

18:48 greg`: did you get it setup?

18:48 the installation section here is really good: https://github.com/technomancy/leiningen

18:50 TravisD: Is "The Joy of Clojure" a good followup book to "Programming Clojure"?

18:50 `cbp: sure

18:50 bob2: yes

18:50 TravisD: thanks :)

18:55 s0x_: hey guys, im strugling for a while now to get my speclj test running. Actually i get in trouble as soon as i require some other namespaces in the implementation (http://pastebin.com/Nm7NSPeD)

18:55 greg`: johnwalker: yes! it works lovely

18:55 im going to start learning clojure

18:56 any tips on what to start with

18:56 johnwalker: great. i think braveclojure is pretty cool: http://www.braveclojure.com/

18:56 s0x_: Would be great to get a bit support in it since i become quite desperate :-/

18:57 greg`: is it available ebook?

18:57 oh yes i see it is!

18:57 johnwalker: err, didnt mean to leave :x

18:58 aphyr also has a good series of posts http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome

19:03 has anyone seen cedric greevey lately

19:11 danielszmulewicz: Hmmm... I need to sign my api calls with OAuth 1.0, I was hoping to use http-kit (the client), but I can't find information... Anyone?

19:12 dacc_: danielszmulewicz: maybe use an higher level library made for oauth?

19:15 danielszmulewicz: dacc: good idea, there are two (at least two), both are based on clj-http (that's fine too). You have experience with those?

19:16 technomancy: danielszmulewicz: you pinged me yesterday?

19:16 dacc: danielszmulewicz: don't have any experience with them, no

19:16 danielszmulewicz: technomancy: yes, hi, I wanted to tell you that I uploaded a Homebrew recipe for grenchman.

19:16 technomancy: danielszmulewicz: oh, nice.

19:18 danielszmulewicz: technomancy: there was some discussion around it: https://github.com/Homebrew/homebrew/pull/26947#issuecomment-35848273

19:19 technomancy: never used homebrew before, so that's a bit over my head

19:21 dacc: cool, i'd been looking for something like this

19:21 (native nrepl client)

19:22 danielszmulewicz: technomancy: yeah, bottom line is that it will not be available throught the main channel (which is source-only), but from an optional channel (think ppa for ubuntu). So less exposure. It's harder to find. (Unless someone is willing to work on a recipe that builds from source). Hope this makes sense.

19:23 technomancy: sure

19:23 I understand binary package management is a bit of a mess on macs.

19:24 danielszmulewicz: technomancy: indeed :-)

19:24 TravisD: Is there a macro that provides an alternative to fn, but creates a memoized function that also looks for cached values whenever it recurses? As far as I know, you cannot use the memoize function to do this except for the special case of top-level functions held in vars

19:26 danielszmulewicz: dacc: Thanks anyway. Tomorrow I'll try out my luck with oauth libraries to sign authorized requests for Etsy. Wish me good luck.

19:26 :-)

19:26 akurilin2: Do you guys have a favorite text/article/blog post to reference when writing macros? I write them so infrequently I have to basically re-learn it every time :P

19:26 dacc: danielszmulewicz: good luck =)

19:27 akurilin2: Or maybe a good chunk of code from Clojure core that has all of the different macro utilities in it for reference?

19:28 danielszmulewicz: akurilin2: http://aphyr.com/posts/305-clojure-from-the-ground-up-macros

19:28 akurilin2: danielszmulewicz: yeah I was looking at that. He references Clojure's (or) in there

19:28 qbg: Macros are usually just a pure function

19:28 akurilin2: so I"m looking at that for reference

19:29 bob2: building grench from source in brew would not be too hard

19:29 just slow, since it needs a whole ocaml toolchain

19:29 technomancy: slow enough that no one would do it

19:29 bob2: <- did :)

19:29 technomancy: * for statistically significant values of no one

19:29 =)

19:30 Cr8: I did too but I install toolchains for fun

19:30 danielszmulewicz: bob2: Plus the recipe will have to manage the installation of the toolchain. PITA.

19:30 Cr8: there's already an ocaml brew formula

19:31 just depend on that and brew will install it before your thing

19:31 danielszmulewicz: Cr8: that's a good idea. Are you positive that there is no other dependencies?

19:32 Cr8: for grench you still have to install the prereq things that are -written in ocaml- once the toolchain is installed

19:32 the opam install -- stuff

19:33 but brew install ocaml got me as far as I needed to be able to just follow the grenchman README

19:33 bob2: yep

19:33 danielszmulewicz, well, it jsut depends on ocaml right

19:33 danielszmulewicz: Cr8: Right. I would I have done if I had more time.

19:34 technomancy: depending on one package manager from another one is pretty sketchy

19:34 danielszmulewicz: bob2: You're welcome to write the recipe and tell me.

19:34 technomancy: especially one that has a "just get whatever's latest; it's cool" policy =(

19:34 bob2: yeah, that's the bit that is a bit dodge

19:34 danielszmulewicz, sorry, didn't mean to sound ungrateful

19:35 danielszmulewicz: bob2: No problem. :-)

19:36 technomancy did a great job and provided the binaries ready to go. It's just a matter of renaming the file, chmodding and putting it in the path.

19:37 technomancy: well, except there's no trust path really

19:37 danielszmulewicz: that last stretch could have been made easy by a package manager.

19:38 Cr8: trust path? I downloaded it with Safari anyway

19:38 technomancy: not really anything suitable for a package manager that offers decent trust guarantees

19:38 Cr8: =P

19:38 technomancy: but that doesn't seem to be a goal of brew anyway =\

19:38 danielszmulewicz: That's what my recipe does and it will be available homebrew-binary.

19:39 technomancy: do they still have the "curl this shortened URL and pipe it to bash" thing?

19:39 pcn: greg`: try installing emacs-live

19:39 Try it out w/o your current bindings. It's a riot.

19:41 danielszmulewicz: technomancy: what distro are you on?

19:41 justin_smith: does anyone have any leads on how I would best manipulate an svg with om? I have a rough understanding of how om works, but I wonder if there are any facilities I should know about or gotchas or whatever before jumping in

19:42 technomancy: danielszmulewicz: been on debian stable for a few years now

19:42 justin_smith: this would be an svg element inside a normal html page

19:42 danielszmulewicz: technomancy: that would be apt-get, right?

19:42 technomancy: yeah

19:43 danielszmulewicz: justin_smith: om and svg manipulation are orthogonal, as far as I can tell

19:44 justin_smith: so if the thing I create in an om tree is an svg, it should just work?

19:44 or do you mean om can't do anything with svg? (which would be sad, because svg is xml)

19:45 danielszmulewicz: justin_smith: om and react expose only part of html5.

19:45 justin_smith: https://github.com/swannodette/om/blob/a3bdabf56e90d00da97d353850df7d545fa86730/src/om/dom.clj svg tag is defined here, and used to define a macro

19:45 hmm

19:46 that makes it look like om.dom/svg om.dom/rect etc. should work I guess

19:46 shoepie: anyone using secretary for routing with om?

19:47 danielszmulewicz: shoepie: I've used secretary before, I plan to use in an om project.

19:47 justin_smith: yeah, it looks like it will work.

19:47 shoepie: danielszmulewicz: i'm trying to use 1.0.0 and can't seem get defroute to work

19:48 johnwalker: justin_smith: there's an example of svg manipulation with reagant, so it's probably also possible with om

19:48 danielszmulewicz: shoepie: there's examples out there. Search for the gists.

19:49 justin_smith: danielszmulewicz johnwalker: thanks for the tips

19:49 shoepie: danielszmulewicz: there's one on their github page now. I just get a "Cannot call method 'call' of undefined" when calling defroute.

19:52 danielszmulewicz: shoepie: That's a very general Clojurescript compilation error. Try with a minimal example (that you can copy from the documentation).

19:58 technomancy: Did you get your ergodox keyboard from Massdrop?

19:59 technomancy: danielszmulewicz: yeah, from the august batch.

19:59 which arrived in december =\

20:00 danielszmulewicz: :-) It's not available anymore. And the sweet atreus, where did you get that?

20:00 technomancy: that little thing?

20:00 danielszmulewicz: yeah

20:00 technomancy: made it myself =)

20:00 danielszmulewicz: Oh, cool!

20:01 technomancy: ordered the parts from digikey and signature plastics and got the case laser cut at a local hack space

20:01 danielszmulewicz: So you're a champ at soldering now?

20:01 brehaut: next step: bamboo

20:01 ± material depth

20:02 technomancy: danielszmulewicz: heh... well I still made a bunch of silly goofs

20:02 it turns out when you turn a board over, left becomes right, and right becomes left

20:02 danielszmulewicz: :-)

20:02 technomancy: this fact is difficult for me to grasp still

20:03 hope to post on my blog about it in more detail

20:03 danielszmulewicz: Yes! I love those posts.

20:03 technomancy: posted my progress here as I was going: http://geekhack.org/index.php?topic=54759.0

20:05 danielszmulewicz: Cool. Thanks!

20:09 dacc: ergodox looks a bit like a kinesis keyboard

20:10 technomancy: dacc: there are a lot of similarities

20:11 * dacc has a DataHand at home he needs to get off his butt and learn.

20:11 technomancy: it's cheaper, more portable, and has hackable firmware, but it doesn't have the finger bowl things

20:11 dacc: separating the hands is huge -- even been thinking about cutting one of my kinesis keyboards in half

20:11 technomancy: oh, also I think the kinesis advantage is only available with brown switches, which I really don't like

20:12 dacc: ah hrm

20:12 * dacc tries to remember what they looked like last time he cleaned.

20:12 dacc: problem with the DataHand is switching to the mouse becomes worst, so need to try and eliminate it entirely

20:13 technomancy: eh; I've been doing that for years =)

20:14 dacc: yeah, should probably switch from jetbrains IDEs to emacs i guess =)

20:14 there's always like %20 that can't be done with keyboard

20:15 dsrx: is there?

20:15 technomancy: need a flexible browser too

20:15 ivan: kinesis advantage is also available with Cherry Red

20:16 dacc: dsrx: in my experience, yes. usually comes up navigating the tool windows, and the are also outright bugs in some of the UI widget shortcuts

20:16 technomancy: do you use vimperator?

20:16 dsrx: oh, in an IDE for sure

20:16 technomancy: ivan: cool; didn't realize that. still not my favourite, but good to have options.

20:16 dacc: no, conkeror

20:16 which IIRC inspired vimperator

20:17 dacc: ah cool, haven't seen this yet

20:17 locks: I used vimperator a lot in days before Firefox v3000

20:18 but then firefox started going downhill

20:19 technomancy: huh... I stopped using conkeror a while because gecko fell behind for a while

20:19 danielszmulewicz: technomancy: you type in Dvorak without changing the layout of the keyboard?

20:19 technomancy: but since the tracing jit landed it's been comparable

20:19 danielszmulewicz: yeah

20:20 danielszmulewicz: well, the punctuation moves on the ergodox and atreus

20:20 I have the firmware sending qwerty for alphanumerics and translate in software

20:20 so I don't have to change the layout when I switch to my internal keyboard

20:20 danielszmulewicz: technomancy: so you have a mental map translating between physical keys and dvorak layout?

20:21 technomancy: not sure what you're asking

20:21 johnwalker: theres also pentadactyl, which i like a bit more than vimperator

20:21 qbg: You just touch type

20:23 technomancy: if I have a mental map anywhere, it's below the level of consciousness at this point

20:23 qbg: muscle memory ftw

20:24 danielszmulewicz: technomancy: I'm trying to understand myself. The keys are not in the same place between qwerty and Dvorak. So if you don't change the physical layout, when you type q, you get ' (if I understand correctly).

20:24 qbg: The OS will handle that

20:25 danielszmulewicz: I mean you look at a key that says 'q' but that will type '''

20:25 amalloy: danielszmulewicz: sure, of course. who looks at keys?

20:25 danielszmulewicz: I do!

20:25 qbg: Learning Dvorak without rearranging is a great way to learn how to touch type :)

20:25 Worked for me back in the day

20:25 technomancy: danielszmulewicz: ah sure. I hit a key in the Q position, the firmware reads it as a Q, the OS receives it and translates it into ' because I have dvorak selected as the layout in software

20:25 danielszmulewicz: I never understood how people manage that. It bothers the hell out of me.

20:26 technomancy: except my keys aren't labeled to begin with

20:26 amalloy: danielszmulewicz: i have my keyboard in a position where i can't see the keys at all during ordinary typing

20:26 danielszmulewicz: technomancy: Ah, so that's the secret!

20:26 it's such a cognitive dissonance otherwise

20:26 technomancy: no, not really

20:26 amalloy: nah

20:26 ticking_: technomancy: what kind of laptop are you using? have you considered making a snap on version of your keyboard^^?

20:27 technomancy: I typed dvorak on a qwerty-labeled board for years

20:27 amalloy: i didn't relabel when i was trying dvorak, back in the day, but i only stuck with it for a week or so

20:27 i swap ! for 1, @ for 2, and so on, whether it's on keys i can see or not

20:27 technomancy: if you want to type fast you can't look at the keys anyway

20:27 regardless of layout

20:27 bob2: I just irc'd until I could touchtype

20:27 technomancy: ticking_: unfortunately the switches on their own are almost as thick as the laptop itself

20:27 danielszmulewicz: I don't type fast. Granted.

20:27 amalloy: well, that's not really true. you can type just as fast while looking at the keys, but it's harder to error-correct because you can't see what you've typed

20:28 qbg: Now you just need to learn one handed dvorak

20:28 technomancy: ticking_: it would require a completely custom laptop case

20:28 which I would love to do, but it's a bit beyond me at the moment =)

20:28 danielszmulewicz: I type on azerty, and can't even manage a qwerty!

20:28 ticking_: technomancy: yeah I didn't expect the laptop lid to be closable with it, but it would allow you to still use the laptop on your laps ^^

20:29 amalloy: danielszmulewicz: that's probably harder, because things are almost the same. if they're totally different, you can build a separate set of muscle memory

20:29 technomancy: ticking_: at some point it becomes just a stand to hold the screen up

20:29 danielszmulewicz: amalloy: interesting point

20:29 technomancy: at which point you start googling for head-mounted displays

20:29 ticking_: technomancy: hrhr yeah, I bought a oculus rift for that purpose, the resolution just kills it though

20:30 technomancy: and considering rewriting xmonad to support free-panning based on the direction your head is facing, etc

20:30 ticking_: so resolution doesn't have to kill it if you can free-pan

20:30 ticking_: technomancy: even better, make the cursor movement based on your head position

20:30 technomancy: your retinas aren't very high resolution to begin with

20:30 well, mine don't get great res

20:30 ticking_: eh... glancing around needs to be low-impact

20:31 dacc: yeah, quick road to neck pain

20:31 technomancy: ticking_: I'm super interested in non-gaming applications of HMDs though

20:31 ticking_: technomancy: trust me, it feels like looking through a fly screen

20:31 * dacc hadn't even thought of that.

20:31 technomancy: dacc: why? you glance around tons in real life =)

20:31 danielszmulewicz: Also european languages have their special accented characters in the layout, and I got used to that.

20:31 dacc: technomancy: sure, but not in a repetetive way, that's the kicker

20:31 ticking_: danlarkin: just don't use them ;] my german colleagues have adapted to me only writing english or special character free german

20:32 technomancy: dacc: not sure about that. I glance from my external display to my internal one displaying IRC

20:32 danielszmulewicz: I should work on reformatting my brain.

20:32 ticking_: technomancy: the ideal would be iris tracking, so you just look at what you want to edit

20:32 dacc: technomancy: guess i'm just "special" dual monitors give me problems

20:32 technomancy: I mean, I think you need a bit more resolution than the current dev model occulus, but not dramatically more

20:32 aperiodic: you need dramatically more

20:33 right now you need letters to be like 1-2 degrees wide to read them

20:34 ticking_: btw speaking of keyboards, has anybody found a solution to completely circumventing the operating systems control of special keys?

20:34 danielszmulewicz: Another thing that beats me is why you need to type fast in the first place. My ideas come slower. Both in writing and in coding.

20:34 aperiodic: I remember someone saying that 4K panels in the rift would give you about 100DPI resolution in the lenses, which is the minimum I'd want before I ditch all my monitors and work in VR space

20:34 but I haven't double-checked that figure

20:34 ticking_: aperiodic: wow that would be nice

20:35 dacc: danielszmulewicz: the ideas can take a while to form, but at some point it seems like there's always an implementation grind that bottlenecks on character entry

20:35 technomancy: danielszmulewicz: that argument only makes sense if you can pipeline IO like a CPU

20:36 if you've figured out a way to do that let me know =)

20:37 danielszmulewicz: technomancy: I'm not sure I understand. My brain IO is slow, that's what I'm saying.

20:38 aperiodic: danielszmulewicz: the less time you spend typing, the more time you can spend thinking about what to type

20:38 eraserhd: Is there a non-short-circuiting `and' that I can pass to reduce?

20:38 ticking_: also most european keyboards are horrendous for typing code

20:39 all the parenthesis are on the number keys

20:39 danielszmulewicz: aperiodic: But that's what I'm saying. I think 90% of the time, and I type 10% time.

20:39 ticking: that's true.

20:39 amalloy: eraserhd: you want ##(doc every?)

20:39 lazybot: ⇒ "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

20:40 amalloy: which does short-circuit, of course, but isn't a macro; that's the real difference you meant

20:40 ticking_: danielszmulewicz: so you have to look down when typing, which I'm pretty sure results in a boundary effect http://newsfeed.time.com/2011/11/21/the-boundary-effect-entering-a-new-room-makes-you-forget-things/

20:40 eraserhd: amalloy: Ah, right.

20:40 xuser: ticking_: I think is more that code, keybindings etcc have grow together more with english than with other langs

20:41 ticking_: xuser: but that's a language problem not a keyboard layout one ^^

20:42 eraserhd: amalloy: Thanks

20:42 systemfault: I personally use two different layouts (but similar,US or Canadian French) depending if I code or write french :/

20:42 ticking_: systemfault: why not go full coding layout then ^^?

20:43 systemfault: ticking_: brackets are better placed on a US layout.... and for french, I need access to éàèêçï

20:43 danielszmulewicz: I don't know. The thing is I write in three natural languages and I code, and I've used the same layout since childhood. systemfault: on a Canadian french layout?

20:44 systemfault: Fortunately, they're both qwerty layouts

20:44 danielszmulewicz: Canadian french layout is qwerty?

20:44 systemfault: Yeah, the canadian french layout is qwerty with dead keys for most accented letters.

20:45 ticking_: systemfault: ah I see ^^, yeah I ditched querty all together and spend a week building my own layout

20:45 danielszmulewicz: systemfault: Now I envy you.

20:45 ticking_: technomancy: btw which keyboard layout are you using?

20:45 systemfault: ticking_: Cool

20:46 danielszmulewicz: Plus I have an overlay for hebrew characters.

20:47 ticking_: systemfault: yeah, but trust me you will hate every OS person on the planet after that experience, it is unbelievable how horribly inflexible keyboard input encoding is

20:47 and buggy

20:47 systemfault: danielszmulewicz: Hmm, why the overlay? (You're still learning how to type it on the keyboard?)

20:47 danielszmulewicz: Because I don't touch type. I need to see the letters.

20:48 ticking_: danielszmulewicz: learn that then, It will be the best week spend in your life

20:48 danielszmulewicz: ticking_: Yeah, I might do just that. Maybe it's time.

20:48 xuser: danielszmulewicz: don't you already know where they are by typing so much? ;)

20:49 danielszmulewicz: It's a psychological thing. I don't look down. Only once in a while, and if don't see them, I get confused.

20:50 technomancy: ticking_: dvorak, but with punctuation in weird places

20:50 ticking_: technomancy: yeah I build one on workman with punctuation in weird places ^^

20:51 technomancy: do you press your modifiers with your thumb?

20:54 danielszmulewicz: I think the problem comes from having a set of languages that I need to write in, and some less frequently than others. So it's difficult to memorize all of the keys and accents placements.

20:56 technomancy: ticking_: not on conventional keyboards, but I do on the atreus and ergodox. I love thumb modifiers.

20:57 ticking_: technomancy: pretty cool

20:59 technomancy: yeah, wasting two thumbs on the space bar is a pretty atrocious design mistake.

21:00 ticking_: technomancy: this a thousand times this

21:03 technomancy: although I think that not having to use the thumb at all might be preferrable sometimes

21:04 akurilin2: Hey guys, quick question: is there a pattern out there for clojure web apps that want to template some mostly-static resources? E.g. I have an app.js file which right now is returned by Compojure route/resources, but I want to pass that file through Selmer first to plug in a couple of values.

21:04 ticking_: there is simply too much distance between it and the tip of my finger

21:04 akurilin2: Do you basically list a set of files in your application that will need substitution and handle them separately from route/resources in your own handler?

21:05 technomancy: so weird to read about the new thinkpad keyboard, and they decided to split the caps lock key in two for some reason

21:05 akurilin2: (I guess I could add middleware for just that set of files actually)

21:05 technomancy: really? of all the keys you could split, you put a home and end where caps lock is?

21:05 ticking_: technomancy: link?

21:06 akurilin2: technomancy: so true about the thumbs

21:06 such wonderful fingers.

21:06 ticking_: ah I found it, wow that is truly weird

21:09 TravisD: That is pretty strange, but I do think capslock is kind of a useless function - makes sense to put other things there

21:15 technomancy: TravisD: everyone I know puts something else there already

21:15 TravisD: not me :(

21:15 technomancy: it's just that splitting it in two makes it a bit harder to hit while touch-typing

21:15 for folks that use it for ctl

21:15 TravisD: yeah, and I guess if you have two keys there, the one that is further left is getting very far away from your usual finger placement

21:46 It's very cute how the seesaw tutorial gets you to build a documentation inspector for the seesaw library

21:58 akurilin2: So I just spent 45 minutes trying to figure out what kind of magic weavejester put into route/resources in Compojure to have it be picked up correctly by nginx and gzipped, since my own custom middleware was not getting gzipped no matter what I did. Turns out I mispelled the content type, lol.

22:11 ryantm: Is there a way to see which libraries are most popular on Clojars?

22:14 amalloy: ryantm: http://www.clojuresphere.com/, but it's a year out of date

22:17 akurilin2: Quick question: is there something specific I have to do to make ring's file-response work correctly in an uberjar scenario when fetching static resources?

22:18 Looks like (file-response "foo.js" {:root "resources/public"}) will work fine through lein ring, but will fail in uberjar mode.

22:22 Ah, file-response will only work for real files.

22:22 In uberjar you want JarURLInputStream

22:23 apparently resource-response will take care of selecting the right option for you

22:26 Also the former is classpath unaware.

22:28 ticking_: god damit who the heck designed javascript

22:29 aperiodic: a poverty of time did

22:29 ticking_: yeah but they keep fucking up even in the extensions

22:29 systemfault: Some crazy guy who used to work for netscape... did it in 10 days though

22:29 * voldyman wants to participate in gsoc (clojure) but is getting performance anxiety

22:30 ticking_: when creating a websocket, you supply the url to connect to in the constructor, but error handling is done with callbacks that have to be set after the object has been created

22:30 voldyman: ticking_: i don't think the object starts connecting to the server as soon as its created

22:31 ticking_: voldyman: I'm sure you can write https://github.com/mschuene he did espresso as part of gsoc and is a colleague of mine

22:31 voldyman: so he might be able to help you with some fears

22:32 voldyman: thanks a lot ticking_ !

22:32 ticking_: voldyman: so when do you think it connects?

22:32 I looked for documentation on the exact behaviour but found none

22:34 voldyman: ticking_: it has onopen function also, that mean it doesn't connect rightaway

22:35 ticking_: voldyman: I guessed that they wanted you to create a custom prototype

22:35 voldyman: there is a very small list of project ideas

22:36 the only thing i could make is quil port to cljs

22:36 ticking_: voldyman: man do that please

22:36 that would be so rad

22:37 quil is nice in theory but sucks monkeyballs in practice

22:37 the implementation is buggy as hell

22:37 aperiodic: voldyman: don't port quil, make a new quil with better semantics

22:37 voldyman: yup, processing.js is amazing but you still have to write processing code

22:38 aperiodic: not my choice http://dev.clojure.org/display/community/Project+Ideas#ProjectIdeas-QuilonClojureScript

22:38 ticking_: yeah the semantics could definately be made better

22:38 amalloy: yeah, i think websocket does start connecting as soon as you construct the object

22:40 voldyman: oh, crap. late for college.

22:40 amalloy: i dunno what happens if it successfully connects before you manage to set the onopen callback. probably it just calls the callback immediately once you set it

22:41 ticking_: amalloy: really? I wouldn't expect any kind of event queue but instead the event to get lost

22:42 voldyman: since websocket creation is async, the object would be assigned the handlers before the connection is compelete

22:42 amalloy: right, silly me. voldyman is right, as http://stackoverflow.com/questions/8393092/javascript-websockets-control-initial-connection-when-does-onopen-get-bound points out

22:43 ticking_: amalloy: oh wow thanks, I don't know why I din't find that

22:43 amalloy: first result for "javascript websocket onopen" :P

22:43 ticking_: wtf

22:43 I should not code at 5AM

22:45 amalloy: thanks a lot :D

22:48 stcredzero: So, if I feel like I know what I'm doing, can I get away with really lightweight side-effects inside a function that you send to pmap?

22:52 ticking_: stcredzero: "most of the yes time"

22:53 stcredzero: That's what I thought, but I was just wanting to ask. What I have in mind is firing off a swap! to save some calculations on the side which will be used right after the pmap is done.

22:56 ticking_: stcredzero: do you need the output of the pmap? or do you just use it to parallelize some task?

22:56 and the thing that gets swapped is the real result?

22:56 quizdr: am i correct that a function cannot interact with a lexical variable from the environment in which it is called; that instead, a macro is required, for deliberate variable capture?

22:57 amalloy: quizdr: well yes. but you could also just pass that value as an argument to the function

22:57 of course

22:57 quizdr: or, alternately, use a global variable rather than a lexical variable, which the function can always access, yeah?

22:57 ticking_: quizdr amalloy: would't that be dynamic binding which clojure has?

22:57 dsrx: you could use a dynamically bound variable

22:58 stcredzero: ticking_: no the thing that gets swapped is not the real result, but it's input to the "next" stage of the game loop.

22:58 ticking_: stcredzero: ah too bad, otherwise you could have used a reducer

22:59 quizdr: not sure a dynamically bound variable would be necessary if you just use a normal global variable (which is not dynamic by default) and reference that in the function directly

22:59 stcredzero: ticking_: It's part of a game loop using pmap to get multi-core concurrency. Basically, I'm storing all of the calcs that can't be done concurrently so that they can be done in a "clean-up" step right after the pmap.

22:59 amalloy: reduce is still fine there. you can reduce over a pair of [(things you could have swap!ed into a side-channel), (list of output values)]

23:00 oh, but that can't be multithreaded. i see

23:00 ticking_: amalloy: reducers?

23:00 you could probably use reducers for that

23:00 amalloy: proooobably

23:00 but just using an atom is probably easier

23:01 ticking_: yes

23:01 stcredzero: reducers are very interesting however. Thanks.

23:16 quizdr: if I have a keyword and I want the item bound to the symbol that is the keyword minus the colon, is this the best way? (eval (symbol (name :k)))

23:18 ambrosebs: quizdr: that discards the namespace, you might want (str :k).

23:19 quizdr: oh, you probably want `resolve`.

23:19 ,resolve

23:19 clojurebot: #<core$resolve clojure.core$resolve@1cab2af>

23:19 quizdr: i would still need eval though, right?

23:19 ambrosebs: ,(doc resolve)

23:19 clojurebot: "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"

23:19 ambrosebs: quizdr: no, resolve does want you want.

23:20 quizdr: resolve just returns the fully qualified name of the symbol, not the data bound to that symbol

23:20 ambrosebs: ,(resolve (symbol (str :+))

23:20 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

23:20 ambrosebs: ,(resolve (symbol (str :+)))

23:20 clojurebot: nil

23:20 ambrosebs: resolve gives you a var, just deref it

23:21 quizdr: ah

23:21 awalker: ,(resolve (symbol (name :+)))

23:21 clojurebot: #'clojure.core/+

23:21 quizdr: so like this: @(resolve (symbol (name :k)))

23:22 bob2: any time you think you need eval, you've probably missed a clojure feature

23:22 ambrosebs: ,(resolve (symbol (namespace :clojure.core/+) (name :clojure.core/+)))

23:22 clojurebot: #'clojure.core/+

23:22 bob2: unless you're writing a repl etc

23:22 quizdr: agreed bob2 hence why i asked

23:23 i have also seen, and used, the case where a function returns a code list (such as using a backquote) and then you eval that, rather than make the function itself a macro

23:23 bob2: sounds like it'd be better as a macro

23:24 since there's no reason to wait to runtime to resolve that

23:24 quizdr: except that macros cannot be passed so easily to map, etc.

23:25 you could build up a list of stuff to evaluate using just functions, not macros, then eval them all together, rather than calling a bunch of individual macros

23:26 i've only seen this used when you have a program that is doing considerable code-generation to setup an environment

23:47 if i want to make sure two items are not both simultaneously nil, is this long-winded line really the most concise way to do it? (assert (and (not (= ins nil)) (not (= kdefaults nil))))

23:49 (should be or, not and ^^)

23:50 ambrosebs: ,(not ((every-pred nil?) nil nil))

23:50 clojurebot: false

23:50 ambrosebs: ,(not ((every-pred nil?) nil 1))

23:50 clojurebot: true

23:50 quizdr: ,(doc every-pred)

23:50 clojurebot: "([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical false result against the original predicates."

23:51 quizdr: awesome ambrosebs. man little functions just keep coming out of the woodwork. i guess the only way is to just memorize the Clojure API !

Logging service provided by n01se.net