#clojure log - Nov 17 2012

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

0:00 TimMc: I don't know if that's the case.

0:00 mholmqvist: amalloy: yes I had to bind *print-dup*

0:00 TimMc: mholmqvist: For clarity, what happens if you pr-str the record with *print-dup* false?

0:00 mholmqvist: TimMc: I get "#MyRecord{:timestamp #<DateTime 2012-11-17T04:47:14.25}"

0:01 TimMc: (What happened to the ">"?)

0:01 amalloy: ^ that's not usable

0:02 amalloy: mholmqvist: what's *clojure-version*?

0:02 mholmqvist: TimMc: the > should be there. :)

0:02 amalloy: TimMc: i misunderstood what he was saying. it sounded like he fixed it by *nod* using print-dup

0:03 mholmqvist: amalloy: {:major 1, :minor 4, :incremental 0, :qualifier nil}

0:03 amalloy: i thought one of 1.4's "big features" was that jodatime things were supposed to print as #inst literals?

0:03 TimMc: Yeah, that's bugging me.

0:05 mholmqvist: amalloy: well, doesn't look like it...

0:05 thanks anyway guys

0:05 TimMc: mholmqvist: Check if #inst reader literals read properly in your environment.

0:05 mholmqvist: at least got it working using the rubbish

0:05 TimMc: yeah regular dates seem to work fine

0:06 I get #inst

0:06 TimMc: Oh, interesting.

0:06 amalloy: but i bet they read as Date objects, not as jodatime objects

0:06 mholmqvist: amalloy: exactly

0:07 amalloy: so clojure.core thinks you don't have joda on your classpath

0:08 mholmqvist: amalloy: hmm. do I need to set that up someway special for this?

0:09 i mean it IS on the classpath

0:11 gotta go, but thanks for now!

0:11 at least I get move forward now...

0:14 amalloy: maybe rich decided not to auto-detect jodatime after all? i can't see it in the source anywhere

1:13 Sgeo: ,(map identity {:a 1 :b 2})

1:13 clojurebot: ([:a 1] [:b 2])

1:14 Sgeo: Blah, if I wanted a hash-map from that I could just throw that into (into {}) I guess

1:15 arrdem: incanter is off of contrib, amirite?

1:16 yep.

1:18 amalloy: Sgeo: (map identity x) is the same as (sequence x)

1:19 Sgeo: amalloy, I just wanted to see that the result would look like what I was expecting. I wanted a function that would take a function that would (take a key and value and return a new value) and take that and make that the "new" value for that key

1:19 I think what I want could be described as

1:19 (comp (partial into {}) map)

1:20 amalloy: yeah. i love into/for, peronally; i don't use into/map nearly as much

1:56 alex_baranosky: anyone used VoltDB from Clojure? (or from Java or any other language for that matter?)

4:13 Sgeo: Is reduce a thing to avoid writing except when needed in favor of other functions, the way recursion is, or is it fully acceptable and idiomatic to use it where, in an imperative language, I might use a loop?

4:13 Because one of the things I want to do, I could only think of in imperative terms until I remembered reduce, but still trying to mentally work out if there's a better way

4:17 thorwil: Sgeo: if reduce makes for a concise solution, use it

4:20 * Sgeo needs to make a mental note to use reduce and assoc-i

4:20 Sgeo: assoc-in

7:36 Licenser: asd

7:36 oops

9:32 Sgeo: ,`(.foobar)

9:32 clojurebot: (.foobar)

9:32 Sgeo: I guess I should smile at that

9:32 ,`(baz .foobar)

9:32 clojurebot: (sandbox/baz .foobar)

9:32 Sgeo: hrm.

9:52 tufflax: What does ANN mean on the mailing list?

9:52 or google group, whatever :p

9:52 tmciver: announcement

9:53 xeqi: Announcement

9:53 tufflax: ah, ok. thanks

11:10 ForSpareParts: I'm using localrepo for a couple of dependencies, and my project checks for them online every time it starts. Can I prevent that?

11:12 xeqi: ForSpareParts: are they looking for a .pom?

11:12 ForSpareParts: Let me check.

11:28 xeqi, it looks like it's looking for a pom, yeah. In addition to some Maven metadata.

11:29 Sorry for disappearing, I've been on the train and my connection is spotty.

11:29 xeqi: I don't think localrepo makes a pom, if you add one it should stop going out to look for it

11:29 np, the conj wifi isn't perfect either

11:30 ForSpareParts: ^ + also make sure you didn't add them as a -SNAPSHOT version

11:32 ForSpareParts: xeqi, where would I put it? In the repo?

11:34 xeqi: yeah, same file name as the .jar, just .pom instead

11:34 it should look something like http://www.sonatype.com/books/mvnex-book/reference/simple-project-sect-pom.html

11:34 but without the dependencies section

11:35 and with the right data based on group, artifactname, etc

11:38 ForSpareParts: Thanks!

12:52 jodaro: hrm

13:54 solussd: if I have a datastructure like this: {:a {:id 3 :b {:c {:id 8} :id 6}}}, what would be the beist way to get the keypath to the map containing :id => 8 (e.g. [:a :b :c])?

13:55 uvtc: ,(get-in {:a {:id 3 :b {:c {:id 8} :id 6}}} [:a :b :c :id])

13:55 clojurebot: 8

13:55 ChongLi: I don't think that's what he's looking for

13:55 uvtc: Oh, whoops.

13:56 ChongLi: I think he wants a function that, given 8, searches the tree for {:id 8}

13:56 or something

13:56 solussd: yeah, I know how to get the value after I know the keypath, I want to do the reverse. :)

13:57 metellus: $findfn {:a {:id 3 :b {:c {:id 8} :id 6}}} 8 [:a :b :c]

