#clojure logs

2010-07-20

00:05BahmanHi all!
00:08cais2002is this the correct and latest way to refer to clj-apache-http in leiningen? [com.twinql.clojure/clj-apache-http "2.0.2"]
00:09cais2002how do I link this to the source, e.g., is it the one on github? http://github.com/rnewman/clj-apache-http
00:11Apage43aleph is cool but has anyone done stuff with the client parts or the rest of netty in general?
00:31tomojApage43: http://github.com/neotyk/ahc-clj
00:31tomojdunno if it's any good
00:31Apage43just found it
00:32Apage43looks like it's abstracted even higher
00:32Apage43will be trying it out
00:34Apage43mostly i needed something i could point at a continuous http feed that wouldn't require keeping a thread around
00:34tomojthe clojure looks pretty ugly so I'm skeptical
00:34Apage43http.agent was sort of working, but i couldn't use a second http.agent from inside another one's handler, it would just block.
00:35Apage43if the handler waited for another agent to do anything, anyway
00:36Apage43I might just write something that only does what i need though, becuase ahc-clj is like, 5 levels of abstraction away from nio and that just feels clunky
00:47cais2002what's the difference between `~'abc and using abc directly in a macro definition?
00:49KirinDavecais2002: Try typing `~'abc and `abc on the repl.
00:51KirinDavecais2002: You can use ~'sym to capture variables.
01:29konrIs there another way to connect some arbitrary function to slots in QT besides proxying a function?
02:55LauJensenGood morning all
02:56konrHello
02:58cobol_expertgood evening
02:58cobol_expertwhat types of config files are normally used in clojure projects?
02:59cobol_expertxml or just clojure lists
03:00cobol_expertor maybe no particular preference
03:06LauJensencobol_expert: Ive seen a little bit of everything, though not a lot of xml. Regular configs where var=value\newline are supremely easy to parse, as are clojure datastructures
03:06cobol_expertokay, I'll stick with clojure lists
03:07cobol_experti think that's what emacs does with lisp
03:09tomojproject.clj is a good example I suppose
03:14LauJensentomoj: Too much work a simple config
03:14LauJensenA normal var=value, #comment file can be slurped in a single expression
03:14cobol_expertI would, but I need some structure
03:14LauJensenlike?
03:15cobol_expertlike xml
03:15cobol_expertactually, in clojure, it'll be a tree of structs
03:15LauJensen{:settings {:x 5 :y 10}}
03:15LauJensenvs
03:16LauJensen# settings
03:16LauJensenx=5
03:16LauJenseny=10
03:16cobol_expertfirst one
03:17LauJensenstill very easy to parse, using a combination of read-string and slurp I suppose
03:17Raynescobol_expert: I typically use a file containing a Clojure map for my configuration. I wrote a small library for that, even. http://github.com/Raynes/clj-config as far as I know, sexpbot is the only real project using it, so I can't promise awesomeness. Might be useful for you though.
03:17cobol_expertyeah, i don't think xml is the way to go
03:18tomojLauJensen: you're right, project.clj is a terrible example
03:18cobol_expertthanks Raynes, i'll take a look
03:20Raynescobol_expert: The idea is that the configuration is just Clojure data-structures. clj-config just abstracts over the reading and writing of those files and data structures, and then you can use the normal Clojure sequence functions for working with the configuration.
03:20RaynesClojure maps are liek teh awesomest configuration format. :)
03:20RaynesGoodnight, friends. <3
03:21LauJensenGoodnight old buddy
03:40dpritchettIs there a solid install guide for vimclojure 2.2 snapshot? I see that Meikel prefers gradle and doesn't want to handhold folks with the install but if there's anyone else who's willing that would help a lot. I'd be happy to reblog the advice for others, too.
03:44Apage43dpritchett: if you figure this out that'd be awesome
03:44Apage43i have been trying to beat vimclojure into submission for a while now
03:45Apage43when it's working i really love it but i haven't gotten it into a working state on my mac yet
03:45dpritchettI'm trying with leiningen and ubuntu, not much luck since I started with 2.2
03:46Apage43i always get the could not determine namespace error
03:47Apage43through lein or not
03:50dpritchettI see some guy claims to have fixed it with a patch to the jar here http://groups.google.com/group/vimclojure/browse_thread/thread/a717b33d63178abd/03cfd155ef4990e4
03:50dpritchettI'm trying to reproduce that but I don't really know how to point to his new jar yet
03:50dpritchettI'm messing around in /libs though
04:07dpritchetthm.. I've gotten to the point where I can invoke a repl with :call vimclojure#StartRepl()
04:07dpritchettbut my localleader (i.e. \sr) isn't responding
04:12cais2002,`~'abc
04:12clojurebotabc
04:12cais2002,`abc
04:12clojurebotsandbox/abc
04:15raek,::hello/foo
04:15clojurebot:hello-from-raek/foo
04:17tomojoh?
04:17tomoj,::hello/foo
04:17clojurebot:hello-from-raek/foo
04:17tomojyou find a security hole?
04:37bsteuberanyone using lein-javac with leiningen 1.2 ?
04:38cais2002,::hihi/foo
04:38clojurebotInvalid token: ::hihi/foo
04:38raek,(ns add-alias-to-black-list)
04:38clojurebotnil
04:39raek,(alias 'todo 'add-alias-to-black-list)
04:39clojurebotnil
04:39raek,::todo/x
04:39clojurebot:add-alias-to-black-list/x
04:39raekside effects!
05:17bartjhow do I revert back to a particular version of a CouchDB document ?
05:22tomojwrong channel
05:25bartjtomoj, sorry wrong window!
06:02LicenserGood Morning
06:10AWizzArdI have (def x 'clojure.java.io) and would like to call (x/reader "my/file") - how can I do this?
06:12tomojyou can't
06:12tomojbut you could do ((ns-resolve x 'reader) "my/file")
06:12AWizzArdyes, ns-resolve is it
06:13AWizzArdgood
06:14LicenserCant you require with As?
06:18AWizzArdLicenser: I don't know what is inside x
06:19AWizzArdI only know that the ns named by x will contain a specific symbol
06:21LicenserAh okay
06:21LicenserYou cacn make a macro for that ;)
06:22LicenserI think I get what you want, having a ns passed to a function and then using this ns as a root for some code in it right?
06:27LicenserThis is a classic: college in a telco 'I'm not sure who is responsible for the odor'
06:27AWizzArdI want a web server that, depending on which site it is running (locally in my dev environment, at a customer, etc), requires a NS containing the right fns and routes.
06:36hoeckAWizzard: just require the correct namespace at app startup-time?
06:38LicenserI think that won't work with cmpilation
06:49AWizzArdhoeck: only later, after the config file has been loaded I will know the namespace.
06:49AWizzArdSo, the app is already partially running.
06:50AWizzArdAnyway, now I've got a working solution, via ns-resolve.
06:51hoeckbut you could still decide (after the initial config loading stage) which namespace to require
06:54LicenserNs intern and ns something else work too and quite well
06:54LicenserI used them for a stupid template engine
07:12AWizzArdhoeck: yes, I load the config and then decide which NS I want to require. And this then happens.
07:12AWizzArdAnd in this NS I access a specific var then, and can start the server.
07:54JorejiHey guys, is it possible to establish a new binding for a variable from a different namespace using a macro?
07:55JorejiI have a function in namespace B, which uses a globally defined variable. I want to rebind that variable within namespace A.
08:07cemerickJoreji: see binding
08:09cemerickJoreji: But, what are you doing, exactly? It sounds like you're using vars as variables (which is decidedly wrong).
08:14Jorejicemerick: I have a (def *some-function* (fn [] (throw. (Exception. "Not inside context")))) which binds a function inside ns B. Futhermore I have a macro inside ns B which binds *some-function* using: (binding [*some-function* (fn [] the-context)]). Now I want to use the macro inside ns A in order to establish the context and bind *some-function* to return the context. However, that does not work (I get the initial function, not the ...
08:14Joreji... newly bound one).
08:16cemerickJoreji: binding does not change the root value of the var -- the bound value is only effective within the lexical scope of the binding form, and thread-local.
08:17JorejiYes, which is why I use a macro which expands into code which 1.) establishes the new binding for *some-function* and 2.) calls the body of the macro within the (binding [...]) form
08:18JorejiFrom what I understand, within the (binding) body the new binding should be bound, no?
08:18cemerickyes
08:18cemerickJoreji: if you can paste code, that'd be helpful
08:25Jorejicemerick: I've already tried a simplified example, but there it works. There must be something wrong with my code I fear.
08:26Jorejicemerick: If I can nail it down, I'll come back - thanks for the help anyway :)
08:37Jorejicemerick: Figured it out. The binding body returned a lazy sequence. Once that was evaluated inside the repl, the old binding was established. A doall did the trick.
08:37cemerickJoreji: yup, that'll happen ;-)
08:50cemerickIs it expected that getting an iterator from a lazy seq will force the seq? That doesn't seem right at all.
08:54unfo-nope, doesn't sound right, since you could loop an infinite seq
08:54unfo-s/loop/iterate/
08:54sexpbotnope, doesn't sound right, since you could iterate an infinite seq
08:55cemerickunfo-: except...
08:55cemerick,(.iterator (for [x (range 5)] (do (println x) x)))
08:55clojurebot#<SeqIterator clojure.lang.SeqIterator@93c2>
08:55clojurebot0 1 2 3 4
08:56unfo-do note that the REPL and actual clj code sometimes act differently
08:56unfo-because the REPL wants to print stuff for you
08:56cemerickunfo-: The same thing happens if I simply def the iterator.
08:56unfo-for example when I once DID want a lazy list iterated and I tried it in REPL it worked - but in my clj prog it didn't
08:57unfo-but my clojure-fu is not strong enough to tell you what's going wrong with that line :)
08:57unfo-i've not done any in 6 months or so
09:05cemerickit actually has nothing to do with .iterator
09:05cemerick,(-> (for [x (range 5)] (do (println x) x)) seq boolean)
09:05clojurebottrue
09:05clojurebot0 1 2 3 4
09:08tomojhuh
09:08tomojas soon as you call seq, the whole thing is forced?
09:08tomojthat doesn't seem right either...
09:08cemerickno, something's very wrong
09:08tomojohhh
09:08tomojwait a minute
09:08tomojaha
09:08cemerickdo tell :-)
09:08tomojtry (-> (for [x (range 100)] (do (println x) x)) seq boolean)
09:09tomojand note where it stops
09:09cemerickah, the chunking
09:09cemerickhrm
09:10cemerickthat's a bit of a problem though, insofar as I'm attempting to use for to lazily load data from disk :-)
09:11tomojwon't for defer to the chunkiness of whatever's in the binding form?
09:12tomoj,(-> (for [x (take 100 (iterate inc 0))] (do (println x) x)) seq boolean)
09:12clojurebottrue
09:12clojurebot0
09:13cemericktomoj: Good catch. http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ for more.
09:21cemericktomoj: a gnarly way to force one-at-a-time:
09:21cemerick,(-> (for [x (->> [1 2 3] (map list) (apply concat))] (do (println x) x)) seq boolean)
09:21clojurebottrue
09:21clojurebot1
09:36Chousukecemerick: would that work with just mapcat? :)
10:04samldoes clojure come with http library?
10:04cemerickChousuke: definitely -- that was mostly the result of a little flailing around. :-/
10:43nDuffsaml, not sure about "come with", but there are lots of 3rd-party frameworks available; see for instance Compojure and Ring, both listed at http://clojure.org/libraries
11:26yesudeepDoes leiningen work with msys on Windows?
11:28yesudeepAlso, I'd appreciate if one of the operators told me why my nickname yesudeep` is banned in here.
11:30cemerickyesudeep: we don't have an op here, unfortunately. The owner of the channel has been awol for a while, and IIRC, the admins haven't responded helpfully to making rhickey (or someone!) owner.
11:35maravillasyesudeep: i haven't been able to get lein working in msys...msys is missing the dirtools util
11:35maravillaswhich the lein script references
11:35Chousukeyesudeep: it might not be banned; you just need to be identified to be able to chat here
11:36yesudeepah
11:36Chousukeyesudeep: unfortunately irc clients don't differentiate between banning and registration-requirements :/
11:38defncemerick: really? ive had good experiences with the ops
11:38cemerickdefn: I've not been involved in that, but that's what I remember hearing.
11:38defnwell it would make sense they weren't receptive
11:39defnbecause jcowan was online 12 hours ago
11:39defn:)
11:39cemerickum, who? ;-)
11:39defnthe channel owner
11:41cemericks/with/of
11:44defncemerick: keep it that way. it's a waste of time :)
11:46defnhttp://pages.cs.wisc.edu/~remzi/Classes/537/Fall2009/Projects/ -- which of these would be the most fun to port/redo in clojure?
11:46defnobviously rolling your own malloc is kind of out of the picture
11:48arkhis it bad form to bind a symbol to itself in a loop? Trumped up example follows:
11:49arkh(def x 10)
11:49arkh(loop [y 0, x x]
11:49arkh (if (zero? x)
11:49arkh y
11:49arkh (recur (+ 1 y) (dec x))))
11:49defnyeah that doesnt look right
11:49arkhI appreciate your honesty : )
11:50defn:)
11:50tomojI think I've done that before
11:50defnyeah but it's a bit ugly
11:50defnthere are better ways of going about it
11:50cemerickarkh: that's fine IMO, especially if x is semantically the same
11:51cemerickarkh: though do use a pastebin next time :-)
11:51defnit's fine, but ugly
11:51defnIMHO
11:51tomojwhat's a better way? come up with a new name for the loop var?
11:51cemerickdefn: you'd name a new binding just to avoid quashing an old one?
11:52defnyeah i guess i would
11:52defn:\
11:52tomojI guess the shadowing could be confusing in some places
11:52arkhwhat I want to do is take a list of things and create a new list of those things in random order. I grab a random element from the list, append to the new list, and take two subvec of the old list to rebind to that
11:52arkhwill do pastebin next time
11:54arkhi.e., take two subvec's with the randomly chosen element excluded, thereby removing it from further use
11:55defnhttp://dosync.posterous.com/clojure-nodejs-and-why-messaging-can-be-lame
11:55defncould someone explain to me why in his code he didn't use a ref around the atom?
11:55tomojarkh: and then what, recur?
11:56tomojoh, I think I see
11:56arkhtomoj: yes, then recur. Each time one element is removed until nothing remains of the old list and the new list has elements appended in random order
11:57cemerickdefn: Why would he need a ref around the atom?
11:57tomojwouldn't you have to concat the two subvecs?
11:57defncemerick: cemerick oh god sorry
11:58defnim crazy
12:01arkhtomoj: I am using concat with the two subvecs - (doall (concat (subvec iplist 0 r) (subvec iplist (inc r) (count iplist))))
12:01tomojcool
12:01arkhtomoj: with 'r' being that randomly chosen element
12:02arkhtomoj: (let [r (rand-int (count iplist))] ... )
12:02tomojwhat's the doall for?
12:03arkhconcat produces a lazy sequence (I think) and I need to whole thing to happen
12:03raekI wish things like this happened where I lived http://strangeloop2010.com/speakers
12:04tomojwhy do you need the whole thing to happen, though?
12:04arkhso that recur can provide the entire list back to the loop for the next iteration
12:05arkhit's possible I have that wrong ... still debugging and, more importantly, still learning clojure
12:05arkhraek: I second that :/
12:06raekalmost every talk is about something I have a deep interest in
12:06raekeven the klein bottle guy will be there!
12:08tomojarkh: once you get it working, try removing the doall
12:08tomojI bet you don't need it
12:08tomojlazy is good :)
12:13AWizzArdAny Ant expert here who knows 'zipgroupfileset' pretty good? I have a folder containing five .jar files and a few .txt files. I say excludes="*.txt" and it works pretty good. It unpacks the contents of the .jar into my own one.
12:13AWizzArdBut how can I exclude files that are *inside* those 5 jars that I want to überjar into my jar?
12:15Licenserhmm has anyone played with swing here?
12:17arkhtomoj: will do/try - thanks
12:29cemerickLicenser: played, used, loved, hated, and saddened by, yes.
12:29Licensercemerick: because I've some issues with the REPL, it makes the swing app locking untill I press return a dozent times, and some output isn't printed either. Did you encounter similar problems?
12:30cemerickLicenser: which app, which REPL, etc?
12:30Licensermy app, and the slime/swank repl of emacs
12:31cemerickcan't help there -- sounds like you're running REPL stuff on the event thread though
12:31LicenserI know you can#t see output in the usual one but only in the inferior lisp buffer but even there it didn't help
12:31Licenser*nods* okay
12:32Licenserbut thanks cemerick
12:32cemerickFWIW :-)
12:32cemerickany kind of UI hanging is always the execution of non-UI-related stuff on the event thread.
12:33Licenserheh
12:56slyrushuh. I didn't think this was going to be the case at first, but an immutable approach to a graph library really makes a lot of sense. a functional approach really simplifies some code.
12:57tomojhow'd you do it?
12:57slyrus(defn remove-connected-component [g start] (let [neighbors (neighbors g start)] (reduce remove-connected-component (remove-node g start) neighbors)))
12:57tomojI once tried translating that paper on inductive graphs into clojure but failed
12:58slyrustomoj: thanks for that pointer. i'll check it out.
12:59slyrustomoj: http://github.com/slyrus/shortcut if you want to check it out. very much both a work in progress and a learning-clojure exercise for me, but it's been fun.
13:00cemerickslyrus: you've seen c.c.graph?
13:00slyruscemerick: directed graphs only
13:00cemerickFar from complete, but it's a damn nice start
13:00cemericksure
13:17slyrusoh, that's nice. with a simple closure for :neighbors I can map c.c.graph on top of my graph stuff.
13:22slyruscemerick: yeah, c.c.graph is pretty nice. I just didn't understand what to do with it when I first started this project. hrm...
13:26defnhow do i include the 1.2.0 beta in leiningen?
13:26defn1.2.0-beta1?
13:28defnis the hamiltonian cycle directed?
13:28defnhmm
13:32rjevansYeah, I use 1.2.0-beta1 in my project.clj
13:32defnk thanks
13:39cemerickslyrus: yeah, it's a generalized model AFAIU
13:41Ploujso what does dynamic typing mean in clojure as it compares to the typing in Jav?
13:41PloujJava*
13:42chouserPlouj: in Java you have to declare the type of every local, every function argument, every function return value.
13:43chouserin clojure you aren't required to declare any of those -- they're discovered, if needed, at runtime.
13:46cemerickgah, not being able to reliably load classes with the "same" name, just different cases, is quite the irritant when you're generating function names and AOT'ing the results.
14:04rubydiamondShould I buy Kindle DX?
14:06nDuffI'm reasonably happy with mine, and its PDF reader is great for Manning's MEAPs (ie. Joy of Clojure). The only complaint I have is lack of ePub support; if you want to have the most available choice in terms of from whom you buy your ebooks, that's a showstopper.
14:14AWizzArdLittle challenge here. I compiled a project into a folder build/ and when I do java -cp "build/;100-jars" my.namespace.server then it works fine. Then I put all .class and .clj files I have in build into a .jar file. I can still run it with -cp "my.jar;100-other-jars" my.namespace.server
14:15cemerickI don't think I have enough juice to do it, but I hope my tweet isn't what kicked those off. :-(
14:15AWizzArdBut, when I now remove my.jar from the cp and do java -cp "100-jars" -jar my.jar then it tells me that it can not find my.namespace.server
14:15AWizzArdAny ideas? There *is* an entry in the Manifest.
14:15hiredman-jar and -cp cannot be used together
14:16hiredmanjava helpfully doesn't print an error messsage when you try to use both
14:18AWizzArdwow
14:20AWizzArdhiredman: so if I want to run it from a jar I better put *everything* I need inside that?
14:21hiredmanyou can specify a classpath in the jar's manifest somehow
14:22hiredmanyou can also use -cp and like you did at first
14:25defnis there a way to (import org.foo.*)
14:26chouserdefn: no
14:36AWizzArdhiredman: okay, thanks for this tip. I would have continued forever to try to include more jars on the CP, while also specifying the -jar option. Now I build an überjar and that works fine. *thumbs up*
15:09raeki'm curious about this Aleph lib
15:09raekanyone here using it?
15:10Licensernot me sadly
15:11cemerickI'm afraid I don't grok what's so awesome about node.js, aleph, et al. :-/
15:13Licensercemerick: I don't know aobut node.js, didn't found it that awsome but aleph is written in clojure :P
15:15kotarak... which is a huge selling point.
15:16raekso, what makes Aleph stand out? it is aynchronous?
15:17raek(respond!) ?
15:17Licenserraek: it's written in clojure
15:17kotarakclojurebot: written in clojure is a huge selling point
15:17clojurebotYou don't have to tell me twice.
15:17cemerickraek: it's like node.js, but has a sane language and access to a huge set of libraries
15:17Licensersorry I really don't know much about it, I like the idea of a lightwight multi thread webserver thingy for clojure apps since you can likely do nice things with it when it comes to sering many paralell reuqests
15:17cemerickI'm just not a web guy fundamentally. Eventing and such through port 80 today doesn't excite me like it did over any other random port when I was fiddling with sockets for the first time. But, have fun if it's your bag. :-)
15:18Licensercemerick: perhaps you are? ^^
15:18cemerickgah!! :-P
15:19cemerick"Back in the late 90's, we used to wire up network services the good old fashioned way, sonny boy!" Oy.
15:20hiredmanthe old fashion way to wire things up is with wire
15:20cemericktoken ring, fer shure.
15:20raekI've done a project in compojure 0.3.x previously and I'm thinking about looking into the alternatives that have emerged
15:20kotarakAt least the metaphor was intacrt.
15:21raekI mean, there seems to be a lot of ring-like web servers: compojure, aleph, moustache, etc
15:21raek(please correct me if I'm missing anything)
15:22chousercompojure and moustache are built on top of ring
15:22raekok, so ring is not only a spec for what the request and respond maps should look like?
15:22kotarakAre there alternatives to autodoc, which are easier to set up?
15:23raekis it the case that ring-based web frameworks are built on servlets and aleph not?
15:27cemerickThe servlet 3.0 spec provides for eventing IIRC. Ring-based apps don't *need* to be deployed as servlets, but that's certainly the easiest path.
15:29timcharperAny counterclockwise users here?
15:31timcharperI'm trying to test it out on a project, but it seems that you can only import maven projects?
15:31timcharperWe're using leiningen to manage dependencies, not maven
15:31cemerickonly intellij has any support for lein AFAIK
15:33timcharperWhy can't I just open an existing closure project? I don't understand why this is an impediment :-(
15:34timcharper^closure^Clojure
15:35cemericktimcharper: There's no such thing as a "clojure project", independent of the various development environments.
15:36cemerickYou can try opening the project in question from the lein-generated pom. Last I knew, that generated pom wasn't sufficient for building the project in question though (only used for deploying to clojars?)
15:37cemerickOtherwise, ccw and enclojure are both good environments, and both eclipse and netbeans have good maven support.
15:46timcharpertrying the lein generated pom wrote, thank you :-)
15:46timcharperroute
15:49jfieldsis there anyway to do this? (update-in {:x [1 2 3 4]} [:x] -> last vector)
15:50jfieldsthe best I could come up with was: (update-in {:x [1 2 3 4]} [:x] -> last vector)
15:50jfieldsbut, I'd prefer to do it without an anonymous function if possible.
15:50jfieldssorry user=> (update-in {:x [1 2 3 4]} [:x] #(-> % last vector))
15:50jfields{:x [4]}
15:50jfields is the best I could come up with.
15:51kotarak,(update-in {:x [1 2 3 4]} [:x] (comp vector peek))
15:51clojurebot{:x [4]}
15:52jfieldscool, thanks
15:52kotarakjfields: although this is only marginally different to #(-> % peek vector)
15:53jfieldskotarak, cool, thanks.
15:53jfieldsI prefer the comp solution. I was trying to use it without the parens, and my value was the fn returned by comp :)
16:02hiredman,((comp (partial apply update-in) reverse list) (comp vector peek) [:x] {:x [1 2 3 4]})
16:02clojurebot{:x [4]}
16:03hiredman,((comp (partial apply update-in (comp vector peek)) reverse list) [:x] {:x [1 2 3 4]})
16:03clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap
16:03hiredmanbleh
16:03Chousukepointlessness strikes again
16:03hiredman,((partial (comp (partial apply update-in) reverse list) (comp vector peek)) [:x] {:x [1 2 3 4]})
16:03clojurebot{:x [4]}
16:04cemerickChousuke: it actually saved me in a big way this morning. I think I've finally come to see the zen between point-free and #().
16:04Chousukeheh
16:05Chousukeif there's more than one comp or partial involved, I tend to use #() or fn.
16:43TakeVWhat is the purpose of the binding aspect in Conjure?
16:43anarsdoes anyone know whether the clojure clr project is a "long term" project, or just a hobby project run by some loyal devs? :)
16:46arkhTakeV: it might be safe to say that it's usually for lexically scoped storage
16:46TakeVarkh: I'm not exactly sure what you mean by "lexically scoped storage".
16:48arkhTakeV: it's the ability to associate something with a symbol but only have that association exist within a "block" of code, or only as the arguments of a function
16:49TakeVSo, not global storage then.
16:49arkhTakeV: clojure doesn't have 'variables' like an imperative language, so binding also helps keep things functional
16:49arkhTakeV: global storage is achieved with def
16:50arkhTakeV: when you want to bind something globally, use def. When you want to bind something locally, there are other ways one can and should perform the binding
16:50TakeVLike let?
16:50arkhTakeV: yes. Also loop, for, etc.
16:51arkhTakeV: let is a special form used by other macros like loop, for and others
16:52TakeVI think I'm a bit confused about how the Conjure system works. User input and requests are handled by the controller, which can affect the model and the view. So where does the binding part come in?
16:56hiredmanbinding aspect?
16:56arkhTakeV: the MVC model doesn't map to Clojure well (afaik ... I'm not a clojure expert). Think of what you want to do as a function. It'll take input and return the last form evaluated. A form is the smallest chunk of code that can be evaluated by clojure. Getting back to the 'function', bindings allow you to temporarily assign values to symbols or return them if it's the last form evaluated.
16:57arkhgod I hope I didn't mangle that too poorly
16:57hiredmanbinding is some what overloaded so it helps to be specific, binding is what let does lexically, but confusingly clojure has a `binding` macro that does binding dynamically
16:57hiredmanand conjure may have it's own thing that it calls "binding"
17:11arkhIs there a good way to bail out of execution early? Something like a System.exit(0) ? I'm running code from a .clj file and want to do this for testing purposes ... and I don't know how to add/remove comments en masse with my editor
17:12arohnerarkh: you can always call System.exit directly
17:12arohner(System/exit 0)
17:13rhudsonanars: As I understand it, the big push in Clojure 1.3 will be "Clojure-in-Clojure" -- rewriting a lot of the Java implementation in Clojure
17:13rhudsonUntil that's done, i suspect there won't be a lot of work on CLR or other target hosts
17:15arkharohner: thank you
17:23scodeWhat's an idiomatic way to get a BigInteger from a Ratio?
17:23scodebigIntegerValue in 1.2, but that's specific to Ratio I believe.
17:23scodeI ended up writing a (to-bigint) that special-cased Ratio, which doesn't feel very nice.
17:24chouser,(bigint 5/3)
17:24clojurebot1
17:24chouser,(bigint 6/3)
17:24clojurebot2
17:24chouserlike that?
17:24scodechouser: No, it gets truncated.
17:24scodeAh
17:25scodeSorry, not on master/1.2.
17:25scodeBut on 1.1
17:25chouserit appears to call .bigIntegerValue when it's a ratio
17:25chouserah
17:25scodeBut bigint sounds nice; I'll chalk 1.1 behavior up to a bug. :)
17:25scodeThanks.
17:26raekis autopromotion still in use in 1.2?
17:26scodeThe fix seems to be committed as 8e916164ca3a57e5ce924ed153fe435356f8d4a0
17:28scode(and the bug was http://www.assembla.com/spaces/clojure/tickets/290)
17:31Raynes,(clojure-version)
17:31clojurebot"1.2.0-master-SNAPSHOT"
17:32Raynes-> (bigint 6/3)
17:32sexpbot=> 2
17:53neotykclojurebot: seen zahardzhan
17:53clojurebotno, I have not seen zahardzhan
18:41jacortinashello
18:41jacortinasquick question for anyone
18:42jacortinasif the reader macro "^" for metadata is deprecated
18:42jacortinaswhat's the syntax now for declaring metadata on a function using defn?
18:45lozh^ is the new syntax #^ was the old
18:45raek,(doc defn)
18:45clojurebot"([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata"
18:46raekyou can also specify metadata with that attr-map
18:46raek(defn foo "Does neat stuff" {:some "metadata"} [x y] (+ x y))
18:47raekbut as lozh said, you can still use ^ syntax
18:48raek(defn ^{:some "metadata"} foo ...
18:48raekthe difference is that the former is evaluated during run-time and the latter during read-time
19:28bortrebcould you guys help out a clojure newbie? I want to see if my code is idomitically correct and also if you think this function is even usefull http://gist.github.com/483772
19:29bortrebI'm thinking about calling it mix. it's for combining algorithms that have complicated and different fun-time properties
19:29bortrebit runs all the functions in separate threads, and then returns the "fastest" result
19:29bortrebs/fun-time/run-time
19:30raek:)
19:32raekI usually write (ns #^{:doc "docstring", :author "Author"} namespace ...) as (ns namespace "docstring" {:author "Author"} ...)
19:33raek(makes indentation more pretty)
19:33bortreboh cool I didn't know that you could do that1
19:34raekfutures are faster to create than threads since futures uses a thread-pool
19:35raeki.e. lesser start-up cost
19:35bortrebah so my explicit thread version is rather niave then
19:36bortrebbut it still seems so sad to use an entire therad to just check whether the atom has changed :(
19:37raekcreating threads that way can still be useful
19:38raekis there any special reason you keep ::void in var?
19:40bortrebheh, no I could just put ::void directly in the atom
19:40bortrebfor some reason I thought you couldn't do that which is silly
19:40raekone can also create sentinel objects with (Object.)
19:41raek(namespaced keywords are perfectly fine too)
19:44bortrebAleph the game engine?
19:47raeknohttp://github.com/ztellman/aleph
19:47raeks/nohttp/http/
19:47sexpbothttp://github.com/ztellman/aleph
19:48raekthere seems to be a lot of software projects called aleph
19:48lancepantzdoes that come from somewhere?
19:48raekand also a programming language
19:48raekthe name?
19:49taliosAleph looks cool.
19:50Apage43aleph is cool but i'm waiting for a more useful async client library.
19:50raekit's the first letter of the phoenician alphabet, the ancestor of the amaric, arabic, hebrew and greek alphabtes
19:50bortrebaleph is a name for the tansfinite cardinal numbers; that's all I've ever heard it used for
19:51raekaleph <-> alpha, beth <-> beta, gimel <-> gamma, etcs
19:51lancepantzhmm
19:51bortreblike aleph-one is a "bigger" infinity than all the natural numbers, for example
19:52taliosApage43: tried http://clojars.org/ahc-clj - built ontop of the ning async client library?
19:52raekI like the concept of "bigger" infinities...
19:52taliosApage43: http://github.com/neotyk/ahc-clj
19:56bortrebis there a way to remove jars you've uploaded to clojars that were mistakes or is this impossible?
19:57lancepantzbortreb: i don't think so, let me know if you figure that out
20:29tomojcan you refer to the generated class in an ns which uses gen-class?
20:30tomoje.g. to construct an instance in -main
20:43tomojoh, seems you can if you :name it
21:03akhudekhey everyone, I have a code pattern for which I *think* maybe monads would be the correct solution
21:03akhudekhowever, the solution is not obvious to me
21:03akhudekI put an example here http://pastebin.com/eTGPD6vw
21:04akhudekessentially, I want to carry forward a state in the first arguement and first return value
21:04akhudekand otherwise have it behave like a let
21:04akhudekis this a macro job or would some clever monad work?
21:18mikemakhudek: it almost looks like you could just use -> or ->> except you have two return values from the first two functions
21:19akhudekyeah, that's the problem, those need to behave as in a normal let since they are often used later down the chain
21:19akhudekI'm trying to figure out if some combination of state-m and state-t might do it
22:37RaynesThat's weird. In Leiningen, when I do :dependencies [[org.clojure/clojure "[1.1.0,)"]], which should be an open-ended version range, it always tries to grab clojure-contrib-master-SNAPSHOT
22:38taliosclojure-contrib? weird.
22:40RaynesI mean, org.clojure/clojure-contrib
22:40RaynesI'm doing 30 things at once. :p
22:42taliosI guess for some reasons "master" evals to being newer than 1.1.0 - the master in their kinda sucks.
22:42taliosits like a classifer for the classifier
22:42taliosactualy, the classifier is after the version. hrm
22:43Raynestalios: I'd understand that if the -master-SNAPSHOT version actually existed, but apparently it doesn't.
22:43RaynesIt's trying to grab something that doesn't exist, even though I didn't tell it to do so.
22:43taliosI think it -used- to. I remember using -master sometime ago from one of the build boxes
22:43taliosmaybe its in your local repo
22:44RaynesIf it is, wouldn't it succeed in grabbing it?
22:44taliosit might be in the metadata, but no jar?
22:46RaynesI hate maven. ;(
22:46taliosbut maven is all goodness :)
22:46talios(that being said, we always feature maven-pain-of-the-week on the podcast) heh
22:47RaynesLuckily, it doesn't look like we need version ranges.
22:47RaynesIf you use the normal "soft" version requirement, but the project that uses the library requires a different version of the same thing, that version is preferred.
22:47RaynesI just noticed that.
22:52mmarczykRaynes: for some reason http://build.clojure.org/snapshots/org/clojure/clojure-contrib/maven-metadata.xml includes 1.2.0-master-SNAPSHOT
22:53Raynesmmarczyk: I still hate maven for being weird. :p
22:53mmarczyka bug in the build box setup I guess...
22:53mmarczyk:-)
22:53taliosthat release USED to exist.
22:54mmarczyktalios: oh? never noticed
22:54taliosRaynes: aww don't hate on the maven, clojure-maven-plugin is all goodness, apart from the XML bloatedness
22:54cemericktalios: how goes it, Mark? :-)
22:54mmarczykanyway, since it's not available on the repo, it shouldn't be mentioned in the metadata
22:54talioshey cemerick - goes good.
22:54Raynestalios: I see you've thoroughly drunk cemerick's kool-aid.
22:55cemericklol
22:55cemerickRaynes: talios is *my* dealer, no the other way 'round!
22:55cemerick;-)
22:55RaynesI only have taste buds for Leiningen.
22:55Raynes<3
22:56cemerickI'm just a zealot for tools that get the job done for me and are generally applicable. *shrug*
22:56cemericktalios: I was surprised to hear the gradle love on the last 'cast.
22:57RaynesI'm a zealot for tools that don't require I touch XML. :D
22:59RaynesMaybe once that polyglot maven crap is done baking. Maybe.
22:59cemerickFair enough. If your requirements were different, you'd probably think otherwise. :-)
23:00RaynesMaybe, but they aren't.
23:00cemerickSame here; if I had simpler needs across the board, I'd probably be all over lein.
23:00RaynesI've never had to build anything in such a complex way that I had to use almighty xml. :p
23:00RaynesBut I haven't really done much building either.
23:00RaynesAll my projects look the same.
23:04tomojtalios: all goodness?
23:05tomojok, I guess I agree
23:08Raynesmmarczyk: Somebody might need to file a bug for that or something. It's pretty bad. You can't have an open-ended version range on contrib because of that. I'd do it, but I don't have a CA (or a printer, or anywhere to go to print it anytime soon) ._.
23:10mmarczykRaynes: I'm thinking that perhaps lein shouldn't include build.clojure.org/snapshots in default-repos
23:10taliosRaynes: polyglot maven hasn't really moved in a few months. all my clojure code was rewritten ( now leiningen compat I believe )
23:10Raynesmmarczyk: That would suck.
23:10taliostomoj: all goodness. all good. Apart from staff resigning prior to our uber new release, which hopefully will be out soon.
23:11tomojhurray
23:11mmarczykRaynes: but anyway, you're right about somebody needing to file a bug report -- care to do it? :-)
23:11taliosthen we can start on our git migration, and hack up the codebase again
23:11RaynesI wasn't sure if one could file an issue without being a contributor.
23:11RaynesI need to do this on the assembla page, right?
23:12tomojyou have to have a CA to work on leiningen?
23:12mmarczykyou don't need a CA to create a ticket on Assembla
23:12mmarczykbut I'd just send this to the ggroup
23:12Raynestomoj: This isn't a Leiningen bug.
23:12Raynesmmarczyk: Alright.
23:12Raynesmmarczyk: Which one?
23:12tomojoh, I see
23:12mmarczykClojure
23:12mmarczykspeaking of CAs, mine seems to be stuck... somewhere since about a month :-(
23:13taliosisn't not even a "clojure" bug - but a build server/admin issue
23:13Raynesmmarczyk: At least you had a chance to sign one. :p
23:13RaynesSo, how about that Haskell thread in the group.
23:14RaynesFor a moment, I thought I was in comp.lang.lisp
23:15cemerickNot a bright spot. :-(
23:15mmarczykRaynes: not sure if you can sign a contract yet, you mean...?
23:16Raynesmmarczyk: No. I don't own a printer, and I live in the middle of nowhere.
23:16Raynes:p
23:16RaynesI can't even *print* a CA right now, much less sign it. ;p
23:16mmarczykRaynes: oh... want a couple of blank copies then? :-)
23:16RaynesIndeed.
23:17mmarczykif you drop me an e-mail with an address, I'll mail you some :-)
23:17mmarczykI'd find it hilarious to do that
23:18mmarczykseeing as it's halfway around the world :-)
23:18RaynesThat would be awesome.
23:18RaynesHow much would that cost you? :o
23:19Lajlammarczyk, I would disagree by the way.
23:19LajlaAbout your idea of vectors.
23:19Raynesmmarczyk: Toss me an email address to send it to, when you get a chance.
23:19Lajla [(+ 1 2) (+ 1 3)] is what it is.
23:19LajlaA vector containing two lists.
23:20LajlaBut aparently the evaluation of a vector as datum in clojure produces a vector of its evaluated members.
23:20mmarczykRaynes: I don't remember the exact amount from the time I sent in the CA myself, but I'm pretty sure it didn't exceed the cost of a latte ;-)
23:21RaynesI wish I had a latte. :<
23:21RaynesSend me one of those too.
23:21mmarczyk:-)
23:22Lajlammarczyk, you cannot ignore me, I have your legs.
23:23mefestoLajla: if you want an unevaluated vector, use a quote
23:23Lajlamefesto, that is not of which I spoke.
23:23mefesto,'[(+ 1 2) (+ 1 3)]
23:23clojurebot[(+ 1 2) (+ 1 3)]
23:23mmarczykRaynes: hopefully I've just sent you a message with an e-mail address :-)
23:23LajlaI mean, mmarczyk said that the [ x ...] notation repraesented a different thing than the ( x ... ) analogue
23:24Raynesmmarczyk: Indeed.
23:24Lajlamefesto, I have crossed oceans of time to be with you.
23:25Lajla"You already admitted to loving Titanic, which makes you a brave man secure in your heterosexuality, but calls into question your overall cinematic credentials."