#clojure logs

2011-08-10

01:45ibdknoxI added remote calls to pinot :)
01:46ibdknoxso you can essentially make a call in clojure script and have noir return the result to you
02:16callenso uh, is github freaking out or what?
02:16callenleiningen's self-install is failing because the jar link 404s.
02:16callenFailed to download https://github.com/downloads/technomancy/leiningen/leiningen-2.0.0-SNAPSHOT-standalone.jar
02:18amachttps://github.com/downloads/technomancy/leiningen/leiningen-1.6.2-SNAPSHOT-standalone.jar
02:18amacthink you just had a bad link, that seems to be the most up-to-date posted jar
02:19hiredmancallen: there is 2.0.0-SNAPSHOT, so a 404 sounds right
02:19depydudes, what IDE / editor do you prefer for clojure? I tried out compojure in eclipse and it had some issues, I didn't really like the one in netbeans, vim clojure is cool but I have to start nailgun server everytime i use it :S
02:19amacdepy: emacs+slime
02:20callenthat seems to have fixed it.
02:20callendepy: emacs => <3
02:21depyhm.. I really like vim, and I finally learn it a bit
02:21depyis it really worth switching to emacs? :D
02:21callendepy: yep.
02:21depygimme few reasons :)
02:21ibdknoxif you use lein ngserver nailgun is fine
02:21callendepy: just today, I opened a zip file in emacs, it seamlessly allowed me to edit the files within the zip without any manual unpacking/repacking of the zip of any sort.
02:22amacnot really, both take a long time to master -- learning both is not as useful as learning one really well
02:22ibdknoxcallen: you can do that in vim too
02:22callendepy: if the indentation is broken in a python file, I can call untabify on the buffer and rectify all indentation instantly.
02:22depyibdknox: Explain more? I tried leiningen yesterday so I'm not that experienced with ii... :)
02:22callenibdknox: I'm sharing my personal experiences, not attempting to be authoritatively exclusive.
02:22callendepy: and besides, slime.
02:22callendepy: / swank
02:23depyI heard about those two but have no idea what they do :D
02:23callenibdknox: also, Tramp beats netrw on vim by far.
02:23callenibdknox: netrw sucks.
02:23ibdknoxcallen: I don't think I've ever actually used it lol
02:23callenibdknox: ido-mode is peerless for letting you breeze through things.
02:23depyAnd yes, feel free to explain. Few different oppinions won't kill anybody... :)
02:24callenibdknox: the unified one-true elisp is fantastic and lets all emacs users share code.
02:24ibdknoxlol
02:24ibdknoxwhy are you telling me this? :)
02:24callenibdknox: as opposed to vim extensions being variously vimscript, python, ruby, c, etc.
02:24callenibdknox: you're the thomas.
02:24ibdknoxthe thomas?
02:25callenibdknox: google "doubting thomas"
02:25ibdknoxlol
02:25ibdknoxI'm more than well aware of what emacs can do
02:25ibdknoxI also know what VIM can do
02:25amalloybecause i'm just sick of #clojure being full of nothing but emacs-haters
02:26ibdknoxand it mostly comes down to preference and which one you learn first :)
02:26ibdknoxamalloy: lol
02:27amalloyibdknox: i'm not sure that's true. i hobbled my way with vim for like four years, barely knew how to copy/paste. obviously there's a lot more you *can* do, but it was never easy to learn. emacs took an effort to learn, but the path and the motivation were there, and i was outpacing my vim skills in two weeks
02:27depywhat about plugin/extension installing? I don't like the vim style with all the files and editing vimrc ...
02:27amalloydepy: if you want an extensible text editor, you have to be willing to edit text files :P
02:27ibdknoxamalloy: I'm not sure I understand that argument? Emacs has a lower initial learning curve but a longer overall time to master
02:28callenibdknox: you're right about it coming down to what you learn first, but you're fortunate if the first you encounter is Emacs.
02:28hiredmanyou can tell emacs is a serious editor because it runs as part of its own build process
02:28ibdknoxvim has an extremely steep initial curve and then levels off
02:28callenibdknox: and doesn't go much further than that.
02:28amalloyeclipse, for example, is superb for installing plugins, depy. but if you want something that's not already in a plugin...
02:28callenibdknox: and any of its advantages can be encapsulated in viper or vi-mode.
02:28callenibdknox: all the other power is exclusive to Emacs.
02:28ibdknoxlol
02:28ibdknoxdogmatic much?
02:29callenibdknox: it merits it.
02:29hiredmanI used to use vim, and then had to switch to emacs for work, and it's just better
02:29amalloyin emacs, and presumably in vim, you can write up a new feature you want without much trouble and just slap it in your .emacs
02:29ibdknoxdepy: haha apparently
02:29amalloydepy: well, you asked about editors. it's a touchy topic, for reasons that are not really hard to understand, and people love to argue about it
02:29ibdknoxI was unaware that I was somehow offending emacs folks by saying VIM is a capable editor
02:30ibdknoxI will be shunned from #clojure now
02:30depy:)
02:30amalloyibdknox: vim is a capable editor. it would be my third choice for java, and second choice for anything else
02:30scottjstoring new features that are compositions of other features is arguably easier and more obvious in VIM since the code for the feature looks like what you type whereas in emacs it looks like the function names of what you type
02:31scottjgranted they may be more maintainable/robust in emacs
02:32callenscottj: in Emacs, any code I write, or that someone else writes, can always be understandable and usable.
02:32callenscottj: in vim, the plugins can be any number of languages or extension methods.
02:33amalloycallen: that seems like a bizarre argument
02:33callenamalloy: it's pretty important, I share the elisp I write with other emacs users in my area.
02:33callenamalloy: and I get stuff from them too.
02:33amalloyyou can add an interpreter for any language to your .emacs, and write your extension in that
02:33scottjcallen: I wasn't clear, I meant keymacros/bindings
02:36scottjI think on strictly text-editing features stock VIM beats stock emacs with more advanced movement (separate beginning/end of word movement), replacement, etc commands
02:36amalloyi guess i don't know what vim extensions look like, so i half-withdraw my claim of absurdity
02:36scottjon # of email/irc clients, emacs is the clear winner
02:40callenscottj: viper mode has all the movement/editing commands that vi mode does, including the various modes such as visual/insert/command, and others
02:40scottjcallen: by easier and more obvious I mean :bind ,a "add3jj" (whatever hte syntax is) vs (defun my-user-function () (move-char 1) (kill-to-end-of-line) (move-point (char-min)) (next-line)) (global-set-key (kbd ....) my user-fn)
02:40callenscottj: so, emacs can do anything vim can editing wise, and it can do everything else better.
02:41callenscottj: also the various programming language specific modes are remarkably powerful compared to what vim offers.
02:41callenscottj: use of the erlang mode for Emacs will make that very clear.
02:41depyI installed emacs
02:42callenscottj: I have a Python environment, which is common to many Python programmers that use Emacs, that literally has a Python process running that is always evaluating my python code so that it can provide hints and follow variables to their definitions.
02:42depyC - f,b,p,n = wtf
02:42callendepy: not really what you usually use
02:42callendepy: usually you'll use ace-mode-jump or search to navigate.
02:42callendepy: my C-f is actually bound to ace-mode-jump.
02:42depyI'm going trough tutorial
02:43depyAm I suppose to have 20cm fingers to move around a file? :D
02:43callendepy: good good, do the tutorial.
02:43scottjcallen: I think some language's syntax highlighting is superior in vim
02:43callenscottj: not been my experience, but at least with emacs all the code is elisp including the built-ins so anything is changeable.
02:44callendepy: no no, you'll learn to navigate in a more natural manner after you do the tutorial.
02:44ibdknoxlol
02:44depyI hope so... :)
02:44callenscottj: only the core is C, such as the engine for elisp.
02:44ibdknoxthis is getting a bit ridiculous
02:44scottjcallen: actually a ton of it is C
02:44callenscottj: not at all
02:44callenscottj: about 20-30% is C
02:44callenscottj: 3/4s is Elisp
02:44scottjcallen: I've tried editing various faces/graphics stuff and most oft hat is C
02:45callenscottj: if you measure by LOC
02:45depyI think the topic of this channel should include: Don't ask about editors...
02:45callenscottj: well of course the graphics layer is C, but i'm not what you tried to change that was C. Virtually everything you could *imagine* is exposed, and as for faces, it supports xft and everything else.
02:46scottjcallen: I wanted to add a pulsating cursor and cool animations when it moves :)
02:47scottjcallen: my refuation was only that more than elisp engine was C
02:47scottjlots of the core movement functions are also C
02:48amalloydepy: "if you ask about editors, the response will be a spirited discussion that you don't care about and are not involved in"
02:48callenscottj: it's a text editor, not a video game.
02:49amalloya little more clear. feel free to ask about editors if you enjoy starting spirited discussions
02:49scottjcallen: tel that to M-x tetris
04:08leo2007what's the best way to get documentation?
04:08leo2007ie something similar to common lisp's hyperspec?
04:10opqdonutclojuredocs.org is pretty nice
04:10opqdonutalso, (doc doc)
04:10jsoftIs there some giant downloadable docs .tar.gz thing or something for java api/classes?
04:11opqdonutwell yes, there are the javadoc docs of the standard library
04:11opqdonutwhich you can most probably download from wherever you downloaded your jdk
04:12jsofthmm
04:12leo2007opqdonut: thanks. for offline reference?
04:12opqdonutwell there's the doc macro which you can use in the repl. also there might've been a way to generate html pages of docstrings
04:13opqdonutbut I don't know the details
04:13leo2007ok
04:36jsoftWhy cant I seem to find an offline docs thing for java/clojure on debian :\
04:39raekjsoft: you can clone the ghpages branch of the clojure git repo to get the clojure api in html form: https://github.com/clojure/clojure/tree/gh-pages
04:40raekI think the javadoc should be available as a debian package somewhere
04:41raekclojure api zip: https://github.com/clojure/clojure/zipball/gh-pages
04:42jsoftAhh thanks.
04:47leo2007any idea why there are two defs of throw-to-toplevel in src/swank/commands/basic.clj
05:14fhdIs defrecord considered depreacted?
05:14amalloyno
05:14fhdamalloy: OK, read that somewhere
05:14kumarshantanufhd: did you mean defstruct?
05:15fhdkumarshantanu: The guy in the article might have meant that, yeah
05:15kumarshantanudefrecord is the new thing that's supposed to be used
05:16fhdkumarshantanu: OK, thanks
05:16amalloyfhd: defrecord *is* not recommended unless you have a compelling reason to use it. don't just use it because it's a great way to pretend you're doing OOP
05:23fhdamalloy: Well, we do need a "type" at this point, so I'd rather not use a map
05:23fhdamalloy: How is that typically handled in Clojure?
05:23fhdbrb
05:24amalloy$google cemerick blog flowchart type clojure
05:24lazybot[Flowchart for choosing the right Clojure type ... - cemerick] http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
05:24amalloythat's all from me. g'night
05:26depyso, basically if u want something like classes but wont use polymorphism and you won't interact with java , the best option is map? :)
05:35fhdamalloy_: Nice, thanks :)
05:42tufflaxdepy yes, but records can also be used as maps, so u can make a map into a record later with minimal problems. Also, you can get polymorphism with maps too through multimethods
05:42depyoh right
05:43depyso protocols = polymorphism for records and multimethods = polymorphism without records?
05:44depyI'm not that far with clojure actually :D so maybe i'm mistaken
05:44raekprotocols = single type dispatch polymorphism with grouping of methods
05:44depyblah.. time to google :D
05:44raekmultimethods = arbitrary dispatch without grouping of methods
05:46raekdepy: have you seen this video by Stuart Halloway: http://vimeo.com/11236603
05:47depynot yet
05:47depytnx, will look at it when I come home.. :)
06:47callisFYI: "Procedural Programming with Clojure in Max" - http://cycling74.com/2011/08/08/programming-with-clojure-in-max/
08:37dnolenI don't suppose there's a simple way to get ClojureScript objects printing sensibly in the browser console?
08:52chouserpr-str might be close
09:10timvisherhey all
09:11timvisheri'd like to transform every seq? in a map to a set, with potentially none of the values actually being a seq?, is there an easy way to do that?
09:18timvisher''(zipmap (keys {:x ["a" "b"] :y "c"}) (map #(if (sequential? %) (into #{} %) %) (vals {:x ["a" "b"] :y "c"})))
09:18timvisher'(zipmap (keys {:x ["a" "b"] :y "c"}) (map #(if (sequential? %) (into #{} %) %) (vals {:x ["a" "b"] :y "c"})))
09:18timvisher\,(zipmap (keys {:x ["a" "b"] :y "c"}) (map #(if (sequential? %) (into #{} %) %) (vals {:x ["a" "b"] :y "c"})))
09:19timvisherbah
09:19timvishercan't remember how to access the bot
09:19ambrosebsjust a comma isn't it?
09:19timvisher,(zipmap (keys {:x ["a" "b"] :y "c"}) (map #(if (sequential? %) (into #{} %) %) (vals {:x ["a" "b"] :y "c"})))
09:19clojurebot{:x #{"a" "b"}, :y "c"}
09:19timvisheryay!
09:19timvisheranyway, that's about what I want
09:19timvisherI just need it for a json interface anyway
09:19timvisherso i'm only concerned with vectors becoming sets
09:20leonid__if none of the values are actually a seq, why are you testing if they are sequential?
09:20timvishermy problem is that i'm bringing in a JSON param and I would like all the lists to become sets.
09:21timvisherare you saying I could be even more specific?
09:21timvishersometimes, though, the input won't have any lists in it
09:21timvisherjust some string or number values
09:21timvisherin that case, I'd like the code to still run fine
09:24manutterwhat's wrong with the solution you just posted?
09:26timvishermanutter: seems verbose?
09:26timvishernothing really, I suppose
09:26timvisherit even avoids the case of thinking a string is a sequential, which is nice
09:26timvisherI thought i'd have to do some special logic for that
09:27timvisherfigured it might be something that's common enough that there's a special function for it, like update-in
09:27timvisheretc.
09:27manutterhmm, does sound plausible
09:29manutterI'm not finding anything on clojuredocs tho
09:29timvisheri didn't either, hence the question
09:30timvisheri'm famously incapable of using the internet. :)
09:32cemericktimvisher: There's all sorts of "mapmap" fns floating around. e.g. http://tech.puredanger.com/2010/09/24/meet-my-little-friend-mapmap/
09:32timvishercemerick: nice!
09:33timvisherhadn't found those yet
09:33timvisheri guess it's not something that clojure-core thinks is common enough to include in the core libraries?
09:33cemerickif you search for "clojure mapmap" (avoiding google's unhelpful mangling of your query), you'll find a bunch of different variations.
09:34ScriptorI guess you'd have to make sure kf is one-to-one
09:35cemerickIf a single, obviously superior implementation with sane semantics emerged, that might have a better shot of getting into core.
10:29choffsteinWould anyone mind taking a look at this gist (https://gist.github.com/1136913)? I've been getting an error whenever I try to use that file as a library to another project: "Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (core.clj:8)"
10:30choffsteinHowever, running a "lein install" for the project is fine -- no errors. Just when I try to use it as a library within another project.
10:32ejacksonchoffstein: try putting the dependencies into [ ... ].
10:33ejacksonso something like (:use [clojure.tools.logging]
10:33ejackson [clj-logging-config.log4j :only logger]) etc
10:33ejacksonjust guessing here though
10:33choffsteinThanks for the thought, but that doesn't seem to be the problem...
10:34choffsteinIt doesn't seem to like the :only
10:34ejacksontry put logger in [] :)
10:34choffstein…yeah, that just hit me :)
10:35choffsteinnow I get "logger does not exist".
10:37choffsteinOy. Well, that's better, I suppose
10:37raekchoffstein: lein install does not AOT compile the source by default. this is why you got the error when you first used the lib.
10:37choffsteinthat makes sense
10:39choffsteinmalcolmsparks' clj-logging-config is not playing very nice with me
10:42choffsteinseems getting rid of :only logger just did the trick. Going through the source, :only logger doesn't make much sense anyway...
11:00solussdwhat's more idiomatic clojure- (apply + …) or (reduce + ….) ?
11:00tufflaxHow do I create an inputstream form a string of contents, not a filename?
11:00tufflaxs/form/from
11:00lazybot<tufflax> How do I create an inputstream from a string of contents, not a filename?
11:01tufflaxsolussd not sure, apply maybe, since it looks a little bit simpler
11:01tufflaxI don't think it matters that much :p
11:01solussdk
11:01solussd:D
11:01tomojtufflax: using clojure.java.io?
11:01tufflaxpossibly
11:02tomoj(clojure.java.io/input-stream (.getBytes "foo"))
11:02tomojIOFactory has an implementation for byte arrays
11:02tufflaxok, thank you
11:09choffsteinanother day of smashing my face against the keyboard...
11:19jweisswhen i run (future (throw (Exception. "oh no"))) either in repl or within a running clojure program at the terminal, the exception never shows up anywhere in stdout. is there a reason, or way to change that?
11:19jweissnot sure what happens to unhandled exceptions in future's internals
11:28jweissah looks like it's thrown on deref, i guess that makes sense.
11:29jweissmy future was side-effecty so i hadn't bothered to deref it
11:33choffsteinAnyone seen this error before: "Caused by: java.lang.NullPointerException
11:33choffstein at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
11:33choffstein at clojure.lang.Namespace.find(Namespace.java:188)"
11:33choffsteinWhoops … sorry for the multiple lines there
12:08replacachoffstein: that's what happens when you pass nil to find-ns
12:10replaca(or in-ns and probably some others as well)
12:14manutterAny Eclipse/CCW users around? I'm curious how the everyday workflow goes re: adding external libs (compojure) as dependencies etc
12:14manutterOr do you just stick with lein?
12:15technomancymaking your build depend on eclipse is really a bummer if you are ever going to be not the only programmer on the project
12:15technomancynot that I'm biased or anything
12:16manutteroh, there's some other editor you like better? :D
12:16manutterI'm fine with lein/emacs actually
12:17manutterjust curious about how people are using other environments.
12:17technomancywell that's just the point; the editor must be totally orthogonal to the build process
12:17wunkitechnomancy: what's your opinion about vim? (not trying to start a flame)
12:18technomancyit seems pretty nice except for vimscript
12:18wunkiI switched from vim fairly recently because of your emacs setup
12:19technomancycool
12:19wunkibut I do miss it sometimes though :)
12:20technomancyanything specific or just generic homesickness?
12:23jaleyprotip - don't hit C-x C-s in vi...
12:23dnolenClojureScripters, has there been any talk of: (cljsc/build "src" {:output-to "foo.js" :watch true})
12:23dnolenwhere watch simply polls for changes in the directory, say every 1/4 of a second or something?
12:26ejacksondnolen: I thikn abedra achieved that effect with a linux command.... digging.
12:28dnolenejackson: it seems preferable to do that for that to work in the REPL because of compilation times.
12:29ejacksonyeah, its in the repl, but there is a background process that pings updates... didn't work for me (osx)
12:29ejacksonthere's this: https://github.com/maxweber/cljs-devmode but its not what I was thinking of
12:30dnolenejackson: hmm seems like it should drop to polling if you're not on Linux
12:31ejacksonhere we go: search the ML for "Minimalist autocompile workflow for ClojureScript"
12:31technomancyjdk7 has cross-platform io notification iirc
12:31technomancyor maybe that was 8?
12:31ejacksonit was alex osburne, sorry.
12:32hugodI started a clojurescript minor mode, that hooked into slime to trigger compiles, but haven't found time to complete it
12:32dnolentechnomancy: jdk7 has that in NIO.2, but jdk7 doesn't have rhino right?
12:32dnolenhugod: ooo
12:33technomancydnolen: oh, no idea about rhino. isn't it available as a jar you can run on any JDK though?
12:33hugoddnolen: https://gist.github.com/1103191 was as far as I got
12:37mattmitchelli need to call a bunch of methods on a java object, is there a threading operator for that? can't remember what that was?
12:37manutter,(doc doto)
12:37clojurebot"([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
12:38mattmitchellmanutter: very nice thank you
12:38manutternp
12:53fliebelPhew, I'm back. Now I have some time to get ClojureScript to work, and to find out some other things.
12:53dnolenfliebel: welcome back!
12:54ejacksonfliebel: howdy dude.
12:56wunkitechnomancy: sorry, was eating. But I mainly miss vim's speed. It just seems snappier
12:59fliebeldnolen, ejackson: Hi
13:00mattmitchellwhat's the best way to invert a map... where the keys become the values and the values become the keys?
13:01fliebeldnolen: So I noticed a link suggesting you got the prdicate dispatch working, is that true? What about logos on Clojurescript? :D
13:01ibdknoxmattmitchell: clojure.set/map-invert
13:03mattmitchellibdknox: great thank you
13:03wunkianyone tried the "Seven languages in seven weeks" book?
13:04manutterI've been on the first week for the last 2.5 months
13:04dnolenfliebel: nope predicate dispatch is a ways off, deep dive into pattern matching at the moment (tho really the difference between pattern matching and predicate dispatch is a static vs dynamic distinction + implication)
13:04wunkimanutter: who is to blame, you or the book?
13:04dnolenfliebel: I'm interested in getting core.logic running on ClojureScript but busy with the match stuff.
13:04manutterwunki: My boss. Busy busy busy.
13:04ibdknoxdnolen: when will match be ready for prime time? there are a couple places in Noir I'd like to use it.
13:05fliebeldnolen: goog, good. d'oh, diner time. I was hoping I could stick around longer now :P
13:05wunkimanutter: are you already familiar with clojure?
13:05manutterwunki: the book is good, I recommend it.
13:05wunkimanutter: ok, will put it on the list!
13:05manutterwunki: I've been playing with clojure for a while now, like a year-ish
13:05wunkimanutter: and you like the language? (since you are in #clojure)
13:05manutterThen I have to code in PHP all day and it rots my brain.
13:06manutteroh yeah, big fan of clojure
13:06dnolenibdknox: probably a few weeks at the soonest. I'd like to see support for :as (arbitrary naming), :when (guards), and Or Patterns.
13:06ibdknoxdnolen: okidoke. Great work btw.
13:07wunkimanutter: I'm starting to learn it now. With the "Clojure Programming" book, which is now in "Rough cut"
13:07dnolenibdknox: tho if it already works you feel free to put it up on Clojars under your own namespace.
13:08manutterwunki: Yeah, I bought that one too (Rough Cuts, that is)
13:09wunkimanutter: nice, I'm only dissapointed that it's PDF only. Could use a .epub one
13:10manutterThat'd be nice.
13:16arohnerit would be nice if (ns) supported alias, so you can alias other namespaces without requiring them
13:17arohnerthat would make some circular require situations easier to deal with
13:19arohneroh, alias does work, it just doesn't fit the naming convention very well
13:25mattmitchellok, why doesn't this work? (-> ["one"] first (fn [x] (str x "_")) keyword) -- i'm expecting :one_
13:25mattmitchell,(-> ["one"] first (fn [x] (str x "_")) keyword)
13:25clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
13:26mattmitchell,(-> ["one"] first (fn [x] (str x "_")))
13:26clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
13:26mefesto,(-> ["one"] first (str "_") keyword)
13:26clojurebot:one_
13:26mattmitchellwow, i need to read the -> docs again :)
13:28mefestoit would be like writing this: (keyword (str (first ["one"]) "_"))
13:36mattmitchellmefesto: i see, i thought that (str "_") would be evaluated too soon, but i guess since this is a macro it's captured and evaluated when needed?
13:37manutter,(macroexpand '(-> ["one"] first (fn [x] (str x "_")) keyword))
13:37clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
13:37manutter,(doc macroexpand)
13:37clojurebot"([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms."
13:38manutter,(macroexpand-1 '(-> ["one"] first (fn [x] (str x "_")) keyword))
13:38clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
13:38manutterInteresting
13:38manutter,(macroexpand-1 '(-> ["one"] first (str "_") keyword))
13:38clojurebot(clojure.core/-> (clojure.core/-> ["one"] first) (str "_") keyword)
13:39manutter,(macroexpand '(-> ["one"] first (str "_") keyword))
13:39clojurebot(keyword (clojure.core/-> (clojure.core/-> ["one"] first) (str "_")))
13:39manutter,(macroexpand-all '(-> ["one"] first (str "_") keyword))
13:39clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macroexpand-all in this context, compiling:(NO_SOURCE_PATH:0)>
13:43fliebelHas anyone tried Jiraph on CouchDB? Masai has memcached support, and Couchbase has memcached.
13:54sritchiehey all -- does anyone have any advice on how to access a file in the resources directory from code, once a project's been uberjarred?
13:55technomancysritchie: clojure.java.io/resource
13:55sritchiegreat, thanks
14:01fliebelRaynes: ping!
14:02Scriptorany rumors on the next clojurenyc meetup?
14:02ScriptorI think I can make this one
14:07dnolenScriptor: hmm maybe I should present match there.
14:08Scriptordnolen: dude, that'd be perfect
14:08technomancyare those generally recorded, or is it only in special cases?
14:09dnolentechnomancy: special cases I think
14:16ordnungswidrighi all
14:16Scriptorhello
14:17technomancywell match is more interesting to me than clojurescript; maybe this could be considered a special case. =)
14:17hiredmanditto
14:17fliebel(inc technomancy)
14:17lazybot⟹ 1
14:18ordnungswidrig(dec |)
14:18lazybot⟹ -1
14:18ordnungswidrig(inc -1)
14:18lazybot⟹ 1
14:18ordnungswidrighuh
14:19Scriptordnolen: send an email to Thorsen, he's mentioned that trying to find speakers has been a huge time-sink
14:19fliebel$mail Raynes I saw you wrote the Memcached backend for Masai. I would like to make that work nicely with Jiraph and CouchBase, where to start?
14:19lazybotMessage saved.
14:20fliebelordnungswidrig: That command is like Karma, not actual Clojure.
14:20ordnungswidrig*dow*
14:21ordnungswidrigAquamacs users, is there a way to set the path to the lein binary for clojure-jack-in?
14:22technomancyordnungswidrig: you can set clojure-swank-command
14:22technomancyit's not tested on aquamacs
14:22technomancybut it might work
14:23ordnungswidrigtechnomancy: is it customizable or setq-able?
14:24technomancyshould work with setq
14:26ordnungswidrigtechnomancy: seems to work
14:28manutterheh, I'm just reading on slashdot about CERN enlisting the help of LHC@home to help look for the Higgs boson.
14:31ordnungswidrigcacalog might by a good fit as well
14:31ordnungswidrigs/ca/&s/
14:31lazybot<ordnungswidrig> &s&slog might by a good fit as well
14:32ordnungswidrigs/^ca/\0s/
14:32manutterwe know what you mean :)
14:38dsantiagoWhat is the problem with :use that people keep talking about on the mailing list?
14:40manutterif you use ":use" without an ":only" clause, you may get more than you intended, and might pollute your namespace
14:41Scriptoronly use :use with :only
14:42thorwiltoo bad there's a with in that statement
14:43manutteruse :use with :only only
14:43manutterIt's like a palindrome
14:43manuttersideways, sorta...
14:43ibdknoxlol
14:44ibdknoxso in fact not a palindrome ;)
14:44manutterwe live in an imperfect world.
14:44ibdknoxit's true :D
14:44wastrela man a plan a canal panama
14:45manutterAble was I ere I saw PHP.
14:45manutteror Elba, whatever.
14:45wastrelbilbo
14:46wastrelthat's what smaug says
14:46wastrelable i was ere i saw bilbo
14:46manutterok, that's going on a T-shirt as soon as I can get to CafePress and some clip art.
15:23amalloymattmitchell: (-> ["one"] first (fn [x] (str x "_")) keyword) expands to (fn (first ["one"]) [x] (str x "_"))
15:25mattmitchellamalloy: thanks! I should start using macroexpand to get a better understanding of what they're doing under the hood
15:53pyrhi
15:56pyrso I wrote a nice small DSL in clojure for an internal project, now I would like the files to be loaded dynamically
15:56pyrso I used find-namespaces-in-dir
15:56pyrwhich works great if the DSL files are bundled inside a project
15:57pyrnow let's say I want to make that directory configurable and potentially outside of the project's resources
15:57pyrfind-namespaces-in-dir breaks
15:58ibdknoxit breaks?
15:58pyrhey ibdknox :)
15:59ibdknoxpyr: hey :)
15:59ordnungswidrigpyr: in which way does it breake?
15:59pyryeah, complains about not being able to find namespaces
16:00pyrwell, for the sake of example, let's say I name my ns 'project.dyn.foo'
16:00pyrI store it in a /tmp/dyn/foo.clj
16:00ibdknoxah
16:00ordnungswidrigpyr: then you're missing a "project/"
16:00ibdknoxyeah
16:00ordnungswidrigpyr: I guess
16:01ibdknoxpyr: the dir structure is rigid as far as I know
16:01ibdknoxpyr: where the root of that structure is located doesn't matter
16:01ibdknoxso long as it's on your classpath
16:01pyrbut it's not
16:02pyr /tmp cannot be on my classpath
16:02pyrbut I see your point
16:02ibdknox,(doc load-file)
16:02clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
16:03arohneribdknox: how do you feel about this? https://gist.github.com/1138051
16:03pyribdknox: yep, i guess i'll have to resort to that
16:04ibdknoxarohner: I don't think I want to get away from the normal destructuring stuff
16:04ibdknoxarohner: it's hard enough to understand
16:05arohneribdknox: ok. I'm trying to find ways to eliminate boilerplate
16:05ibdknoxarohner: absolutely
16:06arohnerseems like every page I have, it's (my-model/find-one :where {:id (Integer/parseInt id)})
16:06ibdknoxyeah
16:06arohnermy current implementation doesn't replace normal destructuring
16:06arohnerit just sticks an extra let around ~@body
16:07ibdknoxlet's say you wanted to catch that exception, how would you do it?
16:07arohnertrue
16:07arohnerit'd have to be in the multimethod, or not at all
16:07arohneror a middleware
16:08ibdknoxmiddleware seems wrong to me for that
16:08ibdknoxthough that's just a knee jerk reaction
16:09arohnerabout a year ago I tried to do this, with the coercion being a middleware. didn't work very well because I needed access to the fn that was going to be called
16:09arohnerand required hacking up compojure to separate "identify the route that matches" from "call the route that matches"
16:09ibdknoxyeah
16:10ibdknoxas a side note
16:11ibdknoxnot really related, I guess, but you could at least have the route ignored by using a regex for the route param
16:11Generic_Dumbassso, what's the weirdest clojurescript code so far that compiles properly?
16:11ibdknoxthat doesn't solve the boilerplate issue
16:13ordnungswidrigwhat is best practice when using slime and protocols. When I C-c C-k a buffer with a protocol then all implementations are void and I must load all other ns using that procotol.
16:14dnolenordnungswidrig: yup
16:14ibdknoxGeneric_Dumbass: I'm not sure I understand your question. What's the weirdest clojure code that CLJS compiles properly?
16:15ordnungswidrigI like protocols but they are a little undynamic
16:15dnolenordnungswidrig: yup
16:15technomancywhat has worked well for me so far is not using protocols
16:15ibdknoxlol terseness ftw
16:15technomancywell, not writing my own protocols anyway
16:15ibdknox(inc dnolen)
16:15lazybot⟹ 1
16:15ordnungswidrigI try to stay away as well
16:17dnolenit's awesomer than writing Java, but not awesomer than writing pure Clojure.
16:17ibdknoxdnolen: I wonder what we should do to espouse that wisdom to people
16:17dnolensticking with the dynamic side of Clojure I mean
16:17ordnungswidrigDo you consider this a valid use case: I want to specify a file name encoding scheme such that I can build a file name for a certain ID and parse the ID from a certain file name. I used (defprotocol NamingScheme (file->id [this file]) (id->file [this id])
16:17ibdknoxthose coming from imperative backgrounds (most) will always see those and go "ooooo"
16:17dnolenibdknox: I try my best, but people see them and "Oooh shiny OOP stuff"
16:18dnolenheh yeah
16:18technomancyordnungswidrig: anything involving files is probably going to be I/O bound, hence multimethods are probably never going to be a bottleneck
16:18dnolen(inc technomancy)
16:18lazybot⟹ 2
16:18ordnungswidrigtechnomancy: are multimethods more dynamic in the above sense?
16:18ibdknoxare multimethods particularly slow?
16:18hiredmanclojure is pretty static for a dynamic language
16:18ordnungswidrigI like that procotols define a set of related functions
16:19hiredmanall name resultion is done at compile time
16:19technomancyordnungswidrig: yes, there is only one gotcha/bug, and that is that you can't change the dispatch function without undefing it first.
16:19technomancykeep that in mind and you will do fine
16:19ordnungswidrighiredman: java is pretty dynamic for a static language
16:19dnolenibdknox: depends on how complicated your dispatch is
16:19hiredmanordnungswidrig: and?
16:19technomancyonly once you profile it and determine multimethods are a bottleneck should you switch to protocols
16:19hiredmanordnungswidrig: I mean, who said anything about java?
16:19ibdknoxdnolen: fair enough
16:20technomancyibdknox: they are a lot harder for hotspot to inline
16:20technomancyfor extremely tight loops
16:20ordnungswidrigtechnomancy: nice hint. I think I've been bitten by that one before
16:20ibdknoxah
16:20ibdknoxthat makes sense
16:20technomancyordnungswidrig: it's annoying; they did the right thing in earlier versions of clojure, but I think this regression was intentional. =(
16:21ordnungswidrighiredman: I mean, clojure *is* that static because the jvm somewhat enforces this.
16:21technomancyordnungswidrig: one solution is to just have (def mymulti nil) (defmulti mymulti [...])
16:21technomancywhich is hideous
16:21ordnungswidrigtechnomancy: hmm, (defmacro redefmulti ….)
16:21hiredmanordnungswidrig: no
16:21technomancyordnungswidrig: that works too =)
16:21hiredmanvar resolution could easily happen at run time
16:21ordnungswidrighiredman: but?
16:22hiredmanit doesn't
16:22ibdknoxlol
16:22hiredmanbecause rhickey didn't want to
16:22ordnungswidrighiredman: I know. But why?
16:22hiredmanyou'd have to ask him
16:22hiredmanI imagine his anwser would be preformance
16:22ordnungswidrigMy guess is that is was because of limitations^h^h^h^h^hproperties of the jvm
16:22hiredmanno
16:22hiredmannot true
16:23hiredmanas I said you could easily do it at runtime on the jvm
16:23ordnungswidrig…regarding performance
16:23pyribdknox: while you're here, https://github.com/pyr/noir/commit/65da23991b548ffdcefbfb83b4794aa08c5a0cee
16:23pyribdknox: nitpick, really
16:24ibdknoxpyr: hm, I can't remember why I did it that way
16:25ordnungswidrighiredman: don't get me wrong. I see that the current implementation is "valid" and at a sweet spot regarding the forces working on it. I just wondered.
16:25dnolen ordnungswidrig: Clojure has become consistently less dynamic by default, while retaining dynamic escape hatches.
16:26ordnungswidrigdnolen: like the change regarding declaring dynamicity [sic?] explicitely?
16:26dnolenordnungswidrig: tho I don't see how you can protocols dynamic w/o invokeDynamic or something like that.
16:26ibdknoxpyr: can you send a pull request to the vnext branch for that?
16:26pyribdknox: sure
16:27ordnungswidrigbtw. is there migration chart regarding the functions in monolitic contrib and modular contrib?
16:27dnolenordnungswidrig: also numeric changes
16:27ordnungswidrigdnolen: isn't invokeDynamic just arrived in jdk7?
16:27dnolenordnungswidrig: yes, but Clojure solidly support JDK 7, ClojureScript might help move that needle.
16:27ordnungswidrigdnolen: that was what I stumbled upon first.
16:27pyribdknox: done
16:27dnolensupport JDK 5 I mean
16:28ordnungswidrig(defn current-file [{dir :dir naming :naming rotate-after :rotate-after iteration :iteration :as rotator}]
16:28ordnungswidrig (file-for-id naming dir (- iteration (mod (dec iteration) rotate-after))))
16:28ordnungswidrigups, sorry
16:28pyribdknox: vnext is the dev branch ?
16:29ibdknoxpyr: yeah, it's where 1.1.1-SNAPSHOT is coming out of
16:29ibdknoxalthough
16:29ibdknoxwith the changes I've been making lately
16:29ordnungswidrigback to the protocol-redifinition problem and slime… is remove-ns a safe workaround?
16:29ibdknoxI think the next official will be 1.2.0
16:29pyribdknox: 'k yeah you're pushing cljs in there too
16:30ordnungswidrigpyr: using reduce for wrappers seems to be a common theme, recently.
16:31hiredmanordnungswidrig: no
16:31hiredmanit has nothing to do with the namespace
16:31pyrordnungswidrig: how so ?
16:32ordnungswidrigpyr: I think I saw it the other day. And I wrote the same code today :-)
16:32pyrahah, great
16:32lobotomyhey guys, what's a good way of doing debug printing in the middle of clojure code?
16:33ordnungswidrighiredman: ah, I was a little vague. To be able to C-c C-k the buffer I needed to remove-ns to avoid an error about an existing alias
16:33dnolenlobotomy: middle of what?
16:33lobotomyin my java thing i just do if(DEBUG) System.out.println("whatever"); in the middle of everything, but that's ugly even there :)
16:33ordnungswidriglobotomy: clojure.contrib.true used to be a good way
16:33arohnerlobotomy: https://gist.github.com/1138179
16:34ordnungswidrig(let [a 1 b 2] (* (trace "a" a) (trace "b" b))
16:34pyrordnungswidrig: ah, but you're the one who replied on my article :)
16:34ordnungswidrigpyr: so you're the one who wrote that article :-)
16:35arohneroh, I didn't know about trace
16:35arohnerthat's nice
16:35lobotomyarohner, that looks like exactly what i need, cheers
16:35lobotomythe trace one is more complicated to use isn't it?
16:36arohnerI think trace works the same way, and is built-in
16:36arohnerthe nice thing about the macro is you can put it around arbitrary expressions, and it tells you which expr is being printed
16:37arohner(inspect (foo)) (inspect (bar)), as opposed to (trace "foo" (foo)) (trace "bar" (bar))
16:37ordnungswidrigarohner: that's a point. And, clojure.contrib.trace is not (yet) ready for 1.3
16:38ordnungswidrigbut it can also print "call trees"
16:39lobotomyhmm, trace isn't built-in though? it seems to be in contrib
16:40arohneryes, it's in contrib. I was assuming you were already using it though
16:40arohnerguess I shouldn't, anymore
16:41lobotomyi am actually :) just a terminology nitpick heh
16:53ordnungswidrighow stable is the support for pr and records in 1.3? Will (read-string (pr-str (ARecord. 1 2 3))) work?
16:54ordnungswidrigIt works for me at the moment but I don't want to rely it if it might break again
16:59dnolenordnungswidrig: I'd consider them stable at least for 1.3.0, don't see any reason for them to change.
17:07liquidproofhello
17:08liquidproofis it possible to change the current namespace, like a with-ns macro or something?
17:08liquidproofso you can extend core functionality from, say, plugins
17:08liquidproofand then swap back to the current namespace
17:08ibdknox,(doc in-ns)
17:08clojurebot"([name]); Sets *ns* to the namespace named by the symbol, creating it if needed."
17:08TimMcYes, but that may not be the best apporach for your goal.
17:09liquidproofTimMc: why not? : o
17:10TimMcNot sure, just feels hacky. I don't know enough to even tell you why, just saying that you might want to wait for others to weigh in. :-)
17:10ibdknoxis this in the repl?
17:12liquidproofnope
17:12ibdknoxoh
17:12ibdknoxdon't do that then
17:12liquidproofyeah, figured so
17:12liquidproofbut i'd like to just change the namespace for an expression set
17:12liquidproofand then swap back
17:12liquidproofif that's even idiomatic
17:13liquidproofsomething like a with-ns macro that allows you to extend some other ns
17:13liquidproofagain, for the sake of ad-hoc plugins
17:13ibdknoxjust use a sub namespce
17:13ibdknoxnamespace*
17:14ibdknoxmything.plugins.awesome
17:14liquidproofhmm
17:14liquidproofyeah, maybe that'd be cleaner
17:14liquidproofand just contain hook functions
17:14liquidprooflike event handlers
17:15ibdknoxor you can register a plugin if you wanted
17:15ibdknoxhave an atom in the plugins.clj with a register function
17:15ibdknoxthen each plugin simply calls and registers itself
17:16liquidproofwould all the plugin files get loaded?
17:16liquidproofeven if they're not referenced by other code
17:16ibdknoxplugins could require all subnamespaces if you wanted
17:17ibdknoxplugins.clj that is
17:17liquidproofoh, yeah, but what's the advantage
17:17liquidproofi would still have to have the event handlers there
17:17ibdknoxsure
17:18liquidproofbut then i'd have control which plugins to load
17:19gtrakI need a with-open that calls an arbitrary method, does it exist?
17:20ordnungswidriggtrak: on exit?
17:20gtrakyes
17:20gtrakinstead of .clsoe
17:20gtrakclose*
17:22gtraksurprised it doesn't exist yet
17:24ordnungswidrigwriting you own with-open which you can pass an expression on close is not hard.
17:24technomancyyou can use with-open if you reify an inputstream or some such
17:24gtrakhmm...
17:25gtrakso dirty :-)
17:25gtraki'll try it
17:25ordnungswidrigreify might make the code more bloat than using (try … (finally(my-close-expr))
17:25gtrakproblem is I need it to work on a let binding
17:26gtraksame as these guys: http://groups.google.com/group/clojure/browse_thread/thread/86c87e1fc4b1347c
17:26ordnungswidrig(let [h (my-open…){
17:26ordnungswidrigups
17:27liquidproofgtrak: you could look up with-open source
17:27ordnungswidriggrok: like this? (let [h (my-open…)] (try body… (finally (my-close h)))
17:27liquidproofand modify the line with .close to your callback
17:27liquidproofor even better pass the argument to the macro and unquote it there
17:27gtrakordnungswidrig, yes exactly, except h is local scope so it doesn't work
17:30ordnungswidriggtrak: (try…) is in the scope of the let.
17:30gtrakah, it's fine unless there's an exception in the let
17:31ordnungswidrigin this case you should not need to close, I assumed
17:31gtrakah, probably right
17:32ordnungswidrigbut it gets ugly as soon as you're wrapping multiple opens. That's what with-open handles for you.
17:34joegallohttp://download.oracle.com/javase/6/docs/api/java/io/Closeable.html
17:34joegallojust gonna drop that there before you reify inputstream
17:34gtrakya, i saw that
17:35gtraki think i'll just leave it ugly for now, I'm kind of noobish on protocols and reify still
17:43hiredmanhttps://github.com/hiredman/clojurebot/blob/master/src/hiredman/horizon.clj
17:43hiredman~scope
17:43clojurebotscope is at http://paste.lisp.org/display/73838
17:43hiredman2 years and 6 months
17:44hiredmanhttp://dev.clojure.org/jira/browse/CLJ-2
17:49sritchiehey guys -- is there a good way to kill a clojure function call, if it takes longer than some set amount of milliseconds to execute?
17:50technomancy(.get (future @(promise)) 1000 MILLISECONDS)
17:50technomancysome variant of that
17:50sritchieah, got it
17:50gtrakah, thanks hiredman
17:52hiredmansritchie: that won't actually kill it, using a future will let you poll for completion and cancel if it takes too long
17:55ordnungswidrigsritchie: killing a thread in java is not cleanely possible from outside. I the function is running in a loop you can set a flag to indicate to exit early.
17:55sritchieordnungswidrig: I'm following url redirects, and looks to bail of the process takes longer than some time
17:59ordnungswidrigsritchie: then you can exit early between the redirects. Or maybe you use limit the absolute number of redirects. You can also interrupt the http requests but this depend son the library you use.
18:00joegalloright, so i think the idea is to have the thing exit cleanly from the inside if it's taken too long, rather than having something on the outside that is watching it to kill it
18:00sritchieordnungswidrig: yeah, I think I'm going to go ahead and limit the total number, and catch the thrown java.net.ProtocolException --
18:00sritchiethat should speed things up enough for now
18:01ordnungswidrigI think a maximum of 5 redirects should catch 99% of all valid cased.
18:02PPPaulhello
18:02PPPauli'm having trouble with multimethods
18:02sritchieordnungswidrig: great, that's good to know
18:03PPPauli am making a very simple dispatch (boolean) but it's not working. i've tested the dispatch function and it works. would someone be able to help me with this? thanks https://gist.github.com/1138397
18:03hiredman~contains
18:03clojurebotcontains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains
18:04PPPaulok
18:04PPPauli've tested the dispatch method in the repl (contains) and it seems to work as intended
18:04hiredmanand you'll most likely run into problems with the defonce behaviour of defmulti when changing the dispatch method
18:05PPPauloh?
18:05PPPauli don't intend to change the dispatch method
18:05hiredmanhave you changed it?
18:05PPPaulno
18:06ordnungswidrigcu all. going to bed.
18:06PPPauli recompile my code when i change things
18:06hiredman,(doc defonce)
18:06clojurebot"([name expr]); defs name to have the root value of the expr iff the named var has no root value, else expr is unevaluated"
18:06PPPaulum
18:07PPPaulwhen i combine the dispatch function in the defmulti, i get the same behavior
18:08hiredmanthat sentence doesn't parse
18:08hiredman"combine the dispatch function in the defmulti" is nonsensical
18:08PPPaulok
18:09PPPaulmy multimethod used to have the (contains-transaction? [transactions transaction] (contains? transactions (:TransactionID transaction))) in it
18:09PPPauli think this is related to the defonce you are talking about?
18:11hiredmanPPPaul: if it is, restart your clojure repl and you should be fine
18:11PPPaulum.. ok i'll try that
18:15sridthere seems to be more than one ways/tools to setup a appengine clojure project. which of them is recommended?
18:18raeksrid: did you run lein deps?
18:18raek(after you added appengine-magic as a dev-dependency)
18:18sridraek: i just fixed it; i added it to :dependencies instead of :dev-dependencies (caught while reading http://stackoverflow.com/questions/5613977/lein-appengine-prepare-fails/5614279#5614279 )
18:22bortrebthis is random, but does anyone know of a famous programmer who is also blind?
18:23technomancybortreb: T.V. Raman is sorta famous
18:23technomancyor at least the closest I've heard
18:24pyradd-classpath is marked as deprecated
18:24sridand he works at google, I believe.
18:24pyris there any replacement function that can modify the classpath ?
18:24technomancyhe wrote emacspeak, and audio frontend to Emacs
18:25bortrebthanks!
18:26sridbortreb - just curious, why do you ask?
18:29bortrebI couldn't imagine how one could do it so I wanted to see an example
18:29technomancyprobably can't be done without emacs =)
18:29ibdknoxpyr: when I tried to use add-classpath it failed miserably
18:30ibdknoxVS also works with screen readers :)
18:30technomancyyeah, but it doesn't handle mail and irc =)
18:30ibdknoxhaha fact.
18:34hiredmanseancorfield: ping?
18:34pschorfis there an idiomatic way to start a background task in clojure?
18:35technomancypschorf: future or (doto (Thread. myfn) .start)
18:36technomancydepending on whether you need a value back and whether you want it in a pool
18:36pschorftechnomancy: thanks
18:36pschorfthe latter works
19:02seancorfieldhiredman: yup?
19:06hiredmanseancorfield: nm, just having weird issues fetching the jdbc jar, everything is working now though, was going to ask if there had been any pom shuffling or something
19:07seancorfieldah... i pushed some doc updates today (or was it yesterday?) but nothing else... certainly no new builds to maven lately
19:08hiredman*shrug*
19:08seancorfieldblame the government for network glitches :)
19:09hiredmanwe've recently switched all uses of clojure.contrib.sql to java.jdbc, so I expect big things :)
19:10seancorfieldheh, no pressure then... gee... i was pleased that with the :fetch-size enhancement Shoeb was able to match the java program performance
19:10hiredmanexcellent
19:11seancorfieldthere's not match open tickets against c.j.j and we're using it heavily in production with MySQL so I'm _reasonably_ confident in it now
19:11seancorfields/match/many
19:11lazybot<seancorfield> there's not many open tickets against c.j.j and we're using it heavily in production with MySQL so I'm _reasonably_ confident in it now
19:11seancorfieldaaron has said we'll get mysql and postgresql up on build.clojure.org soon so we can run automated tests against those (in addition to derby and hsqldb)
19:12seancorfieldi run the test suite against derby, hsqldb and mysql but i still want to add a lot more tests
19:21arohneribdknox: I pushed the coercions code into a separate branch, if you want to take a look at it. https://github.com/arohner/noir/commit/83399b8e7eacb1469ad389b7ef0f63fa8b02685e
19:21arohneribdknox: I don't expect it to get merged, I just didn't want to lose it
19:22ibdknoxarohner: I'll take a look :)
19:23ibdknoxso much new stuff! I think we need a Noir 1.2.0 soon
21:44owl__hi
21:44owl__i'm interestet in something like riak core in clojure
21:44owl__is there any development in this direction?
21:45owl__maybe a java library, i'm not very familiar with this topic
21:47hiredmanclojure's dependency management system (maven) is more mature than erlangs, so stuff is more likely to be delivered a la carte
21:47hiredmanany particular feature you are looking for?
21:49owl__this has nothing to do with dependencys
21:49owl__its an architecture for a distributed system
21:50hiredmanowl__: really? seems like a bunch of what would be seperate libraries, but is released as one large one because it is easier to use
21:50owl__but i can't even find a gen_server for clojure.... so its a lot of work
21:50hiredmanwell, clojure isn't erlang so expecting to find gen_server is kind of odd
21:51owl__i thought someone might have done it
21:51hiredmanthere are various state machine implementations for clojure
21:51owl__gen_server and supervisor would be useful in clojure
21:51hiredmansome of them are even distributed
21:51owl__hm, ok
21:51owl__i will look for it
21:51owl__thanks
21:51hiredman*shrug* only if you like erlang and want to program clojure like it is erlang
21:52owl__but why not? embrace the actor model
21:52cemerickthe one true gospel?
21:53hiredman^-
21:53hiredmanit isn't one
21:53owl__i just think that riak core is a good architecture
21:53hiredmanthats it really
21:56cemerickowl__: I'm sure.
21:56cemerickThere's oodles of distributed computing libraries and frameworks in the Java space, if you want to build on top of something.
21:56cemerickAnd there's all sorts of options in Clojure-land too.
21:56hiredmaninfinispan!
21:56owl__if someone is interested, i just got overwhelmed by these "posts" https://github.com/rzezeski/try-try-try/tree/master/2011
21:56owl__but i did a lot of erlang recently
21:57Praetorwith "name" and "symbol" I can go back and forth between symbols and string... how do I go back and forth between atom-or-form and strings?
21:58hiredmanI guess I am kind of bias, lots of bad experiences with riak at work
21:58hiredmanbiased
21:58TimMcPraetor: Example of an atom-or-form?
21:58cemerickhiredman: didn't you put together a clojure wrapper for that lately?
21:58hiredmanno, not me
21:58PraetorTimMc: I want to convert (fun this) into "(fun this)" from inside a macro
21:59owl__i didn't use it ;)
21:59hiredmanwell, yes, actually, but it's not publicly available, so not the one you are thinking of
21:59hiredman:)
21:59TimMcPraetor: read and pr-str
21:59TimMcor thereabouts
21:59cemerickI can't find what I was thinking of, anyway.
22:00hiredmanit may have been mmgrana
22:00PraetorTimMc: that's what I tried, but I cant' find "read", plus if it's anything like Common Lisp, "read" would do the opposite of what I want, i.e. go from string to form
22:00hiredmanhttps://github.com/mmcgrana/clj-riak/blob/ce9d4598e9fb46d8e670471165af6fd05563ca7a/Readme.md
22:01TimMcWell, you did want back *and* forth. :-)
22:01PraetorTimMc: oh, so pr-str is the opposite? lemme try
22:02PraetorTimMc: can you give me an example usage of pr-str ?
22:02TimMc(I don't have the exact names at hand at the moment, sorry.)
22:02TimMc.findfn "(+ 5 4)" '(+ 5 4)
22:02TimMc&findfn "(+ 5 4)" '(+ 5 4)
22:02lazybotjava.lang.Exception: Unable to resolve symbol: findfn in this context
22:03TimMcBah, been away from this channel too long. Someone give me a hand?
22:03Praetorif there were an atom? function, that'd help too
22:03arohner,(read-string "(+ 5 4)")
22:03Praetorthen I wouldn't need pr-str
22:03clojurebot(+ 5 4)
22:03hiredmanPraetor: this is not common lisp
22:04hiredmanatom is a reference type
22:04arohner,(pr-str '(+ 5 4))
22:04clojurebot"(+ 5 4)"
22:04hiredmanthere is nothing that is an "atom" in the common lisp sense
22:04hiredmanso there is no predicate you can use
22:04Praetorhiredman: how about list? or form? ?
22:05arohnerlist? exists
22:05TimMcOh, you were thinking of atoms in the CL sense, got it.
22:05arohner,(list? '(+ 5 4))
22:05clojurebottrue
22:05Praetorhiredman: if that doesn't work for me in the repl, what am I missing?
22:05arohner,(list? 3)
22:05clojurebotfalse
22:05TimMc$findfn "(+ 5 4)" '(+ 5 4)
22:05hiredmanif what doesn't?
22:05lazybot[clojure.core/read-string]
22:05Praetorhiredman: your helpful pr-str and read-string examples
22:06hiredmanTimMc: findfn may not eval the result, so maybe don't quote them
22:06hiredmanPraetor: how do they not work?
22:06TimMcPraetor: THat was arohner
22:06Praetorhiredman: nvm, it actually works. thanks :)
22:06hiredman,(read-string (pr-str '(+ 1 2)))
22:06clojurebot(+ 1 2)
22:06TimMchiredman: I finally found the right incantation for findfn.
22:06PraetorTimMc: oops, you're right
22:06Praetorarohner: thanks for the examples, arohner
22:07arohnerPraetor: np
22:09Praetoris there a favorite pastie here?
22:09Praetor,paste
22:09clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: paste in this context, compiling:(NO_SOURCE_PATH:0)>
22:09TimMcPraetor: GitHub gists are popular, I guess
22:09TimMcalthough I despise their too-light color scheme
22:10hiredman~paste
22:10clojurebothttp://gist.guthub.com
22:10hiredmanclojurebot: really?
22:10clojurebotPardon?
22:10TimMcguthub haha
22:10Praetorok
22:10TimMccuriously, guthub.com redirects properly
22:11TimMcthank goodness
22:18Praetorhttp://paste.lisp.org/display/123951
22:19PraetorI'm trying to write a function kf that allows me to split up a function name so that I can call a function with the arguments interspersed
22:19PraetorHowever, I can't solve this last problem
22:20hiredman"arguments interspersed"
22:20hiredmaninterspersed with what?
22:20Praetorwith the function name
22:21hiredmanwhat?
22:21clojurebotwhat is seq
22:21Praetorif the function is called add.to. I want to make a call (add. 2 to. (+2 3))
22:21hiredmanyou will have a number of problems with that
22:21Praetorhiredman: kf will be the macro that allows me to make that call: (kf add. 2 to. (+ 2 3)) will become (add.to. 2 (+ 2 3))
22:22hiredmanfirst functions don't really have names, but they can be bound to name locally (via something like let) or globally as a var (via def)
22:22Praetorhiredman: i looks simple, and each step works independently in the repl, but I can't code the last step into the macro
22:22TimMchiredman: I think I see what Praetor is trying to do; it is not that.
22:22hiredman*shrug*
22:23TimMc(macroexpand-1 `(kf add. 2 to. (+ 2 3))) => `(add.to. 2 (+ 2 3))
22:23TimMcI think it's a bad idea, since it manipulates names, but whatever.
22:24PraetorTimMc: it's an experiment, I want to see if it's doable
22:24PraetorTimMc: I can't map pr-str onto the args in the last bit of my macro
22:24Praetorthat's all I need
22:24Praetorwhen I map it, it complains that it can't find the symbol... it's too eager to look the symbols up
22:25TimMcI can't remember if namespace qualification is going to give you trouble here.
22:26PraetorI can get very close, as you can see, all the way to "(((do. not.) (fun this) that))" (as a form, not a string), but the only reason is that I'm cheating with (quote)
22:26Praetorso as to supress evaluation
22:26Praetorotherwise it won't let me do it
22:26Praetor:)
22:27TimMcOK, so you are combining syntax-quote and list, which is not going to help.
22:28PraetorTimMc: I only did it to show how far I can get
22:28TimMcNot bad in and of itself, just not what you mean here.
22:28Praetorbut yes, quote isn't going to help
22:29PraetorI only used quote so that it'd stop looking up symbols that don't exist.
22:29Praetorotherwise it'd try to evaluate "do." and it'd say that that symbol doesn't exist...
22:30Praetorthat's why I can't (apply str (map pr-str ....
22:33TimMcoh, wait... CLojure isn't going to like this.
22:33Praetorbecause of namespaces?
22:33TimMcPutting a dot at the end is going to make it think "Whee! Class constructor!"
22:34Praetoroh...
22:34PraetorI wanted to use colons instead but couldn't
22:34TimMcYeah, those are keywords.
22:34TimMc,(type :foo)
22:34clojurebotclojure.lang.Keyword
22:34Praetorheh. what punctuations are available for naming?
22:34Praetor,(type &foo)
22:34clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: &foo in this context, compiling:(NO_SOURCE_PATH:0)>
22:35Praetorcan I use ampersand?
22:35TimMcNot really, no. You *can* use a bunch of stuff, but there's a list f what is guaranteed future-safe.
22:36TimMc"Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ?"
22:36Praetorok, I'll just use the letter t just to see if I can get to where I want
22:36Praetoroh, I see
22:36TimMcPrefix with underscore, how about that?
22:36TimMcor postfi
22:37Praetoryep, underscore sounds good
22:38TimMcOK, the net step is getting rid of namespace nonsense.
22:39TimMcOtherwise (apply str (getkeys args)) gives you user/do_user/not_ or whatever.
22:39Praetorwell, I'm trying to avoid the evaluation of symbols
22:40PraetorTimMc: http://paste.lisp.org/display/123951#1
22:40PraetorTimMc: gives: Unable to resolve symbol: do_ in this context (NO_SOURCE_FILE:652)
22:40TimMcThe macro gets the symbols already prefixed with namespace.
22:41TimMcPraetor: Here's the state of my work so far: https://gist.github.com/1138805
22:42TimMcBY the way, there is also clojure.contrib.seq/separate
22:42Praetorhmm... why do you call kf with macroexpand-1 and not (kf ... ?
22:44TimMcBecause then I don't have to have a valid expression. It's helpful for work in progress.
22:44TimMcIt takes a form and returns a form.
22:44Praetorah. so that's what's keeping you from having the problem I'm having :)
22:46PraetorTimMc: defmacro is also supposed to take a form and return a form :)
22:46TimMca macro does that, yes
22:47TimMcmacroexpand-1 allows you to use the macro as a function of forms -> forms
22:48Praetormy common lisp brain can't make sense of that. a macro is supposed to be such a function, whose type is Form -> Form
22:48TimMc$findfn 'user/foo 'foo
22:48lazybot[]
22:48Praetorthat's why I'm lost as to why it keeps evaluating my stuff
22:54PraetorI can't get any closer to solving this
22:54Praetorit's maddening
22:55TimMcOK, I think I have it...
22:55Praetorlet's see
22:55TimMchttps://gist.github.com/1138805
22:55TimMcI'm using (use '[clojure.contrib.seq :only (separate)]) by the way
22:56PraetorI was about to ask that. I'm on the repl, copying and pasting that doesn't work
22:56Praetorby "that" I mean your (use... form
22:57TimMcReally?
22:57Praetorjava.io.FileNotFoundException: Could not locate clojure/contrib/seq__init.class or clojure/contrib/seq.clj
22:57TimMcOh, you must not have contrib on the classpath. Sorry.
22:58Praetorwhat do I do then?
22:58TimMcUse filter instead, I guess.
22:58Praetorwhat's the result of running your gist code?
22:59Praetordid you finally join the strings?
22:59TimMc(do_not_ 2 (clojure.core/+ 3 4))
22:59Praetorwow, you got it
22:59Praetornow can you do it without using macroexpand-1 ?
22:59TimMcyeah
22:59TimMconce I (defn do_not_ [a b] a)
23:00Praetoroh... gotcha
23:00Praetorlemme try here
23:01Praetorwith filter
23:01TimMcuse complement
23:01TimMcinstead f repeating yourself
23:02PraetorI thought about that but complement is for switching a boolean-returning function
23:02Praetoror am I mistaken?
23:02TimMcPraetor: check ouy the gist again
23:03TimMcSee how I composed filter and complement?
23:03Praetorright, yes. :) I'm not a newbie at FP :)
23:03TimMcok, cool
23:03ibdknoxhas anyone seen this error? Caused by: java.lang.NoSuchMethodError: clojure.lang.RT.keyword
23:03Praetorheh
23:03PraetorTimMc: I'm still working on making it work here with filter, hang on
23:05TimMcPraetor: OK. I updated mine to just use filter.
23:05PraetorTimMc: another reason I hadn't done that refactoring of is-key is because I didn't know Clojure's let was like Haskell's instead of like Scheme (in Scheme you'd have to use let*)
23:06PraetorTimMc: there you go! that's it :)
23:06Praetoryou proved it's doable!
23:06Praetormy only problem then was that I hadn't defined do_not_ before
23:07TimMcPraetor: Yeah, and if you use let* in Clojure you get a nasty surprise.
23:07Praetorthat's why I kept getting stopped at that error
23:07TimMcit's an internal helper for let
23:07Praetorouch :P
23:07TimMcIn a way, it is exactly opposite. >_<
23:07TimMcPays to read http://clojure.org/lisps about once every week.
23:07Praetory'know, I was much prejudiced against Clojure at first
23:08PraetorI was a Schemer and then a CLer
23:08Praetorbut now that I've watched Hickey's lectures... he's really smart
23:08Praetorso I've changed my mind about Clojure :)
23:08TimMcNice balance of practical and theoretical, yeah.
23:08Praetorso I support doing away with let*. I like Haskell's let better anyway
23:08Praetoryes, indeed
23:09Praetorif Clojure had reader macros we could do away with "kf" :P
23:09TimMcYou wouldn't want that.
23:09TimMcI know a guy who worked at ITA, where they use Lisp for just about everything.
23:10Praetoryeah they're big in CL
23:10TimMcHe's a bit cold on Lisp now, because they used macros to splice together functions names.
23:10TimMcIt was hell to find where anything was defined in the codebase.
23:10Praetoroh, so he was using an equivalent of my kf function?
23:11TimMcThe moral equivalent of it.
23:11amalloyimmoral
23:11TimMcprecisely
23:11PraetorI have to write some Obj-C and I really enjoy the spliced function=arguments thing
23:12PraetorI was wondering how it'd feel in a functional language
23:12Praetorsince I could never try it in haskell
23:12PraetorI think one of the problems with FP languages is that functions have tons of arguments and it's hard to memorize the order in which you have to pass things
23:13Scriptorgood editors can help with that :)
23:13Praetora function call is way too terse in functional languages, so they become obscure
23:13amalloyif only we had some way to combine arguments into a sort of "list" or "map" structure
23:13PraetorScriptor: I use emacs, it doesn
23:13Praetordoesn
23:13Praetort help me one bit
23:13TimMcIt could.
23:13Praetor(sorry, keyboard went crazy)
23:14Scriptorit helps me
23:14TimMcI haven't bothered to set it up yet.
23:14PraetorScriptor: it helps me when I'm writing CL code, not when I'm reading it
23:14TimMcI just hit clojuredocs.org all day.
23:14Scriptorah, good point
23:14amalloyif you have trouble remembering what order to pass arguments in, just pass a map instead, with keys named to help you remember
23:14PraetorScriptor: :)
23:15Praetoramalloy: that smells too much like ruby and too little like the power that a Lisp can give me :)
23:15arohnerPraetor: if you use slime, you get fn arguments
23:15ScriptorPraetor: at least argument order is fairly consistent, couldn't say the same of some other languages
23:16Praetorarohner: I got beaten when trying to set up slime with CL, not sure I have the guts to reconfigure it to use Clojure :P
23:16TimMcPraetor: The ordering is usually such that (partial ...) is useful. :-)
23:16clojurebotAck. Ack.
23:16TimMcugh, clojure
23:16TimMc*clojurebot
23:16PraetorTimMc: heh, if that was so, Haskell wouldn't have a flip function
23:16TimMcclojurebot: The ordering?
23:16clojurebotExcuse me?
23:16TimMcOh, good.
23:17amalloyclojurebot: Praetor: The ordering?
23:17clojurebotPraetor: The ordering is usually such that (partial ...) is useful. :-)
23:17amalloyTimMc: sucker
23:18TimMcargh
23:18Praetorso Tim... about that issue I have loading up libraries in the repl... any clues on that?
23:18TimMcDepends how you're getting a repl/
23:19ScriptorI prefer doing partial with functions that take a seq as a 2nd or 3rd argument, though that might just be me
23:19TimMcI run `lein repl` from anywhere and get clojure + contrib.
23:20Praetorok, let me tell you what I know. I'm running clojure 1.2.1, I created a clj executable on my /usr/local/bin that contains exactly this: http://en.wikibooks.org/wiki/Learning_Clojure/Installation#Linux.2FOSX_Configuration
23:20TimMcOK, so you would either need to add clojure-contrib.jar to that classpath or use Leiningen. :-)
23:21Praetorfor some reason I already have lein installed... I typed lein repl and got in and now (use ... works.
23:21Praetorhow can I check that it's using my clojure 1.2.1 and not some old one, from within?
23:21Praetorfrom within the repl
23:21TimMcsome global
23:22TimMc,*clojure-version*
23:22clojurebot{:interim true, :major 1, :minor 3, :incremental 0, :qualifier "master"}
23:22TimMc,(clojure-version)
23:22clojurebot"1.3.0-master-SNAPSHOT"
23:22PraetorTimMc: great. you're great, sir. I have no more questions :)
23:23TimMcPraetor: I am making liberal use of clojuredocs
23:23Praetorthat'll be the next thing I'll learn to use, then
23:23TimMcclojuredocs.org, that is
23:23TimMcnot a doc feature
23:24Praetorindeed, searching for "clojure version" on it gives me that function ma
23:24Praetorname
23:24PraetorTim, thanks a lot, I won't bother you anymore. I'll go back to coding and reading now. :)
23:25TimMcThe search is a little wonky, by the way -- hyphens mess up the main search, but not the autocomplete.
23:25TimMcHave fun!
23:25TimMcBack to Python for me.
23:25PraetorTimMc: I'd usually search this way: on google: clojure version site:clojuredocs.org
23:26TimMcGood idea.
23:26Praetor:)
23:26ScriptorPraetor: which browser do you use?
23:26PraetorScriptor: firefox. I really need the copyAllUrls plugin, and the TreeStyleTab one
23:26Praetorthat's the only reason
23:26Praetorwhy?
23:26clojurebotPraetor: because you can't handle the truth!
23:26Scriptorfor me, it's "clo"-tab-function name
23:26Scriptoron chrome
23:27Praetor"clo" means you start typing that anywhere, regardless of where the focus is in Chrome?
23:27Scriptorin the url bar
23:27Scriptorso I just need to open a new tab first
23:27Scriptorbut anyway, it's because it detects the search inside clojuredocs.org
23:28Scriptor(as opposed to using google to search the whole site)
23:28Praetorhmm. I'll see if I can enhance firefox's awesome bar to do some of that later
23:28Scriptorthe only issue is that the results page you get from that is far more inferior than what you get from the autocomplete dropdown
23:28Scriptorno idea why
23:29TimMcI use search keywords -- "cld version<enter>" takes me to http://clojuredocs.org/search?q=version
23:29PraetorI'd use chrome if it had the plugins I need
23:29PraetorTimMc: on FF?
23:30TimMcPraetor: Yeah, I have http://clojuredocs.org/search?q=%s bookmarked with cld as the keyword.
23:30TimMcmagic
23:30PraetorI never knew that worked
23:33PraetorTimMc: great tip. I set it up for cljd. I'd never remember "cld" :)
23:59amacIs there any way to bind (let/binding) a vector of k/v pairs? Something along the lines of `(let ~passedvec ~@body) in a macro; I'm not strong with macros but it seems I need a way to expand the passedvec before the let gets expanded...