13:57 I doubt that will find anything

13:57 lazybot: []

13:58 ChongLi: $findfn {:a {:id 3 :b {:c {:id 8} :id 6}}} 8 [:a :b :c :id]

13:58 lazybot: []

13:58 ChongLi: hmm

13:59 solussd: wow, findfn is crazy

13:59 uvtc: solussd: maybe something involving `clojure.walk`.

14:00 solussd: uvtc: yeah, but that just seems too meta for this problem. :)

14:02 .. and I cant think of a way to do it without side effects along the way (e.g. keeping track of where I am in an atom or something each step along the way)

14:02 ChongLi: you're talking about back-tracking

14:02 solussd: there we go

14:02 metellus: recursively search and build the path as you come back out

14:03 ChongLi: I think doing some stream stuff might work

14:03 how about transforming the tree into a lazy seq of pairs

14:03 the pairs being keypaths and values

14:03 and then finding the first value, returning its corresponding keypath

14:03 solussd: that would work, then when I find it (in a loop) I can see where I've come from

14:05 except, of course, it can have "branches": {:a {:id 3 :b {:id 4} :c {:id 5 :d {:id 6 :e {:id 7} :f {:id 8}}}}}

14:06 ChongLi: sure, but the contents of any tree can be represented in a linear structure

14:10 TimMc: You want breadth-first or depth-first?

14:10 ChongLi: what is easier?

14:11 I don't think it matters in this case, but I don't know if his trees will be wide or dep

14:11 deep

14:14 solussd: they're more likely to be wide

14:15 Luyt: http://wiki.theory.org/YourLanguageSucks , but not Clojure ;-)

14:18 uvtc: Raynes: refheap down?

14:24 Raynes: uvtc: Really? Of all the god awful times.

14:24 It's not like I'm in a hospital with my mom or anything.

14:28 Ugh. If this keeps happening, I'm going to have to add some real logging. I can't get heroku logs far enough back to find out what happened

14:28 I don't think...

14:28 technomancy: Is there a way to snatch Heroku logs from `heroku logs` and download them for like the last day?

14:29 solussd: Raynes: try the -n option for up to 1500 lines of logs

14:29 ekoontz: Rayes best wishes to your mom

14:29 Raynes: That might do the trick.

14:29 ekoontz: sorry Raynes

14:29 solussd: e.g. heroku logs -n 1500

14:29 Raynes: ekoontz: Thanks. Latest news was relatively good.

14:29 Hence my ability to stand here and type without shaking too hard to type. ;)

14:30 jacobsen: Hi all, can anyone suggest the best (most idiomatic, preferably) way to intercept single keystrokes on the command line (i.e., rather than reading whole lines) in a clojure app?

14:30 Raynes: You're going to want to use .read instead of read-line or .readLine

14:33 jacobsen: Thanks Raynes - and good luck w/ your mom.

14:33 Raynes: Thanks.

14:33 uvtc: Should be back up or coming back up.

14:35 ambrosebs: Raynes: glad to hear

14:37 uvtc: Raynes: yup, tnaks

14:37 thanks

14:59 Sgeo: Is there a version of clojure.set/project that doesn't deal with relations in general but just associatives? I mean, I could do it myself by putting the argument into a vector and calling first on the result, or something, but I think there should be a simpler way

15:03 Oh, select-keys is in clojure.core

16:23 firefux: Hi, are the books of Clojure for someone new to functional programming?

16:26 solussd: Clojure Programming (Orielly) is a good place to start if you're familar with more mainstream languages

16:26 ChongLi: solussd: did you solve your problem?

16:27 solussd: ChongLi: just getting back to it.. going the seq route, but haven't figured it out yet.

16:27 firefux: solussd: I'll check it out

16:27 ChongLi: it's pretty complex

16:27 tree recursion always confuses me

16:28 solussd: me too. :)

16:28 maybe a zipper is the way to go

16:28 ChongLi: a zipper is for navigating a structure

16:28 one step at a time

16:28 and then making edits

16:29 for example, a GUI application for browsing and editing a DOM tree

16:30 it has stuff like "up, down, left, right"

16:30 for doing that

16:31 so it'd be more suitable for the backtracking approach

16:35 mpenet: Does anyone know what is the equivalent of clojure.lang.Sequential in cljs? To be used with extend-protocol, it seems I can only do it the other way around (using extend-type and cljs.core.ISequential) ?

16:35 alexyk: how, from a running nrepl, can I learn the port used?

16:36 ChongLi: check the buffer *Process List*

16:36 ?

16:36 or do you mean at the repl?

16:37 alexyk: yep

16:37 solussd: ChongLi: yeah, I used a zipper effectively in production a couple of times.. :) pretty cool, I think

16:38 Hodapp: Hrmph. What's a typical stack depth that will make things explode?

16:38 I'm deciding whether to use a trampoline and make up my own sort of stack for just what I need, or just recurse directly.

16:43 TimMc: ,((fn r [x] (when (< x 2000) (r (inc x)))) 0)

16:43 clojurebot: nil

16:43 TimMc: ,((fn r [x] (when (< x 20000) (r (inc x)))) 0)

16:43 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>

16:43 TimMc: ,((fn r [x] (when (< x 10000) (r (inc x)))) 0)

16:43 clojurebot: nil

16:43 TimMc: ,((fn r [x] (when (< x 16000) (r (inc x)))) 0)

16:43 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>

16:44 TimMc: Hodapp: Somewhere around 13k in this case?

16:44 Hodapp: alrighty

16:45 TimMc: Same range on my server laptop -- 10k - 16k.

16:45 I suppose it depends on how your JVM is started, though.

