#clojure logs

2011-08-22

00:01chewbrancatechnomancy: checkout deps looks like it could accomplish it, but I mean more along the lines of declaring a project with a direct git source
00:02chewbrancajust curious if that's ever on the radar or if maven is just the way to go and that I need to get more familiar with using it
00:03taliosan entire project from git? that doesn't contain the project.clj?
00:03taliosthat sounds... broken.
00:03chewbrancabecause here's what I don't understand, if I'm working on a project on several different computers, how do I declare deps for plugins that require manual installation?
00:04technomancychewbranca: definitely not looking to add support for projects that aren't published as artifacts anywhere.
00:04chewbrancatalios: no I mean being able to specify a git source for an individual project in projects.clj
00:04chewbrancatechnomancy: ok cool, so means I need to get familiar with maven
00:04talioschewbranca: if plugins require manual install, then thats a flaw in lein IMHO.
00:05talioscan you not say "this project has plugin deps"?
00:05chewbranca so now that brings back the question, how do I declare that I depend on manually installing some x projects from git
00:05technomancymore like a flaw in the plugin
00:05chewbrancahere is a perfect example: https://github.com/getwoven/webmine
00:05talios(not having actually used lein beyond uber single things, I don't know what it is, or doesn't actually do )
00:05technomancychewbranca: step 1 is to open a bug report for the project saying "you need to publish your jars"
00:05chewbrancasweet looking project, but there is 6 plugins that don't have public artifacts of the required versions
00:06chewbrancatechnomancy: already did, on step 2 right now ;-)
00:06technomancyah, well that's a start =)
00:06taliostechnomancy: can lein deploy to remote maven repo, like Nexus or the like?
00:06technomancychewbranca: if they show no intentions of fixing it, you can upload org.clojars.chewbranca/foo to clojars as a workaround, but it's a shame if it comes to that
00:06taliosor does it only have the clojars/ssh way?
00:07technomancytalios: yeah, it can do archiva/nexus deploys
00:07chewbrancaso how do I programmatically define the dependency and installation of a handful of projects, so that I can reproduce this again?
00:07chewbrancatechnomancy: yeah I really dislike uploading other peoples' projects
00:07taliosnormally I'd suggest installing nexus locally, and using that as a mirror, deploy those artifacts to nexus.
00:07chewbrancaI mean I guess could just do a shell script, would work I guess, but that gets ugly in a hurry
00:07technomancychewbranca: if they had their act together, you wouldn't have to =(
00:08technomancythis isn't the first time I've seen shenanigans like this with getwoven
00:08chewbrancatechnomancy: I agree, but shit happens, and seeing as they deleted clj-http I don't expect them to
00:09technomancygeez
00:09chewbrancatalios: nexus looks interesting, but seems more useful as a centralized server, so should I just look into doing something like setup nexus.chewbranca.com and run my own maven server?
00:09technomancyan internal nexus/archiva is a good solution if you need to share jars among a team, clojars might be better if it's OSS.
00:10taliosor oss.sonatype.org - and get syncing to maven central
00:10chewbrancaI just want to easily be able to have the same setup on my laptop or desktop or random other computer from wherever I am
00:11technomancysonatype won't let you republish other folks' jars though, will they?
00:12taliosyes and no - you can raise a JIRA ticket to get them to deploy jars.
00:13taliosthat you don't own. but they'll do a bit of verification on the jar first.
00:13taliosbut as simple and isolated as clojars, where you just go rampantly slapping jars online under your own groups
00:14chewbrancatalios: yeah definitely something I'm trying to avoid, especially since its a handful of their plugins that need to be released, hopefully something will come of the ticket
00:14talioss/but/not/
00:14lazybot<talios> not as simple and isolated as clojars, where you just go rampantly slapping jars online under your own groups
00:15taliosone of the weaknesses I still see in the clojure community is everyone is source dependant, no one wants to publish jars, or frankly - release anything.
00:15technomancytalios: really? getwoven seems to be the exception rather than the rule
00:16chewbrancatalios: yeah seems like it, but on the opposite end of the spectrum people release rubygems constantly, and it gets problematic to manage deps between a large number of gems
00:16taliosmaybe I just havn't taken a closer look lately :) really need to get back into some clojure hacking
00:16talioschewbranca: rubygems is NOT a good model to chase after tho :)
00:17chewbrancatalios: oh absolutely not, was not suggesting that by anymeans
00:17taliosrubyist just say "I depend on X, not X v2.3.1"
00:17taliostho I think they -can-
00:17technomancyit's mostly a cultural thing
00:18chewbrancatalios: with bundler now, you basically snapshot a set of version deps to use, much nicer than before, but upgrading gets ugly
00:21chewbrancatechnomancy: nice, haven't looked at the leiningen plugins page in a while, pretty good set of stuff there now!
00:23taliosI see the new Cucumber-JVM has a clojure module for writing steps. Must play with that tonight
00:25dnolenk, regex pattern match whittled down to 9 meaningful lines of code, https://gist.github.com/1161596
00:25dnolento-source will probably become a multimethod.
00:53ibdknoxtechnomancy: I was trying to see if there was something obvious I could do to get something that requires 1.3.0 in a lein plugin
00:53ibdknoxtechnomancy: I was working on the cljs watching stuff and my first thought was to just do it as a lein plugin :)
00:54technomancyibdknox: you could construct a dummy project in-memory with 1.3.0 as a dependency and use eval-in-project
00:55ibdknoxoo
00:55technomancylet me know if that actually works; I really have no idea
00:55ibdknoxhaha
00:55technomancybut it seems theoretically possible
00:56ibdknoxI might just leave it be for now, and instead get the script into clojurescript proper
00:57ibdknoxsince I have that working at this point
00:57ibdknoxit'd be so much better in lein though... since it could benefit from having the classpath setup correctly
00:57technomancywell, lein 2.0 will be able to use clojure 1.3 if hiredman's bootclasspath patch gets applied
00:58technomancyso there's that
01:02aaelonyI just followed the "Getting started" instructions for Noir (http://webnoir.org/#started). lein run gives me a server, but going to localhost:8080 the site does not render. The stack trace says java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Named
01:06ibdknoxaaelony: you made no changes to the code?
01:06aaelonyI didn't change anything.
01:06aaelonyI'm using Leiningen 1.6.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM
01:07ibdknoxwhat'd you name your project?
01:07aaelonyI gave it the name "noir-ui"
01:07aaelonymaybe its the dash?
01:08ibdknoxnope
01:08ibdknoxI just did lein noir new noir-ui
01:08ibdknoxlein run
01:08ibdknoxand it worked
01:09aaelonymaybe its my machine
01:09ibdknoxugh, I hope not :(
01:09ibdknoxdo lein clean, lein deps
01:09aaelonyI just tried it again with the name "nnoir", same thing
01:09aaelonywill do
01:10ibdknoxjust to make sure, it's using noir 1.1.0 right?
01:10aaelonyyeah, I did exactly what's on the Getting started section: lein plugin install lein-noir 1.1.0
01:10aaelonylein noir new my-website
01:10aaelonycd my-website
01:10aaelonylein run
01:11aaelonyexcept I didn't use "my-website"
01:11ibdknoxmhm
01:11ibdknoxI'm not sure without looking at it, you could zip it and send it to me
01:11aaelonyI'm using the name "nnoir" now, still an issue
01:12aaelonywill do. I'll use the email on the site.
01:12ibdknoxLately I've been struggling with a class of issues where things, once jarred, no longer behave consistently on different machines
01:12ibdknoxwhich makes no sense to me
01:12ibdknoxI've not heard of it with Noir though
01:12ibdknoxjust the ClojureScript jar I made
01:13aaelonythere may be an older version of something conflicting on my host, but I don't know where it would be coming from
01:13aaelonycome to think of it, I think laprepl gave me a similar problem
01:14ibdknoxremove ~/.m2/repository
01:14ibdknoxthat will force it to get new deps for everything when you call lein deps
01:14aaelonyI think I've been down that path before, but I'll try that again
01:32no_mindI have a try clause inside a doseq. I want that if an exception is raised, the doseq should continue with next element in the sequence, without raising an exception. How do I do this ?
01:34ibdknoxanyone know if ClojureScript's (meta) actually works?
01:34ibdknoxit's there...
01:34ibdknoxbut I'm always getting null :(
03:28michaelr525hello!
03:28ibdknoxhello lol
03:29michaelr525why lol? and when are you going to go to sleep?
03:34amalloy_ibdknox: meta on what kind of element?
03:34amalloy_i don't do any cljs, but looking at the source, at least meta on a list should work
03:35ibdknoxamalloy_: it seems vars can't have it
03:35ibdknoxamalloy_: which is what I was trying to do
03:35ibdknox:(
03:35ibdknoxI have a cheater's solution for now though
03:35amalloy_ibdknox: cljs doesn't have vars anymore at runtime, i thought
03:36ibdknoxamalloy_: yeah
03:36ibdknoxamalloy_: hadn't realized that until tonight
03:36amalloy_what's your cheater solution, ooc?
03:37ibdknoxthe information I need is also stored in the result of an invocation of the function
03:37amalloyman, i knew there were too many _s in this conversation. usually it's you, so i didn't notice :P
03:37ibdknoxhaha
03:38ibdknoxthis is what I was doing
03:38ibdknoxallowing you to attach event handlers to anything that comes out of a (defpartial some-html-here) in pinot
03:39ibdknoxso you can bind events to all dom elements produced by that function
03:39ibdknoxonce
03:40pyrwhich book on java should a clojurian buy ?
03:41pyrit's hard to separate the chaff from the grain when it comes to java books
03:41ibdknoxamalloy: metadata would've made that "nicer"
03:49amalloypyr: you don't care much about java the language, just the jvm and the standard libraries. not sure what would be useful for that
03:55pyramalloy_: yes, i came to clojure as my first jvm language, a bit more used to the specifics of the jvm and java now, but sometimes i think a bit more background litterature would be nice
04:27lnostdalis there some way of getting better stack-traces? .. i'm using swank-clojure at the moment, and i think i recall there being some additional plugins that improves debugging
04:43raekpyr: Java Concurrency in Practice, IMHO. On the other hand, it's not really a book on general Java programming.
04:47pyrraek: yes, this one i wanted to get. i guess i'll take a chance for the rest :)
04:56michaelr525lnostdal: swank clojure should also include swank cdt in it's latest version, but I didn't manage to get it to work so far..
04:56michaelr525lnostdal: http://georgejahad.com/clojure/swank-cdt.html
04:57michaelr525lnostdal: tell me if you have better luck
05:42lnostdalhm, ok. .. i think i have the latest swank-clojure .. perhaps i need to activate CDT tho
06:20fhd1So how do you guys host Clojure web applications?
06:21fhdI have a Compojure web applications running in Jetty, and I'm wondering how to best put it on a server
06:22fhdI've hosted Clojure web apps on Tomcat before, but making the routes work in both Tomcat and Jetty was pretty tedious, can't be the normal way.
06:35michaelr525error: java.lang.Exception: Cyclic load dependency: [ /http/async/client/request ]->/http/async/client/util->[ /http/async/client/request ]->/http/async/client->/fetcher/core
06:35michaelr525damn
06:35michaelr525trying to use the 'fetcher' library
06:36michaelr525that's what i get when compiling the code. just added (:require [fetcher.core :only [fetch]])
06:50michaelr525weird, the version on clojars is older than on githut but the version number is higher.. hhh
08:16ordnungswidrig1Why doesn't accept ring a LazySeq of Strings as body? It says it accept's ISeq
08:20tomojany gloss users around these parts yet?
08:20tomojhardly ever see any aleph questions here..
08:20ordnungswidrig1sorry, I found my error. I was using ring 0.3.5. which does not recogize iseq as response body yet in ring-lint
08:49tomojhttps://gist.github.com/4a57022921afde8a6465
08:49tomojthere's gotta be a seqier way
08:50chousertomoj: you want it in the order given by 'both'?
08:51tomojyeah
08:51tomojhmm
08:51tomojI think I see the way
08:51tomojnope
08:52chouserThe way you're doing it is actually very efficient, taking advantage of the fact that all three are in the same order
08:52tomojyeah
08:53tomojhmm
08:53tomojwell, it works..
08:54chouser(defn in-out-with-both [in out both] (let [in (set in)] (for [b both] [(if (in b) :in :out) b])))
08:54tomojwell..
08:54tomojnot quite the same
08:55tomojthat will probably work just fine for me
08:55tomojin and out are subsequences of both
08:55tomojso if you traverse in and out and both all in order, the worst ambiguity is who sent consecutive duplicate messages
08:55tomojif you turn in into a set it gets worse
08:56tomojbut actually, in and out will almost certainly be disjoint
08:56chouseroh, there can be dups?
08:56chouserah, you're catching :wtf as well
08:56tomojthere should be none of those though
08:56tomojit's a packet dump
08:56tomojand the two sides cut out in order
08:57chouseras I said, yours is very efficient, esp if thes seqs are long
08:57tomojI'll stick with it.. seems like there should be a more elegant way to fold (?) through two seqs or whatever that's doing
08:57chouserThere's not much in core that allows you to choose to consume (or not) a step of a seq based on the value(s) at hand
08:58tomojI guess because you don't often need to?
08:58chouserwell ... dunno. It comes up from time to time.
08:58chouserIt might be interesting to look at some cases and see if there's some HOF that can be factored out.
09:04chouserYou could do it with 'reductions' I think, but you'd end up with almost all that code and it would be less efficient.
09:08dnolentomoj: https://gist.github.com/1a58aca035fbbc040b58, would look like this using match once we have locals matching.
09:10tomojcool
09:25michaelr525heya!
09:31dnolenbam, locals matching, https://github.com/swannodette/match/commit/10b735782b65c7be392a1387253d86c4758a342e
09:34dnolensometimes dynamic vars really rule.
09:43drewrdnolen: why ^:dynamic -> ^{:dynamic true}?
09:43drewr(just curious)
09:44dnolendrewr: 1.2.0
09:44drewrbackward compatibility? bah
09:44pjstadigdnolen: ITYM 1.2.1
09:45drewrdnolen: this is great btw
10:07gtrakis there an existing 'closeable' protocol I can use to extend types with or should I make my own?
10:14bendlasgtrak: java.io.Closeable
10:16gtrakhmm, but apparently you can't extend-type over an interface, must have a protocol
10:16gtrakI think I could use reify, but it's more awkward
10:16bendlasyou can't extend-type, but you can implement it directly
10:17bendlaslike (deftype foo [] java.io.Closeable (close [this] ..))
10:17bendlassame with defrecord
10:18gtrakhmm, I think it's still simpler to make a protocol
10:19bendlasdon't hesitate; good thing is, with-open doesn't care about the type
10:19bendlasit just calls .close
10:19gtrakyea
10:46jaleyhey guys, quick question... is there a way to "apply" a constructor call?
10:47jaleyi.e. ;; (apply SomeType. args-seq) ?
10:48ordnungswidrig1jaley: doest applying "new" work?
10:48ordnungswidrig1(apply new SomeType args-seq)
10:48ordnungswidrig1(no repl at hand)
10:48gtraknew's not a fn, it's a special form
10:49jaleyordnungswidrig1: no but maybe wrapping new in a closure is the way to go
10:49tufflaxYou can at least wrap the constructor in a (fn [& x] (apply Type. x))
10:49tufflaxor something like that
10:49gtraknew is static, you'd have to use reflection to instantiate dynamically
10:49tufflaxmaybe memfn works
10:51gtrakhttp://download.oracle.com/javase/1.4.2/docs/api/java/lang/Class.html#newInstance()
10:51tufflaxgtrak is there a way to give arguments when using newInstance?
10:52joegallono
10:52gtrakdon't believe so
10:52tufflaxHm, so what if I wanted to? :p
10:52joegallofor that you need to Class/getConstructor(s) with the right type arguments
10:52gtrakbut there's a getDeclaredConstructors that you can use to find the right one?
10:52tufflaxoh ok
10:52joegalloyeah, declaredconstructors, missed that word
10:53joegalloand then you can newInstance with arguments off the provided constructor
10:53gtraktufflax, a constructor with varargs takes an array
10:53gtrakso you wouldn't want to use apply on something with unpredictable size anyway
10:54jaleyok i'm getting the idea the best way to do this is with a help function and arity overloading. thanks for the suggestiosn though guys!
10:54gtrakyes, that's probably simplest
10:55tufflaxgtrak hmm yes
10:55tufflaxI learned that java varargs takes arrays the hard way :p
10:55tufflaxtake*
10:59gfrlogwho manages the clojars project?
11:01tufflaxI think ato (alex osbourne) made the site at least
11:01coopernurseyes, github project is here: https://github.com/ato/clojars-web
11:02tufflaxalex osborne, sorry :p
11:02gfrlogokay. I sent a pull request a while ago and have not gotten any comment on it, so I should send a message to his github account?
11:02gfrlogI'm locked out of clojars until the bug is fixed
11:04tufflaxI dunno :p im not alex :p
11:05gfrlogokay. I was just making sure clojars didn't have any more formal of an organization/process behind it
11:06tufflaxI don't think so
11:06gfrlogk, thx
11:07gfrlogoh I see github says he hasn't been around for a while. maybe that's why.
11:21dsantiagodnolen, I love how you file an issue, implement the feature, and then close the issue an hour later. :)
11:23dnolendsantiago: well I never know how easy is something is going to be, or when I'm going to actually work on it :)
11:25dsantiagoIt's very disciplined. Nothing wrong with that.
11:29TimMcIt also gives a richer commit log and project history. If someone later encoutners the bug, a search may turn up the (closed) issue.
11:29TimMcVery nice for users.
11:34ambrosebsalso good to know what's rattling around in dnolen's head at that moment :)
11:34dnolenheh
11:35TimMcOh yeah, and it also means that you don't have to cram a whole wad of rationale into a commit message, you can just refer to an issue #.
11:35gtrakso I tried to extend-type over an interface that a class implements, and I get this: " java.lang.IllegalArgumentException: No matching field found: close for class org.apache.http.impl.conn.SingleClientConnManager" does extend-type not work for the subclasses of the extended class?
11:36ambrosebsTimMc: fossil scm got this right, tickets and wiki are versioned and part of the repo
11:36ambrosebsgithub in a box
11:38gtrakerr wait... that's not it, I did something else wrong
11:42PPPaulis using clojure with couchdb easy?
11:46gtrakso I created a protocol with a close method, and I extended it over the type, but when I run it, I get java.lang.IllegalArgumentException: No matching field found: close for class org.apache.http.impl.conn.SingleClientConnManager, what could be the problem?
11:47dnolengtrak: paste por favor.
11:49gtrakhttp://pastie.org/2411964
11:51dnolengtrak: why would that work? with-open calls a .close method, not an fn.
11:52gtrakhmm, well it's not obvious to me, the protocol's close method is not able to be called by .close?
11:53gtrakis that what reify is made for?
11:53dnolengtrak: fns and methods are not the same thing.
11:54dnolengtrak: you could try creating your own close *interface*.
11:54dnolen(definterface Closeable (close [])
11:55gtrakwould I have to use reify then?
11:55dnolenoh sorry, mispoke
11:56dnolenthe problem with reify is that you can't delegate.
11:57gtrakah
11:57dnolenyou could write you're own version of with-open that does the right thing if the object satisfies Closeable.
11:58gtrakhmm, I'm surprised there isn't a way to delegate though, is there one?
11:58gtrakthis would make it easier on client code
11:59dnolenhow could that be done w/o reflection given the design of the JVM ?
11:59dnolenone day Clojure may support invokeDynamic.
11:59gtrakah, it's that kind of problem
11:59dnolenuntil then, writing your own version of with-open ain't much work.
12:00dnolengtrak: also one day more of Clojure will be pushed into protocols, could be addressed then.
12:01hiredmanscopes!!!!
12:01gtrakhmm, I still don't quite get it, in java I would subclass both interfaces, instantiate the class of interest, and delegate accordingly
12:02dnolengtrak: you can use proxy/genclass. but that doesn't sound like less work to me.
12:04gtrakinterestingly enough google tells me clojure/clr has a gen-delegate
12:08gtrakit looks like reify could work if I do it at the point of instantiation
12:09gtrakyou just can't do it for a class it seems, can use it for an object
12:11gtrakerr-wait, that would only return the closeable, not something that implements both
12:12dnolengtrak: replacing with-open is 10 lines of code. Why pick a more complicated solution?
12:13gtrakfor the sake of client code, documenting that they should use a specific with-open is just like telling them to look up .shutdown, doesn't really save anything
12:14gtrakit would remove a try-finally block, I guess that's something
12:16dnolengtrak: ah so this isn't some internal detail. then use proxy/gen-class
12:18dnolengtrak: also protocols wouldn't help you much if you're going for real interop here since that stuff is invisible to Java.
12:44lobotomyö
12:44lobotomyoops sorry
13:09PPPaulanyone here use clojure with couchdb?
13:12devnPPPaul: Why do you ask?
13:12devnPPPaul: Short answer, yes, and I know more than a few people who do.
13:16chewbrancaPPPaul: I'm currently using clutch for interacting with couchdb from clojure, although I'm relatively new to clojure so I can't say much about long term experience with it
13:57rpgDoes clojure-mode in emacs have any equivalent of hyperspec-lookup that will jump to clojure.org docs?
14:03dnolenrpg: no, but you can get the docstring with slime-documentation, or typing (doc symbol) in the REPL
14:04rpgdnolen: Got it. But I think the hyperspec-like facility would be handy, don't you?
14:12chewbrancadnolen: that regex pattern match turned out very slick, I'll definitely put that to use
14:14michaelr525dnolen: can you explain in two words why pattern matching is usefull?
14:15rpgIn clojure-mode, is there some obvious way to get the swank server to tell you what is the namespace of a symbol in the buffer? Seems like that's necessary for the equivalent of hyperspec-lookup to work....
14:17raekit could evaluate (resolve <the symbol>)
14:17chewbrancamichaelr525: how about 'pure awesome', or 'concise dispatch', or 'clear branching'?
14:18PPPaulcan someone recommend a website for me to get started making couchapps via clojure?
14:19chewbrancamichaelr525: I'm a big fan of erlang's use of pattern matching, where everything passed around as a tuple, so the convention is to do pattern matching on {ok, _} or {error, Error} and perform appropriate operations
14:20chewbrancaPPPaul: you can't realy make 'couchapps' with clojure in the traditional sense of couchapps as a self contained application hosted from couchdb, although I'm intrigued to see what I can do with clojurescript and couchdb in that regard
14:20dnolenchewbranca: nice.
14:20PPPaulso, clojure is good for interacting with couchdb, but not so easy to make couchapps?
14:20chewbrancaPPPaul: https://github.com/ashafa/clutch works pretty well for interacting with couchdb, then you go where ever you want with it
14:21dnolenchewbranca: we're working on making that API clean, no need for deftype/record. only multimethods / plain maps.
14:21chewbrancaPPPaul: well in couchdb terms, a couchapp is a javascript application that is self hosted inside of a couchdb database, so its not really a choice of language (clojurescript blurs this distinction, but I don't think this is what you're talking about)
14:22chewbrancaPPPaul: in terms of interacting with couchdb, clojure is great for doing that and lot of good stuff to work with
14:22PPPaulok
14:22chewbrancadnolen: very nice, I'm already impressed with how clean it is
14:22chewbrancaPPPaul: what exactly are you trying to accomplish?
14:22PPPaulmaking couchapps
14:23dnolenmichaelr525: probably not in two words. do you use Clojure destructuring features much?
14:23PPPauli'm good with javascript, but i rather use clojure
14:23chewbrancaPPPaul: and what does 'couchapp' mean to you? an application with couchdb as a backend, the python couchapp tool or couchapps as nested javascript applications inside of couchdb
14:23michaelr525dnolen: sometimes I use them. I'm not doing clojure much in general.. just when I have some spare time you know
14:23chewbrancacouchapps in the latter meaning are strictly javascript/html apps, no way around that
14:23PPPaulcouchapp means that the app is in couchdb
14:24PPPaulso i can replicate the app
14:24rpgraek: So presumably that's what's happening in swank:find-definition in the swank server, so probably the same logic could be done for something hyperspec-like...
14:24chewbrancaPPPaul: then it has to be in javascript, you could look into using clojurescript, but you can't use native clojure in a couchapp
14:24dnolenmichaelr525: well if you those, pattern matching takes that to another level.
14:25PPPaulok. thanks
14:25michaelr525dnolen: i see, i have to take the blue pill in order to understand ;)
14:25PPPaulclojure script works in couchdb?
14:25chewbrancaPPPaul: no it doesn't, but clojurescript compiles to javascript
14:26dnolenmichaelr525: it's also extensible, and you can use it on things you can use destructuring on - bytes for example. for performance sensitive stuff it introduces no overhead.
14:26dnolencan't use destruturing on I mean.
14:26PPPaulhmmm... sounds like it may be a bit of a process to do a couchapp with clojurescript
14:26michaelr525hmm
14:26chewbrancaPPPaul: I would just stick with javascript for couchapps, or build a more traditional app with clojure up front and couchdb as the backend
14:27dnolenmichaelr525: destructuring won't let you pattern match bits. match will.
14:28chewbrancaPPPaul: what I will do sometimes is a combination of that, so host your assets and javascript UI in couchdb as a couchapp, but throw a reverse proxy up front and have a route like '/api/' kick off to a clojure api server, so you could do things you can't do in a couchapp while still getting to host out of couchdb for most stuff
14:28michaelr525dnolen: can you give me some "real world" usage example where it can give me advantage?
14:29dnolenmichaelr525: personally, I don't think I'll do much serious primitive array work without.
14:29dnolenmichaelr525: say you have an image data in an array and you want to increase the red component uniformly.
14:30michaelr525so you destructure the rgb bits?
14:30dnolenmichaelr525: yes.
14:30michaelr525hmm
14:31michaelr525i see, more concise code and good performance.
14:44yfrankwhats clojure's solution to not having tail call recursion?
14:45coopernurseyfrank: take a look at loop / recur
14:45coopernursehttp://clojuredocs.org/clojure_core/clojure.core/loop
14:46Chousukenote that you can use recur without loop
14:46Chousukefunctions are recur targets
14:46Chousukealso use lazy sequences
14:47yfrankok, thanks :-)
14:49dnolenyfrank: less frequently used, but useful, trampoline
15:03grumpytoadcan graphics programming be stateless in FP clojure(script) ?
15:03grumpytoadfinding it hard to get the right event model for this
15:03ibdknoxgrumpytoad: I don't think clojure suggests that everything should be stateless
15:03ibdknoxjust that its use is explicit
15:04ibdknoxand judicious
15:04grumpytoadi would like to get a stateless js graphics demo..
15:04grumpytoadjust for kicks
15:04ibdknoxwhat do you mean by graphics?
15:04grumpytoadi'm tending towards hmm.. possible but not practical
15:05grumpytoadwell a game.. like that pacman demo, only without state
15:06arohnergrumpytoad: every useful program has state. the issue is where it's kept, and how it's managed
15:06tufflaxgrumpytoad so I assume you have not seen this http://prog21.dadgum.com/23.html
15:06ibdknoxa game will always have state, it just may not be stored globally
15:06arohnermaybe you mean no *global* state?
15:06grumpytoadtufflax: thx for the link..
15:06ibdknoxI never finished it, but I was curious what games would look like in Clojure as well
15:07ibdknoxso I did pong
15:07ibdknoxhttps://github.com/ibdknox/clojure-pong/blob/master/src/clojure_pong/core.clj
15:07grumpytoadi mean, if one has a bunch of event handlers ... they could trigger due to different reasons
15:08grumpytoadbut the main render cycle still needs to know the outcome of some of these handlers
15:08ibdknoxgrumpytoad: eventing requires global state
15:08ibdknoxinstead you would have to think of it as during my loop, is a key pressed?
15:09grumpytoadibdknox: not sure - i thought flapjax and stax-haxe prevented this
15:09ibdknoxif an event happens, you need it to change something
15:10grumpytoadyes, you could do that, but might miss the key press, though i admit i haven't tried
15:12grumpytoadok that link on retrogames is the Right Way tm
15:17dnolengrumpytoad: I think Clojure is less about stateless then it is about managing state. Rich Hickey famous ants.clj demo had plenty of state in it. But it was managed.
15:20grumpytoadwell... there he uses transactions among actors - this isn't really workable in the js event world
15:20grumpytoadwhich, if you have a larger copus of code, becomes quite a nightmare
15:24dnolengrumpytoad: oops, I missed the bit earlier that you wanted to do this in JS.
16:14jweiss_I'm testing 2 maps for equality, and it seems to be inexplicably failing - i tried printing out the 2 maps with println and they inexplicably print differently: {:name "login", :steps (fn [] (Thread/sleep 2000) (println "logged in"))} and the other is {:name login, :steps (fn [] (Thread/sleep 2000) (println logged in))} -- the 2nd one doesn't have any quotes, which is wrong, and i suspect that's what's causing the inequality, but I
16:14jweiss_don't know how this munging happened.
16:15hiredmanuse pr
16:23tufflax,(prn (fn [x] x))
16:23clojurebot#<sandbox$eval6122$fn__6123 sandbox$eval6122$fn__6123@d3258f>
16:24jweiss_i tried pr, it doesn't print to stdout on every thread
16:24tufflaxtry prn
16:24jweiss_k
16:24tufflaxor flush
16:25amalloythere
16:25amalloy's no way prn will work if println doesn't
16:25ibdknox,(doc bound-fn)
16:25clojurebot"([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."
16:25devngrumpytoad: There are web workers. I know it's not an equivalent, but it's something worth considering.
16:25amalloyjweiss_: ##(= (fn [] 1) (fn [] 1))
16:25lazybot⇒ false
16:26tufflaxI'm confused by jweiss original question, what are you trying to do? printing functions doesn't "work" right?
16:26amalloyno function is ever equal to any function unless they are pointer-identical, so your maps won't compare equal if they're not the same
16:26hiredmanbut look at the maps he showed us
16:26jweiss_amalloy: yeah i am aware that compiling two different functions will not be equal even if they look the same. i just have one compiled function
16:26hiredmanneither one has a fn in it
16:27hiredmanthey have forms that would compile to fns
16:27tufflaxoh
16:27amalloyhiredman: well, i think he's given us too little information about where that text came from for us to decide what the problem is
16:28amalloybut you're right, of course, if those are actually lists
16:28jweiss_no, it's really a compiled function, sorry i forgot i am using technomancy's serializable-fn so that i see the source when i print them out.
16:30jweiss_i'm just printing things out to help figure out why map equality returns false when i expect true
16:30hiredmanhave you actually looked at the two maps?
16:30jweiss_it's definitely the same compiled function: test.tree$fn__6505 is the class in both cases
16:31jweiss_and the only other key in the map is a string
16:31amalloyjweiss_: that is insufficient info
16:31amalloyclosures have the same class but aren't the same function
16:31jweiss_amalloy: ok, but it's not a closure
16:32jweiss_i really don't think it's the fn value that's causing inequality here
16:32ibdknoxjweiss_: just put some code in a gist :)
16:33amalloy&(map pr ["string" 'string])
16:33lazybot⇒ ("string"stringnil nil)
16:33amalloy(inc ibdknox)
16:33lazybot⟹ 1
16:33ibdknoxaw my karma is all gone
16:34TimMclazybot is lazy
16:34ibdknoxeither that or you've all secretly been dec'ing me behind my back
16:34jweiss_it's 350 lines, i wish i knew how to boil it down
16:34ibdknoxhehe
16:34tufflaxgive yourself some then ibdknox :)
16:35ibdknoxhaha, I shant cheat
16:35ibdknox(this time)
16:36jweiss_can i print out the hashcode or something to make sure it's the same?
16:37ibdknoxjweiss_: what is the scenario that causes you to try and prove that two functions are equal?
16:37ibdknoxit's hard for me to contrive a situation where that would be the right solution
16:39jweiss_ibdknox: what i have is an atom, a map where the keys are maps. i assoc a map/value into the main map, and then later on another thread try to get the value using what *should* be an identical map as a key.
16:40ibdknoxjweiss_: sounds reasonable so far
16:40jweiss_the only difference between the key i assoc and the one i later use to get the value is, at most, an assoc/dissoc that leaves the same k/vs
16:40jweiss_and yet i get nil
16:41jweiss_if i manually try to retrieve the value, though, i get it
16:41ibdknox,(= {:x 1} (dissoc {:x 1 :y 1} :y))
16:41clojurebottrue
16:41ibdknox,(= {:x 1} (dissoc {:x 2 :y 1} :y))
16:41clojurebotfalse
16:42ibdknox,(= {:x 1} (assoc (dissoc {:x 1} :x) :x 1))
16:42clojurebottrue
16:42ibdknoxare you sure the value is the same after the assoc's happen?
16:42jweiss_ibdknox: no, I'm trying to *make* sure, but I don't know how
16:43ibdknoxah, this is where your println's don't work?
16:43jweiss_ibdknox: yeah, one prints without quotes, the other has quotes.
16:43amalloy&(map pr ["string" 'string])
16:43lazybot⇒ ("string"stringnil nil)
16:44amalloy(repeated for posterity who didn't read it last time)
16:44jweiss_amalloy: maybe i'm missing the point of the above
16:44ibdknoxif it prints with quoest
16:44ibdknoxquotes*
16:44ibdknoxit's a string
16:44amalloyjweiss_: a symbol prints like a string but without quotes
16:44jweiss_amalloy: ok, what about println?
16:45amalloy&(map print "test" "\"test\"")
16:45lazybot⇒ (t "e tnil s enil t snil nil)
16:45amalloy&(map print ["test" "\"test\""])
16:45lazybot⇒ (test"test"nil nil)
16:46jweiss_&(map print [(str {:hi "there"}) {:hi "there"}])
16:46lazybot⇒ ({:hi "there"}{:hi there}nil nil)
16:46jweiss_i used str in both instances though
17:19sridstring construction is not all that pretty in clojure; how can https://gist.github.com/1163620 be made better?
17:21hiredmanI have a solution to that
17:21hiredmanyou it in a function
17:21hiredmanput it in a function
17:21hiredmancall as needed
17:22pjstadigyou can also use format
17:22michaelr525hey
17:24michaelr525I'm trying to implement a retrying connection, using loop try-catch recur, problem it says I can't recur from catch/finally. Seems like a common case that probably many have already solved, anyone knows a good pattern of how to do it?
17:24pjstadigrobert bruce
17:25pjstadighttps://github.com/joegallo/robert-bruce
17:26dnolensrid: I thought that first. But I love string construction in Clojure now. none that multiline bull you have to deal w/ in other langs.
17:27michaelr525oh, I found this solution
17:27michaelr525http://stackoverflow.com/questions/1879885/clojure-how-to-to-recur-upon-exception
17:29pjstadigmichaelr525: robert bruce is more mature and general than try-times
17:30michaelr525oh, it was for me, let me check it :)
17:30michaelr525thanks
17:31michaelr525ooh nice
17:32michaelr525i can see what you did there ;)
17:50pjstadigmichaelr525: sorry should have been more specific about addressing you
17:52amalloyjweiss_: anyway, don't use print or println for anything involved. use pr/pr-str to make sure it prints as the right type
18:08michaelr525how do you restart swank/slime when using clojure-jack-in?
18:11joegallothat's kind of tricky atm
18:12joegalloit might be as simple as just rerunning clojure-jack-in
18:12joegallobut if that gives you an error
18:12joegallothen you might want to kill every buffer with slime or swank in the name
18:12joegalloand then try again
18:12joegalloand if that doesn't work, then you should kill and restart emacs
18:12amalloyjoegallo: from what i hear you just need to kill the *swank* buffer if the first thing fails
18:12joegalloi hope that's the case :)
18:14michaelr525hey joe! thanks for bruce! hehe
18:15joegallooh, you're welcome. it was a funny little thing to write. :)
18:15joegalloplease let me know if you feel like there's anything that is missing or could be improved.
18:19trmswhow do I get the name of a var?
18:23tufflaxWhat do you mean trmsw
18:28joegalloyes, a little more explanation would be helpful
18:28joegallowhat are you trying to do?
18:28trmswsorry. Say I have an interned var #'foo
18:28joegalloit seems like instead of typing (get-the-name-of-some-var the-var) i could just type "the-var". :)
18:28trmswI want the corresponding namespace-qualified symbol
18:29tufflaxhm, im not sure but maybe `foo?
18:30tufflax,`foo
18:30clojurebotsandbox/foo
18:30hiredmanvars round trip through the reader/prn fine
18:31trmswok so now: (def x #'foo)
18:31joegallotufflax: this seems more entrerprise to me:
18:31joegallo(symbol (str (.ns #'foo)) (str (.sym #'foo)))
18:31joegallojk, of course
18:31tufflaxhehe
18:32trmswyes that was what I needed, thanks
18:32hiredmantrmsw: no, stop
18:32tufflax:)
18:32hiredmanwhy are you putting a var in another var?
18:32danlarkinvar turtles obv
18:32trmsw:)
18:32tufflaxhaha
18:33trmswbecause I have menu items in an Eclipse plugin that I want to alter dynamically
18:33hiredmanNo
18:34hiredmanuse an atom or a ref, or really anything else
18:35trmswso using (#'foo) to run the action is a bad idea
18:35hiredmanthat is not what you said you were doing
18:36hiredmanthat is fine, but (def x #'foo) is not
18:37trmswsay I have (defcmd foo ... ). It should create a function called foo (to help with interactive debugging) and maybe also add a menu item which depends on a proxy, to call (#'foo)
18:37tufflaxis there ever any difference between (foo) and (#'foo)?
18:37hiredmannone of that has anything to do with (def x #'foo)
18:37hiredmantufflax: yes
18:38tufflaxok, what? :P
18:38trmswto create the proxy, I'll have an argument x whose value is #'foo
18:38hiredmantrmsw: and?
18:38hiredmannone of that has anything to do with def
18:39hiredman(although, I am beginning to think you really don't know what you are doing, so most likely trying to create locals using def)
18:40hiredmandef is not scheme's define, it does not create local names, it greates global vars
18:40hiredmancreates
18:40trmswdef was a red herring
18:40trmswit was just to try and get past the "if you want the name of #'foo why not just write 'foo"
18:41hiredmanor just use #'foo
18:42tufflaxhiredman what's the difference between calling (foo) and (#'foo)? If I just defn foo then they do the same thing; call the fn
18:44tufflaxoh, now i remember one difference
18:44tufflax#'foo is always a var in the namespace
18:44tufflaxwhile foo migth be something local
18:44tufflaxright?
18:44clojurebotEqual Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://home.pipeline.com/hbaker1/ObjectIdentity.html
18:45hiredmantufflax: the difference generally only manifests when foo is used in a top level form, like (def foo [] 1) (def bar ((fn [x] #(x)) foo)) or def bar ((fn [x] #(x)) #'foo))
18:45amalloyhiredman: or when foo is a macro
18:45hiredmanI suppose
18:47hiredmantufflax: so run those defs at a repl, but make a bar1 and a bar2 (one with foo and one with #'foo) then re-def foo to something else and see what happens
18:47hiredmanthat should be (defn foo [] 1)
18:47tufflaxok, let's see...
18:49amalloyhiredman: clojurebot's link there is dead
18:50hiredmanbleh
18:50currentBI'm trying to use clojurescript to set the text for 5 seperate boxes (divs), each with an id of box1, box2, etc, with a 1 second delay between setting the text for each one
18:50currentBhttps://gist.github.com/1163853
18:50currentBanyone know what's wrong with that?
18:50tufflaxok, hiredman thanks... what was that about #' and macros? :p
18:51tufflaxoh, i see, (#'m) does not work when m's a macro
18:52tufflaxfor some reason i don't understand :P
18:52amalloy&(#'and true false)
18:52lazybot⇒ true
18:52amalloy^ best joke ever
18:52hiredmantufflax: that actually has nothing to do with the difference between #'foo and foo
18:53tufflaxsorry, what?
18:53hiredmantype m in the repl, then type #'m
18:53hiredman(assuming m is the name you gave your macro)
18:53amalloycurrentB: well, you use delay instead of x in your multiplication? can't really tell if that's on purpse
18:55tufflaxok... but I didn't gain any understanding :p
18:55hiredmanm threw an exception and #'m didn't
18:55tufflaxyes
18:55hiredman"can't take the value of a macro" or similar
18:55tufflaxyes
18:56hiredmanthat and the demo with the foo and bar defs should show you the difference
18:56hiredmanif not, spend some time thinking about it and fiddle with it some more
18:56tufflaxok i will ;)
18:56tufflaxthanks
19:08eskatremhello, can I know on what version 4clojure.com is running?
19:10currentBok I actually got something working, but it seems kind of ugly, is this acceptable? https://gist.github.com/1163881
19:11currentBor does anyone know any alternative way to accomplish this
19:14ibdknoxcurrentB: one thing that makes it at least a little easier to read
19:14ibdknoxis to change it from .getElement to goog.dom/getElement
19:15ibdknoxand goog.dom/setTextContent
19:16ibdknoxideally you'd probably alias that ns as well
19:16ibdknoxto dom or something
19:16currentBk thanks. using the incrementor is a necessary evil though?
19:17ibdknoxif you want it to only execute 6 times, I'm not sure how else you could do it
19:17ibdknoxbut I'm not an expert on the goog.* APIs yet
19:17currentBcool thanks a ton!
19:21michaelr525joegallo: hey joe, are you still here?
19:23michaelr525joegallo: maybe I should go to sleep and think about whether I what I did was the right thing to do but: I used try-try-again in two functions where one cals the other and it seems that the inner one affects the sleep time of the outer
19:24joegallohuh... that would be super bad
19:25michaelr525what I did?
19:25joegallono, if they affected each other that way
19:25michaelr525ah
19:26joegallohow sure are you that that's what you're seeing?
19:26michaelr525not 100%, I have to go to sleep. I will check it again tomorrow and tell yout
19:26michaelr525not 100%, I have to go to sleep. I will check it again tomorrow and tell yout
19:27joegallookay.
19:34amalloyeskatrem: www.4clojure.com/about/version
19:34eskatremOK, it's running on version 1.0
19:35amalloyof what?
19:35eskatremfor one problem my code produces the correct result on my machine (clojure 1.2) but fails the unit tests on the website version
19:36amalloyhttps://github.com/dbyrne/4clojure/blob/develop/project.clj
19:36amalloyclearly clojure 1.2.1
19:39eskatremright...
19:47amalloyeskatrem: are you using (case)? for reasons that are complicated, that throws exceptions on 4clojure
19:48eskatremamalloy: not at all
19:48eskatremhttps://gist.github.com/1163944
19:49eskatremthat's my code for problem "reverse interleave"
19:50eskatremfor some reason with my clojure box running on clojure 1.2.0 it produces the result I expect but it fails on the website
19:52amalloyeskatrem: when i try it in my repl, you return the wrong ordering for the first input
19:53dnolenhmm
19:53dnolenanybody using aliased keywords?
19:54dnolen,(require '[clojure.string :as string])
19:54clojurebotnil
19:54amalloydnolen: i can barely remember the syntax
19:54dnolen,(= :string/foo :clojure.string/foo)
19:54clojurebotfalse
19:54dnolenis that right?
19:54amalloy,::string/test
19:54clojurebot:clojure.string/test
19:54dnolenah
19:54dnolenthank you
19:55amalloydnolen: what for, out of curiosity?
19:55dnolenamalloy: match stuff, I'm learning towards multimethods, plain-maps, and namespace keyword as extension points.
19:55dnolenkeeps things dynamic, and avoid the hassles of deftype for users.
19:56dnolenlearning -> leaning.
19:56eskatremamalloy: did I do something bad? 4clojure.com is down again
19:57amalloywhat the hell. jetty is supposed to be more resilient than this
19:59amalloyeskatrem: i don't know how it could be your fault. the last error message in the logs was an hour ago
19:59amalloyand it was clearly working until recently
19:59eskatremamalloy: if it was my fault, the website would really suck to let a noob like me hack it
20:00amalloyi don't even know how to debug that. "Jetty terminates java process without printing any error messages or leaving a segfault or anything"
20:07choffsteinHey all! I just found cemerick's awesome post about continuous integration with hudson and I was wondering if anyone knew if there had been any progress of integrating jenkins / hudson with leiningen
20:08eskatremanyway, is there a reason why my code behaves differently whether the input is a list or a vector?
20:09hiredmaneskatrem: I suggest you look through your code, find the function you call where it behaves differently, and read the doc string
20:09tufflaxHm, hiredman I thought a bit about that macro business, and I don't understand how I'm supposed to know why or how (#'m and-two args) works... :P And I don't see how that foo and bar example is supposed to help
20:10eskatremhiredman: will do!
20:10hiredmantufflax: as I said, the args thing has nothing to do with it, and you should ignore it, just type m and #'m at the repl, don't even try to call them as functions
20:10hiredmanchoffstein: there is a shell task that works fine for lein builds
20:11choffsteinhiredman: Really? Any idea where I can find it?
20:11hiredmanchoffstein: create a new build, select the one that has "shell" in the name
20:12hiredmanmay actually be called Build a free-style software project
20:13choffsteinI'll check that out. Thanks!
20:15tufflaxhiredman hm, but I said "(#'m) does not work when m's a macro" and you said "that actually has nothing to do with the difference between #'foo and foo". But the reason it did not work seems to be that the (#'m) call, for some reason, expects 2 mysterious arguments. I don't know what you want me to see by typing m and #'m :p
20:15dnolenhierarchies when there are no types involved is a beautiful, beautiful thing.
20:19hiredmantufflax: we were talking about the difference between foo and #'foo, which has nothing to do with the implicit argumets macros take
20:28tufflaxhiredman: At first I was talking about the difference between (foo) and (#'foo) when foo is a function. Then I amalloy said that there is a difference between the two when foo is a macro, and I wondered what it was. And it seems to me that the difference is those implicit arguments, or something. But now you say I shouldn't care about them. But that was part of my question from the beginning.
20:30hiredmanthe difference between (foo) and #'foo is the difference between foo and #'foo
20:31hiredmanthe macro stuff you trying to sidetrack onto is unrelated
20:31hiredmanyou are
20:32tufflaxdid you mean "the difference between (foo) and (#'foo)" just now?
20:32hiredmanyes
20:33tufflaxI know that foo evaluates to the value of foo, and #'foo is the var, but how the evaluator handles foo and #'foo when they are being called is something different, no?
20:34hiredmanyour confusion of the macro differences with the differences between foo and #'foo is largely a result of not understanding what happens in the two cases of 1) (m) and 2) (#'m) when m is a macro, understanding the difference between foo and #'foo will leave you about one hop away from understanding #2
20:34amalloytufflax: try looking up how clojure.lang.Var implements IFn.invoke
20:38hiredmantufflax: so given that #'foo is a var, how come when you call it runs a fn?
20:38tufflaxinvoke calls deref
20:38tufflax...first
20:39hiredman,and
20:39clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0)>
20:39hiredman,(deref #'and)
20:39clojurebot#<core$and clojure.core$and@a6eee5>
20:40hiredman,(type (deref #'and))
20:40clojurebotclojure.core$and
20:40hiredman,(instance? clojure.lang.IFn (deref #'and))
20:40clojurebottrue
20:40tufflax,(ifn? and)
20:40clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0)>
20:41tufflaxoh, right
20:41hiredman,(->> #'and deref class .getMethods (map bean) (filter #(= "invoke" (:name %))))
20:41clojurebot({:genericReturnType java.lang.Object, :declaringClass clojure.core$and, :typeParameters #<TypeVariable[] [Ljava.lang.reflect.TypeVariable;@c99f45>, :class java.lang.reflect.Method, :synthetic false, ...} {:genericReturnType java.lang.Object, :declaringClass clojure.core$and, :typeParameters #<TypeVariable[] [Ljava.lang.reflect.TypeVariable;@f78e4b>, :class java.lang.reflect.Method, :synthetic fal...
20:44hiredman,(->> #'and deref class .getDeclaredMethods (map bean) (filter #(= "invoke" (:name %))) (map #(select-keys % [:name :parameterTypes])) (map #(update-in % [:parameterTypes] count))))
20:44clojurebot({:parameterTypes 3, :name "invoke"} {:parameterTypes 2, :name "invoke"})
20:45hiredman,(->> #'and deref class .getDeclaredMethods (map bean) (filter #(or (= (:name %) "doInvoke") (= "invoke" (:name %)))) (map #(select-keys % [:name :parameterTypes])) (map #(update-in % [:parameterTypes] count))))
20:45clojurebot({:parameterTypes 4, :name "doInvoke"} {:parameterTypes 3, :name "invoke"} {:parameterTypes 2, :name "invoke"})
20:56sridcould anyone point me to open-source clojure web apps with much eye candy? (I want something to 'demo' as a clojure web app for an internal project)
20:56srid(ideally, it would be something like one of those node knockout entries)
20:59ibdknoxthe eye candy would have nothing to do with Clojure though..
20:59ibdknoxlol
20:59sridtrue, eye candy is merely a tool of persuasion :-)
21:01amalloywhat about the recent pacman port to cljs?
21:01ibdknoxwebnoir is opensource
21:02currentBwhat's the normal way to call swap! with a function such as drop that takes the collection as the second arg?
21:02currentBor what's the workaround for it, rather
21:03amalloyjust give it a different function
21:03amalloy#(drop 3 %)
21:03currentBactually yeah nvm stupid question
21:03currentBthanks
21:03amalloy(partial drop 3)
21:03sridamalloy: that's static js (compiled from clojurescript), and doesn't demonstrate clojure running on JVM as such.
21:03amalloysrid: fun fact: you didn't ask for it to demonstrate clojure on the jvm
21:04sridibdknox: actually i am using the noir default template at the moment, but looking for a demo app with real functionality.
21:08ibdknoxsrid: typewire.io is all clojure
21:08ibdknoxbut not oss
21:11ibdknoxactually
21:11ibdknoxsrid: why not do clojure atlas?
21:11ibdknoxsrid: http://www.clojureatlas.com/
21:11sridby 'do' you mean reimplement clojureatlas? (i assume it is not osss)
21:12ibdknoxI meant show it
21:12ibdknox4clojure, clojuredocs
21:12sridhmm. here's the context -- i want something that I can 'push' the cloud ... in order to demonstrate my clojure plugin for http://activestate.com/stackato
21:13srid*to the cloud
21:14tufflaxhiredman ok, so, (deref #'and) is a function that takes 2, 3 or 4 args. And that is somehow different from just typing and (this is where most of my current confusion stems from). I know that macros have like :macro true in their meta, and that they are a (kind of) function(?) but I don't know the any details of how that works.
21:14srid4clojure seems interesting, i'll try to get it working first
21:17tufflaxMaybe that is enough about that for one day. Thank you, hiredman. Maybe some day I'll dig deeper :)
22:06mudgehey, there are several clojure pattern matching libraries, anybody know if any of them are planned to be added to clojure.contrib ?
22:53dnolenmudge: I proposed mine, but haven't heard anything.
23:15sridinteresting, so defining a map like {:foo 2 :bar 3} doesn't allow me to use the keys as string when needed (eg: when constructing query urls). (str :foo) => ":foo" ... not "foo" as I'd expect when adding it to the final UR.
23:17jeremyheiler,(name :foo)
23:17clojurebot"foo"
23:19jeremyheilersrid: just use the name function
23:27iceyare there any screencasts of people doing heavy refactoring of clojure code?
23:28iceyor any refactoring at all :) (all the screencasts i've seen feature people who Get It Right the First Time)
23:29sridthat would be useful to me as well; for non-screencasts, see http://codereview.stackexchange.com/questions/tagged/clojure
23:30iceysrid: i hadn't seen this stackexchange before; thanks!
23:31sridah. also checkout - http://stackoverflow.com/questions/tagged/clojure?sort=votes
23:31sridcodereview seems to be a new site. i hope it becomes awesome.
23:32jlivideo seems like a weird format for that
23:33iceysrid: the biggest thing for me is *how* people go about refactoring their code... right now I feel really clumsy when hacking away at stuff I wrote weeks ago, and it would be interesting to see how people go about doing surgery on their software
23:34dnolenicey: I'm curious as to cases where you find your Clojure code needs "heavy refactoring".
23:34ibdknoxicey: amalloy has a nice post about refactoring clojure
23:34ibdknoxdnolen: I've been in cases where I've needed to do a fair amount of refactoring
23:35dnolenibdknox: what I mean is, what led up to that point?
23:35iceydnolen: it's just a case of learning the language. as I learn to be more functional with my approach I realize that I've done things in a suboptimal way
23:35ibdknoxdnolen: mostly just trying to get something done, and perhaps picking the wrong way to represent something initially
23:36ibdknoxdnolen: granted, it's nothing compared to what I've done in other languages
23:37iceyibdknox: by any chance do you have a link or some keywords i could google to find amalloy's post? is it on hubpages?
23:37ibdknoxhttp://amalloy.hubpages.com/hub/The-evolution-of-an-idea
23:37iceyibdknox: awesome, thanks
23:37ibdknoxicey: btw, in answer to your question the other day
23:38ibdknoxicey: it's something that would be neat to do, but the problem is that doing long polling forces a server choice
23:38ibdknoxicey: you'll need to be on top of netty to support any real number of users
23:39iceyibdknox: ahh, so a framework is the wrong level for that. thanks for thinking about it anyways :)
23:40ibdknoxicey: I'm not saying "no", just something that would have to be done deliberately and probably a bit down the road... though a proof of concept should be fairly trivial :D
23:40iceyclojure is the only jvm language that's been bearable for me; i'm still getting used to having all these options (i'm coming from c# and python mostly)
23:41jliI think when you're learning, refactoring is kind of silly. just rewrite it.
23:41jlimaybe that's wrong
23:41iceyjli: well, i'm always concerned about how well i'll be able to maintain a new piece of technology
23:42iceyjli: so i refactor where i can, and rewrite when i must
23:42ibdknoxicey: I used to the Microsoft PM for C# :)
23:42ibdknoxbe*
23:43technomancyicey: you can go through the git history of the peepcode screencast project; all the mistakes are in there =)
23:43technomancynot covered in the video of course
23:43jliibdknox: oh hey, I saw your cljs-watch project on github. I was actually kind of disappointed because I just got done doing my own :P
23:43jliwithout any fancy colorss
23:43ibdknoxhaha dude
23:43ibdknoxcolors ftw
23:43ibdknox;)
23:44jliit does show a diff though!
23:44ibdknoxa diff?
23:44iceyibdknox: hah! that's awesome. it's always nice to have other C# guys around
23:44jliand it uses inotify, though that's linux only
23:44iceytechnomancy: that's a great idea, thanks - I have the video too, so it might be good to compare and watch it again
23:45ibdknoxicey: it's my second favorite language these days :)
23:45ibdknoxjli: so it shows a diff of the generated JS?
23:45jliibdknox: no, of the source
23:46ibdknoxah
23:47iceyibdknox: yeah, i still do .net consulting, but there is so much great stuff on the JVM that I couldn't ignore it anymore.
23:47jlimeanwhile, I tried using inotify-java, but couldn't find jars or figure out how to build it. is there something about having to hook into C that makes it hard to package a jar?
23:48technomancyjli: yes, there are no widespread conventions on how to package native code alongside JVM bytecode
23:48technomancyfrom what I can tell Leiningen is the first tool that even attempts it
23:49jlitechnomancy: oh, what native code in is leiningen?
23:49jlitechnomancy: thanks for lein btw :)
23:49technomancythere's no native code in leiningen, but it has tools for helping you use libraries that include native components
23:49ibdknox_gah, my internet died
23:50ibdknox_jli: did you send a link
23:50jliibdknox_: for what?
23:50ibdknox_jli: is your watcher on github? :)
23:50jliibdknox_: oh, I didn't bother after I saw yours :P
23:50ibdknox_aw
23:51jliibdknox_: do you develop on linux?
23:51ibdknox_jli: mac mostly
23:51jliah okay
23:51ibdknox_jli: I try to build things agnostic to platform as much as I can
23:53iceyif anyone is bored: this all works fine, but am i doing anything stupid? https://gist.github.com/1164308
23:53jliibdknox_: I was thinking about submitting a patch optionally using inotify
23:53iceyi don't like the way i'm setting visits, but don't know a better way to do it
23:53ibdknoxjli: do it
23:53ibdknoxthough
23:53ibdknoxI'll probably clean cljs-watch up some and do it as a patch to clojurescript itself
23:54technomancyicey: include an :only clause with your :use calls
23:54iceydoes clojure have something like python's dir() available?
23:55ibdknoxicey: I'm pretty sure you shouldn't need to include the status and headers parts of the map
23:56technomancythis might be better for visits: (-> r :cookies (get "value") :value Integer/parseInt inc str)
23:56technomancyexcept you should be using a default value instead of try/catch
23:56iceyibdknox: ha, thanks - you're right
23:56ibdknoxyeah, I'd just use an if to set visits
23:56ibdknoxdon't do try/catch
23:57jliicey: you could use if-let for the referer
23:58ibdknoxicey: completely unrelated to clojure, but you shouldn't really use html labels in that context :)
23:58jli(if-let [referer (get ...)] [:div ..])
23:58ibdknoxdestructuring would help there too
23:59jlioh, and I know next to nothing about web development, but I would probably make the thing that returns html a function