#clojure log - Apr 26 2013

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

4:13 sleetdrop: is there a newer textmate bundle for clojure, the one I find on github still use cake, cake is merged in to lein now

4:17 clgv: sleetdrop: why dont you use one of the big three dev environments for Clojure: Emacs, Eclipse+Counterclockwise or Vim?

4:17 ucb: clgv: surely you means emacs, emacs or emacs? </troll>

4:17 Raynes: Well, probably because he doesn't want to use any of those editors.

4:17 clgv: ucb: nope. I am an active CCW user ;)

4:18 ucb: :)

4:18 clgv: Raynes: very likely, but he will get himself in trouble with an unmaintained plugin (or similar) for another editor ;)

4:18 Raynes: sleetdrop: Unfortunately no, all the textmate bundles out there are horrible. The best you can do with those kinds of editors is Sublime Text 2 with the sublime-lispindent plugin/hack/baaaaah

4:20 sleetdrop: clgv:thanks for your advice

4:21 amalloy: clgv: your same argument applies to anyone using an editor that's not in the Big One as to one that's not in the Big Three. it's just a difference of degree; if he's familiar with textmate he might as well use it

4:21 Raynes: amalloy: Go to bed, dude.

4:22 sleetdrop: Raynes:I am a newbie of clojure, just want to try it a little. so I can edit the code with TM, and run it from command line with lein.

4:23 amalloy: sleetdrop: yes, that's a good approach

4:23 it'd be a good idea even if you were already a whiz at an editor with good clojure integration; you want to know how things really work before you learn some shortcuts

4:39 silasdavis: on this topic... what canned emacs configs would people recommend for clojure. I have installed https://github.com/overtone/emacs-live, but am yet to use it

4:39 it may be what I want..

4:40 scottj: silasdavis: not sure if they have anything clojure specific, but there's also prelude and emacs-starter-kit

4:40 silasdavis: I'm currently a vim user, and I am lead to believe clojure support is nicer in emacs across the board, although paredit which is my chief desire is available..

4:42 noprompt: alexbaranosky: you still around?

4:52 amalloy: silasdavis: emacs support is better, but vim's is quite reasonable as i understand it

4:52 clgv: amalloy: I won't forbid him to use it - I just would not advice him to use a dev environment that does not support the language he wants to develop in for productive every day usage

4:53 amalloy: for the purpose of just learning the language pick any editor you like and use the leiningen repl ;)

4:56 noprompt: is the discussion about vim's clojure support?

4:58 scottj: noprompt: appears so

4:58 noprompt: because if that's an issue with the developer in question, i've found a combination of evil-mode and key-chord with emacs can prove to be a much more hospitable experience for working with clojure for those coming from vim.

4:59 clgv: noprompt: not my posts. I just suggested to use Emacs, CCW or vim for Clojure dev ;)

5:00 noprompt: vim can be a nice environment for most languages, and tooling has gotten much better for lisp, but it's simply pales in comparison to what you get with emacs.

5:01 silasdavis: I intend to use both editors

5:01 I'm also learning to write with my left hand

5:02 babilen: silasdavis: You have to give vim-fireplace (and related tooling such as vim-redl) a try. tpope did some great work with other people and it is nice to use.

5:03 noprompt: babilen: totally agree.

5:03 babilen: silasdavis: One problem you will encounter is that /other/ people target emacs and, for example, ship specific modes for their software. Midje does that and there is simply nothing comparable for vim (the situation here got better ever since we have the wonderful repl functionality)

5:04 silasdavis: babilen, thanks for those looks interesting

5:04 does the break point feature allow you to inspect variable subsitutions line-by-line?

5:05 really missing this in my clojure work

5:06 babilen: silasdavis: Another example would be https://github.com/technomancy/slamhound -- It is perfectly usable outside of your editor, but ships a elisp for nice integration into Emacs.

5:07 silasdavis: To be honest: I use and used both editors and quite often prefer vim (textobjects are a huge factor in that) and the tooling is certainly mature enough to be usable. I haven't played too much with vim-redl yet so I can't comment on that particular functionality, but it is definitely worth a try.

5:08 noprompt: i also use both editors, and i came to emacs from vim through evil-mode, and must say i prefer emacs much more.

5:09 part of that stems from my frustration with viml.

5:10 silasdavis: babilen, I'm quite fond of text objects too, particularly for things like vim-surround, is there anything comparable in emacs?

5:10 noprompt: silasdavis: there's evil-surround.

5:10 silasdavis: have you tried evil-mode at all?

5:11 silasdavis: noprompt, I'm not a fan of VimL (hand't heard that before), seems much nicer to have lisp config

5:12 babilen: silasdavis: There is no direct equivalent of text objects in Emacs AFAICT, but I am more proficient in vim than in Emacs. I think it is one of the main differences in culture between Emacs and vim (in that vim has the "do something to object k times" philosophy that works with everything)

5:12 silasdavis: noprompt, I haven't I was sort of planning to take the plunge and go native though

5:13 noprompt: silasdavis: i'm not sure "native" emacs is worth it. in fact, it's what kept me from using the editor at all. if the vim key bindings have taken root in your muscle memory, trying to learn the emacs bindings coming from vim is much like trying to learn dvorak coming from qwerty.

5:13 babilen: noprompt: I use(d) both and prefer vim, but I guess that everyone has to figure it out him/herself ... All I wanted to say is that vim is a perfectly usable development tool for Clojure and there might even be reasons to prefer it over alternatives.

5:15 silasdavis: babilen, I appreciate the info, would't have found it otherwise

5:15 noprompt: babilen: sure it's quite usable. heck, i used it for several months with VimClojure, fireplace, etc. i've even contributed to the vim-clojure-static runtime files. but at the end of the day the experience was kind of frustrating.

5:15 babilen: why?

5:15 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

5:16 babilen: clojurebot: shush!

5:16 clojurebot: Huh?

5:16 silasdavis: noprompt, I'm sure you're right, and in fact I'm coming at from the perspective that a bit of mental plasticity is good for you. In fact I'm planning to learn colemak...

5:17 noprompt: babilen: well VimClojure would crash randomly, but i really liked the repl and the way it looked up documentation, etc. (when it wasn't crashing). fireplace was nice too but i really missed the VimClojure style of development.

5:17 i saw what the emacs environment had to offer, heard about evil-mode and tried it out.

5:19 babilen: noprompt: Okay, sounds as if vim-redl is what you want then ;) -- I agree that VimClojure had its problems (e.g. buffer handling), but the experience is not really comparable to vim-fireplace. I perceive the latter as a well thought-out and stable/usable tool that just lets me work. I personally also /prefer/ being able to use/connect to my "normal" nrepl REPLs, but that is definitely personal preference.

5:20 noprompt: In the end it is not so much different from what Emacs does in that you connect to an nrepl REPL. I don't need my editor to also handle the window management (I have a window manager or tmux or ... for that), but I even could run it in a vim shell)