16:48 ,((fn r [x _ _ _ _] (when (< x 10000) (r (inc x) 0 0 0 0))) 0 0 0 0 0)

16:48 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>

16:48 TimMc: ,((fn r [x _ _ _ _] (when (< x 8000) (r (inc x) 0 0 0 0))) 0 0 0 0 0)

16:48 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>

16:48 TimMc: ,((fn r [x _ _ _ _] (when (< x 5000) (r (inc x) 0 0 0 0))) 0 0 0 0 0)

16:48 clojurebot: nil

16:48 TimMc: Hodapp: ^ Depends on how big your stack frames are too. :-)

16:50 Hodapp: TimMc: ah, yes, true too :)

16:59 clizzin: anyone here have experience with crossover clojure/clojurescript code using lein-cljsbuild?

17:11 abp: hell-o

17:12 zodiak: heaven-o

17:13 abp: Is there any way to bind qualified symbols in a macro?

17:22 TimMc: Bind?

17:24 Can you give an example of input and output?

17:32 yedi: are there any sites similar to disclojure?

17:33 anyone know of any*

17:35 Urthwhyte: there's the weekly http://reborg.tumblr.com/post/35055123582/clojure-weekly-nov-5-2012 newsletter

17:37 yedi: sweet

17:40 ChongLi: hmm

17:40 if I edit 2 different files (in 2 separate instances of emacs) and use nrepl-jack-in on both

17:40 one of them has colorized stacktraces whereas the other does not

17:40 I can't figure out why!

17:42 Urthwhyte: yedi: you might also try fogus' blog and following the #clojure tag on Twitter. I find lots of interesting things through there

17:44 yedi: word, good looks

17:44 ChongLi: anyone have any ideas?

17:47 ahhh, hmm

17:48 if I move the file out of its project directory and just edit it on its own

17:48 it works

17:48 so it must be an old version of one of the deps or something

17:49 Mr_Bond: anyone running Clojure on raspberryPi ?

17:49 abp: TimMc: Sorry, didn't recognize the timeout or whatever that was. I think I know how to do what I want. I can replace all occurences of a qualified symbol with a gensym.

17:49 TimMc: Will show when done

17:50 ChongLi: hmm, it's not the clojure version

18:08 yedi: Any sufficiently complicated Clojure (or Lisp) program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Haskell.

18:08 - some guy on the internet

18:08 Hodapp: yedi: Have you seen the origin of that quote?

18:08 yedi: don't believe so

18:09 Hodapp: https://en.wikipedia.org/wiki/Greenspun's_tenth_rule

18:09 amalloy: hah. repeating the derivative in a lisp room without knowing the original is nicely ironic

18:11 yedi: i wanted you guys to help me understand what the guy who said that was getting at

18:20 seangrove: Hey all, with clojurescript, when compiling and runnig it in the browser with no optimizations (just whitespace), it seems to run fine.

18:20 But with even with simple optimizations turned on, I get "Namespace "goog.debug.Error" already declared."

18:21 Looking at the generated Javascript, it looks like the goog.debug.Error namesapce is actually provided 3 times, with big repeating sections

18:21 Anyway, wondering if anyone's come across this and knows what I've mixed up to get repeating javascript

18:22 abp: Hodapp: yedi: http://s-expressions.com/

18:22 second post "Any sufficiently complicated Clojure (or Lisp) program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Haskell."

18:23 cmeiklejohn: seangrove: can you gist your project.clj?

18:24 seangrove: cmeiklejohn: Definitely, one moment...

18:24 https://gist.github.com/0c462cf39fce5b6e970c

18:24 I've just tried it with advanced optimizations and it seems to work locally, pushing it to production to test

18:25 Wondering if for every namespace I require some library all the dependencies get included all over again

18:26 alexyk: anybody using La Clojure?

18:27 abp: alexyk: Eclipse isn't pretty but counterclockwise (the clojure plugin) is worth it.

18:27 Hodapp: Counterclockwise is way too buggy for me.

18:27 amalloy: if you don't already love eclipse, why would you choose ccw over emacs?

18:27 alexyk: abp: couldn't care less about Eclipse, am using IDEA for Scala very well. La Clojure seems fine, just don't know how to look up definitions by names

18:28 tried Sublime Text and Aquamacs too

18:28 Hodapp: amalloy: I learned Emacs just because I wanted to use it for Clojure stuff. I haven't been disappointed.

18:28 amalloy: me too

18:28 abp: alexyk: So use Eclipse with counterclockwise and use it's proper autocompletion with docs etc.

18:28 Hodapp: this is after knowing and trying to use Eclipse and Vim.

18:29 alexyk: nice thing about nrepl is that I hope to be able to work from several different IDEs against the same JVM if I want to

18:29 abp: Hodapp: amalloy I will, but not now. Busy writing libs... :o Bad reason?

18:29 Hodapp: CCW just gave me all sorts of idiotic issues... the latest one was not worth it to try to diagnose, like the REPL giving me a NullPointerException for no reason that I could not find any information about.

18:29 amalloy: how dare you, abp? being productive instead of fiddling with productivity settings?

18:30 abp: Hodapp: amalloy The setup is good now, not much to do, probably using paredit commands more.

18:33 amalloy: Main productivity is in my head anyways. Working on 30 lines of code for some hours now. I want something like prismatics graph. But with some custom tweaks, too.

18:33 Hodapp: I need to learn paredit.

18:33 the extent of my current knowledge is that I'm vaguely aware something called paredit exists.

18:34 abp: amalloy: First time writing macros after one and a half year of clojure.

18:34 Hodapp: I used some of it's commands but no muscle memory built. :(

18:35 Foxboron: New to Clojure, spent the whole day debugging a lambda, then i saw i had a set of () too much ._.

