#clojure logs

2012-02-13

00:02emezeskeAnyone know if there's a vimclojure/nailgun plugin that works with Leiningen 1.7?
00:02emezeskeI've been using org.clojars.oskarkv/lein-vimclojure "1.0.0-SNAPSHOT" but it doesn't work with 1.7.
00:02ibdknoxemezeske: does mine not?
00:03ibdknoxit seems to for me
00:03emezeskeibdknox: Didn't know you had one! Trying it now.
00:03ibdknoxI really want to figure out a way to get the CLJS repl to work in vimclojure
00:04ibdknoxbut so far it has been nothing but frustratingly cryptic results
00:04emezeskeThat would be awesome
00:07emezeskeibdknox: This is what happens with I "lein nailgun": http://pastebin.com/MzuhjHMe
00:08emezeskePretty much (exactly?) the same thing I saw with the other nailgun plugin I was using
00:08ibdknoxthat's weird
00:08ibdknoxhow did you install it?
00:08ibdknoxlein plugin install?
00:08emezeskeno, via :plugins
00:08emezeskeI'll try lein plugin install
00:09ibdknoxoh yeah, I meant to mention that to you
00:09ibdknoxyou should encourage people to plugin install lein-cljsbuild as opposed to dev dependency it :)
00:09emezeskeWhy? I don't like global plugins; for instance, what if two projects depend on different versions of the plugin?
00:10emezeskeibdknox: BTW, thank you, plugin install made it work
00:11Raynesibdknox: No, he shouldn't.
00:11ibdknoxI'm not sure if the general wisdom has changed (technomancy?) but after the fiascos we had with things like incanter
00:11Raynesibdknox, emezeske: 'lein plugin install .." is going away in Lein 2.
00:11ibdknox?
00:11ibdknoxwhy?
00:11clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
00:12RaynesBecause profiles will replace user-level plugins.
00:12technomancyemezeske: just to clarify, :dev-dependencies still works in 1.7
00:12technomancyit's just that if you can transition off now, it will ease the transition to 2.0
00:12emezesketechnomancy: ahh, gotcha, okay
00:13emezesketechnomancy: I made lein-cljsbuild work either way, I think. But that's good to know for plugins that haven't been updated.
00:13ibdknoxThat doesn't seem to effect my statement for pre-2.0 though?
00:13technomancyemezeske: great; thanks
00:14technomancyibdknox: lein-cljsbuild is needed for the project to build, so it should go in project.clj
00:14ibdknoxhm
00:14technomancyuser-level plugins are for things that are just for your convenience, like difftest or vimclojure
00:14ibdknoxI see
00:14Raynesibdknox: Not doing it at all eases the transition. Of course, for things like `lein newnew` it is okay, but for this -- something required for building a project -- it shouldn't be installed globally.
00:14technomancythough you should be able to use the lein-profiles plugin to get user-level :plugins instead of using "lein plugin install"
00:14technomancy(lightly tested)
00:15sgarrettHello #clojure. I'm working with some array of objects and I want to check to see if an object is in the array and if isn't then don't append. I was thinking a simple way would be to do: (set (conj [1 2 3] 3)) But to see if the value 3 is a "new" value I have to get the length of the set. Is there built in funcitonality to get the length of a set?
00:15ibdknoxI guess I look at it as a utility that I certainly wouldn't want to specify over and over again
00:15ibdknoxwhich seems to be covered :)
00:16technomancyibdknox: different projects would need different versions
00:17ibdknoxof a build tool?
00:17ibdknoxI'd hope not
00:17muhoosgarrett: ##(count #{:fo :bar :baz})
00:17lazybot⇒ 3
00:17technomancyibdknox: of the plugin I mean
00:18ibdknoxthe plugin is a build tool :)
00:18ibdknoxit builds CLJS
00:18technomancyoh, sure
00:18ibdknoxwe're not actually in disagreement though
00:18technomancybut naturally it's going to evolve over time
00:18ibdknoxyep yep
00:18technomancyeven Leiningen itself has :min-lein-version
00:19ibdknoxthe price we pay for making things better ;)
00:19sgarrettmuoo: I'm getting a ClassNotFound exception with that...
00:19sgarrettmuhoo: *
00:23emezesketechnomancy: Cool, lein-cljsbuild's 1.7 support is all done. Wasn't too bad.
00:24emezesketechnomancy: One note: when I run "lein cljsbuild once", I see a bunch of lines like "Overriding previous definition of reference to org.clojure:clojure:jar"
00:24emezesketechnomancy: Is that left-over debug stuff? Or something I should worry about?
00:24muhoosgarrett: take off the leading ##'s
00:24lazybot⇒ s
00:25technomancyemezeske: not sure; is there any more context?
00:25muhoothose are bot-escapes
00:25muhoosgarrett: so, (count #{:fo :bar :baz})
00:25emezesketechnomancy: Nope, just that line about 30 times with different values of "something:something:jar"
00:25sgarrettmuhoo: Just tried that and it works. Thanks for the help.
00:26technomancyemezeske: hm; odd. I wonder if it's related to the way you're constructing a dummy project map. I haven't seen it in "regular" usage
00:26technomancydoes every successive invocation cause it?
00:26emezeskeYeah, it always happens
00:26emezeskeI gotta go play some starcraft. It's not critical, I'll dig into it later. ^_^
00:27technomancyfeel free to open an issue with repro steps
00:27emezesketechnomancy: Roger that. Later!
01:22romanandreghas anyone tried to have multiple arities in fn forms?
01:22romanandregnevermind
01:22romanandreg...
01:23romanandregparenthesis error :-/
01:23romanandregparedit is killing me
01:24seancorfieldi was pairing with a colleague earlier who doesn't use paredit and i got so confused!
01:24seancorfieldkept forgetting to close parens and brackets... nightmare... i can't imagine editing lisp/clojure without paredit!
01:28romanandregwell, the thing is that I'm not familiar with it yet
01:28romanandregtakes a time to get used to
01:28romanandregbut yeah, once you are proficient on it, it can become quite dependable
01:28romanandregin order to code lisp dialects
01:55romanandreghow can I set argslist to functions that are generated from others?
01:56G0SUBthere will be a paredit clinic at Clojure/West.
01:56romanandregwhen I'm doing a doc over the symbol bound using def, the argslist is not there, and I can't find a way to add that meta to it
01:56romanandregmaybe with-meta could do
01:56romanandregbut that's a bit ugly
01:56G0SUBromanandreg, :arglists key in metadata.
01:57romanandregGOSUB def forms don't receive the meta hash as a parameter
01:57romanandreg(doc def)
01:57clojurebotExcuse me?
01:57romanandreg(doc str)
01:57clojurebot"([] [x] [x & ys]); With no args, returns the empty string. With one arg x, returns x.toString(). (str nil) returns the empty string. With more than one arg, returns the concatenation of the str values of the args."
01:57romanandreg(doc def)
01:57clojurebotNo entiendo
01:57romanandregclojurebot: por que no entiendes?
01:57clojurebotI don't understand.
01:58G0SUB(def ^{:foo 1} x 42)
01:58romanandreg(meta x)
01:58clojurebotExcuse me?
01:58romanandreg(meta x) will be nil
01:58G0SUBromanandreg, (meta #'x)
01:59G0SUBromanandreg, metadata is in the var not the fn object.
01:59romanandregI always get confused with the #'
01:59seancorfield(meta #'x)
01:59seancorfieldyou need the var
02:00seancorfieldand you can do (def ^{:arglists ([x])} i identity)
02:00seancorfieldoops (def ^{:arglists '([x])} i identity)
02:00seancorfieldneeds the '
02:00romanandregyes
02:00seancorfieldthen (doc i) yields the expected result
02:01romanandregif you are using both the ^{} and the string on def
02:01romanandregdoes it still works
02:01seancorfieldlike this: (def ^{:arglists '([x])} i "some docs" identity)
02:01romanandregit doesn't for me for some reason
02:01romanandregyes
02:01seancorfieldor (def ^{:arglists '([x]) :docs "some docs"} i identity)
02:01romanandregit works with that example
02:01seancorfielderr :doc
02:01romanandregbut not with mine… umm
02:02romanandreglet me see what is wrong
02:02seancorfieldpastebin yours somewhere?
02:02romanandregtypoe
02:02romanandregtypo
02:02seancorfield'k
02:02romanandregargslist -> arglist
02:03romanandregdone!
02:03romanandregseancorfield: thanks!
02:03romanandreg:-)
02:03seancorfieldglad to help :)
02:03seancorfieldthe more i work with clojure, the more i like it...
02:05G0SUBseancorfield, et tu?
02:08romanandregseancorfield: yeah, I'm really digging it to
02:08romanandregI come from Haskell land and really like the simplicity of it all, types are great for strict systems, but for most of cases you can just let it pass
02:08romanandregand clojure is the closest thing I've found to Haskell's functional awesomeness
02:09romanandregI'm porting some libraries that I'm missing from Haskellland :-), everything is going pretty smooth so far
02:24seancorfieldwe're using clojure for a lot of back end stuff in our internet dating platform at world singles
02:24seancorfieldpersistence, logging, i18n, xml, json, html email generation, log file analysis...
02:30Raynesseancorfield: Oh, World Singles is a dating platform?
02:31G0SUBseancorfield, how do you guys do i18n? any libs?
02:31G0SUBseancorfield, we use enlive for tempting and will need i18n soon.
02:32seancorfieldwe just store key / translation / locale in the DB and have a few functions wrapping that
02:33seancorfieldwe used to use properties files but we wanted a nice web UI for updating them and we have thousands of keys so a DB makes more sense
02:33Raynesseancorfield: You guys aren't affiliated with that christianmingle website with the annoying commercials, are you?
02:33seancorfieldthe fns are (get-resource key locale) and (format-string resource & args)
02:33RaynesBecause I hate those commercials.
02:33seancorfieldlol... no, christianmingle is not one of ours
02:33seancorfieldwe focus on ethnic verticals
02:33RaynesExcellent.
02:34seancorfieldbut we are doing animated TV commercials in iran and greece soon :)
02:34RaynesThey can't be even remotely as terrible as the christianmingle commercials.
02:35seancorfieldlol... ours are cute animations with local language narration (and some local cultural references)
02:35seancorfieldyou can see some of our sites listed here: http://worldsingles.com/ws2010/index.cfm
02:35seancorfieldwe've migrated ten sites to the new platform (that uses clojure)
02:35RaynesHaha, vietvibe. That's clever.
02:36RaynesAwesome. We're getting to the point where we can say "Clojure is used for everything." and be completely serious.
02:36Raynes"Don't believe me? Iranian dating, bro."
02:38seancorfieldthe sites on the new platform are pretty diverse: lovingbbw, deafsinglesmeet, vietvibe, latinromantico, italianosingles, salaamlove, muslimsingles and, coming soon, islamicmarriage
02:38Raynesseancorfield: Do you like your work? You're very committed to it all.
02:38seancorfieldlove my job :)
02:38Raynes:)
02:39seancorfieldinteresting problems to solve, interesting business space, we all work from home, and i love using clojure professionally :)
02:39RaynesI'm probably going to lose my work from home perk soon.
02:39RaynesMostly because it was never seen as a perk but as a limitation. I've gotten rather used to it though.
02:41Raynesseancorfield: Saw your blog post btw. Thanks for the nerdcred. :>
02:42alandipertholy crap clojure/west is close
02:42seancorfieldyeah, better start writing my talk i guess...
02:42RaynesHah, that sounds like me pre-conj.
02:43RaynesIt was like a month before the conference and I'm like "Meh, I've still got time…"
02:43RaynesAnd then I nearly killed myself writing the thing.
02:43alandipertcame out awesomely though, i can only hope for such success!
02:43Raynes<3
02:44RaynesI wont be making this one. Above my paygrade.
02:44alandipertuploading the last of the next batch atm
02:44alandipert(conj vids)
02:44RaynesYeah, I mean from c/w.
02:44alandipertoh, yeah, me too
02:45seancorfieldyour talk was awesome at the conj Raynes !!
02:45RaynesDouble <3
02:45seancorfieldC/W is right in my back yard
02:46seancorfieldand two of my team will be there too - Charlie (who was at the Conj) and Fumiko
02:47alandiperti'm amped to hang with the west coast clj crew
02:47alandiperti've always wanted to go to a bay area clj meeting
02:47seancorfieldwe generally get about 30-40 people at meetings... lots of interest around here...
02:48alandipertbrenton ashworth has told me stories
02:52alandipertwell, g'night all
02:52G0SUBseancorfield, OK. Isn't perf an issue?
03:03seancorfieldperformance of clojure? no... why would it be? G0SUB
03:04seancorfieldor do you the i18n stuff in general?
03:07seancorfieldG0SUB: we load the keys into memory and cache them (in an atom) and we reset! it if they change in the DB and we need to reload them
03:08G0SUBseancorfield, cool! I was talking about the perf of the i18n strings being in the DB.
03:08seancorfieldour entire i18n package is just 41 lines including comments and whitespace :)
03:08G0SUBseancorfield, :-)
03:09seancorfieldanyways... time for bed here...
03:56RaynesHuh.
03:57RaynesFunctions called from within an Enlive template don't inherit the bindings that were in place when the template was called.
03:57RaynesNobody ever caught that? It's a pretty massive bug, one would think.
04:02vijaykiranseems like there will be some action again soon - I saw a couple of comments on the issues by cgrand recently
04:03vijaykiranof course this is not a conclusive evidence though
04:03RaynesI'm just not a fan of leaving pull requests without comment for years.
04:04vijaykiranagreed, but I'd report it though, just to help others who wonder about the same thing.
04:05RaynesI'm still googling in disbelief.
04:06raekRaynes: what behavior did you expect?
04:06vijaykiranI started using enlive pretty recently - so I'm still using simple transformations. So I'm not sure about the bug you are talking about
04:06raekthat Enlive would use bound-fn somehow?
04:07raekor what kind of bindings are you referring to?
04:07Raynesraek: (defn x [] (prn *out*)) (binding [*out* "foo"] (x))
04:09RaynesWell, obviously that doesn't work because string isn't a writer.
04:09raekthis should print "foo". what about the enlive case?
04:09RaynesBut anyways, *out* should be "foo".
04:09raekhrm, yeah
04:09RaynesIf x is an enlive template (which is also a normal function), it does not get the inherited value.
04:09RaynesSomething enlive does blows away the bindings.
04:09RaynesNot sure what though.
04:09raek(def ^{:dynamic true} *foo*) (defn x [] (prn *foo*)) (binding [*foo* "foo"] (x))
04:10raekok, that sounds like something that should either be fixed or documented
04:11RaynesIt's probably a result of everything being wrapped in 27 functions and other magic.
04:11raekso a template behaves as if it was wrapped with bound-fn?
04:11RaynesYes.
04:15RaynesOkay, guess I'm filing an issue.
04:15RaynesNot optimistic.
04:17ejacksonHappy Monday, everyone.
05:07cindy1986Hi ;)
05:08cindy1986Why is leiningen taking so much CPU ?
05:13lucianbecause JVM
05:19cindy1986damn jvm
05:28cindy1986warning: [options] bootstrap class path not set in conjunction with -source 1.5 << what does it mean?
05:29vijaykirancompiling the sources with 1.5 source but with >1.6 classpath ?
05:30cindy1986how can i set another value for that in project.clj ?
05:37vijaykiranI'm not sure where you are getting the -source option from .. can you paste the project.clj somewhere ?
05:46cindy1986vijaykiran: https://gist.github.com/1815984
05:49vijaykiranand you get this warning when you are running lein run ?
05:51vijaykiranI just used the same with a new temp project, and I don't get any warning. Not sure what you are trying to do though. Create a project with java and clojure sources ?
05:51vijaykirancindy1986: ^^
05:51cindy1986java 1.7 ?
05:51cindy1986problem occured after updating to 1.7 on linux
05:52vijaykiranah okay. could be the cause of the warning then. I don't have 1.7
05:52cindy1986Don't know vijaykiran
05:52vijaykiranmay be one of the projects that you are pulling via project.clj, might have source setting
05:55cindy1986where is the damn source setting?
05:57vijaykiranprobably in one of the deps you are pulling
05:58vijaykiranhttps://blogs.oracle.com/darcy/entry/bootclasspath_older_source
05:59cindy1986ahh ok
05:59cindy1986yes
05:59cindy1986got it ;)
06:19osa1what is the minimum library requirement to create a clojure app that communicates with a web server? actually I want to create a webapp with clojure but I don't want to learn lots of libraries for now. so I'll keep third party libraries minimum.
06:19vijaykiranring, compojure
06:19vijaykiranor ring + moustache
06:20zxcxzcim trying counterclockwise. just because i already had eclipse. but i hear there's others, like la clojure? is that better?
06:20dbushenkojust ring if you're talking about really minimum
06:20vijaykiranzxcxzc: yeah, la clojure is fine too .. if you are used to IntelliJ
06:20dbushenkozxcxzc, yep, I tried both and LaClojure is better
06:22osa1vijaykiran: thanks. I think I'll go with ring. what are my webserver alternatives?
06:22vijaykiranjetty/netty
06:22vijaykiranjust add the jetty adapter for ring
06:22dbushenkotomcat
06:23zxcxzcim not used to intellij. but it's available for free too these days, right?
06:23vijaykiranyes community edition + laclojure works fine
06:24dbushenkoosa1, btw, it would be much better if you've tried Noir (webnoir.org). You'll find yourself making the website with clojure quick and easy. much easier than with pure ring
06:31dbushenkocemerick, a few days ago bought "Clojure Programming". Great work! Most practical book about clojure I've read so far!
06:32cemerickdbushenko: Thank you :-)
06:32cemericktell your friends, and have them tell 5 more ;-)
06:32dbushenko:-) sure!
06:33vijaykirancemerick: +1 for the book, been reading it on Safari Rough Cuts
06:34cemerickdbushenko, vijaykiran: Keep an eye on http://clojurebook.com or https://twitter.com/#!/clojurebook for updates re: sample code and errata
06:36vijaykiransure
06:37cemerickAnyway, glad you guys are enjoying it. Hopefully it'll be in print before Clojure/west.
06:38luciancemerick: is an ebook version planned?
06:41cemericklucian: Yup, it'll be available in kindle, mobi, and epub IIRC.
06:42cemerickIf you get the Rough Cut, you can download a PDF of that (and then a copy of the final book when it ships).
06:43luciancemerick: would that be DRM-free? afaik safari is drm-only
06:43cemerickYou mean the downloaded PDF? I honestly don't know.
06:44luciani'll just wait for the epub then (i'm assuming that one is DRM-free)
06:45vijaykiransafari pdfs are DRM -free
06:47osa1where are json functions in clojure 1.3? I tried clojure.data.json but got an FileNotFoundException
06:48cemericklucian: yeah, looks like O'Reilly is strictly no-DRM http://shop.oreilly.com/category/ebooks.do
06:48luciancemerick: nice, thanks
06:48vijaykiranosa1: did you add clojure.data.json dependency ?
06:48dbushenkoosa1: try cheshire
06:49vijaykiranosa1: https://github.com/clojure/data.json
06:49vijaykirancheshire is better though
07:16cindy1986#on clojure
09:15zxcxzc1hmm, i installed intellij and la clojure and the leiningen plugin, but there doesnt seem to be a "lein repl"
09:18vijaykiranyou just need to use start clojure console
09:18vijaykiranlook under tools menu
09:20zxcxzc1had to add the lib folder in the project settings
09:20zxcxzc1so now the clojure repl works
09:20zxcxzc1although that seems a bit wrong
09:31vijaykiranI think laclojure comes with its own clojure - 1.2, so yes, you need to setup to use the correct clojure version
09:50mklojureI want to read an entry, when it is null, the entry should be created. Can I pack this into the "let" bindings ?
09:57morphlingmklojure: (let [entry (or (read-entry) (create-entry))] ...) are you looking for or?
09:57mklojureis create entry used if read-entry is false? morphling ?
09:59morphlingmklojure: ah, yes, didn't think of that
10:01mklojureWhat is the best way to store a list of strings?
10:01clojurebotGabh mo leithscéal?
10:01mklojureseq?
10:01clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
10:04morphlingmklojure: depending on what you want to do with them a set, vector, or list. each of these is seqable
10:04mklojureset is okay,... how can I create a set in clojure?
10:04TimMcmklojure: Specifically, 1) how will you create the list, 2) how will you access it?
10:05morphling,(doc set)
10:05clojurebot"([coll]); Returns a set of the distinct elements of coll."
10:05joly,(= (set 1 2 3) #{1 2 3})
10:05clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$set>
10:05mklojurehow will you create the list << set of hashes with initial hash to create the set
10:06TimMc&(conj #{} "foo" "bar" "qux")
10:06lazybot⇒ #{"foo" "bar" "qux"}
10:06jolyoops...
10:07TimMcIf all you need is a set, my two questions actually don't matter.
10:07mklojure,(set "hash")
10:07clojurebot#{\a \h \s}
10:07mklojureI want to build a structure to store collections in memcached
10:08mklojure[head node] => leaf: headname_checksum
10:08joly(set ["hash" "test" "abcde"])
10:08joly,(set ["hash" "test" "abcde"])
10:08clojurebot#{"abcde" "hash" "test"}
10:10mklojure,(set "hash" "hash2")
10:10clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$set>
10:10mklojure,(set ["hash"])
10:10clojurebot#{"hash"}
10:10mklojureyeah
10:10mklojureHow to generate UUID in clojure?
10:11vijaykiranjust use java uuid generator ?
10:12mklojure;)
10:13francislHi, Im trying to start a project in clojurescript and an empty file to a basic def statement it throws an error
10:13francisl-- No protocol method ILookup.-lookup
10:14francislcan someone give me a hint on how to go from there?
10:15vijaykiranfrancisl: can you tell us how you created the project ?
10:15francisljust put a cljs file in a directory. and create the output with : cljsc myfile.cljs > myfile.js
10:16francislI tried to follow the quickstart on the github wiki page
10:19vijaykiranhmm .. works fine for me ..
10:19vijaykiranwhat does your file contian ?
10:21francislI tried with nothing, got the error. I tried with a simple (ns employee) (def employees ["some data"]), same error
10:22TimMcCould be a CLJS bug. It's in alpha or so.
10:25vijaykiranworks fine, with that - 1. Cloned the repo 2. ./script/bootstrap 3. created a cljs file with the code that you pasted
10:26vijaykiranworks fine - and I see the result javascript
10:33francislhumm, thank, I'll tried to reinstall it all
10:38ohpauleezibdknox: Any word on the possibility of a korma CQL partial merge?
10:42ohpauleezLauJensen: ^
11:30mklojure,(concat (set "") "x")
11:30clojurebot(\x)
11:31mklojure,(concat (set [""]) ["x"])
11:31clojurebot("" "x")
11:32mklojureHow to generate empty set?
11:32mklojure,(set)
11:32clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$set>
11:32mklojure,(set nil)
11:32clojurebot#{}
11:32terom,#{}
11:32clojurebot#{}
11:33mklojure,(concat #{} ["x"])
11:33clojurebot("x")
11:33mklojureyeah
11:36mklojurewhen I have two instructions,... how can i execute both?
11:36mklojure(creplace bucket (concat currentbucket leafkey) (cset leafkey value))
11:36mklojure (cset leafkey value) is the 2'nd
11:36mklojure(creplace bucket (concat currentbucket leafkey)) the 1'st
11:39AWizzArdmklojure: just write them one after each other.
11:40AWizzArdmklojure: you can test this: (println "command 1") (println "command 2")
11:40lucianalthough theoretically execution order is not guaranteed unless it's in a (do ...)
11:40mklojureeven it is in a let ... ?
11:40AWizzArdlucian: why is it not guaranteed?
11:40AWizzArdFrom left to right.
11:40AWizzArdThis is how it happens.
11:41AWizzArdas the forms are read
11:43mklojure,(concat #{} "iluv_9e3c286d-d6a8-4ca6-98a7-5642e614aae5")
11:43clojurebot(\i \l \u \v \_ ...)
11:43TimMcmklojure: conj
11:43mklojure,(concat #{} ["iluv_9e3c286d-d6a8-4ca6-98a7-5642e614aae5"])
11:43clojurebot("iluv_9e3c286d-d6a8-4ca6-98a7-5642e614aae5")
11:43TimMc&(conj #{} "hello")
11:43lazybot⇒ #{"hello"}
11:44TimMc&(disj #{"hello"} "hello")
11:44lazybot⇒ #{}
11:44AWizzArddo is not really doing anything, it is a helper for macros, where exactly one form is expected
11:44AWizzArdfor macros ==> for places
11:47mklojure#<ClassCastException java.lang.ClassCastException: net.spy.memcached.internal.OperationFuture cannot be cast to clojure.lang.IPersistentCollection>
11:47mklojuremh,.. !
11:47mklojure(cset bucket #{})) in a let returns the OperationFuture
11:48TimMcSomething is expecting a collection, you're only giving it a bare item.
11:51lucianAWizzArd: you may have a point in that clojure does it differently. but all lisps i've seen so far don't guarantee it
11:51TimMclucian: Are you sure you aren't thinking about argument eval order?
11:52TimMcOh wait, you definitely are.
11:52TimMcnvm
11:52TimMcYes, some lisps make a guarantee, others do not.
11:53TimMcI *believe* Scheme48 evals the even-index arguments first, and then the odd-index arguments in reverse order -- just so that people don't rely on an ordering.
11:53jsabeaudryAny suggestions regarding a client side UI framework with clojurescript?
11:54lucianTimMc: heh. it should just do it randomly
11:54lucianjsabeaudry: twitter bootstrap
11:58vijaykiranjsabeaudry: depends on what you mean by "framework"
11:58mklojure(let [leafkey (str bucket "_" (uuid)) currentbucket (or (cget bucket) (cset bucket #{}))] (creplace bucket (concat currentbucket [leafkey])) (cset leafkey value))
11:58mklojurecset returns the OperationFuture
12:00mklojureBut I think it is still not so nice... cause I know that I can "prefill" the collection with the leafkey and set it. To create a new one only to be able to make the replace there,... mhhh
12:00TimMcmklojure: I think you missed my earlier comment that conj is way more appropriate than concat with a single-element coll.
12:00mklojureI tried it TimMc, but it also ends up with problems
12:00mklojure(concat currentbucket [leafkey]) => (conj currentbucket leafkey)
12:01TimMcAh... what type is currentbucket?
12:01zzachQuestion about a function containing def ^:dynamic ... and binding ...: after entering this function (http://pastebin.com/9H5J2yTL) into the Clojure 1.3 repl, it returns "resultA", after entering it a second time, it returns "resultB". Why does it not directly return "resultA"?
12:02TimMcmklojure: concat produces a lazy seq, conj produces an object of the same abstraction type
12:02raekzzach: you are not supposed to use 'def' inside another def
12:03raekdef does not create a local variable, it creates a global variable (if it didn't exist) and sets it value in a non-threadsafe manner
12:03mklojureOk, it works also with conj
12:04mklojure<ClassCastException java.lang.ClassCastException: net.spy.memcached.internal.OperationFuture cannot be cast to clojure.lang.IPersistentCollection> << mhhh!!1
12:04zzachraek: i expected "resultB" as result. How to set the variable locally so that binding does not complain?
12:05raekzzach: if you want to play with :dynamic and binding, you need to structure your code like this:
12:05raek(def ^:dynamic var1 "resultA")
12:05raek(defn test1 [] (binding [var1 "resultB"] var1))
12:06raekthis will always return "resultB"
12:06mklojurecan I cascade let and if-let ?
12:08TimMcmklojure: You can nest them, yes.
12:08zzachraek: OK, it returns "resultB". Can it be achieved if var1 is not already declared at time of function test1 execution?
12:08mklojure(if-let [currentbucket (cget bucket)] << does it do what I want if bucket is NIL ?
12:08raekzzach: a rule of thumb is if you have a "def___" form inside a function, you are doing something wrong
12:09TimMcmklojure: That depends on what cget is.
12:09raekzzach: If I understood you correctly, no. binding only works on already defined top-level vars
12:09mklojurecget is a fn, queries memcached
12:09mklojurereturns nil or the value
12:10mklojureof a speficied key
12:10raekzzach: are you looking for something like variable assignment in imperative languages?
12:10TimMcmklojure: Well, I still don't know what that means for you here... if-let only cares about the return value of cget.
12:10mklojureokay, and if it is nil if-test will yield to else ?
12:10mklojurenot nil to true ?
12:11TimMcSorry, I couldn't parse that.
12:12zzachraek: in principle yes, was also trying let, which allows only one-time assignments.
12:12TimMc&(if-let [x 42] (str "consequent " x) "alternative")
12:12lazybot⇒ "consequent 42"
12:12TimMc&(if-let [x nil] (str "consequent " x) "alternative")
12:12lazybot⇒ "alternative"
12:12mklojureTimMc: cget returns nil or something other
12:12mklojureyeah
12:12mklojurethx
12:13raekzzach: the only answer I can give you is "it depends on what you want to solve with assignment" :-)
12:17mklojureIt works!
12:17mklojure(let [leafkey (str bucket "_" (uuid)) newitem (cset leafkey value)] (if-let [currentbucket (cget bucket)] (creplace bucket (conj currentbucket leafkey)) (cset bucket [leafkey])))
12:17mklojureAny ideas how to improve / write it more compact / better style ?
12:18mklojureOne thing I was not sure about is "newitem",... I don't need it but wanted it to happen before yielding
12:18raekzzach: assignment is used for many things. one usage is for updating loop variables, another is in conditions (like int y; if (x < 0) { y = -x; } else { y = x; }), a third is to mutate a object
12:18raekzzach: clojure has a different approach to all three cases
12:18raekfor number one, check my answer to this question: http://stackoverflow.com/questions/8540855/setf-in-clojure/8564082#8564082
12:18raekfor number two: you can do it like this in clojure (let [y (if (neg? x) (- x) x)] ...) since if is an expression rather than a statement
12:18raekfor number three: check out 'atom' and 'ref': http://clojure.org/atoms http://clojure.org/refs
12:23zzachraek: In case two, does y automatically change if x is changed?
12:26r0adrunnerhi! anyone knows how to solve character encoding issues with enlive's deftemplate?
12:27raekzzach: x cannot be changed
12:28raekin clojure, locals introduced by let and function parameters are alway unchangeable. they act as a name for a value rather than a mutable cell
12:28raekr0adrunner: I know a little
12:29raekr0adrunner: have you identified whether the problem is when you read the template or when you generate the http response?
12:30r0adrunnerraek: i think is when i read the template... this works: (defpage teste "/teste" []
12:30r0adrunner (slurp "resources/templates/newuser.html"))
12:30r0adrunnerraek: but this shows black diamonds:
12:30raekok, that can explain it
12:30r0adrunnerraek: (defpage newuser "/newuser" []
12:30r0adrunner (view/template-newuser))
12:30r0adrunner
12:31raekslurp always uses UTF-8 unless you provide a :encoding option
12:31raekenlive uses some automatic encoding detection mechanism which can guess the wrong encoding
12:31r0adrunnerraek: i want to default to utf-8
12:32raekr0adrunner: are you using deftemplate?
12:32armpantshi, does anyone know where to find an xmpp library that supports mutli-user-chat in clojure?
12:32r0adrunnerraek: yes
12:33raekr0adrunner: I think you should be able to write (io/reader (io/resource "some/path") :encoding "UTF-8") instead of "some/path"
12:33TimMcarmpants: Check the Java world too.
12:34raekr0adrunner: sorry, io/reader defaults to UTF-8 too, so (-> "some/path" io/resource io/reader) should be enough
12:34armpantsThanks, I'll try that. I'm a newb, and so not so confident in my ability to wrap a java library, but I'll try. Thanks.
12:36raekr0adrunner: did it solve the problem?
12:37r0adrunnerraek: im trying right now
12:38mklojurer0adrunner: yes, I know
12:38mklojureenlive's deftemplate? I had encoding issues with jetty not with netty
12:39raekr0adrunner: you might also need to add a "Content-Type: text/html; charset=UTF-8" header if your web stack does not already provide it
12:39mklojurer0adrunner: or try this: ; To fix issues that appear for Jetty (not Netty) with UTF-8 responses (defn utf8response "Ring skeleton with headers." [body] {:status 200 :headers { "Content-Type" "text/html;charset=UTF-8" "Character-Encoding" "UTF-8"} :body body})
12:40raekotherwise, if the header is just "Content-Type: text/html" then the servlet infrostruvture will "correct it" to "Content-Type: text/html; charset=iso8859-1"
12:40mklojureyeah. Netty deals with this issue
12:40mklojureGot long time to figure it out
12:40raek*infrastructure
12:41mklojurer0adrunner: did it work for you?
12:42r0adrunnerraek: first solution dont seem to have worked. I am using noir.. how to change the encoding for that
12:43raekr0adrunner: dunno. I haven't used noir myself yet. you need to make sure that enlive gets the reader you provided somehow
12:44raekif enlive gets a reader, it won't try to guess the encoding itself
12:45r0adrunnerraek: tried that: (deftemplate template-profile (clojure.java.io/reader (clojure.java.io/resource "templates/profile.html") :encoding "UTF-8"))
12:45r0adrunner
12:45raekwhat happened?
12:45r0adrunnerraek: what do you mean by make sure that enlive gets the reader you provided?
12:45raekah, you are using deftemplate directly
12:45r0adrunnerraek: same result in browser
12:46raekI thought you were using something in noir that abstracted enlive away
12:46mklojuredamn headers
12:46raekare you sure the page isn't cached or something?
12:47r0adrunneri am.. (defpage profile "/user/:nick" {:keys [nick]}
12:47r0adrunner (view/template-profile {:nick nick})
12:47r0adrunner
12:47raekhave you reloaded the view namespace?
12:47r0adrunnerraek: does not seem to be cached
12:49r0adrunnerraek: does not seem to be a namespace thing
12:49raekweird
12:51raekr0adrunner: are you sure the file is in UTF-8?
12:51rodrigovieirahello everyone
12:51rodrigovieirahow do I know the size of a vector in Clojure?
12:52raekrodrigovieira: count
12:52r0adrunnerraek: yes
12:52TimMc$findfn [1 4 5] 3
12:52lazybot[clojure.core/count]
12:52raekr0adrunner: which version of enlive are you using?
12:53r0adrunner1.0.
12:53r0adrunner1.0.0
12:53r0adrunnernoir 1.2.1
12:54raekr0adrunner: if you run (apply str (template-profile <some valid argument here>)) in the repl, does the characters look correct there?
12:54r0adrunnerraek: there is some answers in google refering to using a middleware, but in noir page it says it is deprecated bcause ring already does the utf-8 encoding by default
12:55raekok, good
12:55raekthe enlive coding handling is still broken, though
12:55rodrigovieiraraek: thanks
12:56raekthis is strange... (deftemplate template-profile (io/reader (io/resource "templates/profile.html")) ...) should just work!
12:56r0adrunnerraek: yes.. it prints the character im trying to print: ç
12:57raekr0adrunner: what repl are you using?
12:57r0adrunnerraek: even without clojure.java.io it prints everything well in the repl.
12:57raekr0adrunner: if you remove my io/... fix, does the character become broken again?
12:58raekr0adrunner: the problem with encoding bugs is that sometimes they can undo themselves
12:58raekthere are encoding problems in some repl setups too... :(
12:58r0adrunnerim using the emacs repl,,
12:58raekusing clojure-jack-in?
12:58r0adrunneryes
12:58raekthen you're good
12:59jcromartiethere are two kinds of encodings: UTF-8, and the wrong kind
12:59r0adrunnerit used to have problems with encoding but i fixed it somehow..
12:59raekthis seems to indicate that the error is not with enlive (and that is sucessfully guesses the encoding to be UTF-8)
12:59raekif you used slime-connect, you needed to set slime-net-coding-system to utf-8-unix
13:00raekbut clojure-jack-in takes care of that nowadays
13:00raekjcromartie: yes. agreed!
13:00r0adrunnertried with curl in shell, same thing.. wrong encoding
13:01raekhave you tried adding the "Content-Type: text/html; charset=utf-8" header?
13:01r0adrunnerhow to do that
13:01r0adrunner:
13:01raekr0adrunner: oh, can you check in curl which header it actually sends?
13:02r0adrunnerGET /newuser HTTP/1.1
13:02r0adrunner> User-Agent: curl/7.24.0 (x86_64-unknown-linux-gnu) libcurl/7.24.0 OpenSSL/1.0.0g zlib/1.2.6 libssh2/1.3.0
13:02r0adrunner> Host: localhost:8080
13:02r0adrunner> Accept: */*
13:02hsbot mueval-core: L.hs: removeLink: does not exist (No such file or directory)
13:02hsbot Not in scope: data constructor `User'Not in scope: data constructor `Agent'Not in scope: `curl'Not in scope: `x86_64'Not in scope: `unknown'Not in scope: `linux'Not in scope: `gnu'Not in scope: `libcurl'Not in scope: dat...
13:02hsbot mueval-core: L.hs: removeLink: does not exist (No such file or directory)
13:02r0adrunner>
13:02r0adrunner< HTTP/1.1 200 OK
13:02r0adrunner< Date: Mon, 13 Feb 2012 18:03:11 GMT
13:03r0adrunner< Set-Cookie: ring-session=22bc8e8a-fa67-4695-85df-1911137b26ed;Path=/
13:03r0adrunner< Transfer-Encoding: chunked
13:03r0adrunner< Server: Jetty(6.1.25)
13:03r0adrunner<
13:03r0adrunnerraek: sorry.. didnt know which line is important...
13:03pmooserAnyone here have much experience with using ritz ? I've only gotten it to work for me by hacking on it, but I don't understand why those hacks are required.
13:04hugodpmooser: I would be interested in hearing what you needed to do to get it to work
13:06r0adrunnerraek: the html file has the "Content-Type: text/html; charset=utf-8"
13:08r0adrunnerraek: any clue?
13:10r0adrunnerraek: you think enlive character coding handling is broken?
13:10mklojurer0adrunner: have you tried jetty?
13:10mklojureI think it is not about enlive
13:11mklojureI use it too and had the same issues
13:11mklojureIt's about the standard headers that are set for a http response
13:12mklojureDo you have a response method r0adrunner like (def routes (app ...
13:12mklojure["change"] (fn [req] (response ....
13:12mklojureit works with utf8response
13:12mklojure; To fix issues that appear for Jetty (not Netty) with UTF-8 responses (defn utf8response "Ring skeleton with headers." [body] {:status 200 :headers { "Content-Type" "text/html;charset=UTF-8" "Character-Encoding" "UTF-8"} :body body})
13:12jcromartieso, who's hiring wannabe-Clojure/JDK devs nowadays?
13:13jcromartieI know computers. Hire me.
13:13mklojuregood q. jcromartie !
13:13mklojureI configured internet rouaters
13:14r0adrunnermklojure: i use noir's defpage.. can u explain how to setup that code u just wrote?
13:15mklojureI use enlive and moustache, can you post your code as gist?
13:15mklojurering.adapter.jetty << ...
13:15mklojurehttps://gist.github.com/
13:18mklojurehave you tried http://webnoir.org/autodoc/1.2.0/noir.util.middleware-api.html#noir.util.middleware/wrap-utf-8 ? r0adrunner
13:21r0adrunnermklojure: Unable to resolve symbol: wrap-utf-8 in this context
13:22r0adrunnermklojure: it says that it is deprecated in that page
13:23mklojureyes r0adrunner , depends on which version you use
13:24mklojurehttp://webnoir.org/tutorials/middleware
13:24mklojureexample for utf-8 !?
13:24mklojuredamn! Nothing is working really out of the box
13:24mklojure:D Just like Noir
13:25r0adrunnermklojure: that worked for you?
13:25r0adrunnermklojure: https://gist.github.com/1818843
13:26mklojurer0adrunner: I do not use Noir
13:27mklojureJust Moustache + Enlive directly
13:27r0adrunnermklojure: oh.. right..
13:29mklojurer0adrunner: https://github.com/kremers/Clojure-Memcached-Connector
13:37r0adrunnermklojure: Worked! Thanks a lot
13:37r0adrunnerraek: thanks too!
13:37mklojureyeah
13:37mklojurer0adrunner: what are you working on?
13:38r0adrunnermklojure: a miniblog to post photos. a "pet project" to learn clojure
13:39mklojureAhh nice ;)
13:40mklojureAnd how does your stack look like? Noir, Enlive, MySql ?
13:42r0adrunnermklojure: noir, enlive and trying mongodb...
13:42mklojuregood exp with mongodb ?
13:42mklojureI like memcached cause it is so fast
13:42mklojureand with membase there is persistence management and authentification etc.
13:42r0adrunnermklojure: i think mongodb fits well with the dynamic flow of clojure..
13:43mklojureI think mongo is a bit heavyweight?
13:44antares_r0adrunner: if you are using mongodb with clojure, check out monger (https://github.com/michaelklishin/monger) and validateur (https://github.com/michaelklishin/validateur) for data validation. We hope to push initial documentation site for Monger up this weekend.
13:44r0adrunnermklojure: i have not done anything with it in production... i just like how i can shove data into it, and it manages to add fields and stuff
13:44r0adrunnerantares_: tnx.. i will check it out
13:45mklojurehttp://www.couchbase.com/couchbase-server/features#production_ready
13:45mklojurecheck this out
13:47mklojurer0adrunner: anything online to see?
13:49r0adrunnermklojure: no.. i am yet trying to print input on screen and getting it right :)
13:49r0adrunnermklojure: used it in production? couchbase?
13:50r0adrunnermklojure: output i mean
13:53mklojurenope r0adrunner
13:53mklojureWant to do this :)
14:13mklojureDoes anyone know how to build a Lazy seq behind a future : http://dustin.github.com/java-memcached-client/apidocs/net/spy/memcached/MemcachedClient.html#asyncGetBulk(java.util.Collection)
14:14mklojureNow I've done it like this: (defn cgetall "Read the full collection" [bucket] (let [nodes (cget bucket)] (.getBulk (find-connection) nodes)) )
14:16mklojureTimMc: any idea?
14:25detryoHi, which http client would you recomend? http.async.client or clj-http?
14:25technomancyclj-http for sure
14:26detryosince I'm more familiar to the async client in java I was about to choose http.async.clinet
14:26detryobut it is true that the documentation looks more complete for clj-http
14:27detryothank you technomancy
14:38amalloymklojure: "build a lazy seq behind a future" doesn't mean anything as far as i can tell
14:40mklojureamalloy: cause the future itself is already kind of lazy?
15:01BelafHello list! Anybody using clojure.java.jdbc with sqlite-jdbc ? I used to have no issue with clojure.contrib.sql, but moving to clojure 1.3 (and thus clojure.java.jdbc) I keep getting "java.sql.SQLException: database is locked".
15:41gtrak`#clojure
15:42Bronsayes, this is how this chan is called :P
15:42mklojureyeah yeah yeah
15:42gtrak`indeed
15:42mklojurelet get crazy-clojure
15:43ritreXen+alS3
15:44ritreahh, sorry
15:45TimMcNow tell us what that's the password for! :-)
15:45mklojuresecret porn collection'?
15:45mklojurehttps://github.com/vim-scripts/VimClojure/blob/master/ftplugin/clojure.vim
15:45mklojureDoes anyone know if a good documentation for all this shortcut stuff exists?
15:46ritretrue that is password :)
15:48tmciverThat *was* a pretty good password. :/
15:49TimMcFairly memorable, too.
15:50ritrejust accdent, bad window wos focused, pretty stupid
15:53TimMchappens to me all the time, luckily not into IRC
15:59rahcoladoes anyone know whats happening when slime gives Evaluation aborted without other errors?
16:00amalloyit's always so horrifying to see your password in plaintext. i usually react like..."wait, i didn't realize fonts could render this, i thought it existed only in my head and rendered as ****"
16:02hugodrahcola: hava a look at *e, which should be bound to whatever exception caused that
16:03rahcolahugod: thank you
16:03rahcolaany idea why those exceptions are not presented in the usual manner?
16:04raekrahcola: did you try to display a string with non-ascii characters?
16:04rahcolanoup
16:04ritreTyping password to IRC, it's really memorable.
16:05rahcolait was a IllegalArgumentException from calling a method for nil
16:05raek /msg NickServ IDENTIFY hunter2
16:07hugodrahcola: assuming this is swank-clojure, no idea
16:12pjstadighugod: your change here https://github.com/technomancy/clojure-mode/commit/cdfc45850b29700dda83a148e1c90ed2219ab943 is wreaking havoc on my formatting
16:13pjstadighttps://github.com/technomancy/clojure-mode/issues/63
16:13pjstadighugod: is there something i need to configure?
16:14hugodpjstadig: mm, not sure swank-clojure updates indentation
16:15pjstadigi've found pulling out that add-hook fixes the issue, but i wonder if there's a way to make it play more nicely
16:15hugodi guess the indentations in clojure-mode need to get back into swank-clojure somehow
16:16hugodusing the hook you can write macros, and set ^{:indent n} so they indent properly when used
16:16amalloyraek: nobody seems to be taking the bait and telling you they just see it as *******
16:17raekamalloy: yeah..
16:17hiredmanhugod: neat
16:18raekre. "hunter2": http://bash.org/?244321
16:18aphyrIf I have some code that needs to be run once at JVM startup (configuring log4j)... where should I put it?
16:19ordnungswidrigaphyr: you can place it in any namespace that gets loaded.
16:19ordnungswidrig(ns foo) (do-some-initialization)
16:36aphyrAh, that's rather nice actually. Thanks technomancy, ordnungswidrig
16:44TimMc&(doc defonce)
16:44lazybot⇒ "Macro ([name expr]); defs name to have the root value of the expr iff the named var has no root value, else expr is unevaluated"
16:44TimMc(defmacro uneval [& args] nil)
17:10slewishi. How can I pass pre-defined fields in to defrecord? Ex: (def fields ['a 'b]) (defrecord R fields) doesn't work.
17:13brehaut(apply ->R fields)
17:14brehautslewis: also, keywords are more idiomatic than quoted symbols in clojure (eg, (def fields [:a :b]))
17:14hiredmanbrehaut: you are misunderstanding the question
17:15brehauthiredman: oh, so i am
17:15brehautslewis: ignore me
17:16slewisok :), didn't work
17:16TimMcslewis: Probably a macro.
17:18slewisso in (defrecord R [a b]), what are a and b? symbols that aren't evaluated til later?
17:20amalloyaren't evaluated ever
17:21slewisoh, right… but are they symbols?
17:21amalloyyep
17:22TimMcslewis: Are you sure you should even be using a defrecord?
17:23slewiswhy can't I do (defercord R [(symbol "a") (symbol "b")])
17:24amalloybecause (symbol "a") isn't a symbol. it's a list which, if you evaluated it, would evaluate to a symbol
17:25TimMcslewis: Just use a regular ol' map.
17:26slewisTimMc: Well, its part of an interface within appengine-magic. Basically I want to be able to create a record, and have access to the field names for the created class at a later time.
17:26slewiswithout introspecting
17:26emezeskeslewis: You'll have to write a macro to do that.
17:27gtrak`aren't there issues with defining records at runtime anyway, or protocols, maybe?
17:27emezeske(defmacro crazy-thing [a b] `(defrecord R [~a ~b]))
17:28emezeskeOr something horrible like that
17:28amalloynot really, gtrak. but who said anything about doing this at runtime?
17:28ordnungswidrigslewis: see here. http://stackoverflow.com/questions/5531986/treat-clojure-macro-as-a-function
17:28gtrak`amalloy: noone, I just want to make sure he's not trying to do that
17:29slewisgtrak: I'm not. I want to define some field names, use those to create a record, and later have access to the field names
17:29ordnungswidriggtrak: using a macro to expand a macro "call" it ok.
17:29ordnungswidriggtrak: what emezeske suggested should work fine
17:29gtrak`yea
17:30dnolenslewis: why do you need a record?
17:30TimMcdnolen: Something to do with appengine
17:31slewisdnolen: I guess I could cite performance, but the real reason is because that's what the library i'm using wants
17:31emezeskednolen: The appengine-magic interface to the GAE datastore is defined in terms of records
17:32dnolenslews: emezeske: does it actually need records? or can you provide a deftype or something created w/ reify
17:32dnolen?
17:32slewisI think the root of the problem is I don't fully understand how clojure macros work, so I'll look in to fixing that
17:32slewisdnolen: well it provides a macro (defentity …) which calls (defrecord ...)
17:34dnolenslewis: so look under the hood, you can probably do what you want on the fly w/ reify
17:34slewisI would lose the functionality the (defentity ) macro provides then if I follow you...
17:35dnolenslewis: defentity is just sugar
17:35slewisit provides some other functions
17:35ordnungswidrigslewis: so you can provide a macro which calls defentity which calls defrecord. But on the other hand why would you like to keep the arguments to defentity?
17:36slewisbecause I want to know the names of the fields that the entity was defined with
17:36dnolenslewis: if I'm understanding correctly you want to create the records dynamically right?
17:36slewisno
17:36dnolenslewis: oh ok
17:37slewisI just want to know the field names that the created class has
17:37slewiswhich I can get by introspecting the java class… but that seems wrong, since the field names are passed in at compile time and won't change
17:37ordnungswidrigslewis: assuming that defentity doesn't give you a way to access the fields later, then using a macro to call defentity and store the field names "somewhere" is perfectly possible.
17:38slewisordnungswidrig: k, that's what i was thinking…
17:38ordnungswidrigslewis: have you read this? http://groups.google.com/group/clojure/browse_thread/thread/d134035d3efe8c7e
17:39dnolenslewis: is app-engine magic 1.3.0 compatible?
17:39dnolenslewis: if so you have YouRecord/getBasis
17:40slewisordnunswidrig: I hadn't, thank you
17:40slewisdnolen: yes it is
17:41nathanmarztechnomancy: hey
17:41dnolenslewis: getBasis will give you vector of symbols that are the records fields
17:41technomancynathanmarz: what are the haps?
17:41nathanmarztechnomancy: does leiningen let you configure how often it updates SNAPSHOT deps?
17:41nathanmarze.g., every time or just periodically
17:41slewisdnolen: nice, didn't see that… that seems to be the best solution
17:41technomancynathanmarz: IIRC maven-ant-tasks provides methods to do that, but they are no-ops.
17:42ordnungswidrigappengine-magic seems to define a method "get-clh-properties" on the entiy
17:42technomancyhopefully pomegranate/aether will do better in lein2
17:42ordnungswidrigslewis: https://github.com/gcv/appengine-magic/blob/master/src/appengine_magic/services/datastore.clj#L397
17:42nathanmarzah ok
17:42ordnungswidrig"Returns a set of all properties which pass through the Clojure reader on their way in and out of the datastore."
17:43nathanmarzgrazie
17:43technomancynathanmarz: lein2 should be usable very soon though
17:44ordnungswidrigslewis: oh, ignore what I said, clj-properties is for "reader-format-persisted" properties only.
17:47slewisI still want to fix my mental model though… (defrecord name [fields]), what type of object is [fields] and why can't I pass it in from something pre-defined
17:48TimMcslewis: lrn2macro
17:48TimMcThat's really the only solution.
17:48slewisdnolen: getBasis was close, but (defentity) doesn't pass it through to the record object
17:49slewisTimMc: yeah, you're right. Thanks all
17:49TimMcdefrecord is a macro; it is a syntax transformer; you cannot pass things to a macro like you can a fn
17:49emezeskeslewis: [fields] is a vector of symbols
17:49ordnungswidrigslewis: you can, but you cannot "apply" a macro, thus you have to expand the application of the list of arguments yourself. This is done by a macro itself.
17:50dnolenslewis: that doesn't make sense based on the link ordnungswidrig pasted. you have to be using Clojure 1.3.0 for this to work.
17:52gtrak`ordnungswidrig: you can @ it for that
17:52emezeskeslewis: (defmacro special-defentity [entity-name fields] `(do (def ~(symbol (str (name entity-name) "-fields")) ~fields) (defentity ~entity-name [~@fields])))
17:52emezeskeslewis: totally untested, probably broken
17:54ordnungswidrigemezeske: like that, or maybe better by using a protocol: (defprotocol SelfAwareEntity (field-names [this])) and a matching macro to extend-protocol the defined entity in special-defentitiy
17:54slewisdnolen: hmm yeah looking it at it should work… and now it works, I don't know what I did. sorry
17:55emezeskeordnungswidrig: that sounds cleaner!
17:55ordnungswidrigslewis: another so question on that: http://stackoverflow.com/questions/5925048/using-macros-in-clojure
17:56ordnungswidrigemezeske: I don't use appengine-magic but it sounds like a reasonable extension to me
17:59slewisordnunswidrig: I did see that before and it makes more sense now that I've talked to you all
18:00ordnungswidrigslewis: at least your google power was in place at the time needed *g*
18:00slewisits very rare that I make my way to IRC ;)
18:01ordnungswidrigslewis: in case of clojure it helps.
18:03slewisordnungswidrig: so I see!
19:24devnIs it possible to have prompt-like behavior in the REPL using just clojure?
19:24devnAs in: Enter your name and hit enter
19:26technomancydevn: sure, as long as you have access to *in*, which you don't always in leiningen
19:26technomancyprint+flush+read-line
19:27devntechnomancy: I guess I was thinking in the SLIME REPL -- what about that?
19:27devntechnomancy: what would cause me to lose access to *in*
19:27TimMcAnt throws away stdin -- trampoline doesn't help with that, does it?
19:28technomancyno, trampoline does
19:28technomancybut slime is just not hooked up to stdin
19:28technomancyit's hooked up to a socket
19:29technomancyanyway, you can do it, I just don't know which streams you have to rebind and wrap to make it happen in swakn
19:33devntechnomancy: hm, that's not ideal but I can take a peek and see if I can figure it out. If you have any pointers let me know, seems like you probably have a better handle on swank internals than me.
19:33technomancyhah
19:33technomancyI don't really know anything about the internals actually
19:33technomancybut I can see why you would make that mistake =)
19:34devnwell, you're certainly more proficient in elisp
19:34devnand yes I suppose I made the mistake of thinking: oh right, lein-swank
19:34devn:)
19:34devnswank-clojure, etc.
19:35technomancyyou'll have to ask jochu
20:20tmcivertechnomancy: I'm trying to upgrade lein; I don't think I've ever done an upgrade since the original install some time ago. Do I simply put the lein shell script on my path? Do I need to run 'lein self-install' or is that for Windows users?
20:20technomancyit should be able to run self-install itself when necessary
20:20technomancyplacing it on the $PATH is enough
20:21technomancyunless... (hint hint) you would like to try 2.x
20:21TimMctmciver: just run lein upgrade
20:21tmciverOK, so just overwrite the old lein script?
20:21technomancyoh right; lein upgrade will do it too
20:21tmciverTimMc: Oh, didn't see that task.
20:21technomancyI haven't used that in ages but that's what you want
20:21tmciverOK, thanks.
20:39photexhello folks, I am experiencing a bit of discord between my understanding of a simple bit of code and what's actually happening.
20:40photexlooking at a blog post someone else has this problem and mentions that it's discussed in "Programming Clojure"
20:40TimMc$1.50 on "lazy seqs and binding"
20:40photexbut I'm searching through the pdf and am having trouble locating the discussion
20:40photextotally!
20:40photex:)
20:40TimMcI was kidding... was I right?
20:41photexyes
20:41photexhaha
20:41TimMcclojurebot: You owe me.
20:41clojurebotNo entiendo
20:42TimMcphotex: I have the book; what page are you on?
20:43photex158
20:43photexI'm using with-open as suggested in the documentation
20:43technomancyso if my profiler shows most of the time being spent in sun.misc.Unsafe.park but the load is insanely high, that means I/O issues, right?
20:43photexon a reader that's being given a path
20:44photexto a log file
20:44photexand I thought that using (map my-func (line-seq logfile)) would work
20:45photexbut the stream is being closed, and I would like to understand why and learn what the correct approach to this is
20:45TimMcHmm, I think we have different versions of the book.
20:45photexmine might be old
20:45photexI haven't downloaded it in a while
20:45technomancyphotex: you have to consume the seq produced by map inside the with-open call
20:45photexlemme check for an update
20:46tmciverIsn't there only one version of that book?
20:46photextechnomancy: so use vector?
20:46TimMcphotex: As technomancy said, map produces a lazy seq itself.
20:46technomancythat's one way to do it
20:47technomancydepends what you're trying to do really
20:47photextmciver my ebook says it's version P3.0 from July 2010
20:47TimMcphotex: Wrapping the call to 'map in (dorun ...) would be a quick fix, but converting map to doseq would be better.
20:48photexok awesome... thanks for the information. I didn't realize map was lazy :)
20:48TimMcphotex: Wait, are you just doing side-effects in my-func, or getting back results you want?
20:48TimMcI may have assumed something.
20:49photexright now, I'm trying to just do something that I did in Python in like 15 minutes (analyze a bunch of render logs)
20:49photexfigured that it would be a good way to learn
20:49photexapply things I do for work etc etc
20:49TimMcOK, so my-func is probably a pure function that just parses a log line, yeah?
20:49photexso I'm just splitting up log lines
20:49photexhoping to generate some simple stats like 2/30 frames failed
20:49photexetc
20:49photexnothing crazy
20:50photexjust trying to learn
20:50photexlist start times in the logs, maybe determine total running time of the job and so on
20:50TimMcphotex: (doall ...) around the map will realize the lazy seq *and* hand it back to you. (Read up on doall, dorun, and doseq.)
20:50tmciverI only have a hard copy of "Programming Clojure" from 2009.
20:51photexbut yeah, to start, I'm taking each line, using a regex to extract the log level and the message
20:51TimMctmciver: I bought the ebook, and there was an updated copy.
20:51photexand associate that in a map by the show the job ran under
20:52photexTimMc technomancy thank you for the information
20:52tmciverI upgraded lein from 1.6.1 to 1.7.0 in an effort to get rid of an error when trying to run 'lein difftest', but it's still there. The error is:
20:53tmciverjava.io.FileNotFoundException: Could not locate clansi__init.class or clansi.clj on classpath:
20:53technomancytmciver: heading off, but try reinstalling the plugin
20:53TimMcphotex: There's a similar issue where lazy seqs escape a (binding ...) clause and see a different value for a var than you intended. Same solution works, or you can capture the value lexically.
20:53tmcivertechnomancy: do I manually remove the old jar? I forget.
20:54TimMctmciver: lein plugin uninstall...
20:54tmciverTimMc: Thanks.
20:54TimMcBut 1.3.7 is what I have.
20:58tmcivertechnomancy, TimMc: lein difftest works now. Thanks.
20:58technomancyyou don't have to uninstall
20:58technomancyfwiw
20:59tmciverTimMc lied to me? >:
20:59TimMctmciver: Did you install a different version?
20:59tmciverNl
20:59tmciverNo
20:59tmciver1.3.7
20:59tmciverNo prob. It works now.
21:00tmciverAfter all that I can finally do some Clojure.
21:17TimMctmciver: How does this look for import+ syntax? https://refheap.com/paste/738
21:19TimMctmciver: I'm a little torn on options like "A :as B" vs. ":rename {A B}" vs. simply "{A B}"
21:21TimMcYou can see that I've used all of those in the example syntax. :-)
21:21TimMcThe {A B} form is the most options-limiting.
21:27tmciverTimMc: my initial reaction is to go with "A :as B"
21:27tmciverTimMc: {A B} isn't as obvious.
21:28TimMcIt does match the "Class [option value]*" pattern.
21:28citizenparkerseancorfield: Just wanted to say thanks for http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-fw-1
21:29tmciverTimMc: not sure if I'm familiar with that...
21:29citizenparkerThat's the best and most straightforward resource I've seen for getting cljs up and running on a standalone project
21:29tmciverTimMc: was there supposed to be parenthises around contents of line 7?
21:29TimMctmciver: That's pseudo-BNF
21:30TimMctmciver: Line 7? Nope.
21:31tmciverTimMc: why is there parens for the stuff on line 8 then?
21:31TimMc(sub.pack.age Class :opt val :opt val AnotherClass :opt val (deeper.sub.package YAClass))
21:31tmcivers/is/are
21:31TimMcNesting subpackges.
21:38tmciverTimMc: where is the pattern used? use, require?
21:38TimMcIt isn't.
21:38TimMcBut it should!
21:39TimMcIf you think it's too confusing, we can just leave that syntax open for future features.
21:39TimMcand always use full package names for now
21:39tmciverHmm, so the question is whether to conform to what use/require do, or to break away and do it 'better'?
21:40TimMcBetter, as long as it really is.
21:49tmciverI'm confused by a lack of parens on line 7. It may be unambiguous to parse but it would be confusing to the eye if not for the indentation.
21:49seancorfieldcitizenparker: just saw your message - glad it helped!
21:50TimMctmciver: Well, that's what indentation's for, yeah? :-P
21:51tmciverTimMc: eh
21:51TimMctmciver: Reload, is it clearer now?
21:52seancorfield,(clojure-version)
21:52clojurebot"1.3.0"
21:52seancorfield,*clojure-version*
21:52clojurebot{:major 1, :minor 3, :incremental 0, :qualifier nil}
21:53tmciverWell, I feel that since both 'Color' and the stuff that follows and the line starting with (geom.. are both subordinate to java.awt, they should be indented to the same level.
21:54tmciverBut it looks weird to my eye that (geom... has parens and Color... doesn't.
21:56amalloyTimMc: Color should have []s
21:57amalloyin the same way that require looks like (:require (clojure [core :as c]))
21:58TimMc(will respond when I'm off the phone)
21:58amalloyso eg (import+ (java.awt [Color ...] (geom [Point2D$Double ...]))
22:06francislhi group, I have a basic question, I want the users input in the console, it work fine with read-line + lein repl, but it fails with lein run
22:06francislwhat should I use to make it work with lein run?
22:07TimMcSomeone just asked that!
22:07TimMc~logs
22:07clojurebotlogs is http://clojure-log.n01se.net/
22:07TimMchttp://clojure-log.n01se.net/#19:24
22:08TimMcfrancisl: ^ this discussion might be helpful
22:08francislok, perfect, thanks
22:09TimMcI don't understand the issues involved, so I might be misleading you...
22:10TimMcamalloy: I was avoiding mixing [] and (). Also, I figured it might be OK to drop some parens the way Clojure does with 'let.
22:11brehauttalios: hi
22:12amalloyTimMc: let and for drop unnecessary parens, but you always see a newline instead for legibility
22:12TimMchrm
22:13amalloythe parens are useful for lining stuff up, too - you like *can't* put a newline in your current layout because the modifiers would get indented to the left of the things they're modifying
22:14TimMcIf I use [java.awt (Color ...)] things line up more nicely, but I'd prefer it the other way.
22:15talioshey brehaut
22:15TimMcGotta go, but I'll check the backlog for any more suggestions.
22:15taliosbrehaut - done anything with pallet? looks like I'm getting/having to play with it soon
22:16tmciverTimMc: OK, see you tomorrow.
22:16brehauttalios: i havent sorry
22:16brehautit does look like its worth some time though
22:16taliosI'll just hit up cemerick sometime. I still kinda loathe the lisp syntax at times tho.
22:17taliossp?
22:17tim___Is there a way to have a non-namespaced symbol in a syntax quote?
22:17brehauttalios: just think, at least its not javascript ;)
22:18taliosbrehaut - I can only think that, I'm not allowed to vocalise my JS dislike at the office anymore ;p
22:18tim___e.g. `(def ~name 1) that expands to (def baz 1)
22:18brehauttalios: oh dear.
22:19brehauttalios: theres quite a bit of coffeescript love in your office isnt there?
22:19amalloy&(let [name 'baz] `(def ~name 1))
22:19lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
22:19taliosbrehaut - yep - about 80% ish of our JS code is coffee
22:20brehauttalios: i havent made up my mind if that is a good thing or a bad thing
22:21taliosbrehaut: well it solves a lot of potential JS bugs just in the code it gens
22:21hugodtalios: stop on by #pallet if you have questions...
22:23tmcivertim___, amalloy: also `(def ~'baz 1)
22:23tmciver&`(def ~'baz 1)
22:23lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
22:24talioshugod: sweet. will do.
22:24brehauttalios: yeah thats definately true, although ive found that strict mode + jquery catch a lot of the same ones
22:25tim___tmciver: thanks, that did the trick
22:28taliosbrehaut: I see jet brains kotlin got updated with some nice canvas love as well. looks nice
22:29brehauttalios: i havent looked at kotlin at all.
22:30taliosbrehaut: http://kotlin-demo.jetbrains.com - compiles to .class and .js files which is nice. wicket web based ide as well
23:29sdegutisevening
23:30sdegutiswould a 64-bit unsigned int be enough space to store hash codes for clojure values?
23:31arohner1sdegutis: yes. Java hash codes are 32-bits
23:31sdegutiswhat algorithm is used to calculate them?
23:33sdegutisreply!
23:33sdegutissorry, dont mind me.
23:33arohner1sdegutis: clojure doesn't have control over the hash codes for java primitives (ints & strings, etc). You'll have to read the clojure source code for the algos to clojure's hash-map & vector algos
23:33sdegutisah cool thanks
23:34sdegutiswait, do java primitives have hash code functions built-in?
23:34sdegutisi dont know much about java specifically, but the more i hear about it the more i like golang :)
23:35RaynesGo is for gophers!
23:35amalloy&(.hashCode (Long. 10))
23:35lazybot⇒ 10
23:35RaynesRust is where it's at.
23:35arohner1sdegutis: yes, class Integer and class String's hash code fns are built in, and can't be changed
23:38sdegutisinteresting
23:54jhowarthAre there any good animation libraries clojurescript yet?
23:54jhowarthfor clojurescript*
23:59lynaghkjhowarth, you mean for DOM attribute tweening?
23:59lynaghkibdknox just wrapped jQuery, so you could use the animate function from there