#clojure logs

2013-04-26

04:13sleetdropis there a newer textmate bundle for clojure, the one I find on github still use cake, cake is merged in to lein now
04:17clgvsleetdrop: why dont you use one of the big three dev environments for Clojure: Emacs, Eclipse+Counterclockwise or Vim?
04:17ucbclgv: surely you means emacs, emacs or emacs? </troll>
04:17RaynesWell, probably because he doesn't want to use any of those editors.
04:17clgvucb: nope. I am an active CCW user ;)
04:18ucb:)
04:18clgvRaynes: very likely, but he will get himself in trouble with an unmaintained plugin (or similar) for another editor ;)
04:18Raynessleetdrop: 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
04:20sleetdropclgv:thanks for your advice
04:21amalloyclgv: 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
04:21Raynesamalloy: Go to bed, dude.
04:22sleetdropRaynes: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.
04:23amalloysleetdrop: yes, that's a good approach
04:23amalloyit'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
04:39silasdavison 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
04:39silasdavisit may be what I want..
04:40scottjsilasdavis: not sure if they have anything clojure specific, but there's also prelude and emacs-starter-kit
04:40silasdavisI'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..
04:42nopromptalexbaranosky: you still around?
04:52amalloysilasdavis: emacs support is better, but vim's is quite reasonable as i understand it
04:52clgvamalloy: 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
04:53clgvamalloy: for the purpose of just learning the language pick any editor you like and use the leiningen repl ;)
04:56nopromptis the discussion about vim's clojure support?
04:58scottjnoprompt: appears so
04:58nopromptbecause 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.
04:59clgvnoprompt: not my posts. I just suggested to use Emacs, CCW or vim for Clojure dev ;)
05:00nopromptvim 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.
05:01silasdavisI intend to use both editors
05:01silasdavisI'm also learning to write with my left hand
05:02babilensilasdavis: 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.
05:03nopromptbabilen: totally agree.
05:03babilensilasdavis: 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)
05:04silasdavisbabilen, thanks for those looks interesting
05:04silasdavisdoes the break point feature allow you to inspect variable subsitutions line-by-line?
05:05silasdavisreally missing this in my clojure work
05:06babilensilasdavis: 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.
05:07babilensilasdavis: 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.
05:08noprompti also use both editors, and i came to emacs from vim through evil-mode, and must say i prefer emacs much more.
05:09nopromptpart of that stems from my frustration with viml.
05:10silasdavisbabilen, I'm quite fond of text objects too, particularly for things like vim-surround, is there anything comparable in emacs?
05:10nopromptsilasdavis: there's evil-surround.
05:10nopromptsilasdavis: have you tried evil-mode at all?
05:11silasdavisnoprompt, I'm not a fan of VimL (hand't heard that before), seems much nicer to have lisp config
05:12babilensilasdavis: 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)
05:12silasdavisnoprompt, I haven't I was sort of planning to take the plunge and go native though
05:13nopromptsilasdavis: 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.
05:13babilennoprompt: 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.
05:15silasdavisbabilen, I appreciate the info, would't have found it otherwise
05:15nopromptbabilen: 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.
05:15babilenwhy?
05:15clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
05:16babilenclojurebot: shush!
05:16clojurebotHuh?
05:16silasdavisnoprompt, 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...
05:17nopromptbabilen: 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.
05:17noprompti saw what the emacs environment had to offer, heard about evil-mode and tried it out.
05:19babilennoprompt: 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.
05:20babilennoprompt: 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)
05:21nopromptbabilen: 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).
05:21babilenThere was also a time were the Emacs tooling was working worse than vim-fireplace -- (just google for install problems of slime, ...)
05:22babilennoprompt: 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.
05:22nopromptthere'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.
05:23nopromptbabilen: 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.
05:24nopromptbtw, 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.
05:24babilennoprompt: 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.
05:25silasdavisis tmux better than screen?
05:25babilenmuch
05:25nopromptindeed.
05:26silasdaviscan it run daemonised
05:26babilensilasdavis: sure
05:26silasdavislike 'screen -dmS session-name <command to run unattended>'
05:27babilenhaha
05:28silasdavisbecause I should probably know about this stuff
05:28nopromptbabilen: 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?
05:29nopromptsilasdavis: 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.
05:30babilennoprompt: 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"
05:30nopromptbabilen: point well taken.
05:32silasdavisthis perhaps links to the tension between elegant powerful tools and integrated possibly compromised tools
05:32nopromptbabilen: emacs + evil mode is certainly not vim, i'll give you that.
05:32silasdavisfor example visual studio with the resharper plugin really is quite powerful in its code intelligence
05:33silasdavisit'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
05:33silasdavisI'm interested to see what happens with lightbox
05:33silasdavislighttable rather: http://www.lighttable.com/
05:33nopromptthe 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.
05:34babilennoprompt: 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
05:34nopromptsilasdavis: so am i. i think light table might turn out to be a real nice place between emacs and vim.
05:34babilenyeah
05:35silasdavisyou've probably come across this, but in case not: http://blog.sanctum.geek.nz/series/unix-as-ide/
05:36nopromptbabilen: it took me one week to return to same level of productivity w/ emacs + evil-mode coming from vim.
05:37noprompton 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.
05:38babilennoprompt: 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 ..
05:39babilen(or preferences)
05:39silasdavishmm I managed unbalance my parenthesis with emacs paredit
05:39nopromptbabilen: i won't disagree with you there. and will agree to leave it up to personal preference/philosophy.
05:40silasdavisbut using 'kill region'
05:40silasdavisshould that be possible..?
05:40babilensilasdavis: Can you reproduce that in vim ;)
05:40nopromptsilasdavis: sure that can happen. it can happen with vim's paredit too.
05:41nopromptnothing's stopping you from hitting 'x'.
05:42babilenx won't unbalance paranthesis (or delete a pair)
05:42nopromptor 'r', 'R', 'cw', etc.
05:43babilenthat'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 :)
05:43nopromptbabilen: oh yeah, you're right.
05:44silasdavisI am using some weird heavily customised emacs config
05:44nopromptwhat's not true? you can use 'r', 'R', and 'cw' on a ')'.
05:44silasdavis<noprompt> silasdavis: sure that can happen
05:44nopromptsilasdavis: did you customize it?
05:45silasdavisno: https://github.com/overtone/emacs-live
05:45silasdavisif I do C-w
05:45nopromptthen throw it in the trash and customize it yourself :)
05:45silasdavisit will delete until the end of line it seems
05:45silasdavisand will unbalance parens
05:45nopromptyeah, hang on. i think i know what you want.
05:45silasdavisnoprompt, but it's so... colourful
05:46babilensilasdavis: Please read http://clojure-doc.org/articles/tutorials/emacs.html (it's based on technomancy's starter kit IIRC)
05:46nopromptthere's a way to kill an sexp w/o fucking the whole thing up.
05:46babilensilasdavis: but then: use vim!
05:46babilen</end>
05:49babilensilasdavis: 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)
05:50rodnaph_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... :(
05:50rodnaph_i'm sure it was cgrand... but can't see anything on his github.
05:51rodnaph_hehe, well ping me if you remember first, thanks :)
05:52silasdavisbabilen, do they package paredit or shall I have that too?
05:52rodnaph_babilen: i've been meaning to try vim-redl for a while, will give it a go now (i'm still using VimClojure)
05:54nopromptsalisdavis: paredit-kill-sexps-on-whole-line, which is a mouthful, but i think it's what you're looking for.
05:57nopromptwhoops, my bad it's simply paredit-kill-sexps-on-line.
05:58noprompti have that bound to "D" in my evil normal state. it won't screw up the balance.
05:59babilenrodnaph_: Oh, you /have/ to switch to vim-fireplace from VimClojure. It is much better :)
06:00babilensilasdavis: paredit is available, sure ... https://bitbucket.org/kovisoft/paredit/
06:04nopromptfwiw, the maintainer of vim's paredit plugin is a very good guy.
06:04noprompthe fixed several bugs i discovered while working with the plugin and was quick to fix the issues.
06:05nopromptthe plugin is excellent.
06:05nopromptslimv actuall isn't bad either considering vim's lousy support for that sort of thing.
06:06nopromptoff topic, does anyone use korma?
06:10rodnaph_babilen: ogm i have a semi-decent repl in vim! :D
06:10silasdavisnoprompt, yes but I only picked it up about a week ago
06:10babilenrodnaph_: I'm using "lein repl" but yay!
06:11rodnaph_i was using lein repl, with slimv (which worked pretty well tbh). gonna give this a go for a bit.
06:12rodnaph_actually... i don't seem to be able to send stuff to the repl...
06:13noprompthttp://f.cl.ly/items/3w0E1A420H043r383p2G/Screen%20Shot%202013-04-26%20at%203.09.59%20AM.png
06:13rodnaph_noprompt: if only i could get used to emacs... have given it a go a few times, but always come back to vim.
06:14nopromptrodnaph_: i only came to it via evil-mode and key-chord.
06:15borkdudehmm, 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
06:15noprompti also had to add a few small things https://github.com/noprompt/matilde/blob/master/emacs.d/noprompt-evil.el#L7-L29
06:16nopromptborkdude: i'm assuming the fn does something like (fn foo [& {:as opts}]?
06:17borkdudenoprompt yes, the arglist looks like this: [& {:keys [weeknr year description budget name] :as k}]
06:17rodnaph_borkdude: you can use apply if u can flatten your map to a list... ?
06:18silasdavisbabilen, I'm trying to enable paredit mode in a running vim with let g:paredit_mode = 1
06:18silasdavisdoesn't seem to wrok
06:18borkduderodnaph_ 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
06:18silasdavisIt should auto close a '(' right?
06:18silasdavisI'm in an empty buffer
06:18nopromptborkdude: this might be ugly but, (apply f (-> {:foo "bar" :baz "quux"} seq flatten))
06:18rodnaph_silasdavis: in a clojure file? it'll probably use the filetype
06:19borkdudenoprompt or maybe I just have to change the other function to expect a map ;)
06:19nopromptborkdude: that's what i've tended to do.
06:20silasdavisrodnaph, I'm not in a clojure file but I think that command should be turning it on
06:20babilensilasdavis: Are you editing a .clj file? Can you run ":call PareditToggle()" ?
06:20nopromptborkdude: [& {:as opts}] looks nice but it can throw a wrench in the composability machine.
06:21silasdavisoh it works in a clj file
06:21silasdavisbabilen, the toggle function works
06:21silasdavisg:paredit_mode = 1 doesn't
06:21silasdaviseven in vimrc
06:21silasdavisperhaps it only works to disable it (it is listed in docs)
06:21babilensilasdavis: 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.
06:21nopromptborkdude: [& {:as opts}] is kinda like having an implicit hash in ruby - it's no fun and confusing.
06:22nopromptreduce the cognitive load by avoiding that kind of thing.
06:22babilensilasdavis: 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.
06:23borkdudenoprompt I think I read somewhere (in the style guide?) that (foo :a 1 :b 2) was more idiomatic than (foo {:a 1 :b 2})
06:25nopromptit 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.
06:27nopromptto muddy things, that's just my opinion. :)
06:27nopromptpersonally i prefer explicit over implicit.
06:28tomojhow do you untie a nom? :(
06:28nopromptwhen you start dabbling in implicit styles of coding you're just asking for it.
06:30nopromptborkdude: 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.
06:34clgvborkdude: 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
06:34mindbender1is there a function to remove a thing from vector
06:35clgvmindbender1: yep, for the last element: ##(pop [1 2 3])
06:35lazybot⇒ [1 2]
06:35mindbender1(remove [1 2 3] 3)
06:35mindbender1what of (remove [1 2 3] 2) => [1 2]
06:36mindbender1what of (remove [1 2 3] 2) => [1 3]
06:36clgvif you want to keep the vector datatype you can only add to and remove from its end
06:37mindbender1is there a structure supporting this wsh
06:37mindbender1wish
06:38borkdudeyou can also use subvec (but personally I've never needed it)
06:38noprompt,(doc subvec)
06:38clojurebot"([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."
06:38clgvright. but you cant compose two subvecs into one vector again efficiently
06:39mindbender1I think this will be a convinience
06:40clgvremoving efficiently works with sets and hash-maps.
06:41clgvmaybe you need an hash-map with sorted keys
06:41clgv*removing arbitrary elements efficiently
06:42mindbender1though based on arrays => https://www.refheap.com/paste/13980
06:42mindbender1but looks convinient
06:43sveduboisHow can you write these clojurescript lines in a short way?
06:43sveduboishttps://www.refheap.com/paste/13979
06:47clgvmindbender1: is this a real array underneath? if so there are worst case O(n) elements to shift.
06:48clgvmindbender1: just in case this code happens to be part of a bottleneck
06:49clgvsvedubois: is there a `doto` macro in clojurescript?
06:49nopromptclgv: yes.
06:50clgvhmm do-set would be more appropriate since the expressions are nested
06:52nopromptwell i think i'm out for the night. take care everyone. :)
07:02mindbender1what the cost of this => (defn remove [v o] (vec (filter #(not= % o) v)))
07:04mindbender1clgv: sorry I didn't see ur ping
07:05mindbender1the doc says it's array like
07:06mindbender1I don't what the author meant but it probably runs fast enough for goog
07:06silasdavisbabilen, is there a better alternative to ctags for use with clojure?
07:21sveduboisI have tested the defmacro set-all! from:
07:21sveduboishttp://stackoverflow.com/questions/4579679/factor-clojure-code-setting-many-different-fields-in-a-java-object.
07:21svedubois(defmacro set-all! [obj m]
07:21svedubois `(do ~@(map (fn [e] `(set! (. ~obj ~(key e)) ~(val e))) m) ~obj))
07:21sveduboisBut it doesn't work. Any advice?
07:26sveduboisPerhaps, ClojureScript does support macros, but only in .clj files that are imported with require-macros.
07:42noidisvedubois, yes, you can only write macros in Clojure, not ClojureScript
07:44silasdaviswill that change?
07:44silasdavisthis refers to clojurescript macros: http://blog.getprismatic.com/blog/2013/1/22/the-magic-of-macros-lighting-fast-templating-in-clojurescript
07:45mpenetit's clojure macros generating clojurescript really
07:45silasdavisah yes I see https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure
07:45mpenetthis could change with "cljs in cljs " or something
09:07meliponehello
09:07meliponeI am using the memoize function. How can I clear the cache and start again without restarting the repl?
09:08ucbmelipone: what cache?
09:08meliponeI mean whatever is memoized by the function
09:08ucbI'd say just create a new memoised function
09:09ucbe.g. if you do (def memo-f (memoize f)) just redef memo-f in your repl
09:09meliponeha, okay, thanks
09:13clgvmelipone: you can do that with core.memoize an additional library
09:16silasdavisdoes anyone know of a declarative database dsl for clojure
09:16silasdavisso you can just write a definition
09:17silasdavisand have it magically update your database schema to want you want
09:18jcromartieis there a generic HOF that reverses the arguments to a function
09:18clgvsilasdavis: maybe korma is what you want - check for yourself
09:18jcromartie(defn reverse-args [f] (fn [& args] (apply f (reverse args))))
09:18clgvjcromartie: nut built-in
09:19cmdrdatssilasdavis: I've written http://www.github.com/yuppiechef/macaron which does that
09:19clgv*not
09:19cmdrdatssilasdavis: I do need to add some examples though - it's not entirely obvious when you look at the code
09:20silasdavisclgv, 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
09:21silasdaviscmdrdats, interesting thanks, I've also found: https://github.com/budu/lobos
09:21silasdavisIt seems he intends to provide declarative definitions too: https://groups.google.com/forum/?fromgroups=#!topic/lobos-library/CE4itjz-yPo
09:21nDuff(all macros! can't compose!)
09:22silasdavisif you play with (analyze-schema) it outputs a sort of abstract database language
09:22clgvnDuff: no idea, I just read the advertisement pages ;)
09:23silasdaviscmdrdats, can macaron deal with databases with stuff in them already?
09:23nDuffsilasdavis: see its update-table call.
09:24nDuffclgv: Really does depend on what your style is. If you tend to code more compositionally, though... korma isn't fun.
09:24jcromartieI have not been a big fan of any of the db libraries though
09:24jcromartieactually ClojureQL seemed really nice
09:25jcromartieI think it would be better to start with some abstraction around database tables
09:25jcromartietreat them as references
09:26jcromartienested/tree inserts and updates are really hard though
09:26jcromartieI think people are used to the Rails way, which is pretty good, and so they try to make Clojure do that
09:28silasdavisnDuff, 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
09:29nDuffsilasdavis: 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.
09:29silasdavisjcromartie, lobos seems to have ambitions to solve this in quite a general way, updating via diff
09:30silasdavisnDuff, sql server/database projects actually do some of this reasonably well. Obviously they are digusting
09:30jcromartieyou need a declarative way to specify what to do under certain differences
09:30silasdavisbut you can do a reasonably full sort of diff
09:30jcromartieit's simpler to just say "step 1, do this; step 2 do that"
09:30jcromartieI wrote a migration tool which worked
09:32silasdavisjcromartie, 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
09:32jcromartieI've got a real solution for this, of course :)
09:32jcromartiestore all changes to the system as events, and then cache them in a DB or in memory or however you want
09:33jcromartieI mean cache the results
09:33jcromartieso you handle schema changes by dropping and recreating the DB with the new schema and replaying events
09:33jcromartiethe DB speed tends to be a bottleneck though, and the downtime required is pretty unrealistic
09:34jcromartieit only makes sense if you're going to use the DB for reporting and keep the "current" system state in memory
09:35cmdrdatssilasdavis: sorry, got pulled away - yes, it deals with tables that already have data
09:35cmdrdatssilasdavis: it's currently bound to mysql - but I'm planning to abstract it out so that I can use it with datomic
09:36gdevcmdrdats:) what does? sorry I just got here and this conversation seems relevent to what I'm doing at the moment
09:36cmdrdatsgdev: https://github.com/Yuppiechef/macaron - a little db abstraction library I wrote a while ago
09:36silasdaviscmdrdats, perhaps you should keep an eye on lobos/lobo mailing list too, you have similar aims
09:38silasdavisalthough I just realised that post I linked to was 2011
09:38cmdrdatssilasdavis: 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
09:38cmdrdatsso there's no 'migration' path
09:39cmdrdatsalso, 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)
09:39gdevcmdrdats:) 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
09:41silasdaviscmdrdats, 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
09:42silasdavisalso if you're going for CRUD/entities, perhaps you could use sqlkorma's relational dsl to generate/adapt the tables
09:42silasdavisit seems they contain the necessary information
09:44cmdrdatssilasdavis: sounds interesting - I'll definitely take a look
09:45gdevsilasdavis:) 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
09:46mynomotogdev: It doesn't create tables. Or drop, or alter them.
09:46gdevmynomoto:) ohhai, I know, I know, it's not an orm, that's what I was getting at =)
09:47gdevI was up in the wee hours of the morning trying to update rows in a database from clojure with no luck
09:49mynomotogdev: gfredericks solution did'n work? It should have.
09:49gdevI think the dataset is too large so it's like saying (update everyone-in-the-world (set-field {:is_cool true (where {:name "gary"}))
09:51mynomotogdev: but can you do the select part alone? You you can, it shouldn't be a problem.
09:52gdevmynomoto:) Yeah, I can do the select part, but doing gfredericks solution just made it hang
09:52gdevmynomoto:) so I tried just doing a simple update with a hardcoded number and that hung too
09:53gdevnot sure if database was having issues but writing to it seemed to be a problem
09:53mynomotogdev: but one simple update work?
09:54mynomotogdev: can you write to the db at all?
09:54gdevmynomoto:) 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
09:54gdevnow that I'm at work on the company lan I'm trying it again
10:04pl6306Why won't this "(map #(% (str "|" %)) ("A" "B" "C"))" work?
10:05pl6306I just want to make a list with 2 string elements
10:05dnolenpl6306: ("A" "B" "C"), you're invoking a function called "A"
10:05matthavenerpl6306: what's output are you expecting?
10:05pl6306Yes but how do I quote it inside the function def
10:05matthavener(list (% (str "|" %)))
10:06pl6306(("A" "=A") ("B" "=B")("C" "=C"))
10:07matthavenererr, wait, i was totally wrong
10:07dnolen,("A" "B" "C")
10:07clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
10:07dnolen,'("A" "B" "C")
10:07clojurebot("A" "B" "C")
10:07dnolen,["A" "B" "C"]
10:07clojurebot["A" "B" "C"]
10:07dnolen,(map #(str % "|" %) ["A" "B" "C"])
10:07clojurebot("A|A" "B|B" "C|C")
10:07matthavener,(map #(list % (str "=" %)) '("A" "B" "C"))
10:07clojurebot(("A" "=A") ("B" "=B") ("C" "=C"))
10:08pl6306Thanks matthavener
10:08matthavenerbe sure to understand the diff between (list a b c) and '(a b c) because its something that tripped me up at first
10:09gdevmynomoto:) it works!
10:09matthavener,'(1 (+ 1 1) 3)
10:09clojurebot(1 (+ 1 1) 3)
10:09matthavenervs
10:09matthavener,(list 1 (+ 1 1) 3)
10:09clojurebot(1 2 3)
10:11mynomotogdev: good. No vpn next time. ;)
10:12gdevgfredericks:) mynomoto thanks for your help, yeah vpn is bad
10:13sveduboisIs this conversion from js to clojurescript correct?
10:13sveduboiscube.intersect(sphere).subtract(cylinder1.union(cylinder2).union(cylinder3));
10:13svedubois(.substract (.union cylinder2 cylinder3 cylinder1) (.intersect sphere cube))
10:15dnolensvedubois: hmm
10:16dnolensvedubois: I think the .intersect needs to come before the union
10:16dnolensvedubois: and you can't write union that way.
10:31sveduboisDo you think this is correct?
10:31svedubois(-> cube (.intersect sphere) (.subtract (-> cylinder1 (.union cylinder2) (.union cylinder3))))
10:39sparkjoyNot 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:41florianoveris there a chance to do long-polling get requests with clj-http ?
10:43dakroneflorianover: what do you mean by "a chance to do" ?
10:43florianover well, is it possible?
10:43florianoveroh hi! dakrone personal!
10:43dakronewhat 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:44dakroneflorianover: hi! :)
10:44florianoverhttp://developers.box.com/using-long-polling-to-monitor-events/
10:45florianovermaybe it is just a problem with the api...
10:45dakronehmm... 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:46florianoverok, thx. Will try :)
10:47dakroneflorianover: good luck, let me know how it turns out
10:50`fogusflorianover: I'd be interested to see what you come up with too.
10:51florianoverwill respond :)
10:55mduerksenis there any possibility to define a default implementation for a protocol?
10:57florianover@dakrone it worked. i just had the wrong URL :D
10:57dakroneflorianover: :)
10:57dakroneglad to hear it
10:57florianoveri didn't had to use as stream
11:02mduerksenok my bad, i can use Object :/
11:02borkdudeObjection your honor.
11:04akells`has anyone ever had issues importing java.nio.file.Paths into a clojure project?
11:12NeedMoreDesuLolwut, no abs for rational numbers?
11:15borkdude,-3/4
11:15clojurebot-3/4
11:16borkdude,3/-4
11:16clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: 3/-4>
11:17AimHereNeedMoreDesu, isn't that just because clojure's rational numbers are clojure's and Math/abs (or whatever) is wrote by java
11:17silasdavisany recommendation for GPG/OpenPGP signing from clojure?
11:27NeedMoreDesuAimHere: Oh, well, that makes sense.
11:54ppppaultalk
12:01ucb...amongst yourselves...
12:04silasdavisany suggestions on where to set up a globally readable environment name like ':development', ':production', etc
12:04silasdavismay be sourced from environment variable in future
12:04silasdavisfor now just want to define it in one place
12:06justin_smithyou could (System/setProperty "environment" "production"), and better yet only set it if it does not yet exist (found via System/getProperty)
12:09technomancysilasdavis: I use environ for that
12:14silasdavistechnomancy, perfect thanks
12:17tbaldridgehey, 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:17arrdemtbaldridge: not idiomatically no
12:17tbaldridgeso far it seems refer only brings in vars that are defined inside the namespace being refered.
12:18arrdemtbaldridge: yes that is expected behavior
12:18tbaldridgehow about not idiomatically.
12:18arrdemtbaldridge: I mean you can (def foo bar/foo)
12:18arrdemtbaldridge: and there is an oft-bashed library which automates that
12:18tbaldridgeyeah, I thought of that, but that looses doc strings,
12:18arrdemtbaldridge: lemme dig this moster out for you hang on
12:19justin_smithyou could pull in the meta too, no reason not to
12:19arrdemtbaldridge: potemkin is the tool you want...
12:19arrdemtbaldridge: but that's a huge code smell and amalloy et all would tell you to rework your api rather than use it
12:19tbaldridgeI'll take a look, thanks. An yes, I know I shouldn't be doing this :-P
12:20silasdavistbaldridge, what's the use case out of interest?
12:21silasdavissounds like a sort of delegation pattern
12:21silasdavisonly I wouldn't want to do it through namespaces
12:21silasdavisbut I don't know much about metaprogramming in clojure
12:22tbaldridgeno, 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:22tbaldridgeSo yeah, I'm going to figure out a better way.
12:26arrdemtbaldridge: 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:27ppppauli 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:27silasdavisand what will you call your agent?
12:28no7hing:D
12:28arrdemsilasdavis: IFruitEater, FrutEatingAgent
13:01daydreamtDoes irclj support connections to irc servers that use ssl?
13:53MarcoPolo,(println "test")
13:53clojurebottest\n
13:55MarcoPolo,(let [x
13:55MarcoPolo (for [x (range 10) ]
13:55MarcoPolo (do (println "Evaling" x)
13:55MarcoPolo [x]))]
13:55MarcoPolo (first x))
13:55clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
13:56MarcoPolo&(let [x
13:56MarcoPolo (for [x (range 10) ]
13:56MarcoPolo (do (println "Evaling" x)
13:56MarcoPolo [x]))]
13:56MarcoPolo (first x))
13:56lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
13:56MarcoPolo,(let [x (for [x (range 10) ] (do (println "Evaling" x) [x]))] (first x))
13:56clojurebotEvaling 0\nEvaling 1\nEvaling 2\nEvaling 3\nEvaling 4\nEvaling 5\nEvaling 6\nEvaling 7\nEvaling 8\nEvaling 9\n[0]
13:58MarcoPoloSo 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:59dnolen_MarcoPolo: putting side effects into lazy seqs is generally a bad idea.
13:59dnolen_MarcoPolo: and you'll run into issues because of chunking
13:59clojurebotI don't understand.
13:59beakyhello
14:00dnolen_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:01pl6306How do I and a number of entries into a map? I think it is probably apply assoc any one have simple example?
14:02dnolen_pl6306: into
14:03pl6306thanks
14:05MarcoPolo@dnolen_ I just have the side effect in there to see when it is being evaluated, and what do you mean by chunking?
14:05dnolen_,(into {} [[:foo 1] [:bar 2])
14:05clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
14:05MarcoPoloDoesn't range return a lazy seq as well?
14:05MarcoPolo,(type (range 10))
14:05clojurebotclojure.lang.LazySeq
14:05dnolen_MarcoPolo: it's lazy when/how it evaluates is a mostly implementation detail if your code is pure.
14:06dnolen_MarcoPolo: as an optimization some types returns chunked sequences when seq'ed to reduce allocation/step overhead
14:07MarcoPolodnolen: Okay, that makes sense. Thanks
14:07MarcoPolo,(let [x (for [x (take 10 (iterate inc 0)) ] (do (println "Evaling" x) [x]))] (first x))
14:07clojurebotEvaling 0\n[0]
14:07MarcoPoloyup :)
14:08gozahi 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:10MarcoPologoza: This might be what you are looking for: http://clojuredocs.org/clojure_core/clojure.core/update-in
14:10MarcoPologoza: 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:11gozaMarcoPolo: thanks, I'll look into it.
14:12gozaMarcoPolo: ok, so is it recommended to represent the trees with maps instead of seqs?
14:13gdev,(doseq [even [2 4 6] odd [3 5 7]] (print (- odd even)))
14:13clojurebot135-113-3-11
14:14asteve,(= 1 nil)
14:14clojurebotfalse
14:14asteve,(= 1 'nil)
14:14clojurebotfalse
14:14astevehah
14:15gdev,(doseq [even [2 4 6] odd [3 5 7]] (print (- even odd)))
14:15clojurebot-1-3-51-1-331-1
14:15gdev,(doseq [even [2 4 6] odd [3 5 7]] (print (* even odd)))
14:15clojurebot61014122028183042
14:15gdev,(doseq [even [2 4 6] odd [3 5 7]] (prn (* even odd)))
14:15clojurebot6\n10\n14\n12\n20\n28\n18\n30\n42\n
14:17MarcoPologoza: I feel like it's easier to use when you use maps, but it depends on what you are using the tree for
14:18gozaMarcoPolo: ok, cool. When should I use other structures?
14:30gdevso in emacs i evaluate a doseq and it just returns nil instead of printing out the values
14:30gdev,(doseq [x [1 2 3] (prn x))
14:30clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
14:30gdev,(doseq [x [1 2 3]] (prn x))
14:30clojurebot1\n2\n3\n
14:33gdevnvmnd, it was printing out in the nrepl buffer instead of the message buffer
14:35gdevprn prints to the nrepl buffer and everything else prints to the message buffer
14:36rlbwhat'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:36chronnogdev: the message buffer gets the result of the form you evaluate
14:37chronnogdev: hence the nil of the doseq
14:37MarcoPologoza: 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:37rlb(I've used data.zip a bit in the past, but didn't know if that was still a good choice.)
14:39gdevchronno:) yeah, I just realized that the doc for doseq says it returns nil thanks
14:41justin_smithgdev: also, prn returns nil
15:02gdevif 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:03nDuffgdev: Typically, yes.
15:04gdevnDuff:) thanks, does it time out if it takes too long? I just realized this expression updates 18 thousands rows in the database
15:05gdev18 thousand I meant, not 18 1000s
15:05nDuffgdev: No, but you should be able to interrupt it yourself. Unfortunately, I don't remember the keybindings offhand.
15:06gdevnDuff:) she doesn't seem to be responding to C-x g
15:07gdevor C-g rather
15:07justin_smithC-c C-c should send an interrupt iirc
15:07justin_smithbut not kill the shell, just stop the current calculation
15:08gdevjustin_smith:) thanks, now "C-c C-c" is hanging out in my buffer, how long does it take to kill it?
15:08justin_smithlol
15:08justin_smithno idea
15:08howdynihaohi guys regarding lazy sequences, i have a question about how take-nth or take-last work
15:08justin_smithit could be trying to roll back now
15:08howdynihaodoes clojure actually compute every item in the sequence when it's "skipping" ?
15:09howdynihaofor instance (take-nth 10 (range 100)) does it actually compute 1,2,3,4,5,6,7,8,9 ?
15:10gdevjustin_smith:) okay, well C-x C-c seems to have done the trick
15:10justin_smiththat's one way to do it
15:13justin_smithhowdynihao: 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:15justin_smithfor 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:16justin_smithso if the inputs to map can jump to an index, map can too
15:16dnolenjustin_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:17justin_smithdoesn't work which way?
15:18dnolenjustin_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:18justin_smithok, good to know
15:19justin_smithyeah, based on (time (last (range x))) it really is generating all the intermidiaries, which surprises me greatly
15:19dnolenhowdynihao: but note take-nth is lazy so it won't actually compute 1-9, until it needs to
15:20howdynihaoright ok
15:20howdynihaoi was curious if it had some magical / cool implementation for 'skipping'
15:29lynaghkping: seancorfield
16:02danneuif you don't need to share state across threads (independent computations), are you back to just doing Java Thread dispatches?
16:03gdevquick 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:04gdevthat's a pretty complex statement but I think it does good enough row mapping
16:04danneugdev: prob be easier to post the gist link
16:04gdevdanneu:) good call, thanks
16:07danneugdev: i personally like to separate the computations from the function i'm actually trying to write
16:08danneui.e. i'd use `let`
16:08danneu(let [total (+ (rand-int 100) (:subtotal row))] ...)
16:13danneuand yeah i know you were prob looking for some higher level help, but that's all ive got
16:13tieTYT2maybe 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:16jcromartiewhenever I do "C-u 8 0 ;" I know it's time to make a new namespace
16:20gdevheres my gist for the code above https://gist.github.com/gdeer81/c9d3ea6d4db3036aa2d5
16:25gdevwhy is that gist not showing up, wtf github
16:33gdevokay, since gist is being funny, here is my code in pastebin http://pastebin.com/9HLZUD5t
16:34Raynesrefheap.com
16:34kencauseyLighttable 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:34kencausey | ordnungswidrig oriig Orva othiym23 owengalenjones OwenOu ozataman ozzloy pandeiro pendlepants pepijndevos PeregrinePDX pinupgeek pisketti pjstadig pl6306 pmaes ppppaul prip prismatictrail â arrdem
16:35kencausey | 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:35kencausey | 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:35kencausey | 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:35kencausey | 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:35kencausey | 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:35RaynesThat;s awesine,
16:35kencausey | 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:35kencausey | 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:35dakronewhoa
16:35kencausey | zz_Inoperable] â AWizzArd_
16:35RaynesThat's awesome.
16:35kencausey15:31:40 -- | Channel #clojure: 608 nicks (1 ops, 0 halfops, 0 voices, 607 normals) â azkane
16:35rbransonwtf
16:35technomancyops?
16:35kencauseyDid any of that go through? Sorry
16:35RaynesI dunno how you managed to just print everything.
16:35omacieloy
16:35technomancychouser: ^
16:35rbransonPRINT ALL THE THINGS
16:35Raynestechnomancy: He didn't do it on purpose.
16:35technomancyRaynes: doesn't mean he shouldn't be briefly banned
16:35TheMoonMasterGood job.
16:36omaciel:)
16:36arohnerwe enforce the death penalty for all crimes here
16:36gdevwow that woke everyone up
16:36synfinaticon the plus side I didn't realize there was someone here with the nick wookiehangover
16:36russfrankawww.
16:36wei_hi everyone
16:37TheMoonMasterlol
16:37gdevRaynes:) https://www.refheap.com/paste/13989 is that better?
16:39wei_which has better performance, or are they the same? (first (rsubseq m <= 1)) or (last (subseq m <= 1))
16:39gdevdidn't realize refheap doesn't do line wrapping, grr
16:40justin_smithgdev: http://pastebin.com/UfZ5Jxtc version with formatting and destructuring
16:40justin_smithnothing big
16:42gdevjustin_smith:) thanks, it looks a lot nicer, will it perform better? lemme run it and see
16:42justin_smithI dunno, destructuring may perform a little better than inline accesses, but that is just speculation
16:43arrdemwhen 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:43amalloyarrdem: "never" is close enough
16:44arrdemamalloy: somehow I figured that was gonna be the answer...
16:45arrdemmeh I can imagine a ns layout where I don't need to (ab)use load. use case destroyed.
16:45gfrederickswhat if pre/post conditions could have metadata with an error message?
16:45Bronsagfredericks: eh, I often wished they could have
16:46gfredericksI wonder if the core folks would approve of that
16:59tieTYT2does Bodil Stokke hang out here?
17:00tieTYT2ah, probably :)
17:00tieTYT2this language looks like a great idea: https://github.com/bodil/BODOL
17:01arrdemwhat the... utf8 chars for fn application and lambda declarations?
17:03trinary"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:04tieTYT2arrdem: it's optional
17:04tieTYT2I 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:05dnolenCLJS ObjMap vs. PersistentArrayMap perf update http://dev.clojure.org/jira/browse/CLJS-499
17:05Bronsaor use emacs and M-x toggle-input-method and write \lambda :)
17:05arrdemBronsa: or just have pretty-lambda installed :p
17:05Bronsaheh
17:06BodiltieTYT2: It's been known to happen. :)
17:07BodilAnd yeah, I feel the world's pretty much ready for non-ASCII character sets by now. :)
17:07tieTYT2as an american, I don't even want to go metric yet
17:09BodilBut yeah, it's optional - sadly, keyboards aren
17:09Bodilaren't quite there yet. :(
17:09tieTYT2yeah
17:09yogthosjust have to wait for BCI I guess :P
17:13tieTYT2Bodil: From the tests and the front page, I don't see any examples of static typing
17:13tieTYT2but the intro says: Clojure is great, but sometimes I miss static typing.
17:14BodiltieTYT2: 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:14yogthostieTYT2: https://github.com/frenchy64/typed-clojure
17:14tieTYT2yogthos: did you mean to link me to https://github.com/clojure/core.typed ?
17:15yogthostieTYT2: indeed :)
17:15tieTYT2k i'll watch this video
17:19nathanichowdy 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:20nathanics/lazy/verbose/
17:24arrdemany 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:25arrdem(199 LoC, mostly (derfrecord) forms)
17:26justin_smithit 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:27arrdemjustin_smith: oh. herp derp good one.
17:35gdevjustin_smith:) so that version of the query takes around 20 minutes
17:35justin_smithas compared to?
17:36gdevcompared to nothing, i didn't benchmark the other one since i figured it would be slower
17:37gdevI also realized i didn't need to do two where clauses, since the prod_id was unique identifier for each row
17:37justin_smithcode layout can help with things like that
17:38gdevindeed =)
17:41ppppauli layout my code like a fruit basket
17:45doriantje-I layout my code like spaghetti ._.
17:45ppppauli love spaghetties
17:45justin_smithwith namespacing you can at least aspire to ravioli layout
17:46gdevso 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:46doriantje-My code is a poor man's pasta.
17:50ppppaulmock pasts?
17:50ppppaulmock pasta*
17:54ppppaulanyone here experimented with simulant?
17:54OkasuGuys, can you give me a link for awesome talk from one guy whos ancesotor was a convict and was sent to australia?
17:55OkasuI can't remember name of that guy.
17:56jorgeubad clojure joke: how can you tell if someone is a clojure dev? ......... it doesn't matter he will tell you!
17:56arrdemI suppose there is that...
17:56justin_smithif you work backend, how do you pretend you are a java dev?
17:57justin_smithdon't say anything, they will assume you are
17:57jorgeuyup
17:57jorgeuI have seen that trend
18:01justin_smith"backend lisp developer? are you joking? that exists?"
18:02ozzloyhttps://www.refheap.com/paste/13991 the repl works for simple things, but i'd like to get rid of that error
18:02Apage43try frontend lisp developer
18:02ozzloythe internet doesn't show much for it
18:03arrdemApage43: but clojurescript is almost a thing so..
18:03ozzloyline 15
18:03ppppauljorgeu, please, no more jokes
18:03Apage43ozzloy: your project.clj in that folder probably specified a :main or :repl {:init …}
18:04ozzloyApage43, this is from the clojure koans
18:04justin_smithozzloy: does this happen when you use lein new and open a repl there, or only in the clojure koans?
18:04ozzloyi'll see
18:05ozzloyhttps://www.refheap.com/paste/13992 doesn't happen in a new project
18:09abpozzloy: Update leiningen.
18:09ozzloyabp, ok
18:13ozzloyhttps://www.refheap.com/paste/13993 now it looks worse
18:14ozzloyoh the repl appears to work though
18:14ozzloydo i have to do lein project update or something inside clojure-koans?
18:14justin_smiththis 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:15ozzloyoh i have the test runner runnign
18:15ozzloyi should kill that maybe. i'll try that and see what happens
18:15justin_smiththere is a "lein upgrade" command
18:16ozzloyhttps://www.refheap.com/paste/13994
18:17ozzloyjustin_smith, i did that already
18:17ozzloyjustin_smith, upgraded lein
18:19justin_smithI 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:19justin_smiththat is what I meant by "probably has to do with that wacky thing the koans do"
18:19ozzloyi just tried creating a new project and a repl in there since i've updated lein and that worked
18:19ozzloyi'll just use a repl in a different project
18:19ozzloykinda wonky
18:19ozzloybut the koans are pretty self contained
18:21ozzloythanks abp justin_smith and Apage43
18:44seancorfieldlynaghk: you pinged me a few hours ago? sorry, was at lunch...
19:09gdevso i just looked at the oracle trace file and my application has a 1 to 1 mapping of sql statements to database records
19:11gdevjustin_smith:) yea I don't think I picked the right solution for this one
19:14justin_smithgdev: yeah, data modeling is not a simple thing, and the design can have huge consequences
19:34SgeoSomeone pinged me
19:34SgeoAre there public logs?
19:34ivanit was a spammer
19:34SgeoOh
19:35ivanhttp://clojure-log.n01se.net/date/2013-04-26.html
19:35trinaryI think it was a mis-copy-paste actually :)
19:35SgeoShouldn't public logs be in topic?
19:36ivantrinary: no honest man would use an IRC client without paste detection ;)
19:36trinaryharsh!
19:36justin_smithI have had erc do that before
19:37justin_smithworst 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:38ivanyeah, I'm sure I would leak all of my secrets within a couple hours of ERCing
19:39howdynihaohow can i get [1 2 3] [1 2 3] to be [ [1 1] [1 2] [1 3] [2 1] ... ]
19:39howdynihaowell actually, how do i put that into words
19:39howdynihaotechnical term
19:39gfrederickscartesian product?
19:40gfredericks,(let [as [1 2 3] bs [:c :d :e]] (for [a as, b bs] [a b]))
19:40clojurebot([1 :c] [1 :d] [1 :e] [2 :c] [2 :d] ...)
19:40gfredericksif you have just two sequences, that'll work. If the number varies, I think there's a contrib library with combinatorics functions
19:40gfredericksalso you could write your own and it's lots of fun
19:41gfredericks(fn cp [& colls] (if (empty? colls) [[]] (for [x (first colls), xs (cp (rest colls))] (cons x xs))))
19:42gfredericksthat doesn't work and I don't know why and I'm going to make tacos
19:42howdynihaoyum tacos
19:42trinaryhah
19:44gfredericksoh I forgot an apply I think
19:45technomancyapply tacos
19:45justin_smithyeah, that or you can change cp to take a single arg
19:45Bronsagfredericks: math.combinatorics
19:47gfredericks[org.clojure/math.tacos "0.1.0"]
19:48Bronsatacos everywhere
19:49justin_smith(map (comp eat taco) [:asada :pollo :barbacoa])
19:52justin_smiththrow a (juxt identity identity) in there and double your tacos
21:21lynaghkIs 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:24benkayi 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:24gfredericksbenkay: you have to install it on the transactor
21:25gfredericksyou can't "pass" it since the transactor isn't in the same process as your normal code
21:25benkayyou speak to the problem exactly, gfredericks. so, implementation would be to include function in schema?
21:26gfredericksthere's a special mechanism for installing functions
21:26gfredericksI'm not sure about the details
21:27corpsangfredericks: I am pairing with benkay right now
21:27gfredericksit's in the docs somewherehttp://docs.datomic.com/database-functions.html
21:28corpsanis that mechanism the standard run-a-transaction-with { :db/id (d/tempid :db.part/user) :db/ident :my-function :db/fn … }
21:29gfredericksyeah that looks right
21:29corpsanokay. 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:30gfredericksyeah if you can get away with that it's certainly simpler
21:30corpsanwell, i don't want to store code that might change any time
21:30gfrederickssure
21:30corpsanin this case the helper function is operating on a brittle data structure
21:30benkayyeah and i r no trust migrations and schema change
21:33corpsanthanks gfredericks!
21:33gfredericksnp
23:48echo-areahttp://pastebin.com/wnuZKRyA
23:48echo-areaHi.
23:49echo-areaI see the clojure program takes more than ten times than the corresponding Java program.
23:49echo-areaIn the disassembled code, the only difference is some more load/save code in every iteration of the clojure program.
23:50echo-areaAnd I see there are more minor pagefaults in the clojure run.
23:50echo-areaCan I explain the longer execution time with this?
23:53echo-areaSorry, I meant the only added code was a `pop'.
23:54andyfingerhutA "Hello, world" program in Java takes about 0.2 sec to finish on my machine, whereas in Clojure about 1.1 sec.
23:54ivanI hear you should use criterium for microbenchmarks like that
23:54echo-areaandyfingerhut: That's because of the initialization of RT
23:55andyfingerhutAre you not measuring the time taken for a JVM to start, run your code, and then exit?
23:55tomojhow do we get ['lam (nom/tie c ['lam (nom/tie d ['var c])])] from '(lam [c] (lam [d] c)) ?
23:55echo-areaandyfingerhut: But I measured the actual two iterations, not the whole program
23:56andyfingerhutI don't see that in your paste anywhere. I saw "time" being used at a shell prompt.
23:56echo-areaThat's only for seeing pagefaults
23:56echo-area(time (p1))
23:56echo-areaThat is.
23:56tomojthere'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?