18:35 TimMc: Parentheses overkill is a pretty common mistake for beginners.

18:36 Foxboron: Did you have "((" anywhere in your code?

18:36 Foxboron: TimMc, no. Its was a set of paranthesises around the whole expression i did not see.

18:36 abp: Visual recognition accustomizing to ((((((()))))))

18:36 TimMc: Consecutive open parens are rare in beginner and intermediate functional programming.

18:38 Foxboron: But its fun really.

18:38 abp: Foxboron: Before it becomes pure joy, yes.

18:39 Urthwhyte: Hodapp: It only takes about ~20-30 minutes to learn the basics and it's a huge productivity boost

18:39 Hodapp: Urthwhyte: Is it just a mode in Emacs?

18:39 Urthwhyte: I use the vim plugin, can't speak to emacs

18:40 but it is much better supported there, I'm sure someone else in the channel can advise

18:50 Hodapp: Urthwhyte: just got it installed in a couple minutes; not understanding if I'm seeing all its features, but I can see how it might be useful

18:51 Urthwhyte: I would just do the emacs equivalent of `:help paredit` and print out the keybind section

18:51 Hodapp: I am looking at the mode help right now

18:51 that's the root of the 'not understanding if I'm seeing' etc.

18:52 Urthwhyte: ahh

18:52 It's relatively simple, keeps parens balanced automagically

18:52 Hodapp: oh, nevermind, somehow I missed like 9 pages of documentation

18:52 Urthwhyte: only remotely complex stuff is probably slurping and barfing

18:52 Hodapp: must have hit Ctrl Meta Shift End mouse-3 V by mistake instead of C-V, I do that all the time

18:53 Urthwhyte: hah

18:53 This is why I stick to modal editors ;)

18:53 Hodapp: <troll>vim has two modes, 'beep' and 'break everything'</troll>

18:54 Urthwhyte: http://www.gnu.org/fun/jokes/ed-msg.html

18:55 Hodapp: -rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs

18:55 bahahahahaha

18:55 -rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed

18:55 1929, that's a good touch :)

18:59 I really shouldn't knock 'ed'. I've never used it.

18:59 Urthwhyte: I have...once

18:59 It was not a pleasant experience

19:00 Hodapp: you just need to learn to use it!

19:01 Urthwhyte: One editor is enough for me

19:01 Hodapp: At work, I use: Emacs, Visual Studio *gag*, Eclipse, MATLAB's editor, vim, and sometimes notepad/notepad++

19:02 Foxboron: I use Sublime Text 2

19:02 and Light Table sometimes for the repl ^^

19:02 Hodapp: I should poke around at Light Table soon

19:02 Urthwhyte: I use vim exclusively, Eclipse@Google put me off ever using an IDE again

19:02 Foxboron: Hodapp, its actually quite fun for basic stuff :)

19:03 mattmoss: I position the disk platter according to the incoming gamma rays so that those rays flip the correct bits on the platter.

19:03 Hodapp: Foxboron: 'fun' is surprisingly underestimated for a lot of programming tasks

19:03 uvtc: jEdit recently got good Clojure support. See http://clojure-doc.org/articles/ecosystem/development_tools.html .

19:03 Foxboron: Hodapp, indeed. and watching how the variables evolve with the reple with blocks of code is quite interesting.

19:03 Hodapp: I was messing with Lively Kernel the other day - an implementation of the Morphic graphics model that Self and Smalltalk used for a GUI that you can do live-editing, live-inspection, live-everything on

19:04 that was actually kind of fun.

19:04 Foxboron: I just pray the end version of Light Table is great and got as great support for other languages

19:04 TimMc: Hodapp: paredit is more than just keeping parens balanced -- it's a decent implementation of "structural editing". You move entire forms around.

19:04 Hodapp: paredit-convolute-sexp is my favorite <3

19:05 Hodapp: sounds kinky.

19:05 TimMc: Very.

19:05 eis: Foxboron, how do you like Sublime Text? can you compare it to anything? I've been using emacs, but I can't say I'm quite happy

19:05 Hodapp: M-x happy-mode

19:05 geez

19:05 TimMc: Hodapp: If you have (let [x 5] (if foo x y)) and want to put the if around the let, that command lets you do it.

19:06 Urthwhyte: eis: It's a better Textmate with some very nice packages

19:06 eis: Hodapp, that would be real nice! I'd bind that to every key combination right away

19:07 Foxboron: eis, ummmm. I can't really compared it to anything as i am mostly a windows person and havent been that emerged with vim/emacs

19:07 I do however feel Sublime is a viable option for VIM users who want some GUI

19:07 as all keybinds are available in Sublime.

19:08 eis: Urthwhyte, I've seen people writing plugins, looks like it's quite extensible. Do you think it can be comparable to Emacs, in like power-ness?

19:08 Urthwhyte: Foxboron: The problem is it doesn't implement word objects quite properly IME

19:08 I had the same problem when trying viper mode in emacs; the subtle differences tripped me up

19:09 eis: I can't really speak to that one way or another since I'm not familiar at all with the extensions API. I use a completely stock copy and only pull it out when pairing with someone who doesn't know vi basics