5:21 noprompt: babilen: maybe, but vim doesn't let me have an IRC chat session open (which i'm using now), or let me run a shell (that isn't qwerky).

5:21 babilen: There was also a time were the Emacs tooling was working worse than vim-fireplace -- (just google for install problems of slime, ...)

5:22 noprompt: And why should it? (but lets not get into this, please) -- I am using irssi in a wonderful shell running inside tmux ... I can switch to my editor and arrange all this with tmux's or my window manager's functionality.

5:22 noprompt: there's something very nice about never having to leave your editor, and if vim had subprocesses and viml was decent i would never look back.

5:23 babilen: that's fine and i've actually got a fair bit of customization for that in my vimrc. but i just felt like it was a bit hackish and error prone.

5:24 btw, i don't think vim is a bad editor at all. in fact, i've found editing code in emacs very frustating in some cases.

5:24 babilen: noprompt: The approach to this is *the* underlying cultural difference. If you want Emacs then you simply want it, but that has little to do with the Clojure tooling in itself.

5:25 silasdavis: is tmux better than screen?

5:25 babilen: much

5:25 noprompt: indeed.

5:26 silasdavis: can it run daemonised

5:26 * babilen also likes https://github.com/erikw/tmux-powerline but then ... is there a #clojure-offtopic ?

5:26 babilen: silasdavis: sure

5:26 silasdavis: like 'screen -dmS session-name <command to run unattended>'

5:27 * silasdavis installs tmux

5:27 * silasdavis is clearly getting no actual work done today

5:27 babilen: haha

5:27 * silasdavis did spend the last two years save 3 months in windows .NET land

5:28 silasdavis: because I should probably know about this stuff

5:28 noprompt: babilen: i'm not so sure. i think the core philosophies of modal editing are sound. indeed it's why i love vim so much. but at the end of the day if it's just modal editing you want, and the editor you have is sufficiently equipped to handle such a task *and* give you more in return, then why use vim?

5:29 silasdavis: ha! i had a day like that today! someone sent me a stack overflow post about programming jokes and it ate up nearly an hour of my time.

5:30 babilen: noprompt: Well, you also lose things. it's not that emacs+evil-mode is vim. And I wasn't referring to modal editing but to the "unix philosophy of doing one thing well" vs "do everything in Emacs OS"

5:30 noprompt: babilen: point well taken.

5:32 silasdavis: this perhaps links to the tension between elegant powerful tools and integrated possibly compromised tools

5:32 noprompt: babilen: emacs + evil mode is certainly not vim, i'll give you that.

5:32 silasdavis: for example visual studio with the resharper plugin really is quite powerful in its code intelligence

5:33 it's editor is just about good enough, and there is a vim plugin, but there is enough friction that you end up turning it off

5:33 I'm interested to see what happens with lightbox

5:33 lighttable rather: http://www.lighttable.com/

5:33 noprompt: the unix philosophy is certainly the right philosophy in many cases, but i think if you built every tool/library/program with that intent you might be doing more harm than good.

5:34 babilen: noprompt: I am simply more productive in vim and thats what counts in the end, doesn't it? Emacs just doesn't "feel" right and I missed a lot of little things all the time. (textobjects for example) ... And given that Clojure tooling on vim is excellent now and gets /a lot/ of attention by gifted developers its just wonderful

5:34 noprompt: silasdavis: so am i. i think light table might turn out to be a real nice place between emacs and vim.

5:34 babilen: yeah

5:35 silasdavis: you've probably come across this, but in case not: http://blog.sanctum.geek.nz/series/unix-as-ide/

5:36 noprompt: babilen: it took me one week to return to same level of productivity w/ emacs + evil-mode coming from vim.

5:37 on top of that i've been able to pick up emacs lisp far more rapidly than viml. filling in the missing blanks has been almost trivial.

5:38 babilen: noprompt: I tried it for longer than that, but went back and am more than happy. Lets conclude with that. All I wanted to point out is that Clojure tooling is good and is getting better by the minute on vim and that picking an editor is /much/ more specific to capabilities of the Editor itself and your needs ..

5:39 (or preferences)

5:39 silasdavis: hmm I managed unbalance my parenthesis with emacs paredit

5:39 noprompt: babilen: i won't disagree with you there. and will agree to leave it up to personal preference/philosophy.

5:40 silasdavis: but using 'kill region'

5:40 should that be possible..?

5:40 babilen: silasdavis: Can you reproduce that in vim ;)

5:40 * babilen runs

5:40 noprompt: silasdavis: sure that can happen. it can happen with vim's paredit too.

5:41 nothing's stopping you from hitting 'x'.

5:42 babilen: x won't unbalance paranthesis (or delete a pair)

5:42 noprompt: or 'r', 'R', 'cw', etc.

5:43 babilen: that's simply not true .. there might be bugs (and I'm sure there are), but in general you cannot unbalance paranthesis. I mean that's one of the main points of paredit :)

5:43 noprompt: babilen: oh yeah, you're right.

5:44 silasdavis: I am using some weird heavily customised emacs config

5:44 noprompt: what's not true? you can use 'r', 'R', and 'cw' on a ')'.

5:44 silasdavis: <noprompt> silasdavis: sure that can happen

5:44 noprompt: silasdavis: did you customize it?

5:45 silasdavis: no: https://github.com/overtone/emacs-live

5:45 if I do C-w

5:45 noprompt: then throw it in the trash and customize it yourself :)

5:45 silasdavis: it will delete until the end of line it seems

5:45 and will unbalance parens

5:45 noprompt: yeah, hang on. i think i know what you want.

5:45 silasdavis: noprompt, but it's so... colourful

5:46 babilen: silasdavis: Please read http://clojure-doc.org/articles/tutorials/emacs.html (it's based on technomancy's starter kit IIRC)

5:46 noprompt: there's a way to kill an sexp w/o fucking the whole thing up.

5:46 babilen: silasdavis: but then: use vim!

5:46 </end>

5:49 silasdavis: fwiw, there is also http://clojure-doc.org/articles/tutorials/vim_fireplace.html which will walk you through a sensible vim setup (throw in vim-redl https://github.com/dgrnbrg/vim-redl if you require that functionality)

5:50 rodnaph_: lazyirc... someone recently released a library with some handy macros for doing things like if-let with mutiple bindings, and an if-when... did anyone else see this i can't find it now... :(

5:50 i'm sure it was cgrand... but can't see anything on his github.

5:51 * babilen recalls something like that .... but is in the same situation as you

5:51 rodnaph_: hehe, well ping me if you remember first, thanks :)

5:52 silasdavis: babilen, do they package paredit or shall I have that too?

5:52 rodnaph_: babilen: i've been meaning to try vim-redl for a while, will give it a go now (i'm still using VimClojure)

5:54 noprompt: salisdavis: paredit-kill-sexps-on-whole-line, which is a mouthful, but i think it's what you're looking for.

5:57 whoops, my bad it's simply paredit-kill-sexps-on-line.

5:58 i have that bound to "D" in my evil normal state. it won't screw up the balance.

5:59 babilen: rodnaph_: Oh, you /have/ to switch to vim-fireplace from VimClojure. It is much better :)

6:00 silasdavis: paredit is available, sure ... https://bitbucket.org/kovisoft/paredit/

6:04 noprompt: fwiw, the maintainer of vim's paredit plugin is a very good guy.

6:04 he fixed several bugs i discovered while working with the plugin and was quick to fix the issues.

6:05 the plugin is excellent.

6:05 slimv actuall isn't bad either considering vim's lousy support for that sort of thing.

6:06 off topic, does anyone use korma?

6:10 rodnaph_: babilen: ogm i have a semi-decent repl in vim! :D

6:10 silasdavis: noprompt, yes but I only picked it up about a week ago

6:10 babilen: rodnaph_: I'm using "lein repl" but yay!

6:11 rodnaph_: i was using lein repl, with slimv (which worked pretty well tbh). gonna give this a go for a bit.

6:12 actually... i don't seem to be able to send stuff to the repl...

6:13 noprompt: http://f.cl.ly/items/3w0E1A420H043r383p2G/Screen%20Shot%202013-04-26%20at%203.09.59%20AM.png

6:13 rodnaph_: noprompt: if only i could get used to emacs... have given it a go a few times, but always come back to vim.

6:14 noprompt: rodnaph_: i only came to it via evil-mode and key-chord.

6:15 borkdude: hmm, if a function expects arguments like :foo "bar" :foo2 "bar2" instead of a map, what is the best way to pass the arguments if you have already a mp

