#clojure logs

2012-03-18

00:01ideally_worldHow would you test *state* with Midje?
00:08ideally_worldFor the time being, just going to create a sub function that calculates the state that the state setting function uses and then test the sub function...
00:12yoklovweird, there's no `any?` function?
00:13yoklovbut there's a `not-any?`, `every?`, and `not-every?`
00:13yoklovthat just seems inconsistent.
00:15ideally_worldsome?
00:18yoklovoh
00:18yoklovright.
00:22archaicalso look at contains?
00:23pyninjanot to be confused with .contains
00:23ideally_worldcontains? is probably more what you are looking for...
00:24ideally_worldthough some is a bit more generic :)
00:30amalloycontains? doesn't sound anything like what he's looking for
00:38ideally_worldamalloy, you're probably right, just talking out of my ass :(
00:38ideally_worldnot unusual for me...
00:42mdeboardAre multimethods a vehicle to method overloading?
00:44ibdknoxthey're for polymorphism, yeah
00:45tremoloyea, it's really more method overriding than overloading
00:45tremolooverloading is where arity comes in
01:03ideally_worldsuspect midje and live-coding are somewhat incompatiable :/
01:06wmealingmidje is for mocking right ?
01:07muhoowell that was a fun weekend. my brain is full now.
01:07wmealinglive coding (ie artistic ) ?
01:08wmealingthat is something ive always been interested in
01:09cgagf
01:09cgag'
01:09cgag';
01:09cgagwoops, was just waking my monitor up
01:10ideally_worldmidje is a testing frame work that is a bit more abstract than normal testing
01:10wmealingah
01:10ideally_worldlive coding is more for overtone, which I only dabble with rarely
01:10ideally_worldbut the live-coding configs actually got my emacs environment sane enough for me to start using Clojure
01:11ideally_worldI really like the feel of midje "test". Basically stating facts on what is expected confirm (or not) that they are true
01:12ideally_world"FAILURE: 1 fact was not confirmed. (But 20 were.)" :)
01:43wmealingi've yet to do it, i'm pretty new to clojure, just working my way through the coans now
01:43wmealingideally_world, are you using somehting like supercollider ?
04:41ideally_worldwmealing, yes, using supercollider on a mac
05:51FullmoonDoes Emacs + Slime make a good development environment for clojure code?
05:55foobar27Fullmoon: I'm quite happy with it, though I use swank (which uses slime)
05:56foobar27especially the interactive evaluation is quite practical if you've just started with clojure
05:56foobar27do you already work in emacs?
05:58ideally_worldisn't swank slime's backend?
05:58ideally_worldthat is, it's the server that makes slime possible
05:59ideally_worldIMHO, Emacs with Slime is the best environment for writing Clojure code
05:59ideally_worldI realy really really hate using it for Clojure code :)
06:05foobar27ideally_world: you seem to be right
06:13dan_bis there a "not" missing in your last message, ideally_world?
06:14dan_bif you hate using the best environment, I tremble to thionk of your reaction to any of the lesser ones
06:14ideally_world:)
06:14ideally_worldIt speaks volumes for how much I like the language
06:14dan_bor are you a Lisp Machine trero grouch?
06:14dan_bs/trero/retro/
06:15ideally_worldhow ever you word it, I've never seen a Lisp Machine
06:15ideally_worldthough I probably grew up pretty close to a few...
06:15dan_b(the delightful thing abut clojure is how devoid the community is of "hey let's build a lisp machine" people)
06:15dan_bat least, what I've seen of it so far
06:15ideally_worldHey, let's not build a Lisp Machine...
06:15ideally_worldthere's your not :)
06:16dan_bhehe
06:17ideally_worldI'd hate emacs more if technomancy hadn't pointed out the bleedy obvious commands on https://github.com/technomancy/swank-clojure
06:22AimHereLets build a java bytecode machine in hardware, and run clojure on it
06:43ideally_worldI guess dragging the C programmers half way to Lisp, dragged some of them towards Lisp Machines? :)
06:46ambrosebsgiven a protocol and a class, is there a function that determines if an instance of that class "satisfies" that protocol?
06:47ideally_worldsatisfies?
06:47ambrosebssay (satisfies? IParseType []) ;=> true
06:48ideally_worldbut I'd expect you did that already
06:48ambrosebsI want (magic-fn IParseType PersistentVector) ;=> true
06:48ambrosebswell I can kinda see a way to use some private clojure.core functions to make my own function
06:48ambrosebsbut id rather not ;)
06:49ambrosebsanother pair of eyes is always good
06:49ideally_worldmy eyes are tired and naive
06:49ideally_world:)
06:49ambrosebsxD
06:49ideally_worldand not quite what they were at the Conj :)
06:49ideally_worldalthough probably a bit less naive than then
06:50ideally_worldactually spoke to you a couple of times at the Conj
06:50ideally_worldand back in Australia
06:50ambrosebsorly? remind me?
06:50ideally_worldtall :)
06:50ambrosebsLOL pic?
06:50ideally_worldfalse :)
06:51ambrosebshaha :)
06:51ideally_worldlol
06:51ambrosebswell im deep into Typed Clojure
06:51ideally_worldAmerican accent from Australia
06:51ideally_worldsaid hello on the way back from the Firday not party
07:02ambrosebsok, made my own implementation. just minor modification of clojure.core/find-protocol-impl
08:39jaleyFor some reason, after grabbing slime-ritz from marmalade, package.el won't autoload it. It loads other packages, and if I open slime-ritz.el and load it manually, that works fine. Anyone else have this issue?
08:52bsteuberI wonder how I could find out in which lein2 profile I am from a when-in-production macro
08:54bsteuberI would probably add a different hook copying over a lein-profile.clj, but maybe there's a simpler way?
09:19tomojany glossers around? finite-block seems to be basically identity. you can encode byte arrays, but buf-seqs just decode back to buf-seqs
09:19tomojso how do we get a byte array?
09:20tomojI thought (.array (gloss.io/contiguous buf-seq)) worked, but I realize now this will sometimes return too much
09:20rfgpfeifferhello?/who
09:21llasramtomoj: You need to get a byte-array on decode, not encode, right?
09:23tomojright
09:23tomojah, I think this works:
09:24tomoj(let [b (byte-array len)] (.get (gloss.io/contiguous buf-seq) b) b)
09:24rfgpfeifferI'd like to write a native clojure compiler for gsoc. Is anybody here familiar with cola/pepsi/potion/fonc?
09:26llasramtomoj: Something like that should work, but seems a bit hacky; still hacky, but you should be able to use .remaining on the `contiguous' ByteBuffer to get the real content size
09:26llasramtomoj: I did a quick look, and I don't see anything in gloss to decode directly to a byte array, but it wouldn't be too hard to implement in terms of gloss's internal protocols
10:27winkhello, anyone knows some semi-fleshed out user management for noir web apps? not that it would be hard to reinvent., but still... :P
10:33bsteuberwink: I just googled around a bit and found https://github.com/remvee/ring-basic-authentication
10:34winkbsteuber: thanks, will take a look at it. I just usually hate trying 5 things when there's a generally accepted well-known default :)
10:35bsteuber:)
11:21yoklovso, if i have a small piece of necessary application-specific state which needs no concurrency semantics, which reference type should i be using?
11:22yoklovusually I use atom, but should i be using var instead? or ref?
11:22Vinzentyoklov, usually atom is ok
11:23yoklovyeah, what throws me is the description of var as "thread local state"
11:24Vinzentin order to modify var you have to bind it first, like (binding [*foo* 1] ... (set! *foo* 2))
11:25Vinzentso if you don't need thread-local bindings, you don't need dynamic vars
11:25yoklovright, and that definitely seems like a hassle, but do i need that if i do `(def ^:dynamic *foo*)`
11:25yoklovand
11:26yoklovactually that makes sense, so if i _need_ the state to be thread local, use a var
11:27Vinzentexactly. If you want just plain "mutable variable", atom is ok
11:27Vinzentalthough, usually you don't want it :)
11:29yoklovof course not, but you sometimes need it
11:31yoklov(e.g. in my silly unlambda interpreter there's a "current-character" at all times, which is a tiny piece of necessary state)
11:31raekif your application has essential state, then you need something like it
11:33yoklovyeah. i had just been wondering if i was horribly abusing clojures reference types by using atom
11:56fliebelmorning
11:58antares_yoklov: atom is a good place to start.
11:59yoklovyeah, i almost never need concurrency semantics in my programs, and had been using atom when i needed some state.
11:59yoklovjust felt like checking that that was, in fact, appropriate
12:06Chousuke_yoklov: if you write your programs using mostly pure functions, changing it later won't be that difficult anyway
12:06yoklovyup
12:07yoklovand a nice thing about clojure is that i always have that option
12:07yoklovas opposed to other functional languages where concurrency support is spotty at best
12:08yoklov(depending on the language, of course)
12:08Chousuke_clojure has an edge in that the concurrency tools are orthogonal to the rest of the language.
12:08Chousuke_I suppose that
12:08Chousuke_is true of Haskell too
12:10Chousuke_but in lots of languages you have to worry about how to use the rest of the language in a way that doesn't interfere with concurrency when you decide to add it.
12:11Chousuke_java interop has that sort of effect in clojure too, though :P
12:14yoklovright, i came from programming mostly in racket, and if you want concurrency in that you either have to settle for working fake concurrency, or not-really-working parallelism
12:16yoklovclojure overall is an extremely well-designed language, and the concurrency sematics are certainly no exception (even though i never really finding myself wanting to use them)
12:19ChousukeIt seems to me that Clojure's good design stems from rhickey's insistence on simplicity as he defines it. As you add features designed like that, it looks like people perceive it as overall good design :P
12:19mdeboardgo figure :P
12:24yoklovyeah, definitely. and comparing to other lisps, it helps a lot to be modern.
12:30zwit is a little strange, (require 'clojure.contrib.str-utils) success in lein repl, but failed in slime. but I do not find clojure-contrib.jar in my box, so why lein repl can find it?
12:31zwThere is only clojure-1.3.0.jar, no clojure-contrib.jar
12:32Bronsa_zw: this is because lein repl outside a project runs a repl from within leiningen's process
12:32raekzw: in the same project?
12:33Bronsa_and leiningen < 2.0 uses clojure 1.2 and clojure-contrib
12:35raekzw: also, use clojure.string instead. the old contrib is deprecated and clojure.string has been available since 1.2
12:42pandeiroanyone using lynaghk's c2 lib yet? https://github.com/lynaghk/c2
12:43zwthanks Bronsa and raek
12:43zwBronsa, you said leiningen has its own clojure?
12:43Bronsa_well
12:44Bronsa_clojure is included in leiningen's standalone jar
12:44raekzw: Leiningen and your project run in separate environments
12:44raekyou control the project environment through the project.clj file
12:45zwOh, where is leiningen's jar? I only find .lein and .m2 directories
12:45raekin one of those...
12:45BronsaLEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar"
12:45zwYes, I just want to know the global jars, not per project
12:45Bronsait's in .lein/self-install
12:46raekzw: when just tinkering, it's common to have a project for that
12:46raekleiningen is not built for developing outside projects
12:47raekso if you want to play with, say, clojure 1.3 and some library, do a "lein new tinkering" and declare those libs in the project.clj file
12:48Bronsaalias clj="java -cp `for i in $HOME/src/dummy/lib/*.jar; do echo -n $i: ; done` clojure.main"
12:48Bronsai have this on my .zshrc
12:48raekif you just started learning clojure, don't try to install libraries globally as you would do in other languages
12:49zwwhy? raek
12:49raekwhen in Clojure-land, do as Clojurians do :-)
12:49winkinstall ALL the libs!
12:49raekzw: also, leiningen does not have any concept of globally installed libraries
12:49raekso you can't
12:50zwI think I can set swank-clojure's classpath, so the libs won't be downloaded while (clojure-jack-in)
12:50raekif you just want to get started with clojure, it's probably easiest to do thing the way most other people do them
12:50Vinzentzw, libs are downloaded when you do lein deps
12:50raekzw: libraries are only dowloaded once (unless you use SNAPSHOT versions)
12:51Vinzentzw, M-x clojure-jack-in just starts swank server and connects to it
12:51zwyeah, but I just wandering the other way
12:51Vinzentwhy do you need it?
12:51raekwhich other way?
12:51zwI just want to know if I can do thing differently
12:51Vinzentzw, you can, with cljr
12:51Vinzentbut it has very specific use-case
12:52raekwell, you basically have "use leiningen" or "download all jars manually and launch clojure with the java command with the correct classpath setting"
12:52zwI don't need it, just a little curiously
12:52raekzw: one way to se what's going on in leiningen is to use the "lein classpath" command
12:53raeka very basic repl can be started with "java -cp <output from lein classpath> clojure.main"
12:53zware results of `lein classpath` different for different projects?
12:54raekzw: yes
12:54raekdifferent projects use different libraries
12:54raekand different versions of them
12:54raekwhich can be incompatible
12:54zwso it just result from dependencies/dev-dependencies?
12:54raekyes
12:54zwI'm using emacs/slime, I like it
12:55raeklein download the deps of your project, and the deps of the deps, and so on
12:55Vinzenthm, btw, cljr actually seems outdates. Is there modern analogous of it?
12:55raekand provides a way to start a repl, swank server, or whatever, with correct classpath settings
12:55zwbut I download clojure-contrib failed, long list of maven error, does the newest version is 1.3.0?
12:56Vinzentzw, clojure-contrib is gone
12:56raekzw: there is no clojure-contrib for clojure 1.3
12:56raekhttp://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
12:56Vinzentah, too slow
12:56raekzw: some of the namespaces have been merged into clojure, some have been split off into their own projects, and some are simply unmaintained
12:56zwoh, but I have some old code in the book "pragramming clojure" to try
12:57Bronsazw: you can still use clojure 1.2 with clojure-contrib 1.2
12:57raekzw: then you can set up a project that uses clojure 1.1 or clojure 1.2
12:57raekand things will work exactly like in the book
12:57zwok, seems the only solution
12:57Bronsajust put [org.clojure/clojure "1.2.1"] [org.clojure/clojure-contrib "1.2"] in :dependencies of a project
12:58zwI still wander is it necessary to repeat same jars in different projects?
12:59raekin lein2 they aren't copied to the lib/ directory anymore
12:59raekthey are used directly off the .m2 directory instead
13:00zwmy lein seems to be 1.7.0
13:00raekzw: here is the rationale: https://github.com/technomancy/leiningen/wiki/Repeatability
13:00zwlein2 is dev version?
13:00raekyes
13:00raekit's about to be released
13:00raekpretty soon
13:02zwok, I feel leiningen is mysterious, I should do some read
13:03zwthank you guys, it's very nice chatting to you
13:04zwgo to sleep now, bye guys!
13:05zwI'll be back :)
13:05yoklovleiningen rules
13:05yoklovboth the 30's sci-fi novel _and_ the program
13:05zwI've heard about the novel
13:06yoklovby novel i mean short story, actually
13:06yoklovand yeah
13:06yoklovi read it for class in highschool haha, it's very cool. i really like that lein's name is a reference to it
13:08zwOh, I havn't read it, maybe I should find it
13:08yoklovif you have some time to kill it's worth it.
13:08zwok, thanks
13:08zwbye
13:17yoklov,(#([3, 4]))
13:17yoklovoh damn
13:17yoklov&(#([3, 4]))
13:17lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector
13:17clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
13:18yoklov&(#(vector 3 4))
13:18lazybot⇒ [3 4]
13:18yoklovweird.
13:18raek([3 4]) and [3 4] are not the same thing
13:19yoklovyeah, but that's not what's happening, is it?
13:19raektherefore #([3 4]) = (fn [] ([3 4])) is not the same thing as (fn [] [3 4])
13:19yoklovreally?
13:19TimMc&((constantly [3 4]))
13:19lazybot⇒ [3 4]
13:19raeknote the extra parens
13:19raekyou try to call [3 4] as a functions
13:19raek-s
13:20yoklovyeah, i guess that makes sense
13:20TimMc&(#())
13:20lazybot⇒ ()
13:20raek#(...) is a shorthand for the sommon cases when you want an anonymous function that performs a call
13:20TimMc&`#([3 4]) ; yoklov
13:20lazybot⇒ (fn* [] ([3 4]))
13:20raek*common case
13:20yoklovraek: yeah i knew that
13:21yoklovTimMc: that makes more sense now
13:21yoklovI should use ` more often when i'm confused by the reader
13:22yoklovactually, raek, i guess i didn't realize that it was for when it performs a call specifically.
13:22raek&'#([3 4])
13:22lazybot⇒ (fn* [] ([3 4]))
13:23TimMcYeah, ' is often clearer to read than `.
13:24yoklovyeah, ` ends up with all those clojure.core/lists iirc
13:24yoklovand concats
13:24yoklovwait no that's just if you actually use read
13:25raek&`(foo ~bar)
13:25lazybotjava.lang.RuntimeException: Unable to resolve symbol: bar in this context
13:25raek&'`(foo ~bar)
13:25lazybot⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/foo)) (clojure.core/list bar)))
13:25yoklov&(with-in-str "`(foo ~bar)" (read))
13:25lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
13:25yoklovwhoops
13:26raek&(read-string "`(foo ~bar)")
13:26lazybot⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox6997/foo)) (clojure.core/list bar)))
13:26raekputting double quotes around it and passing it to read-string has the same effect as quoting
13:27yoklovthat is… weird.
13:28yoklovthough, not if you do something like (read-string "#=(+ 3 4)") :p
15:27beffbernardI'm trying to change the :source-path in a noir project to "src/clj" but jetty doesn't like that
15:30beffbernardOops, just solved my own prob. I didn't change noir.server/load-views to reflect my changes
15:47choffsteinAnyone know why `lein clean` might not be removing my lib/ directory?
15:48choffsteinI run lein clean && lein deps and I end up getting multiple snapshots of the same lib, compiled on different days
15:48choffsteinwhich isn't such a big deal locally -- I can just manually remove my lib directory -- but sort of sucks on my CI server
15:57tmciverchoffstein: yeah, doesn't remove jars from lib for me either. The doc says it removes *compiled* class files and jars.
15:57choffsteinhm, okay. That seems ... strange to me -- but I guess it makes sense if I am actually managing version numbers correctly, right? Which I don't...
15:59fliebeldnolen: Any breakthroughs there? I'm crawling towards a working connectedo goal.
16:00JetienHi! How can you get the line where the Reader throws an exception? I tried using clojure.lang.LineNumberingPushbackReader and catch the clojure.lang LispReader$ReaderException excpetion, but I can't seem to access its member "line"
16:06dnolenfliebel: sorry haven't had a chance to get to it yet, a bit busy putting together a CLJS presentation today
16:07fliebeldnolen: Ok, where are you presenting?
16:09dnolenfliebel: BK.js this Tuesday and NYC.js next week
16:09dnolenanyone tried to use SublimeText with CLJS?
16:14fliebel> (partition odd? (list 1 2 3 4 5 6 7 8 9))
16:14fliebel(1 3 5 7 9)
16:14fliebel(2 4 6 8)
16:14fliebel(scheme, not clojure)
16:31FrozenlockI'm trying a compojure example. In it, there's the Float/parseFloat function. However this leaves me with an ugly .0 when I have a full number. By using read-string it seems I can avoid this problem. Is there any drawback to using read-string instead of Float/parseFloat?
16:41beffbernardFrozenlock: Depends if you want a Double or not I guess
16:41beffbernard,(class (read-string "0.0"))
16:41clojurebotjava.lang.Double
16:41beffbernard,(class (read-string "0"))
16:41clojurebotjava.lang.Long
16:42FrozenlockWell that's the beauty of it, it will asign the correct type automatically.
16:42FrozenlockNo need to parse integer or float, just read-string
16:43beffbernardYup
16:43Frozenlockyahoo! :D
17:05nybblesanyone know if it's possible to load incanter.core without any guy windows opening up?
17:07nybblesarch i meant *gui windows
17:07nybblesstupid autocorrect..
17:10jkkramerFrozenlock: keep in mind that read-string reads more than just numbers
17:10jkkramer&(read-string "#=(println \"hi\")")
17:10lazybotjava.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.
17:11cgagnathanmarz: I was reading the storm tutorial the other day, there's a missing "````" following the ExclaimationBolt extends BaseRichBolt example
17:17mkwhy does are there 20 invoke methods taking 1-20+ arguments?
17:17mk-does
17:21nathanmarzcgag: thanks, fixed
17:21mkthis is from java, for example RT.var("foo", "bar").invoke(...)
17:21pellebHi guys. I have a question about organization of my new oauth library clauth https://github.com/pelle/clauth
17:21Hali_303hi! which is the most up to date joda time library? clj-time was not updated in the last 2 years..
17:23pellebI have a Store protocol for storing tokens, users etc. and a memory based implementation. I want to add redis, datomic etc. Should I do this in the same project with dev dependencies for clj-redis etc or as seperate project for each implementation.
17:23RaynesHali_303: https://github.com/seancorfield/clj-time
17:23RaynesHali_303: Sean's is the canonical repo at this point.
17:26Raynespelleb: Today is probably going to be a pretty slow day in here due to a lot of people flying home and getting settled back in after the Clojure/west conference. If you don't get sufficient replies tonight, I'd give it another shot tomorrow.
17:26pellebRaynes: Thanks. Good point. I wish I could have been there.
17:27RaynesAs do I.
17:29Hali_303Raynes: thanks!
17:29Hali_303Raynes: any way to use lein to use this version of clj-time?
17:30RaynesHali_303: The one on clojars is his.
17:30Hali_303Raynes: hm
17:30Raynes[clj-time "0.3.7"]
17:30Rayneshttp://clojars.org/clj-time
17:31Hali_303oh i see
17:40mkare there any nice interfaces from java to clojure?
17:47gfredericksmk: I wrote a clojure macro for generating classes with static functions from clojure
17:48mkgfredericks: got a link?
17:48gfredericks$google lib-2367
17:48lazybot[fredericksgary/lib-2367 · GitHub] https://github.com/fredericksgary/lib-2367
17:48gfredericksit's the lib-2367.export ns
17:49gfredericksmk: let me know if you have any questions/suggestions
17:50gfredericksmk: there's more documentation about options in the macro's docstring
17:51mkyou could add an example of what the generated code looks like
17:52gfredericksmk: it's boring gen-class stuff -- you'd really find that helpful?
17:52mkI was thinking of it the other way, with some sort of way to call clojure code from java
17:52gfredericksmk: yeah that's what this is for
17:53gfredericksyou stick the macro at the bottom of your ns, make sure to aot-compile the ns, and then you will have a class with a static method for each public function
17:54mkI was thinking that maybe a good way to make clojure easier for people (including myself, since I'm learning) is to pretend that clojure is really a java ... jar, in a sense
17:54gfrederickswell the clojure language is certainly a jar
17:54gfredericksand it's easy enough to make jars from clojure projects with leiningen
17:55mkyeah, but to start it up one needs to set up what initially looks like a whole bunch of strange tools
17:55gfrederickswhat tools beyond leiningen?
17:57mkif you have a bunch of java code that you'd need to use, and you're used to working from eclipse, you now have to figure out ccw, and so on
17:57gfredericksah
17:57ideally_worldyeah, there's the language, then there's the tool support :(
17:58gfredericksit's not easy to make everything easy
17:58ideally_worldat least the language is consistent :)
17:58gfredericksmost of the time
17:58ideally_worldmore often then the tool support seems to be
17:59mkwhenever I get into a new language, I have the most trouble with just that initial step. I tried scheme, I think... there's this pseudo-emacs editor that it uses, I think?
17:59ideally_worldtrial by fire, if you can't get the tool support working, you're not passionate enough to use the language? :)
17:59mkit took me about 5 minutes to quit (unfortunately, maybe)
18:00mkyeah, in a sense. Keeps the newbies out too :)
18:00ideally_worldI sympathise with you mk, I've been having a go at learning for about 6 months and only just getting comfortable with emacs dev
18:00gfredericksI find it simpler to avoid things like eclipse
18:01mkwell... I really mean bad coders, but lisp itself should keep those out, or magically turn them into good coders
18:01gfredericksprobably as a result of the fact that it takes so much effort to develop plugins
18:01ideally_worldthe hard part with the toolset is that you need to use them consistently and that's sometimes hard to do when you're starting to learn the language
18:01mkgfredericks: I hardly use plugins
18:02gfredericksmk: I mean like for new languages like clojure
18:02ideally_worldeveryone is different, but I'd strongly recommend having a good long run at using emacs with all the Clojure support
18:02gfredericksI've had success with using eclipse when I need to do java and classic CLI tools when doing clojure, and mixing them together
18:02mkgfredericks: well, hopefully someone does that for you - like ccw
18:03gfredericksmk: yeah, but because it takes more effort for that to get done, the set of things available at the command line is usually a superset of the set of things available in an IDE
18:03gfredericksand when you work with things that aren't mainstream like clojure, that difference tends to be more stark
18:04mkgfredericks: yes, but what's available isn't always what's easy. An ide makes them available in an easy way. In any case, some people are used to eclipse...
18:04mkbut the bigger thing, I guess, is that people are used to however they load up java
18:07mkif I had a main method with at the very least load("path/file.clj") and startrepl() or something, then it's like I haven't really left the java toolchain at all
18:08gfrederickshmm
18:08gfredericksthat doesn't soudn impossible
18:09gfredericksmk: you can call general clojure functions from java in a mildly clunky way using e.g. RT.var("clojure.core/load-file").invoke("path/file.clj")
18:09gfredericksI think that's correct, not 100% sure
18:10bbloomquick question about idiomatic use of vectors and conj: i frequently run into the situtation where i have a vector, process it in some way, wind up with a seq, and then want to conj onto the right of it
18:10bbloomi have to either (conj (vec whatever) x) ….or…. (concat whatever [x])
18:10bbloomseems clunky
18:10mkgfredericks: yeah - Object result = RT.var(path, "foo").invoke(args);
18:10bbloomam i missing something?
18:11gfredericksbbloom: I think clojure 1.4 has something for that
18:11bbloom:-P what's it called?
18:11gfredericksmapv
18:11gfredericks,*clojure-version*
18:11clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
18:11gfredericks,(doc mapv)
18:11clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
18:11gfredericksyep
18:12bbloomah, that's cool, but not exactly what i need because i'm not always using map
18:12bbloomfor example when working with paths in a tree: (interleave path (repeat :children))
18:12bbloomI have to do: (concat (interleave path (repeat :children)) [x])
18:13mkI'm having fun looking at RT.var at the moment, I had program set up to automatically reload loaded .clj files whenever a save occurs. That's a bit ugly, though.
18:13gfredericksyeah :/ I guess there's not really a good answer to that besides 1.4
18:14bbloomdoes 1.4 help with this in some other way?
18:14gfredericksoh right
18:14gfredericksforgot map doesn't apply :)
18:14gfredericksthen no probably not
18:14winkhm.. is it possible to convert strings/vars to usable keywords? my problem is: hiccup's "[:input.myclass" syntax, I'd like to do something like (let [x '(str ":input." y)] [x ...
18:15bbloomhaha ok, thanks
18:15gfrederickswink: like ##(keyword "foo")?
18:15lazybot⇒ :foo
18:15bbloom`(keyword "asdf")
18:15bbloom,(keyword "asdf")
18:15clojurebot:asdf
18:15winkdoh. thanks :)
18:16mkif there were some way to just treat clojure like... xml or jsp files, then perhaps some number of java programmers could be tricked into using clojure
18:17mkjust having a repl hooked up to running code might be enough for some people
18:20gfredericksmk: I think chas emerick is pretty interested in this topic; I think he may have started a google group or something
18:22mkthanks, I'll look that up
18:24gfredericks,(-> cdr a is car other my quote flatten)
18:24clojurebot(clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> ...)
18:24gfrederickshmph
18:26gfredericks&(-> cdr a is car other my quote flatten)
18:26lazybot⇒ (my other car is a cdr)
18:26gfredericksoh
18:26gfredericks&*clojure-version*
18:26lazybot⇒ {:major 1, :minor 3, :incremental 0, :qualifier nil}
18:26gfredericksso what changed about -> between 1.3 and 1.4?
18:29tmcivergfredericks: I was going to ask you about that the other day; I couldn't figure it out and it wouldn't work in my repl.
18:29Luyt_&(-> cdr a is car other my quote flatten) ; amazing
18:29lazybot⇒ (my other car is a cdr)
18:30tmciverThe threading macro is building up a list of symbols by placing each at the end of the thing that comes next?
18:31gfrederickstmciver: yeah
18:31gfrederickstmciver: for reference: ##(-> cdr a is car other my quote)
18:31lazybot⇒ (my (other (car (is (a cdr)))))
18:32gfrederickstmciver: adding quote to the end of a threading macro is a great way to see what it's doing
18:32gfredericksat least in 1.3 it is :)
18:32tmcivergfredericks: Can't get it to work in my swank repl.
18:32gfrederickstmciver: what clojure version?
18:32tmcivergfredericks: 1.3
18:32gfredericksweerd
18:33gfrederickstmciver: well you can at least use lazybot
18:33tmcivergfredericks: it gives me the following: (clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> cdr a is car other my)
18:35gfrederickstmciver: well I can't figure out why quoting the thing doesn't work, but I can help with understanding the -> macro in general if that's your issue
18:38tmcivergfredericks: does it work in your own repl?
18:38gfredericksnope
18:39gfredericksand lazybot won't show me ##(source ->) for some reason
18:39lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
18:39gfredericks$source ->
18:39lazybot-> is http://is.gd/8TJH2p
18:39gfredericksooh there we go
18:39tmcivergfredericks: I understand the threading macro I guess I was just surprised that it worked with unquoted symbols like that.
18:39RaynesThose links need to be updated.
18:39Raynes&(require 'clojure.repl)
18:39lazybot⇒ nil
18:40Raynes&(clojure.repl/source ->)
18:40lazybot⇒ Source not found nil
18:40RaynesFFFUUU
18:40gfrederickstmciver: it's because the symbols end up inside a (quote) form before they ever get evaluated
18:41gfrederickssince -> is a macro, it does all its macroey things first, by which time everything's inside of (quote) and so never gets evaled
18:41tmcivergfredericks: yeah, that makes sense.
18:41gfredericksRaynes: yeah that link is to the middle of an unrelated docstring in 1.2 :)
18:42gfredericksamalloy: explain us the mysteries of (->)?
18:43Raynesamalloy is sick with the lisplauge.
18:43gfredericksthat sounds parenthetical
18:44amalloyhuh?
18:44gfredericksamalloy: what is the difference between ##(-> cdr a is car other my quote flatten)
18:44lazybot⇒ (my other car is a cdr)
18:44gfredericksand
18:45gfredericks,(-> cdr a is car other my quote flatten)
18:45clojurebot(clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> ...)
18:45gfredericksthe former seems only reproducible by lazybot
18:45amalloylazybot probably macroexpands it too much
18:46gfredericksoh it has to handle it manually?
18:46amalloysorta
18:46gfredericksweerd
18:47gfredericks,(-> cdr a is car other my quote macroexpand-all flatten)
18:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macroexpand-all in this context, compiling:(NO_SOURCE_PATH:0)>
18:48gfredericksah well
18:48amalloygfredericks: lazybot has to mostly-macroexpand stuff, so he can find out if you're doing some illegal interop hidden by a macro like memfn
18:48amalloyhe carefully doesn't macroexpand stuff inside of (quote ...), but i think (-> x quote) tricks him
18:48gfredericksthat lazybot sure is vigilent
18:48gfredericks$botsnack
18:48lazybotgfredericks: Thanks! Om nom nom!!
18:49Raynesall ur code r belong to us
18:49gfredericksclojurebot: all ur code |r| belong to us
18:49clojurebotAlles klar
18:51mk'(x) and (list x) don't do the same thing?
18:52gfredericksno
18:52gfredericksnote the difference between ##(list 1 2 (+ 2 3)) and
18:52lazybot⇒ (1 2 5)
18:52gfredericks&'(1 2 (+ 2 3))
18:52lazybot⇒ (1 2 (+ 2 3))
18:53mkwhat is ' equivalent to?
18:53gfredericksquote
18:53mkah
18:53gfredericks&(quote (1 2 (+ 2 3)))
18:53lazybot⇒ (1 2 (+ 2 3))
18:53mkthanks
18:53gfrederickssure
18:54gfredericksmk: '(...) isn't used very often since you can get list-ish literals using vectors without having to quote
19:02mkdoes the clojure java code have to be untyped (object and exception are everywhere) for clojure to function, or does Rich hate types?
19:03gfredericksclojure is a dynamically typed language
19:03gfredericksso...I think that's the normal way to do it on the jvm
19:04raekmk: I think there are version of the clojure data structures with generics in another project
19:04raekin case you want to use them in a java app
19:05raekhttps://github.com/krukow/clj-ds
19:05mkI see - thanks
19:07gfredericksmk: it sounds like you might be looking for a much tighter coupling between java/clojure than is intended/possible; I think anytime you have a radically different language, things will be a little rough at the boundary points. At least from the static side to the dynamic side. Using java from clojure is much cleaner.
19:12mkyeah, I understand that. There just seem to be places where it could be a bit easier - like the lack of any javadocs in the code
19:14gfredericksyou're browsing through the java source files?
19:14mkvia clojure-src.jar
19:16gfredericksI'd say you're definitely not using clojure the way most beginners do; but I guess that just leads back to the eclipse discussion
19:20mkit's mosty because I'm toying with using parts of clojure from java (I'm not sure how it'll work out in the end, but it's interesting enough)
19:24gfredericksI guess it'd be cool if lib-2367 could generate classes from namespaces in libraries. Well maybe it can...I suppose if you just put (ns clojure.core) (export-ns) it would at least try
19:24gfredericksthe class might be too big; not sure
20:00seancorfieldwfoolishly trying to get emacs / swank etc running on windows 8 (what else is there to do on a sunday afternoon)...
20:00seancorfieldwi run lein swank, try to slime-connect, it says connected but i don't get a slime-repl in emacs
20:00seancorfieldwi can eval code and send it to the swank server tho'
20:01seancorfieldwdoing the same on my mac produces a slime-repl as expected
20:01seancorfieldwguess i missed a step in setup on win8?
20:05seancorfieldwhmm, slime-repl-set-package is void ... so i'm guessing that's because the repl didn't start?
20:08seancorfieldnm, lein swank had failed due to an existing process on that port... *sigh*
20:16rhcif my clojure-contrib.jar contains clojure/contrib/http/agent.clj, and i run clojure with java -cp clojure.jar:clojure-contrib.jar clojure.main and then run "(:require clojure.contrib.http.agent)" in the REPL, i should be able to use the http ns, right? am I missing something?
20:16FrozenlockIn the REPL, when I have an object like this one: #<Server Server@2cec33>. How can I "take it back"? I would like to be able to do (.stop #<Server Server@2cec33>).
20:17gfredericksFrozenlock: *1 refers to the result of the last expression
20:17gfredericksalso there is *2 and *3
20:17gfredericksFrozenlock: so you can also do (def foo *1) if you need something around longer
20:17Frozenlockrhc: I think require is insufficient. Try (use 'your-library-name). But I'm a noob, use it at your own risks :p
20:18rhcFrozenlock: ahh, thank you
20:18Frozenlockgfredericks: Oh thanks! Just need to count how far away it is now :P
20:18gfredericksrhc: (require 'clojure.contrib.http.agent) is what you were trying to do
20:18rhcFrozenlock: guess the instructions at the top here: http://richhickey.github.com/clojure-contrib/http.agent-api.html were a bit misleading
20:18lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/http.agent-api.html and try to stop linking to rich's repo.
20:18rhclazybot: ahhh thank you :)
20:19rhcwhich also has the correct require..
20:19gfredericksrequire/use/import have different syntax depending on whether they are inside of a (ns) declaration or run as proper functions
20:19rhcgfredericks: ah, care to elaborate? or should i look at the docs for require/use/import
20:20gfredericksrhc: basically when you run them as functions you have to quote the arguments, like (require 'foo)
20:20gfredericksbut inside a (ns) you don't quote, and you add the colon up front
20:20gfredericksso (:require foo)
20:21rhcah, cause of the way evaulation works?
20:21gfrederickswell they could be more consistent; the (ns) macro could have been written to do things just about any way it wanted
20:21gfredericksbut the functions have to have their arguments quoted because of evaluation, yes
20:22gfredericksso if (ns) let you do (ns foo (require 'bar)) then there would be less confusion
20:22gfredericksbut it's hard to take things back
20:22rhcyep
20:22rhcmakes sense, thanks
20:22gfredericksand maybe some reason to keep it the way it is, if only to make people think about the diff between macros and functions
20:23rhcthats the trouble when too many people start using your language before you're done ;)
20:23gfredericksha
20:23gfredericksneedless to say there's been much discussion about it already
20:23rhcinteresting, doesn't seem terrible, just another little "thing" to remember
20:23gfredericksyeah
20:25Frozenlockrhc: if you stumble upon an explanation of use/require, could you please send the link this way? :P
20:28rhcFrozenlock: http://stackoverflow.com/questions/871997/use-vs-require-in-clojure
20:28rhcin my words, 'use' imports the names into your current namespace
20:29rhcsimilar to python from package import * vs import package
20:29rhcor in C++ #include <lib.h> vs #include <lib.h> using namespace lib;
20:30FrozenlockOoohhh! Quite an important difference indeed!
20:31gfredericksnote that you can (require '[foo.bar.baz :as baz]) to give you a shorter prefix
20:35gfredericksalright that's it; I'm making a keybinding for paredit-forward-slurp-sexp
20:37FrozenlockNot a vanilla Emacs' function.. what does it do? (I can somehow guess, but still...)
20:37gfredericksin paredit mode it will move the next form to the end of your current form
20:38gfredericksso ((foo bar baz) bang) can become ((foo bar baz bang))
20:39FrozenlockLike M-t, but for multiple arguments?
20:39gfredericksFrozenlock: are you familiar with paredit?
20:41FrozenlockNot really, I use (show-paren-mode) to track my S-expressions. I'll take a look.
20:45hiredman~ping
20:45clojurebotPONG!
20:45hiredman,(+ 1 3)
20:45clojurebot4
20:45hiredman,(println :foo)
20:45clojurebot:foo
20:46gfredericksbotercizes
20:47gfredericksremember to exercise your bot at least twice a day to keep him in shape
20:48hiredmanI've been off line for days and I think ibdknox was trying to tell me clojurebot was broken
20:49gfrederickshe seems to have been behaving himself for the last few hours
20:51amalloygfredericks: isn't it bound to C-) and C-RIGHT already?
20:55seancorfieldfinally bludgeoned windows 8 into submission: emacs / clojure-jack-in works beautifully on it now!
20:55gfredericksamalloy: tmux hates C-RIGHT and urxvt hates C-shift
20:55seancorfieldalso did slime-connect from win8 VM to swank server run on host mac which was novel :)
21:04arohnerwhy does noir call (name) on session keys? Is there a specific reason why session keys should be strings?
21:09gtrakhmm, how do we got on prismatic?
21:09gtrakget*
21:22arohnerseancorfield: just wait until you're chaining SSH tunnels for slime :-)
21:23seancorfieldheh...
21:23seancorfieldright now i'm playing with starting a swank server inside my application for debugging etc
21:25arohnerseancorfield: yes, I have slime running on all of my apps, all of the time
21:25arohnerhighly recommended
21:25rhchmm, is this an appropriate place to talk about lein?
21:26arohnerrhc: yes. I believe there's also #leiningen, but this is fine too
21:26rhcwhy does it download clojure-ver.jar when i try to build a jar file
21:26rhc?
21:31gfredericksrhc "try to build a jar file" == `lein jar`?
21:34rhcgfredericks: yes
21:34rhcgfredericks: i was kinda just expecting it to package up the .class/.clj files into a jar with nothing else
21:40gfredericksrhc: it doesn't include the clojure jar in the jar it builds, it just uses it to compile against I think. Also probably uses it to run the compiler.
21:41gfredericksrhc: check out the jar with `jar tf my-jar-I-just-built.jar`
21:41rhcah, nice
21:41rhcgfredericks: thanks for your help
21:41rhcdo you dev clojure professionally?
21:41y3diahh i can't wait to see the datomic talk, did anyone see at west?
21:42gfredericksrhc: yep
21:42gfredericksy3di: yep
21:45y3digfredericks: how was it?
21:47gfredericksy3di: the idea of making the database-snapshot an explicit part of a query is cool
21:47gfredericksthe one thing I didn't expect was how easy it is, once you do that, to be able to do things like make hypothetical changes to the db and then query against that hypothetical db without changing the real one
21:48arohnery3di: it was very cool
21:48FrozenlockI can haz video?
21:49arohneryeah, the state of the DB is a value, so you can use it in queries like, "query the DB from last week", or "take yesterday's DB, and apply this transaction to it, and see if the transaction applies w/o error"
21:49y3didid it feel/seem revolutionary/next-gen?
21:50gfredericksFrozenlock: probably not, this was just on friday; you could watch rich's intro video on datomic.com though
21:52Frozenlock20 min talk.. nice :D
22:32TimMcThey need to get the contents of that into text.
22:32TimMcI can't skim video.
22:38gfredericksman it's even harder to skim talks at conferences
22:38gfredericksyou yell at them to jump forward 4 minutes and everybody just stares at you
22:41iceyI want to mess around with Datomic, but I'm not used to using jars that don't come from Clojars / another Maven repo. Is this approach [ http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/ ] appropriate for dealing with local jars, or is there a better / more standard way to go?
22:53rhcgfredericks: ok, lein makes so much more sense now :)
22:54rhcafter putting my code into a lein project, simplifies the dependencies tremendously
22:54rhcthough its kinda awkward when you want something in github that hasnt been put into clojars so you have to add it locally..
22:55gfredericksrhc: yeah that is a bit awkward
22:57gfredericksrhc: but at the very least you can push it up to clojars yourself
22:57gfredericksjust be sure to change the maven group before you do
23:03ibdknoxjust clone it into a checkouts dir and you're good to go
23:05gfredericksyeah I guess that is easier
23:09rhcgfredericks: oh really? so there's no "owner" on clojars?
23:09rhcibdknox: what do you mean?
23:10ibdknoxrhc: if you create a checkouts/ in the root of your project
23:10rhcthen just clone a repo in there a build a jar?
23:10ibdknoxanything you put there will be added to the classpath. So if you git clone some project into that directory
23:10ibdknoxyou'll have access to it from your project
23:11ibdknoxno jar-ing or anything needed
23:11rhcoh cool
23:11rhcperfect, i felt installing it was kinda kludgy
23:12gfredericksrhc: in clojars I think the only rule is the first person to add a jar to a particular group owns that group
23:12gfrederickswhich is why you should avoid pushing up somebody else's project to the same group that they specify in the project.clj
23:12gfrederickscuz they probably want it
23:13rhcyeah, thats what i figure
23:13rhci was just using irclj for a learning project..
23:14ibdknoxirclj is on clojars: http://clojars.org/irclj
23:15rhcyeah, but for some reason the snapshot there (1.5.0) is not equiv to the git repo
23:20ibdknoxRaynes: ^
23:20RaynesYeah, I'm in the middle of a rewrite.
23:21ibdknoxah :)
23:21RaynesThe version in the repo might do what he wants, but it isn't complete.
23:21rhcoh hey Raynes :)
23:21RaynesNo ctcp support at the very least.
23:21rhcyeah I read your comments on the github
23:21RaynesI've been too busy to work on it lately. :<
23:21rhci figured if i ran into some problem maybe i could contribute as well
23:22rhcbut for this crappy bot i don't need ctcp or anything really, so its no biggie, i was just glad to see any irc lib
23:22RaynesSure. The core is there. The rest is probably just adding multimethods for things it doesn't support that you might need.
23:22rhcyeah, i saw that its nicely abstracted to add anything missing
23:24Raynesrhc: Want me to release an alpha for you to play with?
23:25rhcRaynes: nah don't worry about it, i was able to build from github
23:25rhcor is this alpha different from github?
23:25RaynesWhat's on Github is what I have.
23:26RaynesI'm not that mean. ;)
23:26amalloywouldn't you rather use the last stable release than the github snapshot anyway?
23:26rhcok, that's what I figured :)
23:26Raynesamalloy: No.
23:26amalloygiven that what's on github is probably Raynes's half-baked ideas
23:26amalloyaw, okay&
23:27rhcamalloy: i picked the snapshot only because this is just some learning exercise
23:27RaynesThe old version in its 'complete' state is disgusting enough that the new version trumps it in its incomplete state.
23:27rhcits irc, i can't be that serious, right? :P
23:27Raynes:p
23:29Raynesrhc: If you need anything, just ping me or shoot me an email.
23:30rhcRaynes: thanks!