19:12 eis: Urthwhyte, oh, it's been like that for me. Some time ago I read a post by a guy who I'd say is a quite advanced emacs user (like, his .emacs is huge, and he's written a lot of elisp code), and he wrote that he's considering a switch to Sublime

19:12 Hodapp: snazzy, I can wipe out an entire expression with one C-k!

19:13 Foxboron: eis, really. Just try Sublime Text 2

19:13 Urthwhyte: eis: I tend to keep a simple config for sake of portability. I was for a time really deep into customising my tooling and writing tons of automation and realised it wasn't really helping me as a developer, just a distraction from learning.

19:13 Foxboron: Get the Package manager, and check some plugins. If you are dependant on multiple views, Origami is your friends. SublimeREPL for REPL etc

19:14 eis: Foxboron, oh yeah, I've seen those. I tried to code in Scala with ENSIME and some Sublime plugin, but that didn't work out too well. What do you use for Clojure in Sublime?

19:15 Foxboron: eis, the standar Clojure support is actually kinda poor.

19:15 ivan: Emacs is worth using for org-mode for me

19:15 have you tried using #emacs to get happier about Emacs?

19:15 Foxboron: You got SublimeREPL to get a REPL up and running, and you can use it to evaluate stuff

19:15 eis: Urthwhyte, spot on! Sadly, unconfigure Emacs isn't much of an editor, at least for a novice like me

19:15 Foxboron: but more then that, its poor :P

19:15 Urthwhyte: Not really fair to compare tooling for clojure and scala :P

19:16 Scala is much closer to the Java school in terms of package naming and methods

19:17 eis: ivan, I'm kinda new to IRC. I might try the #emacs channel, despite the fear of being ridiculed by gurus :D

19:18 Hodapp: It took me a couple hours to earn two ignores in #emacs

19:18 ivan: there are also a bunch of screencasts on youtube that have shown me the things I wanted

19:18 antares_: eis: have no fear, IRC is full of nice people, not just dicks

19:19 Hodapp: well, I don't know how many ignores I earned, but I know that two people were vocal about it

19:19 Urthwhyte: ++antares_

19:19 eis: yeah, there's the emacsrocks.com IIRC, it's quite an awesome screencast

19:19 Hodapp: I've never had a single issue here though

19:20 Urthwhyte: This channel is great; has answered my queries time and time again

19:20 nicely, even

19:20 Hodapp: in #c++ on the other hand my experience has always been that to get my question answered I first have to spend 10 minutes smacking around the first asshole who tries to tell me my question just ain't worthy and I'm a dumbass for asking it... and then the channel pays attention.

19:21 eis: haha, wow. glad that I don't code in c++ :D

19:21 Urthwhyte: ##java is the worst by far IME

19:22 Hodapp: Urthwhyte: I fear you're right. I've spent some time there.

19:22 Urthwhyte: In both channels I've had all sorts of issues with them just not even wanting to give me the time of day until I had produced an almighty "test case".

19:22 as if conceptual knowledge is just something that is impossible

19:23 Urthwhyte: what sort of lovely issues have you had?

19:26 Urthwhyte: Just rudeness and a sense they were reluctant to answer questions. Not worth getting into specifics of it really. Editor wars are more fun than IRC channel pissing matches ;)

19:26 Hodapp: :P

19:27 Sounds about right. I just got really sick of the bunch of curmudgeony dicks that were there, and I've never seen anything close to that here

19:28 but since we're actually having an editor war

19:28 vim sucks.

19:29 Urthwhyte: It's too bad emacs doesn't have a decent text editor

19:29 it's a decent OS

19:30 Hodapp: I once was banned from a channel for saying that.

19:32 Urthwhyte: well, I have an actual Clojure question: https://gist.github.com/dd6d904fa86b9697c518 is there a more idiomatic way to write this?

19:33 Foxboron: wait

19:33 you guys complain about #c++ and ##java

19:33 seen #python?

19:33 where everyone believes THEY are right

19:33 and if you do anything even remotly "magic" or hacky, they flame you

19:33 and if you come and give them a comment, they flame you along with your hackey script.

19:33 its madness

19:37 Urthwhyte: It seems a huge mess to me atm. String interpolation would help a bit but the nested doruns and huge anonymous function could do with improvement

19:48 solussd: Urthwhyte: check out doseq, for one

19:49 Urthwhyte: ,(doc doseq)

19:49 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

19:56 solussd: Urthwhyte: marginally better I think: https://www.refheap.com/paste/0955ce736403a66c4a8754564

19:56 at least not forcing maps and holding on to the heads of the produced seqs

19:57 abp: Urthwhyte: https://gist.github.com/4102158

19:58 Urthwhyte: ah, that is much better. I've been somewhat consciously avoiding for and doseq due to a lack of comfort with them

19:58 solussd: or do what abp suggested and make it one write. :D

19:58 Urthwhyte: but it really does make everything much clearer; overreliance on map is a holdover from Ruby habits

19:59 Frozenlock: I see that that lein Noir (plugin) is deprecated. Is there something to replace it?

20:01 abp: Urthwhyte: Comfort comes with experience. Be patient and try things out. doseq etc. is rarely needed.

20:01 Bergle_1: lol, i see so many refernces to cool libs and tools.... sooo much to learn.

20:01 * Bergle_1 is a n00b to clojure, and havnt ben in java land for ooh 15+ years

20:01 abp: Bergle_1: :o way to long...

20:02 Bergle_1: bought Pragmatic programm Programming CLojure last week - about 1/2 way into it :)

20:02 abp: Bergle_1: I've survived around 4 years of java and can't take much more.

20:02 Bergle_1: ive been in .net / sql server / cold fusion / js land ;) heh

20:03 * Bergle_1 i wrote a java lib seriously last back in pre 1.0 days lol :)

20:03 Bergle_1: pre java 1.0 :")

20:03 Urthwhyte: Ruby/Python with a very brief stint in Java-land

20:03 but my career has yet to really begin, so not a fair comparison

20:03 abp: Bergle_1: Then read Clojure Programming, The Joy of Clojure and ClojureScript: Up and running too. :D

20:03 Bergle_1: finish this book first, then play some more, come with a project to muck with.

20:03 Foxboron: Like, i am a fulltime basher of Java, yet i learn Clojure