6:15 noprompt: i also had to add a few small things https://github.com/noprompt/matilde/blob/master/emacs.d/noprompt-evil.el#L7-L29

6:16 borkdude: i'm assuming the fn does something like (fn foo [& {:as opts}]?

6:17 borkdude: noprompt yes, the arglist looks like this: [& {:keys [weeknr year description budget name] :as k}]

6:17 rodnaph_: borkdude: you can use apply if u can flatten your map to a list... ?

6:18 silasdavis: babilen, I'm trying to enable paredit mode in a running vim with let g:paredit_mode = 1

6:18 doesn't seem to wrok

6:18 borkdude: rodnaph_ I was thinking of things that could go wrong since order is not guaranteed, but yeah, only the order of mapentries is not guaranteed of course

6:18 silasdavis: It should auto close a '(' right?

6:18 I'm in an empty buffer

6:18 noprompt: borkdude: this might be ugly but, (apply f (-> {:foo "bar" :baz "quux"} seq flatten))

6:18 rodnaph_: silasdavis: in a clojure file? it'll probably use the filetype

6:19 borkdude: noprompt or maybe I just have to change the other function to expect a map ;)

6:19 noprompt: borkdude: that's what i've tended to do.

6:20 silasdavis: rodnaph, I'm not in a clojure file but I think that command should be turning it on

6:20 babilen: silasdavis: Are you editing a .clj file? Can you run ":call PareditToggle()" ?

6:20 noprompt: borkdude: [& {:as opts}] looks nice but it can throw a wrench in the composability machine.

6:21 silasdavis: oh it works in a clj file

6:21 babilen, the toggle function works

6:21 g:paredit_mode = 1 doesn't

6:21 even in vimrc

6:21 perhaps it only works to disable it (it is listed in docs)

6:21 babilen: silasdavis: Yeah, it uses the filetype or you have to activate it explicitly for other filetypes. That is documented in its documentation IIRC and easily customisable.

6:21 noprompt: borkdude: [& {:as opts}] is kinda like having an implicit hash in ruby - it's no fun and confusing.

6:22 reduce the cognitive load by avoiding that kind of thing.

6:22 babilen: silasdavis: You can disable it for the filetypes it is activated in by default with that setting AFAIUI -- If you want it for other filetypes you have to add them to the supported filetypes.

6:23 borkdude: noprompt I think I read somewhere (in the style guide?) that (foo :a 1 :b 2) was more idiomatic than (foo {:a 1 :b 2})

6:25 noprompt: it can be in some cases. i guess it really depends on what you're trying to do. also, idioms, while good to adhere to, are like rules - at times they're meant to be broken.

6:27 to muddy things, that's just my opinion. :)

6:27 personally i prefer explicit over implicit.

6:28 tomoj: how do you untie a nom? :(

6:28 noprompt: when you start dabbling in implicit styles of coding you're just asking for it.

6:30 borkdude: i'd say this: if having an implicit map is causing you enough trouble to have to bend over backwards in several places in your code then go for the explicit map.

6:34 clgv: borkdude: if you want to pass on optional parameter maps and also want transitive documentation for optional parameters, then checkout https://github.com/guv/clojure.options

6:34 mindbender1: is there a function to remove a thing from vector

6:35 clgv: mindbender1: yep, for the last element: ##(pop [1 2 3])

6:35 lazybot: ⇒ [1 2]

6:35 mindbender1: (remove [1 2 3] 3)

6:35 what of (remove [1 2 3] 2) => [1 2]

6:36 what of (remove [1 2 3] 2) => [1 3]

6:36 clgv: if you want to keep the vector datatype you can only add to and remove from its end

6:37 mindbender1: is there a structure supporting this wsh

6:37 wish

6:38 borkdude: you can also use subvec (but personally I've never needed it)

6:38 noprompt: ,(doc subvec)

6:38 clojurebot: "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

6:38 clgv: right. but you cant compose two subvecs into one vector again efficiently

6:39 mindbender1: I think this will be a convinience

6:40 clgv: removing efficiently works with sets and hash-maps.

6:41 maybe you need an hash-map with sorted keys

6:41 *removing arbitrary elements efficiently

6:42 mindbender1: though based on arrays => https://www.refheap.com/paste/13980

6:42 but looks convinient

6:43 svedubois: How can you write these clojurescript lines in a short way?

6:43 https://www.refheap.com/paste/13979

6:47 clgv: mindbender1: is this a real array underneath? if so there are worst case O(n) elements to shift.

6:48 mindbender1: just in case this code happens to be part of a bottleneck

6:49 svedubois: is there a `doto` macro in clojurescript?

6:49 noprompt: clgv: yes.

6:50 clgv: hmm do-set would be more appropriate since the expressions are nested

6:52 * noprompt yawns

6:52 noprompt: well i think i'm out for the night. take care everyone. :)

7:02 mindbender1: what the cost of this => (defn remove [v o] (vec (filter #(not= % o) v)))

7:04 clgv: sorry I didn't see ur ping

7:05 the doc says it's array like

7:06 I don't what the author meant but it probably runs fast enough for goog

7:06 silasdavis: babilen, is there a better alternative to ctags for use with clojure?

7:21 svedubois: I have tested the defmacro set-all! from:

7:21 http://stackoverflow.com/questions/4579679/factor-clojure-code-setting-many-different-fields-in-a-java-object.

7:21 (defmacro set-all! [obj m]

7:21 `(do ~@(map (fn [e] `(set! (. ~obj ~(key e)) ~(val e))) m) ~obj))

7:21 But it doesn't work. Any advice?

7:26 Perhaps, ClojureScript does support macros, but only in .clj files that are imported with require-macros.

7:42 noidi: svedubois, yes, you can only write macros in Clojure, not ClojureScript

7:44 silasdavis: will that change?

7:44 this refers to clojurescript macros: http://blog.getprismatic.com/blog/2013/1/22/the-magic-of-macros-lighting-fast-templating-in-clojurescript

7:45 mpenet: it's clojure macros generating clojurescript really

7:45 silasdavis: ah yes I see https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure

7:45 mpenet: this could change with "cljs in cljs " or something

9:07 melipone: hello

9:07 I am using the memoize function. How can I clear the cache and start again without restarting the repl?

9:08 ucb: melipone: what cache?

9:08 melipone: I mean whatever is memoized by the function

9:08 ucb: I'd say just create a new memoised function

9:09 e.g. if you do (def memo-f (memoize f)) just redef memo-f in your repl

9:09 melipone: ha, okay, thanks

9:13 clgv: melipone: you can do that with core.memoize an additional library

9:16 silasdavis: does anyone know of a declarative database dsl for clojure

9:16 so you can just write a definition

9:17 and have it magically update your database schema to want you want

9:18 jcromartie: is there a generic HOF that reverses the arguments to a function

9:18 clgv: silasdavis: maybe korma is what you want - check for yourself

9:18 jcromartie: (defn reverse-args [f] (fn [& args] (apply f (reverse args))))

9:18 clgv: jcromartie: nut built-in

9:19 cmdrdats: silasdavis: I've written http://www.github.com/yuppiechef/macaron which does that

9:19 clgv: *not

9:19 cmdrdats: silasdavis: I do need to add some examples though - it's not entirely obvious when you look at the code

9:20 silasdavis: clgv, I think korma allows you to specify the relations (I intend to use it), but I don't think it will create the tables etc for you

9:21 cmdrdats, interesting thanks, I've also found: https://github.com/budu/lobos

9:21 * nDuff wonders if he was Doing It Wrong in finding korma completely unusable

9:21 silasdavis: It seems he intends to provide declarative definitions too: https://groups.google.com/forum/?fromgroups=#!topic/lobos-library/CE4itjz-yPo

9:21 nDuff: (all macros! can't compose!)

9:22 silasdavis: if you play with (analyze-schema) it outputs a sort of abstract database language

9:22 clgv: nDuff: no idea, I just read the advertisement pages ;)

9:23 silasdavis: cmdrdats, can macaron deal with databases with stuff in them already?

9:23 nDuff: silasdavis: see its update-table call.

9:24 clgv: Really does depend on what your style is. If you tend to code more compositionally, though... korma isn't fun.

9:24 jcromartie: I have not been a big fan of any of the db libraries though

9:24 actually ClojureQL seemed really nice

9:25 I think it would be better to start with some abstraction around database tables

9:25 treat them as references

9:26 nested/tree inserts and updates are really hard though

9:26 I think people are used to the Rails way, which is pretty good, and so they try to make Clojure do that

9:28 silasdavis: nDuff, cmdrdats looks like it would try and alter a table, although it would die with a not null constraint - that is sort of tricky problem though. Also I see it's bound to mysql at the moment

9:29 nDuff: silasdavis: Doing It Right is a quite hard problem. I'm trying to remember the name of the toolkit I used for managing database migrations on Django, but it was a several-years-of-history / still-actively-involving kind of deal.

9:29 silasdavis: jcromartie, lobos seems to have ambitions to solve this in quite a general way, updating via diff

9:30 nDuff, sql server/database projects actually do some of this reasonably well. Obviously they are digusting

9:30 jcromartie: you need a declarative way to specify what to do under certain differences

9:30 silasdavis: but you can do a reasonably full sort of diff

9:30 jcromartie: it's simpler to just say "step 1, do this; step 2 do that"

9:30 I wrote a migration tool which worked

9:32 silasdavis: jcromartie, I think one way to avoid the update problem is to have a wipeable database, but store your test/bootstrap data as fixtures (I think that's what rails calls them in a testing context) that are loaded after schema creation

9:32 jcromartie: I've got a real solution for this, of course :)

9:32 store all changes to the system as events, and then cache them in a DB or in memory or however you want

9:33 I mean cache the results

9:33 so you handle schema changes by dropping and recreating the DB with the new schema and replaying events

9:33 the DB speed tends to be a bottleneck though, and the downtime required is pretty unrealistic

9:34 it only makes sense if you're going to use the DB for reporting and keep the "current" system state in memory

9:35 cmdrdats: silasdavis: sorry, got pulled away - yes, it deals with tables that already have data

9:35 silasdavis: it's currently bound to mysql - but I'm planning to abstract it out so that I can use it with datomic

9:36 gdev: cmdrdats:) what does? sorry I just got here and this conversation seems relevent to what I'm doing at the moment

9:36 cmdrdats: gdev: https://github.com/Yuppiechef/macaron - a little db abstraction library I wrote a while ago

9:36 silasdavis: cmdrdats, perhaps you should keep an eye on lobos/lobo mailing list too, you have similar aims

9:38 although I just realised that post I linked to was 2011

9:38 cmdrdats: silasdavis: Lobos looks interesting, but my aim with macaron is to define 'entities', generate the CRUD functions off that and have the underlying db automatically adapt when the schema changes

9:38 so there's no 'migration' path

9:39 also, it doesn't concern itself with query language, the named query support is in the native underlying db language (so SQL for mysql, and eventually datalog for datomic)

9:39 gdev: cmdrdats:) i saw an example of someone adapting their code to deal with schema changes by using defrecord, can't seem to find the article though

9:41 silasdavis: cmdrdats, he notes somewhat vaguely on the wiki and more explicitly on the mailing list that his desire was to automatically generate the migration, which sounds liek what you'd have to do to have the db adapt

9:42 also if you're going for CRUD/entities, perhaps you could use sqlkorma's relational dsl to generate/adapt the tables

9:42 it seems they contain the necessary information

9:44 cmdrdats: silasdavis: sounds interesting - I'll definitely take a look

9:45 gdev: silasdavis:) i'm using korma for my little project and I didn't see anything in the docs about creating a table, besides exec-raw of course