20:03 hmmm

20:04 Bergle_1: im pretty happy with the Programming Clojure book,

20:04 so far. :)

20:04 Urthwhyte: Joy of Clojure is next on my reading list (I've just finished with Programming Clojure)

20:04 Bergle_1: only one swear point wher ei chased my tail for an hour or so cause he didnt explain what a specific construct was - but found it online :)

20:04 abp: Bergle_1: I've spent to much time reading and trying libs, now all those things are in my head and i want to unify them.

20:04 Bergle_1: howd you find Programming Clojure Urthwhyte ? its one of the better books ive read on a languages so far.

20:05 Urthwhyte: a coworker's recommendation

20:05 Bergle_1: ive also been toying with lighttable :) lol i kicked some $ to it bakc on kickstarted - cause it looked so cool just to encourag edev, its only alpha but its a neat toy at moment. :)

20:06 abp: Urthwhyte: Does my code work for you? :)

20:06 Bergle_1: Funded too, waiting to write plugins.

20:07 Bergle_1: ive played with smalltalk on on off over the years and its a wonerful environment :)

20:07 just never did anything serious with it.

20:08 abp: Bergle_1: Ah ok, that was some time ago?

20:09 Bergle_1: smalltalk with squeak hmm 5 years

20:09 Urthwhyte: abp: Needs a second map across the questions hash, since questions is a nested col

20:11 solussd: worked well

20:11 solussd: did you try abp's approach? it's much cleaner / more functional

20:13 Urthwhyte: I'm fixing it up right now

20:13 just trying to rewrite my partition func first

20:14 abp: Urthwhyte: Yeah thought something like that ;)

20:14 Urthwhyte: Little challenge for you now.

20:16 solussd: ChongLi: In case you're interested, here's how I solved my problem (it's lazy, in a good way): https://www.refheap.com/paste/b3e00d3aa3a5b7c7791dbfa30

20:25 abp: Finding labrary names is tough but a little imagination applied and neat things appear: clevejate

20:25 Does that sound good? I'm no native english speaker. German, actually.

20:28 solussd: abp: i like it

20:32 abp: a

20:32 It's elevate + clj = clevejate

20:33 brainproxy: is there a 'not' form for checking that an exception is not thrown?

20:33 (is (not (thrown-with-msg ...))) doesn't work

20:35 uvtc: abp: I think there has been a recent rule instituted severely restricting Clojure pun names. :)

20:42 ChongLi: solussd: nice

20:42 solussd: :D

20:43 ChongLi: quite a long function name

20:43 haha

20:43 why not just use namespaces?

20:43 solussd: yeah, I'm an objective-c developer by day!

20:44 oh I am, it's in the <something>.models.group namespace (and groups have org_hierarchies)

20:44 (objective-c doesn't have namespaces, in case that didnt make sense as a joke)

20:44 ChongLi: haha

20:49 abp: uvtc: Problem is, it's not puny. I want to elevate programming in clojure into a mainly declarative and occassionaly funtional sphere.

20:50 Then every sort of tooling like datomic queries and core.logic applies to your program like to your data.

20:53 TimMc: I've started using biological taxonomic names for projects.

20:53 Bookmarking tool -> Chelydra (after the snapping turtle genus)

20:54 Foxboron: Writing Python for over a year, Started with Clojure yesterday, and now i forget to add :'s D:

20:54 TimMc: (the tool does not exist yet, so don't bother searching for it :-P)

20:55 abp: TimMc: That's true for my lib too. Just a github organziation.

20:56 Foxboron: hm

20:56 abp: TimMc: But biological taxonomies is a good idea. Will try mixing purpose of my lib with those. :)

20:56 Foxboron: Achive max geekynes, type equations as project names.

20:57 abp: Wow! First big task done. Now I think I'm at least not totally stupid. :D

21:00 TimMc: abp: technomancy generally uses literary references -- e.g. "Leiningen Versus the Ants"

21:04 abp: TimMc: Oh, I didn't know that. Everything that is on peoples minds end up as their library names. I want revolutions! Clojure, ClojureScript and Datomic lead the way. :D But really, Datomic is a name by the central concept, datoms. My central concept is elevating programming from functional into declarative style.

21:05 Has *everyone* seen http://blog.getprismatic.com/blog/2012/10/1/prismatics-graph-at-strange-loop.html and https://github.com/strangeloop/strangeloop2012/blob/master/slides/sessions/Wolfe-Graph.pdf?raw=true and understood the implications? That's huge.

21:06 Still waiting for the recording of the presentation at strangeloop 2012 though.

21:07 And the open source version of graph. So much so that I start writing everything I need by myself. I did exactly that for Java, but fixed on swing-properties, thousands of lines of javassist compiler extensions and jgrapht management. Thats all vanishing now into pure functional awesomeness.

21:11 uvtc: TimMc: Oooh, good idea (re. naming).

21:11 abp: It's going to get modules for cljs (history, localstorage, rpc, ajac, websockets, dom), ring ((reversable) routes, view-rendering), swing (declarative binding through graph nodes), datomic (event-sourcing, writing, reading) etc.

21:11 It's realy only about bridging into graph nodes at some point.

21:13 Control flow and state are always drawable as graphs. Timing of functions can be written into the graph at nodes, besides their results.

21:14 And graphs can be stored in datomic.

21:15 So you write data, to process data, to present data, to export data. Abstract all the things. Now imagine I've got crazy hear and

21:16 'am standing on the stage at the conj. :(

21:16 *crazy hear -> crazy hair

21:29 wingy_: ibdknox: if you are there .. (require 'myapp.server :reload-all) doesn't seem to reload the namespace

21:29 in Light Table

21:30 TimMc: abp: Have you seen scgilardi's kiln library?

21:31 Also, a couple of folks at the last Boston Clojure Meetup got me hooked on "Engineering a Safer World", which in part discusses the kinds of complex problems you can get in big dependency graphs.

21:32 Basically, all the components can be working as designed and the system can still fail -- so you'll need really good ways of debugging module graphs.

21:34 wingy_: hm im using (require 'myapp.server :reload-all) from the lein repl but with no effects

21:34 how do i reload the code i have made?

21:40 TimMc: wingy_: Perhaps code-reloading is not sufficient for your needs, then.

21:40 Is the server still running all this time?

21:40 wingy_: it is .. cause i reloaded that one file and it works

21:41 the server file requires all other files, reload that one doesn't work

21:41 which is weird since :reload-all should re-require all files that one requires

21:41 TimMc: yes

21:42 abp: TimMc: Will investigate on kiln. For debugging visualization of every state and flow seems enough.

21:43 TimMc: scgilardi has no kiln

21:43 Has he? ;)

21:45 TimMc: abp: Oops, it's not on his account: https://github.com/straszheimjeffrey/The-Kiln

21:46 He gave a presentation about it some months ago.

21:47 robink: What's currently the best Clojure HTTP client library?

21:47 clj-http?

21:47 clojurebot: dakrone maintains clj-http

21:49 abp: TimMc: Oh, yeah, I've seen that. But looks much to cluttered and read arkward things about it. :/

21:50 TimMc: OK. I'm just starting to read about Prismatic's Graph, thanks to your link.

21:52 abp: TimMc: Sure, no problem, I think it's very relevant for programming. My graph-lib is coming along great. I'm putting together graphs, in terms of (compile your-graph)

21:53 TimMc: Oh, more like (compile your-fnk-map)

21:53 TimMc: I wrote my own little graph thing once upon a time for a GUI that had annoying computational dependencies between events, state, and display.

21:53 I think everyone eventually writes such a thing. :-D

21:55 https://github.com/timmc/cascade

21:55 abp: TimMc: To bad nothing get's flexible and enjoyable enough to become widely adopted.

21:56 TimMc: Yeah, it's hard to imagine something that's generic enough.

21:57 abp: TimMc: Looks quite nice at a first glance.

21:58 TimMc: Mine is useful for (I hope!) efficient recomputation of intermediate state as inputs change over time.

21:58 abp: TimMc: For me it's much work to implement now. ;) But it's my first day working on it.

21:58 TimMc: I'd be hard-pressed to merge that with something like The Kiln, which is functional.

21:58 abp: TimMc: Yea, I call that iterative graph updates.

21:59 TimMc: Yours is not functional?

21:59 TimMc: No, it is entirely based on side-effects.

21:59 abp: TimMc: Oh, yeah, you mentioned state.

22:00 TimMc: The API looks functional (you get a new cascade object back), but each node is supposed to mutate stuff externally.

22:01 abp: TimMc: But some state will always be there. When I unify Clojure and ClojureScript into one graph it can depend on server side storage, session cookie, other cookies, localstorage, history, dom, rpc etc.

22:01 TimMc: Ah, sure.

22:03 abp: TimMc: I've thought about reducing state to what already is stateful, but between that, theres always one coherent state. Even when employing side-effects. You can't write when there is nothing to write.

22:04 TimMc: Didn't follow that.

22:05 abp: TimMc: user-typed -> do-calculations = result, coherent state, pause, next thing happens. Async result -> do-calculations = result, coherent state, pause, ...

22:07 TimMc: I understood that even less -- what do you mean by coherent state?

22:08 abp: TimMc: Point at a time were nothing happens, everything is done. You have everything the graph produces in any way in a single map. That's a coherent state.

22:09 TimMc: not?

22:09 TimMc: Even datomic uses one atom to snapshot these. :D

22:10 TimMc: Ah, I see.

22:10 You don't always get that in distributed systems, though.

22:10 abp: TimMc: Sure?

22:11 TimMc: I don't know enough about datomic, I guess.

22:12 abp: TimMc: I've only seen "Writing Datomic in Clojure" http://www.infoq.com/presentations/Datomic (and the other talks on it)

22:13 bbloom: abp: TimMc: have you seen adobe's adam and eve?

22:14 http://stlab.adobe.com/group__asl__overview.html

22:14 in particular the property model is interesting

22:15 TimMc: I will check those out tomorrow, thanks!

22:15 bbloom: this paper too http://dl.acm.org/citation.cfm?id=1449927

22:15 abp: bbloom: Yeehaw, more inspiration!

22:15 bbloom: I think reactive programming is overrated. :x

22:16 bbloom: i wouldn't call this "reactive"

22:16 in short, they define inputs, variables, constraints, and outputs

22:16 abp: bbloom: That's good, haven't looked into it.

22:16 yedi: so I have a list of strings formatted like this "<value> <key>". How can I make a map that contains a matching of keys to the list of corresponding values from that list of strings?

22:16 abp: bbloom: That's the way.

22:16 bbloom: inputs are initial values, constraints relate the variables, the variables are bound to the UI, and then outputs form the "command" in the adobe photoshop command history sense

22:17 undo/redo style

22:17 in also plays nice with that event sourced view of the world

22:18 there is local state for a form, which is 1-to-1 data bound, but the global document state is always event sourced

22:18 unfortunately, command models for applications have a high investment cost. most applications don't necessarily need complex undo/redo from step 1

22:18 so the model demos poorly

22:18 but i think it's a really strong approach for larger systems

22:19 yedi: you have a space separated list?

22:19 yedi: it's a list of strings

22:19 bbloom: yedi: ah, alternating key, value, key, value, ...

22:19 ?

22:20 &(apply hash-map [:x 1 :y 2 :z 3])

22:20 lazybot: ⇒ {:z 3, :y 2, :x 1}

22:20 yedi: it's not one entire string tho

22:20 bbloom: yedi: that what you need?

22:21 abp: bbloom: Will have a look, at least it doesn't exist in clojure now.

22:21 yedi: its like ["val1 key1" "val2 key2" "val3 key1"] => {"key1": ["val1" "val2"], "key2": ["val2"]}

22:22 bbloom: yedi: ah, you want a "multi-map"

22:23 do you want the values ordered? or do you want sets? ie {"key1": #{"val1" "val2}...

22:23 yedi: sets would be fine

22:23 solussd: yedi: &(into {} (map #(clojure.string/split % #"\s") ["key value" "key2 value2"]))

22:23 ,(into {} (map #(clojure.string/split % #"\s") ["key value" "key2 value2"]))

22:23 clojurebot: {"key" "value", "key2" "value2"}

22:23 solussd: there we go

22:24 bbloom: solussd: that won't produce a multiset, that will clobber values

22:24 er multimap

22:24 solussd: ooh

22:24 reduce using update-in

22:25 bbloom: yup

22:27 yedi: start by getting a list of key value pairs

22:27 break the problem down into steps

22:28 &(->> ["val1 key1" "val2 key2" "val3 key1"] (map #(string/split % #" ")))

22:28 lazybot: java.lang.RuntimeException: No such namespace: string

22:28 bbloom: &(->> ["val1 key1" "val2 key2" "val3 key1"] (map #(clojure.string/split % #" ")))

22:28 lazybot: ⇒ (["val1" "key1"] ["val2" "key2"] ["val3" "key1"])

22:28 bbloom: so that gets you val key

22:29 &(->> ["val1 key1" "val2 key2" "val3 key1"] (map #(reverse (string/split % #" "))))

22:29 lazybot: java.lang.RuntimeException: No such namespace: string

22:29 bbloom: &(->> ["val1 key1" "val2 key2" "val3 key1"] (map #(reverse (clojure.string/split % #" "))))

22:29 lazybot: ⇒ (("key1" "val1") ("key2" "val2") ("key1" "val3"))

22:29 solussd: yedi: (reduce (fn [m [k v]] (update-in m [k] #(conj % v))) {} (map #(clojure.string/split % #"\s") ["key value" "key2 value2" "key2 anothervalue2"]))

22:29 ,(reduce (fn [m [k v]] (update-in m [k] #(conj % v))) {} (map #(clojure.string/split % #"\s") ["key value" "key2 value2" "key2 anothervalue2"]))

22:29 bbloom: that gets you key/val

22:29 clojurebot: {"key2" ("anothervalue2" "value2"), "key" ("value")}

22:29 bbloom: then do what solussd is saying :-)

22:29 i recommend using multiple steps with lets or ->> for clarity

22:29 solussd: sorry, just jumped out of the repl and pasted. :D

22:40 Sgeo: I'm very much missing the nice documentation that static typing naturally provides

22:40 Writing out the types of stuff in English is annoying

22:41 abp: Sgeo: Have you tried/read about typed clojure?

22:41 Sgeo: Heard about it

22:44 yedi: hey thanks guys, now i can look at this and try to understand what each part is doing

22:44 so when i come up against something similar later, i know whwat to do =D

22:50 bbloom: yedi: so are you familiar with sets?

22:50 &(conj #{1 2 3} 3 4 5)

22:50 lazybot: ⇒ #{1 2 3 4 5}

22:52 bbloom: there is also a clojure.set namespace:

22:52 &(clojure.set/union #{1 2 3} #{3 4 5})

22:52 lazybot: ⇒ #{1 2 3 4 5}

22:52 bbloom: there's a bunch of different approaches

22:52 to problems like yours

22:52 but the key thing is: break it down into steps!

22:52 simplify the problem as you go

23:04 nightfly_: Why would you have january be month 0 in a date library and leave everything else normal...

23:05 amalloy: nightfly_: C set the precedent for date representations

23:12 nightfly_: amalloy: Didn't realize this was such a pendemic thing. Mystery solved at least.

23:34 Sgeo: How many libraries have functions that disallow certain arguments, where those arguments might make sense but the creator of the function decided not to support it because s/he couldn't imagine why anyone would pass those arguments in?

23:34 (Example: partial)

23:34 ,(partial identity)

23:34 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$partial>

23:35 dakrone: ,((partial map inc) [1 2 3])

23:35 clojurebot: (2 3 4)

23:35 dakrone: Sgeo: ^

23:35 ivan: I think Sgeo knows how to use partial

23:36 dakrone: ah, I'm sorry, I mistook the "(Example: partial)" as desiring an example for it

23:36 Sgeo: (partial identity) might not be useful to write directly, but when a macro emits code, it shouldn't be forced to check out many arguments will be passed to partial, if there's a sensible but useless-seeming result.

23:37 ivan: yeah, I've run into another one of those in core

23:37 dakrone: too much conj, not enough sleep

23:37 Sgeo: ivan, which?

23:37 * ivan checks

23:37 abp: dakrone: Be happy. :)

23:38 amalloy: Sgeo: there's a bug report for that in jira somewhere, and i think maybe there's a plan to change it? not sure about that

23:38 ivan: maybe I wanted (assoc {}) to work

23:38 Sgeo: amalloy, yeah, I think I heard that too

23:39 ivan: or perhaps (conj {})

23:39 Sgeo: ,(conj [] 1 2 3)

23:39 clojurebot: [1 2 3]

23:42 amalloy: but why would you ever (conj {})? (apply conj m vs) should really just be (into m vs)

23:44 ivan: ah, right

Logging service provided by n01se.net