9:46 mynomoto: gdev: It doesn't create tables. Or drop, or alter them.

9:46 gdev: mynomoto:) ohhai, I know, I know, it's not an orm, that's what I was getting at =)

9:47 I was up in the wee hours of the morning trying to update rows in a database from clojure with no luck

9:49 mynomoto: gdev: gfredericks solution did'n work? It should have.

9:49 gdev: I think the dataset is too large so it's like saying (update everyone-in-the-world (set-field {:is_cool true (where {:name "gary"}))

9:51 mynomoto: gdev: but can you do the select part alone? You you can, it shouldn't be a problem.

9:52 gdev: mynomoto:) Yeah, I can do the select part, but doing gfredericks solution just made it hang

9:52 mynomoto:) so I tried just doing a simple update with a hardcoded number and that hung too

9:53 not sure if database was having issues but writing to it seemed to be a problem

9:53 mynomoto: gdev: but one simple update work?

9:54 gdev: can you write to the db at all?

9:54 gdev: mynomoto:) no, that's why I was thinking it might have been db issues; i was at home on VPN since the db is on company network

9:54 now that I'm at work on the company lan I'm trying it again

10:04 pl6306: Why won't this "(map #(% (str "|" %)) ("A" "B" "C"))" work?

10:05 I just want to make a list with 2 string elements

10:05 dnolen: pl6306: ("A" "B" "C"), you're invoking a function called "A"

10:05 matthavener: pl6306: what's output are you expecting?

10:05 pl6306: Yes but how do I quote it inside the function def

10:05 matthavener: (list (% (str "|" %)))

10:06 pl6306: (("A" "=A") ("B" "=B")("C" "=C"))

10:07 matthavener: err, wait, i was totally wrong

10:07 dnolen: ,("A" "B" "C")

10:07 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>

10:07 dnolen: ,'("A" "B" "C")

10:07 clojurebot: ("A" "B" "C")

10:07 dnolen: ,["A" "B" "C"]

10:07 clojurebot: ["A" "B" "C"]

10:07 dnolen: ,(map #(str % "|" %) ["A" "B" "C"])

10:07 clojurebot: ("A|A" "B|B" "C|C")

10:07 matthavener: ,(map #(list % (str "=" %)) '("A" "B" "C"))

10:07 clojurebot: (("A" "=A") ("B" "=B") ("C" "=C"))

10:08 pl6306: Thanks matthavener

10:08 matthavener: be sure to understand the diff between (list a b c) and '(a b c) because its something that tripped me up at first

10:09 gdev: mynomoto:) it works!

10:09 matthavener: ,'(1 (+ 1 1) 3)

10:09 clojurebot: (1 (+ 1 1) 3)

10:09 matthavener: vs

10:09 ,(list 1 (+ 1 1) 3)

10:09 clojurebot: (1 2 3)

10:11 mynomoto: gdev: good. No vpn next time. ;)

10:12 gdev: gfredericks:) mynomoto thanks for your help, yeah vpn is bad

10:13 svedubois: Is this conversion from js to clojurescript correct?

10:13 cube.intersect(sphere).subtract(cylinder1.union(cylinder2).union(cylinder3));

10:13 (.substract (.union cylinder2 cylinder3 cylinder1) (.intersect sphere cube))

10:15 dnolen: svedubois: hmm

10:16 svedubois: I think the .intersect needs to come before the union

10:16 svedubois: and you can't write union that way.

10:31 svedubois: Do you think this is correct?

10:31 (-> cube (.intersect sphere) (.subtract (-> cylinder1 (.union cylinder2) (.union cylinder3))))

10:39 sparkjoy: Not sure if this is the right place to ask Datomic questions, but is anyone actively working on a .NET client for the REST API? If so, we'd like to contribute.

10:41 florianover: is there a chance to do long-polling get requests with clj-http ?

10:43 dakrone: florianover: what do you mean by "a chance to do" ?

10:43 florianover: well, is it possible?

10:43 oh hi! dakrone personal!

10:43 dakrone: what do you mean by a long-polling request? how long? I don't think there's anything preventing you from doing it if that's what you're asking

10:44 florianover: hi! :)

10:44 florianover: http://developers.box.com/using-long-polling-to-monitor-events/

10:45 maybe it is just a problem with the api...

10:45 dakrone: hmm... I think it's possible, you'd have to send {:as :stream} with the original request, and handle parsing it yourself, since the connection wouldn't be completed for every response

10:46 florianover: ok, thx. Will try :)

10:47 dakrone: florianover: good luck, let me know how it turns out

10:50 `fogus: florianover: I'd be interested to see what you come up with too.

10:51 florianover: will respond :)

10:55 mduerksen: is there any possibility to define a default implementation for a protocol?

10:57 florianover: @dakrone it worked. i just had the wrong URL :D

10:57 dakrone: florianover: :)

10:57 glad to hear it

10:57 florianover: i didn't had to use as stream

11:02 mduerksen: ok my bad, i can use Object :/

11:02 borkdude: Objection your honor.

11:04 akells`: has anyone ever had issues importing java.nio.file.Paths into a clojure project?

11:12 NeedMoreDesu: Lolwut, no abs for rational numbers?

11:15 borkdude: ,-3/4

11:15 clojurebot: -3/4

11:16 borkdude: ,3/-4

11:16 clojurebot: #<NumberFormatException java.lang.NumberFormatException: Invalid number: 3/-4>

11:17 AimHere: NeedMoreDesu, isn't that just because clojure's rational numbers are clojure's and Math/abs (or whatever) is wrote by java

11:17 silasdavis: any recommendation for GPG/OpenPGP signing from clojure?

11:27 NeedMoreDesu: AimHere: Oh, well, that makes sense.

11:54 ppppaul: talk

12:01 ucb: ...amongst yourselves...

12:04 silasdavis: any suggestions on where to set up a globally readable environment name like ':development', ':production', etc

12:04 may be sourced from environment variable in future

12:04 for now just want to define it in one place

12:06 justin_smith: you could (System/setProperty "environment" "production"), and better yet only set it if it does not yet exist (found via System/getProperty)

12:09 technomancy: silasdavis: I use environ for that

12:14 silasdavis: technomancy, perfect thanks

12:17 tbaldridge: hey, I have 3 namespaces a, b and c. b refers a and c refers b. Is there a way to make a's defs show up in any namespace that refers b?

12:17 arrdem: tbaldridge: not idiomatically no

12:17 tbaldridge: so far it seems refer only brings in vars that are defined inside the namespace being refered.

12:18 arrdem: tbaldridge: yes that is expected behavior

12:18 tbaldridge: how about not idiomatically.

12:18 arrdem: tbaldridge: I mean you can (def foo bar/foo)

12:18 tbaldridge: and there is an oft-bashed library which automates that

12:18 tbaldridge: yeah, I thought of that, but that looses doc strings,

12:18 arrdem: tbaldridge: lemme dig this moster out for you hang on

12:19 justin_smith: you could pull in the meta too, no reason not to

12:19 arrdem: tbaldridge: potemkin is the tool you want...

12:19 tbaldridge: but that's a huge code smell and amalloy et all would tell you to rework your api rather than use it

12:19 tbaldridge: I'll take a look, thanks. An yes, I know I shouldn't be doing this :-P

12:20 silasdavis: tbaldridge, what's the use case out of interest?

12:21 sounds like a sort of delegation pattern

12:21 only I wouldn't want to do it through namespaces

12:21 but I don't know much about metaprogramming in clojure

12:22 tbaldridge: no, I have one namespace that includes many functions, the supporting code for those functions is quite large. Thus, I'd like to keep all protocols in one namespace, and the common implementations of those namespaces in another.

12:22 So yeah, I'm going to figure out a better way.

12:26 arrdem: tbaldridge: I guess it depends on how big your "common case" implementation is, but I would say try to group the common case with the protocols and then provide the special cases elsewhere.

12:27 ppppaul: i have an orange. i would like to somehow use agents to help me devour this orange, but i haven't used them before and i'm wondering if there is something i should read first... some sort of agent tutorial possibly related to oranges

12:27 silasdavis: and what will you call your agent?

12:28 no7hing: :D

12:28 arrdem: silasdavis: IFruitEater, FrutEatingAgent

12:42 * justin_smith has a similar need for an agent only visible in its own namespace, with an integer handle, a "license" if you will

13:01 daydreamt: Does irclj support connections to irc servers that use ssl?

13:53 MarcoPolo: ,(println "test")

13:53 clojurebot: test\n

13:55 MarcoPolo: ,(let [x

13:55 (for [x (range 10) ]

13:55 (do (println "Evaling" x)

13:55 [x]))]

13:55 (first x))

13:55 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

13:56 MarcoPolo: &(let [x

13:56 (for [x (range 10) ]

13:56 (do (println "Evaling" x)

13:56 [x]))]

13:56 (first x))

13:56 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

13:56 MarcoPolo: ,(let [x (for [x (range 10) ] (do (println "Evaling" x) [x]))] (first x))

13:56 clojurebot: Evaling 0\nEvaling 1\nEvaling 2\nEvaling 3\nEvaling 4\nEvaling 5\nEvaling 6\nEvaling 7\nEvaling 8\nEvaling 9\n[0]

13:58 MarcoPolo: So my understanding of for was that it returned a lazy seq, so when I do first I expect it to just run enough code to give me 0 (in the example), why is it running the code for 1-9?

13:59 dnolen_: MarcoPolo: putting side effects into lazy seqs is generally a bad idea.

13:59 MarcoPolo: and you'll run into issues because of chunking

13:59 clojurebot: I don't understand.

13:59 beaky: hello

14:00 dnolen_: unless you stop using range and use something like (take 10 (iterate inc 0)), or wrap range in something that forces actual one by one evaluation

14:01 pl6306: How do I and a number of entries into a map? I think it is probably apply assoc any one have simple example?

14:02 dnolen_: pl6306: into

14:03 pl6306: thanks

14:05 MarcoPolo: @dnolen_ I just have the side effect in there to see when it is being evaluated, and what do you mean by chunking?

14:05 dnolen_: ,(into {} [[:foo 1] [:bar 2])

14:05 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

14:05 MarcoPolo: Doesn't range return a lazy seq as well?

14:05 ,(type (range 10))

14:05 clojurebot: clojure.lang.LazySeq

14:05 dnolen_: MarcoPolo: it's lazy when/how it evaluates is a mostly implementation detail if your code is pure.

14:06 MarcoPolo: as an optimization some types returns chunked sequences when seq'ed to reduce allocation/step overhead

14:07 MarcoPolo: dnolen: Okay, that makes sense. Thanks

14:07 ,(let [x (for [x (take 10 (iterate inc 0)) ] (do (println "Evaling" x) [x]))] (first x))

14:07 clojurebot: Evaling 0\n[0]

14:07 MarcoPolo: yup :)

14:08 goza: hi everyone, is there a way of replacing specific elements of a tree (as nested seqs)? I've tried using clojure.walk, but I'm not sure how to use it with the nesting.

14:10 MarcoPolo: goza: This might be what you are looking for: http://clojuredocs.org/clojure_core/clojure.core/update-in

14:10 goza: or if you don't want an update function and just replace a value you can use assoc-in http://clojuredocs.org/clojure_core/clojure.core/assoc-in

14:11 goza: MarcoPolo: thanks, I'll look into it.

14:12 MarcoPolo: ok, so is it recommended to represent the trees with maps instead of seqs?

14:13 gdev: ,(doseq [even [2 4 6] odd [3 5 7]] (print (- odd even)))

14:13 clojurebot: 135-113-3-11

14:14 asteve: ,(= 1 nil)

14:14 clojurebot: false

14:14 asteve: ,(= 1 'nil)

14:14 clojurebot: false

14:14 asteve: hah

14:15 gdev: ,(doseq [even [2 4 6] odd [3 5 7]] (print (- even odd)))

14:15 clojurebot: -1-3-51-1-331-1

14:15 gdev: ,(doseq [even [2 4 6] odd [3 5 7]] (print (* even odd)))

14:15 clojurebot: 61014122028183042

14:15 gdev: ,(doseq [even [2 4 6] odd [3 5 7]] (prn (* even odd)))

14:15 clojurebot: 6\n10\n14\n12\n20\n28\n18\n30\n42\n

14:17 MarcoPolo: goza: I feel like it's easier to use when you use maps, but it depends on what you are using the tree for

14:18 goza: MarcoPolo: ok, cool. When should I use other structures?

14:30 gdev: so in emacs i evaluate a doseq and it just returns nil instead of printing out the values

14:30 ,(doseq [x [1 2 3] (prn x))

14:30 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

14:30 gdev: ,(doseq [x [1 2 3]] (prn x))

14:30 clojurebot: 1\n2\n3\n

14:33 gdev: nvmnd, it was printing out in the nrepl buffer instead of the message buffer

14:35 prn prints to the nrepl buffer and everything else prints to the message buffer

14:36 rlb: what's a reasonable choice these days for xml manipulation -- say I need to read an xml document, make some modifications, and write it back out?

14:36 chronno: gdev: the message buffer gets the result of the form you evaluate

14:37 gdev: hence the nil of the doseq

14:37 MarcoPolo: goza: I'm still relatively new at this, so anyone else feel free to correct me. I use vectors where I would usually want an array is most other languages, but I write code to work with seqs so it won't matter if it is a vector or list (or lazyseq). hashmaps ar helpful when you want to represent attributes of something or most trees. I think it actually uses trees on the backend

14:37 rlb: (I've used data.zip a bit in the past, but didn't know if that was still a good choice.)

14:39 gdev: chronno:) yeah, I just realized that the doc for doseq says it returns nil thanks

14:41 justin_smith: gdev: also, prn returns nil

15:02 gdev: if you evaluate an sexpression in emacs with C-x C-e and the message buffer just sits there saying "C-x C-e" that means that the evaluation is still taking place?

15:03 nDuff: gdev: Typically, yes.

15:04 gdev: nDuff:) thanks, does it time out if it takes too long? I just realized this expression updates 18 thousands rows in the database

15:05 18 thousand I meant, not 18 1000s

15:05 nDuff: gdev: No, but you should be able to interrupt it yourself. Unfortunately, I don't remember the keybindings offhand.

15:06 gdev: nDuff:) she doesn't seem to be responding to C-x g

15:07 or C-g rather

15:07 justin_smith: C-c C-c should send an interrupt iirc

15:07 but not kill the shell, just stop the current calculation

15:08 gdev: justin_smith:) thanks, now "C-c C-c" is hanging out in my buffer, how long does it take to kill it?

15:08 justin_smith: lol

15:08 no idea

15:08 howdynihao: hi guys regarding lazy sequences, i have a question about how take-nth or take-last work

15:08 justin_smith: it could be trying to roll back now

15:08 howdynihao: does clojure actually compute every item in the sequence when it's "skipping" ?

15:09 for instance (take-nth 10 (range 100)) does it actually compute 1,2,3,4,5,6,7,8,9 ?

15:10 gdev: justin_smith:) okay, well C-x C-c seems to have done the trick

15:10 justin_smith: that's one way to do it

15:13 howdynihao: different lazy seqs obey different rules, some know how to jump straight to an element without computing the previous. range would pretty much be guaranteed to be one of them

15:15 for example iterate needs to do all the calculations at least once, and is also a lazy seq, but map only needs to know the value of the inputs at that index to get the value for the ouput at that index

15:16 so if the inputs to map can jump to an index, map can too

15:16 dnolen: justin_smith: howdynihao: range doesn't work that way as far as I know, nor any of the seqs operations that I'm aware of.

15:17 justin_smith: doesn't work which way?

15:18 dnolen: justin_smith: there is no "skipping", take will seq it's argument and it must step through each element of the seq, chunking allows some seqs to move 32 elements at time, but you still have to go through everything.

15:18 justin_smith: ok, good to know

15:19 yeah, based on (time (last (range x))) it really is generating all the intermidiaries, which surprises me greatly

15:19 dnolen: howdynihao: but note take-nth is lazy so it won't actually compute 1-9, until it needs to

15:20 howdynihao: right ok

15:20 i was curious if it had some magical / cool implementation for 'skipping'

15:29 lynaghk: ping: seancorfield

16:02 danneu: if you don't need to share state across threads (independent computations), are you back to just doing Java Thread dispatches?

16:03 gdev: quick code review: (doseq [row results] (update table (set-fields {:total (+ (rand-int 100) (:subtotal row))}) (where {:dept [= 1 10]}) (where {:prod_id (:prod_id row)}))))

16:04 that's a pretty complex statement but I think it does good enough row mapping

16:04 danneu: gdev: prob be easier to post the gist link

16:04 gdev: danneu:) good call, thanks

16:07 danneu: gdev: i personally like to separate the computations from the function i'm actually trying to write

16:08 i.e. i'd use `let`

16:08 (let [total (+ (rand-int 100) (:subtotal row))] ...)

16:13 and yeah i know you were prob looking for some higher level help, but that's all ive got

16:13 tieTYT2: maybe one of you swing experts could help me with this: http://stackoverflow.com/questions/16229526/how-do-you-remove-the-ctrlc-action-on-a-jfilechooser

16:16 jcromartie: whenever I do "C-u 8 0 ;" I know it's time to make a new namespace

16:20 gdev: heres my gist for the code above https://gist.github.com/gdeer81/c9d3ea6d4db3036aa2d5

16:25 why is that gist not showing up, wtf github

16:33 okay, since gist is being funny, here is my code in pastebin http://pastebin.com/9HLZUD5t

16:34 Raynes: refheap.com

16:34 kencausey: Lighttable on Win7/64bit: I try to eval-in-editor a defn and I get "ich number35 nz- octagon Odinodin Okasu OlegYch omaciel omarkj â arohner

16:34 | ordnungswidrig oriig Orva othiym23 owengalenjones OwenOu ozataman ozzloy pandeiro pendlepants pepijndevos PeregrinePDX pinupgeek pisketti pjstadig pl6306 pmaes ppppaul prip prismatictrail â arrdem

16:35 | prof-freud przl pyrtsa pyykkis qfrstory quackv4 quuxman qz racycle raek rafl Ragnor rahcola rasmusto ravster Raynes Raynos rboyd rbranson rbxbx rcarey3 rcg rcj_ rdd redinger reeses reiddraper â AsgardBSD_

16:35 | reikalus2kka rfgpfeiffer rikur rippy rkneufeld rlb rlr rmarianski rmrfchik robear robink rocco`` rodnaph rotty rowth rpg rplaca russfrank ryanf S11001001 saiam saint_cypher samrat___ saolsen â Ash

16:35 | sattvik saurik scalabl3 scgilardi scode Scorchin scottj seancorfield seangrove SegFaultAX septomin serpent213 sethalves Sgeo shadower Shambles_ SHODAN si14 Sigma silven simcop2387 sjl Sonderblade â astrax

16:35 | sorenmacbeth spjt spligak srcerer sritchie ssedano ssideris st3fan stain stask strax sturner sundbp synfinatic TakeV tali713 tbaldrid_ tboyt tcrawley|away tcrayford technomancy telex terjesb terom â atman

16:35 | TEttinger2 tfnico___ the-kenny TheBusby TheMoonMaster thorguy__ tieTYT tieTYT2 TimMc tippenein tmarble toast tobyp tofflos tolsen tomaw tomku tomoj tos9 ToxicFrog tpope trinary TristamWrk Trystam â atyz

16:35 Raynes: That;s awesine,

16:35 kencausey: | Tuna-Fish tvaalen twem2 txdv tyler_ ucb ujihisa vickaita vsayer walter warpy wastrel wdouglas weavejester wei_ whee whilo whoahbot Wild_Cat Wild_Cat` wilfredh wilk wink wolanski wookiehangover â augustl

16:35 | wormphlegm worrelsik wyan xeqi Xorlev xybre yacin yacks Yamazaki1kun yason yastero yazirian yedi yogthos ystael zaargy zaiste zakwilson zaphar_ps zeekay zenoli zerokarmaleft ziman zodiak â averell

16:35 dakrone: whoa

16:35 kencausey: | zz_Inoperable] â AWizzArd_

16:35 Raynes: That's awesome.

16:35 kencausey: 15:31:40 -- | Channel #clojure: 608 nicks (1 ops, 0 halfops, 0 voices, 607 normals) â azkane

16:35 rbranson: wtf

16:35 technomancy: ops?

16:35 kencausey: Did any of that go through? Sorry

16:35 Raynes: I dunno how you managed to just print everything.

16:35 omaciel: oy

16:35 technomancy: chouser: ^

16:35 rbranson: PRINT ALL THE THINGS

16:35 Raynes: technomancy: He didn't do it on purpose.

16:35 technomancy: Raynes: doesn't mean he shouldn't be briefly banned

16:35 * kencausey blushes

16:35 TheMoonMaster: Good job.

16:36 omaciel: :)

16:36 arohner: we enforce the death penalty for all crimes here

16:36 gdev: wow that woke everyone up

16:36 synfinatic: on the plus side I didn't realize there was someone here with the nick wookiehangover

16:36 * kencausey slinks away as he is too embarassed to actually ask a question now

16:36 russfrank: awww.

16:36 wei_: hi everyone

16:37 TheMoonMaster: lol

16:37 gdev: Raynes:) https://www.refheap.com/paste/13989 is that better?

16:39 wei_: which has better performance, or are they the same? (first (rsubseq m <= 1)) or (last (subseq m <= 1))

16:39 gdev: didn't realize refheap doesn't do line wrapping, grr

16:40 justin_smith: gdev: http://pastebin.com/UfZ5Jxtc version with formatting and destructuring

16:40 nothing big

16:42 gdev: justin_smith:) thanks, it looks a lot nicer, will it perform better? lemme run it and see

16:42 justin_smith: I dunno, destructuring may perform a little better than inline accesses, but that is just speculation

16:43 arrdem: when is it idiomatic to use (load)? I'm just looking at how clojure.pprint used to (load) in code to keep the main pprint file small.

16:43 amalloy: arrdem: "never" is close enough

16:44 arrdem: amalloy: somehow I figured that was gonna be the answer...

16:45 meh I can imagine a ns layout where I don't need to (ab)use load. use case destroyed.

16:45 gfredericks: what if pre/post conditions could have metadata with an error message?

16:45 Bronsa: gfredericks: eh, I often wished they could have

16:46 gfredericks: I wonder if the core folks would approve of that

16:59 tieTYT2: does Bodil Stokke hang out here?

17:00 ah, probably :)

17:00 this language looks like a great idea: https://github.com/bodil/BODOL

17:01 arrdem: what the... utf8 chars for fn application and lambda declarations?

17:03 trinary: "If you're discouraged by the curious absence of λ and ƒ on your keyboard, you can substitute Clojure's fn and defn or Common Lisp's lambda and defun respectively." :)

17:04 tieTYT2: arrdem: it's optional

17:04 I think it'd give a better first impression if it used fn/defn (or something like that) instead of the function and lambda symbols

17:05 dnolen: CLJS ObjMap vs. PersistentArrayMap perf update http://dev.clojure.org/jira/browse/CLJS-499

17:05 Bronsa: or use emacs and M-x toggle-input-method and write \lambda :)

17:05 arrdem: Bronsa: or just have pretty-lambda installed :p

17:05 Bronsa: heh

17:06 * arrdem pushes shen onto the reading heap

17:06 Bodil: tieTYT2: It's been known to happen. :)

17:07 And yeah, I feel the world's pretty much ready for non-ASCII character sets by now. :)

17:07 tieTYT2: as an american, I don't even want to go metric yet

17:09 Bodil: But yeah, it's optional - sadly, keyboards aren

17:09 aren't quite there yet. :(

17:09 tieTYT2: yeah

17:09 yogthos: just have to wait for BCI I guess :P

17:13 tieTYT2: Bodil: From the tests and the front page, I don't see any examples of static typing

17:13 but the intro says: Clojure is great, but sometimes I miss static typing.

17:14 Bodil: tieTYT2: No, it's not implemented yet. I'd say I'm planning to do it over the weekend, but I doubt it's a two day job. :)

17:14 yogthos: tieTYT2: https://github.com/frenchy64/typed-clojure

17:14 tieTYT2: yogthos: did you mean to link me to https://github.com/clojure/core.typed ?

17:15 yogthos: tieTYT2: indeed :)

17:15 tieTYT2: k i'll watch this video

17:19 nathanic: howdy all, does anyone happen to know of a lib that can parse XML into hiccup-like structures? it looks like clojure.data.xml can go from hiccup-style vector trees to XML (sexp-as-element), but I can't seem to convince it to go the other direction. it just wants to serialize into its own much more lazy tree format.

17:20 s/lazy/verbose/

17:24 arrdem: any suggestions for cleaning up this file or would you say it's good as is? https://github.com/arrdem/pascal/blob/master/src/me/arrdem/compiler/symbols.clj

17:25 (199 LoC, mostly (derfrecord) forms)

17:26 justin_smith: it would be easier on the eyes if you added :as compiler to the :require statement rather than using the full namespace on every reference to it

17:27 arrdem: justin_smith: oh. herp derp good one.

17:35 gdev: justin_smith:) so that version of the query takes around 20 minutes

17:35 justin_smith: as compared to?

17:36 gdev: compared to nothing, i didn't benchmark the other one since i figured it would be slower

17:37 I also realized i didn't need to do two where clauses, since the prod_id was unique identifier for each row

17:37 justin_smith: code layout can help with things like that

17:38 gdev: indeed =)

17:41 ppppaul: i layout my code like a fruit basket

17:45 doriantje-: I layout my code like spaghetti ._.

17:45 ppppaul: i love spaghetties

17:45 justin_smith: with namespacing you can at least aspire to ravioli layout

17:46 gdev: so I'm not sure if I just need to break the update query out into multiple calls to the database or if I just have my app play some relaxing music while the user waits 20 minutes

17:46 doriantje-: My code is a poor man's pasta.

17:50 ppppaul: mock pasts?

17:50 mock pasta*

17:54 anyone here experimented with simulant?

17:54 Okasu: Guys, can you give me a link for awesome talk from one guy whos ancesotor was a convict and was sent to australia?

17:55 I can't remember name of that guy.

17:56 jorgeu: bad clojure joke: how can you tell if someone is a clojure dev? ......... it doesn't matter he will tell you!

17:56 arrdem: I suppose there is that...

17:56 justin_smith: if you work backend, how do you pretend you are a java dev?

17:57 don't say anything, they will assume you are

17:57 jorgeu: yup

17:57 I have seen that trend

18:01 justin_smith: "backend lisp developer? are you joking? that exists?"

18:02 ozzloy: https://www.refheap.com/paste/13991 the repl works for simple things, but i'd like to get rid of that error

18:02 Apage43: try frontend lisp developer

18:02 ozzloy: the internet doesn't show much for it

18:03 arrdem: Apage43: but clojurescript is almost a thing so..

18:03 ozzloy: line 15

18:03 ppppaul: jorgeu, please, no more jokes

18:03 Apage43: ozzloy: your project.clj in that folder probably specified a :main or :repl {:init …}

18:04 ozzloy: Apage43, this is from the clojure koans

18:04 justin_smith: ozzloy: does this happen when you use lein new and open a repl there, or only in the clojure koans?

18:04 ozzloy: i'll see

18:05 https://www.refheap.com/paste/13992 doesn't happen in a new project

18:09 abp: ozzloy: Update leiningen.

18:09 ozzloy: abp, ok

18:13 https://www.refheap.com/paste/13993 now it looks worse

18:14 oh the repl appears to work though

18:14 do i have to do lein project update or something inside clojure-koans?

18:14 justin_smith: this probably has to do with that wacky thing the koans do where they reload files if you edit them and show you the next koan

18:15 ozzloy: oh i have the test runner runnign

18:15 i should kill that maybe. i'll try that and see what happens

18:15 justin_smith: there is a "lein upgrade" command

18:16 ozzloy: https://www.refheap.com/paste/13994

18:17 justin_smith, i did that already

18:17 justin_smith, upgraded lein

18:19 justin_smith: I don't know if the koan run thing would interfere with a repl, but I think the koan project is set up so running lein against it's project.clj will mess up unless you are using the lein koan plugin

18:19 that is what I meant by "probably has to do with that wacky thing the koans do"

18:19 ozzloy: i just tried creating a new project and a repl in there since i've updated lein and that worked

18:19 i'll just use a repl in a different project

18:19 kinda wonky

18:19 but the koans are pretty self contained

18:21 thanks abp justin_smith and Apage43

18:44 seancorfield: lynaghk: you pinged me a few hours ago? sorry, was at lunch...

19:09 gdev: so i just looked at the oracle trace file and my application has a 1 to 1 mapping of sql statements to database records

19:11 justin_smith:) yea I don't think I picked the right solution for this one

19:14 justin_smith: gdev: yeah, data modeling is not a simple thing, and the design can have huge consequences

19:34 Sgeo: Someone pinged me

19:34 Are there public logs?

19:34 ivan: it was a spammer

19:34 Sgeo: Oh

19:35 ivan: http://clojure-log.n01se.net/date/2013-04-26.html

19:35 trinary: I think it was a mis-copy-paste actually :)

19:35 Sgeo: Shouldn't public logs be in topic?

19:36 ivan: trinary: no honest man would use an IRC client without paste detection ;)

19:36 trinary: harsh!

19:36 justin_smith: I have had erc do that before

19:37 worst thing, is when it is pasting back the contents of the same buffer, you cannot tell it has happened, because the buffer looks the same

19:38 ivan: yeah, I'm sure I would leak all of my secrets within a couple hours of ERCing

19:39 howdynihao: how can i get [1 2 3] [1 2 3] to be [ [1 1] [1 2] [1 3] [2 1] ... ]

19:39 well actually, how do i put that into words

19:39 technical term

19:39 gfredericks: cartesian product?

19:40 ,(let [as [1 2 3] bs [:c :d :e]] (for [a as, b bs] [a b]))

19:40 clojurebot: ([1 :c] [1 :d] [1 :e] [2 :c] [2 :d] ...)

19:40 gfredericks: if you have just two sequences, that'll work. If the number varies, I think there's a contrib library with combinatorics functions

19:40 also you could write your own and it's lots of fun

19:41 (fn cp [& colls] (if (empty? colls) [[]] (for [x (first colls), xs (cp (rest colls))] (cons x xs))))

19:42 that doesn't work and I don't know why and I'm going to make tacos

19:42 howdynihao: yum tacos

19:42 trinary: hah

19:44 gfredericks: oh I forgot an apply I think

19:45 technomancy: apply tacos

19:45 justin_smith: yeah, that or you can change cp to take a single arg

19:45 Bronsa: gfredericks: math.combinatorics

19:47 gfredericks: [org.clojure/math.tacos "0.1.0"]

19:48 Bronsa: tacos everywhere

19:49 justin_smith: (map (comp eat taco) [:asada :pollo :barbacoa])

19:52 throw a (juxt identity identity) in there and double your tacos

21:21 lynaghk: Is it worth trying to do things like ETag/not-modified in my ring/compojure app, or would it be easier to throw nginx in front of it?

21:24 benkay: i have a tiny helper function in my codebase, and given that functions should be readily passable, I would like to pass this function into a transaction to be run on my transactor in Datomic. wat do?

21:24 gfredericks: benkay: you have to install it on the transactor

21:25 you can't "pass" it since the transactor isn't in the same process as your normal code

21:25 benkay: you speak to the problem exactly, gfredericks. so, implementation would be to include function in schema?

21:26 gfredericks: there's a special mechanism for installing functions

21:26 I'm not sure about the details

21:27 corpsan: gfredericks: I am pairing with benkay right now

21:27 gfredericks: it's in the docs somewherehttp://docs.datomic.com/database-functions.html

21:28 corpsan: is that mechanism the standard run-a-transaction-with { :db/id (d/tempid :db.part/user) :db/ident :my-function :db/fn … }

21:29 gfredericks: yeah that looks right

21:29 corpsan: okay. so i'm a little scared of storing code in my database. sounds like recommended solution is "don't use little helper functions inside transactor. give transactor everything it needs to do what it needs to do"

21:30 gfredericks: yeah if you can get away with that it's certainly simpler

21:30 corpsan: well, i don't want to store code that might change any time

21:30 gfredericks: sure

21:30 corpsan: in this case the helper function is operating on a brittle data structure

21:30 benkay: yeah and i r no trust migrations and schema change

21:33 corpsan: thanks gfredericks!

21:33 gfredericks: np

23:48 echo-area: http://pastebin.com/wnuZKRyA

23:48 Hi.

23:49 I see the clojure program takes more than ten times than the corresponding Java program.

23:49 In the disassembled code, the only difference is some more load/save code in every iteration of the clojure program.

23:50 And I see there are more minor pagefaults in the clojure run.

23:50 Can I explain the longer execution time with this?

23:53 Sorry, I meant the only added code was a `pop'.

23:54 andyfingerhut: A "Hello, world" program in Java takes about 0.2 sec to finish on my machine, whereas in Clojure about 1.1 sec.

23:54 ivan: I hear you should use criterium for microbenchmarks like that

23:54 echo-area: andyfingerhut: That's because of the initialization of RT

23:55 andyfingerhut: Are you not measuring the time taken for a JVM to start, run your code, and then exit?

23:55 tomoj: how do we get ['lam (nom/tie c ['lam (nom/tie d ['var c])])] from '(lam [c] (lam [d] c)) ?

23:55 echo-area: andyfingerhut: But I measured the actual two iterations, not the whole program

23:56 andyfingerhut: I don't see that in your paste anywhere. I saw "time" being used at a shell prompt.

23:56 echo-area: That's only for seeing pagefaults

23:56 (time (p1))

23:56 That is.

23:56 tomoj: there's a pretty obvious non-relational way where you walk through the data and keep a map of symbols to fresh noms, but how can we do it relationally?

Logging service provided by n01se.net