#clojure logs

2010-01-06

00:31konrHow can I add {:c "Camel"} to the right place at {:language {:letters {:a "ant" :b "bee"} :numbers #{1 2 "many"}}}?
00:41arohnerkonr: update-in
00:41arohner(update-in [:language :letters] assoc :c "Camel")
00:43konrarohner: thanks! I wasn't aware of that function
00:47leoHey guys, When a clojure file containing (:import com.foo Bar) loads, then loading the class also runs all its static initializers during compile time. How do people work around this?
02:13TheBusbyis there a simple way to change the "rate" of a lazy sequence?
02:14TheBusbyfor example, if you have a text file with two columns per line
02:14TheBusbyand you use (read-lines *in*) to read in the data line by line
02:14TheBusbycould you return a lazy sequence of aggregated data?
02:15TheBusbywhere the summation of each column would be returned when an empty line occured?
02:15hiredmanthat has nothing to do with lazy-sequences
02:15TheBusbyif the file was 1TB
02:16hiredmanand everything to do with the function you use to turn a file into a lazy sequence
02:16TheBusbyyou'd need to iterate over it
02:16TheBusbyer, if your input was a lazy sequence though
02:16hiredmana lazy sequence is just two methods first() and rest()
02:16hiredmanthe rest is all other stuff
02:17hiredman(not rest(), rest)
02:17TheBusbyI'm probably thinking about this incorrectly then
02:17hiredmansure
02:17TheBusbyif you used map() for everyline of input you'd have a line of output
02:17TheBusbythis would be processed line by line and the entire collection would not be stored in memory
02:17hiredmaneh?
02:18somniumyou could do something like (repeat (read-line-fn)) and then take-n ..., but that opens up other issues
02:18hiredmanmap is a fn that consumes seqs and returns a lazy seq
02:19TheBusbymap returns an element for every element it consumes for the seq though right?
02:19hiredmanyes
02:19TheBusbyso it's 1 to 1
02:19TheBusbyreduce takes many inputs and will return one value right?
02:20somniumreduce isnt lazy though
02:20TheBusbymany to one
02:20hiredmanit's better to start off with your problem instead of, think sort of halfway through, then presenting the halfway through
02:20TheBusbyokay
02:20TheBusbyI have two columns of numbers
02:20TheBusbywhere the first column is a non-unique record number
02:21TheBusbyand the second contains related information
02:21hiredmanis this sorted? all the records with the same record number are adjacent?
02:21TheBusbyI'd like to read in the list, and have a lazy sequence return a map of all the related information for that record_number
02:22TheBusbycorrect, sorted
02:22TheBusbyExample
02:22TheBusby1 10
02:22TheBusby1 20
02:22TheBusby1 30
02:22TheBusby1 40
02:22TheBusby2 5
02:22TheBusby2 6
02:22TheBusbyetc
02:22hiredmanyou can stop
02:23hiredmanyou are going to have to write a custom lazy-seq function, either on top of line-seq, or directly over the bufferedreader/file/etc
02:24TheBusbyI was hoping I could write a generic function that would accept a function and a sequence and return a new sequence defined by the function
02:24hiredman
02:24TheBusbyI haven't thought of a good way to do this yet, nor know if it's actually possible
02:25TheBusbyis there a simple way to do the example I provided above?
02:26TheBusbythis is so trivial to do in ruby...
02:26hiredmanwell, go to #ruby then
02:27TheBusbysorry, I didn't mean to offend
02:28TheBusbywhat I was trying to communicate was that this problem seems simple but appears very hard to do in a functional way
02:28hiredmanit isn't
02:28hiredmanit's just a loop
02:29somniumsomething like (map line-processor-fn (BufferedReader. (FileReader. "file"))) no?
02:29hiredmannope
02:29TheBusbycan't use map unfortunately since it's a 1->1 transform
02:30hiredmanhe is try to group lines
02:30somniumer, line-seq around the end, but doesnt duck-streams have something for this?
02:30somniumah
02:32TheBusbyI could process everything inside one big loop, but I was hoping there might be some way to have it return another lazy-seq instead
02:32somniumTheBusby: so you want to produce a new seq with nodes like [:record-
02:33somniumnumber data data data] ?
02:33TheBusbya new seq that's composed of multiple elements of another seq
02:33TheBusbycorrect
02:33hiredmanlisppaste8: url?
02:34hiredmangah
02:34lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
02:34hiredmantoo late
02:34hiredmansomething like http://gist.github.com/270111
02:36somniumTheBusby: is data on one line separated by white-space?
02:36TheBusbytab delimited
02:36hiredmangar
02:37TheBusbybut multiple lines make up a record
02:37somnium?
02:37hiredmanemacs seems to have decided to ignore my font preferences
02:37hiredmanvexing
02:38TheBusbyoh, that looks very interesting
02:39hiredmanf assumes that the seq has already been turned into a bunch of [id value] pairs
02:40TheBusbyin the returned lazy seq you'd need to (cons d (f xs a '(b))) wouldn't you?
02:41TheBusbyI'll try it and see if memory is okay
02:41TheBusbythank you!
02:42hiredmaneh?
02:42hiredmanno
02:42TheBusbywouldn't "b" be dropped otherwise?
02:42hiredmanI don't think so? (untested, eats babies)
02:43hiredmanoh right
02:43hiredmanyes
03:04LauJensenMorning all
03:27TheBusbyhiredman: does recur not accept variable numbers of arguments?
03:28TheBusbyI was trying the code you were nice enough to provide, and ran into this error "Mismatched argument count to recur, expected: 2 args, got: 3"
03:29TheBusbyI tested the idea with this (defn t [a b & [c d]] (recur 1 2 3 4)) and got the same error
03:30hiredmanrecur might not like that destructuring
03:31TheBusbythe docs says the arity has to match, I guess they just need to be required then
03:31hiredmanbah
03:31hiredmanit's the vararg
03:32TheBusbyahh, even removed though it has an NPE
03:33TheBusbyhttp://pastie.org/768568
03:33TheBusbyseems to NPE when it asks for the rest
03:36hiredmanstart putting in printlns
03:36hiredmanto figure out where the nil is
03:40TheBusbyahh, it doesn't appear to like the end of the input sequence
03:56TheBusbyhiredman: works great, no memory issues; thank you so much!
05:49arj_I'm trying to understand thread-local and set!
05:49arj_first thing I wonder is why the documentation for binding doesn't mention that they are thread-local?
05:50ordnungswidrigafaik they are thead-local, yes
05:50arj_second thing is if there is a way to create thread-local bindings for new variables
05:51arj_so that I can set! them
05:51arj_let doesn't work and binding needs already def'ed variables
05:53ordnungswidrig(binding [x 1] (set! x 2)) doesn't work?
05:53somniumnot if x is not a var
05:54arj_exactly
05:56somniumclojure frowns on imperative code -- locals are asways immutable
05:56somniumarj_: why do you want to call set! on something that isnt a var?
05:58arj_was I was thinking was something like init a local var at the top of a function, then change that in the function and return it
05:58ordnungswidrigarj_: that's sounds naughty
05:58somniumvars are always top-level, afaik
05:59somniumreference types are available for what you describe
05:59arj_yeah so far I have had good luck rewriting the functions in a more functional style
05:59somniumbut again, why do you want to do that?
06:00arj_reference types?
06:00somniumatom, ref, agent etc
06:00arj_ah yes, but they are quite verbose
06:01somniumthey scream "Mutable State Here!", and this is widely regarded as a good thing
06:01ambientoh how i long for the days of single thread of execution :p
06:01somniumambient: javascript!
06:01somnium:)
06:02somniumwhen IE supports concurrency it will all be over
06:04praptaksomnium: you can still run into concurrency problems with JS. Asynchronous calls.
06:05praptakasynchronous calls + fast-clicking impatient users :)
06:07somniumpraptak: true, but you can never really access a var simultaneously
06:46esjMy REPL is complaining about an exception in some code of mine :"clojure.test$test_var__8905$fn__8907.invoke (test.clj:643)", where test.clj has about 100 lines of code. What am I missing here ?
06:47esjis it really saying the error is on line 643? If so how ?
06:48esjoh, ignore me, stupid question.
07:02praptakAbout (doc doto) - is "in the from of" a typo of "in the front of"?
07:03the-kenny,(doc doto)
07:03clojurebot"([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the from of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
07:03praptaksorry, "at the from of"
07:04the-kennyLooks like a mistake
07:05praptakOr an obscure idiom, hence my question.
07:32esbenaI have a lot of mutually recursive functions, do I really have to 'prototype' them before use - or is there some way to tell the interpreter to look forward (using slime)
07:36Chousukeyou need to declare them
07:37Chousukeyou could also evaluate the file out of order manually, but that's not very practical
07:38Chousukethere's the declare macro for creating unbound vars, you can use that.
07:39ordnungswidrig1how can I embed unicode character in strings in clojure?
07:40Chousukejust type it in? :)
07:41Chousukethere's also the \UNNNN escape
07:41AWizzArdordnungswidrig1: you can also use the \u1234 syntax, which will add the unicode char which has the hex code 1234
07:41Chousukeoh, it was a small u? hm.
07:41AWizzArdtho this gives you access to "only" 65k chars, and not the full range
07:41esbenaChousuke: thank you for the declare macro - I used empty function definitions before!
07:41AWizzArd,\u65
07:41clojurebotInvalid unicode character: \u65
07:41Chousukeesbena: yeah, there's no need for the function to actually be defined in any way
07:42Chousukeesbena: but the var must exist
07:42AWizzArd,\U54
07:42clojurebotUnsupported character: \U54
07:42Chousukeneed four numbers
07:42AWizzArdyes
07:42Chousuke,\u0054
07:42clojurebot\T
07:42ordnungswidrig1ah, recompile is your friend...
07:42ordnungswidrig1thanks
07:42AWizzArd,\U0054
07:42clojurebotUnsupported character: \U0054
08:08arj_how do I add to the end of a collection?
08:08arj_collection is vector
08:09_fogus_,(conj [1 2] [3 4])
08:09clojurebot[1 2 [3 4]]
08:09neotyk,(conj [1 2] 3)
08:09clojurebot[1 2 3]
08:09djork,(conj '(1 2) 3)
08:09clojurebot(3 1 2)
08:09djork:-)
08:10djorkJust FYI
08:10arj_ah yeah
08:10arj_thanks :)
08:10_fogus_conj works like push for vectors
08:11djork(conj {:x :y} [:j :k])
08:11djork,(conj {:x :y} [:j :k])
08:11clojurebot{:j :k, :x :y}
08:11djorkthere we go
08:11djorkconj is 'cpmkpom
08:11djorkOMFG CAN I TYPE?
08:11djork'conjoin'
08:11djorkalso a pun, if I am not mistaken
08:12djork'cons' is a historic Lisp function and intentionally replacing the 's' with a 'j' would make a good Clojure pun if one had that in mind
08:13djork(although cons is still there for seqs)
08:13arj_it's the evil filter that changes my collection into a list
08:13_fogus_Wouldn't have to be cjons?
08:13neotyk,(class (conj {:x :y} [:j :k]))
08:13clojurebotclojure.lang.PersistentArrayMap
08:17neotyk,(doc list*)
08:17clojurebot"([args] [a args] [a b args] [a b c args] [a b c d & more]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."
08:18neotykarj_: is that what you need?
08:25arj_neotyk: I wrapped it in a vec, just a bit wierd that it changes my seq type
09:16defn`(defn discover-namespace [nspace] (vals (ns-publics nspace))) -- Instead of using this function like: (discover-namespace 'clojure.core), How do I use it like: (discover-namespace clojure.core)?
09:17defn`In other words, how do I quote nspace in my function to get the value of nspace and append a ' to it
09:18Chousukeyou need to make discover-namespaces a macro :/
09:18Chousuke-s
09:18defn`that'll be a good learning experience
09:18defn`would this be a case for unquote splicing?
09:18Chousukenah.
09:19Chousukeyou can actually use the function as the macro driver. just expand the macro call to a call to discover-namespace with the symbol quoted :)
09:19defnwhoa
09:20Chousuke(defmacro discover-namespace-m [ns] `(discover-namespace '~ns)) like that.
09:21defnwhat is the m? for macro?
09:21Chousukeyeah.
09:21defni just discovereda similar convention for predicates
09:21defn(defn abc-p)
09:21defnalthough in clojure it makes more sense to use ?
09:21Chousukeit's not a convention though. Usually you'd name the macro discover-namespace and the driver function discover-namespace*
09:22defnwhy not here?
09:22Chousukebecause your function was already named discover-namespace :)
09:22defnoh...right :)
09:22defnthanks for the help Chousuke
09:22Chousukein this case using the driver function approach is a bit overkill though. I'll leave the other solution as an exercise :P
09:22defnoh -- one more question for you which is painful to even ask...
09:23defnChousuke: http://gist.github.com/270299
09:24defnThat is probably the ugliest thing I've ever written. Any ideas?
09:24chousermaybe use 'format'?
09:24the-kennydefn: split the function into multiple function
09:24chouseruse keyword destructuring
09:24chousernah
09:24Chousukeformat and map destructuring might help, yes.
09:26chouserdefn: you really want a vector back, and not a single string or print?
09:26Chousuke,(let [{:keys [ns name arglists macro]} {:ns 'foo :name 'bar}] [ns name arglists]); did it go something like this?
09:26clojurebot[foo bar nil]
09:26defnChousuke: i end up writing the lines to a file, so having it split up is hand
09:26defnhandy
09:27defnbut i could just as well write the string
09:27Chousukethat way, you can at least get rid of the (:foo (meta v)) stuff, which should improve things a lot
09:27defnyeah definitely Chousuke
09:31defnmaybe i could use templates to make the functions for each (:foo (meta bar))
09:33arj_how expensive is: (vec (filter #(blah) myvector)), will it create a temporary seq, and will it create a new vector? I guess the new vector will share a lot with the old, so it might not be that expensive. I'm thinking of big-O
09:34the-kennyarj_: filter is lazy
09:34the-kenny(doc filter)
09:34clojurebot"([pred coll]); "
09:34the-kenny,(doc filter)
09:34clojurebot"([pred coll]); "
09:34chouserarj_: O(n)
09:34defnit wont create a new vector
09:34defnwill it?
09:35chouseryeah, the new vector will not share any structure with the old vector, though the values themselves will not be copied, just references to them.
09:36arj_aha thanks
09:37somniumdoes chunking come into play on the performance of things like that? (vec (filter pred [1 ... n])) ?
09:37chouservectors are no good at removing items from anywhere except the right-hand end, so you're not going to do much better.
09:37chousersomnium: yes, that example actually will use chunked seqs for the filter and transients to build the new vector
09:37Chousukehmm
09:37Chousuke~def vec
09:57chouserdefn: the nature of the problem is a bit messy, but is this any better? http://gist.github.com/270300
09:58chouserI'm not sure it is. my version is no shorter, and arguably less regular
10:00defnchouser: it's okay -- i think im going to keep it how it is
10:01defnwhile I like your way quite a bit, it seems to make it a fair bit harder to read and understand at first glance
10:01defnwhile my function is not pretty, it is definitely easy to understand what's going on
10:01chouserdefn: yep
10:01chouserI was hoping the angle I was taking would result in a smaller function, but having failed that it just looks more complicated.
10:01defnchouser: how would you enumerate all of the namespaces after the dot, like clojure.core, set, xml, etc.
10:02chouserdefn: search the classpath. :-/
10:02defnewwwwwww
10:03defnthere's got to be a better way!
10:03chouserI don't think they're all listed anywhere else.
10:07defnchouser: so in order for me to programatically find all of the clojure.* namespaces i have to use the classpath?
10:08defni want a list like '(clojure.core, clojure.set, clojure.xml, clojure.zip, clojure.main)
10:08chousermight be best of just listing them manually
10:09chouseryou don't wankt walk, test, inspector... ?
10:09defnoh sure, yes i do
10:09defnthat's just a short example of what im trying to accomplish
10:09defnyeah, although i was hoping to abstract this sufficiently so eventually someone could drop this jar in their undocumented (un-exampled) project, and use it as sort of a way of bootstrapping your project with editable example documentation
10:10defnso you could drop this in...say...your own library you wrote, and type java -jar docs.jar --new .
10:10chouserthose namespaces are just files on disk (in a jar or not) until they get loaded. They're not loaded automatically.
10:11chouserso the only place to look for them is on disk, in a jar or not.
10:20defnchouser: it seems like I can do everything except programatically discover namespaces -- would it be possible to introduce some sort of identifier which would allow that sort of behavior?
10:20defnlike metadata for sub namespaces
10:21chousernot sure what you mean. where would you but such an identifier?
10:21chouserput
10:21defnnot sure -- that's why im asking
10:21defnmaybe it could be an optional piece of the (ns) macro
10:23defnim not really looking to do anything other than have a way of saying "this clojure.xml ns is part of clojure.*"
10:23chouserbut "clojure" is not a namespace for "clojure.xml" to be a sub-namespace of.
10:24chouserdefn: does the lien config file name all the namespaces the project includes? if so, that might be an approach.
10:25defnit wont solve the clojure.* problem, but yes ive considered doing something like that -- basically the :main that is referenced in the lein project becomes the jumping off point for discovering other related namespaces
10:39somniumdefn: if you're intending to use as an autodoc maybe it would be easier to (file-seq "./src") or something similar
10:46defnsomnium: yeah not a bad idea
10:46defnsomnium: are you familiar with compojure at all?
10:47somniumdefn: familiar with the pats I use :)
10:47somniumparts that is
10:48defnheh, im a newb -- trying to figure out how to do what i need to do, but not very clear on how to go about accomplishing it
10:48somniumdefn: shoot
10:49defni have this set, and i want to create a route which will render some html if someone sends a GET request to /docs/:name
10:49defnwhere :name is one of the items in the set
10:49defnmy only web framework experience is with rails, which compojure certainly is not
10:51somniumdefn: something like (GET "/docs/*" (do-something (:* params))) would be my first shot
10:51defnwould it be something like: (defroutes doc-routes (GET "/docs/:name" (doc-page (;anme params))))
10:51defnack sorry lag
10:51somniumyeah, that would work
10:52defnwhat kind of special magic do i need in the doc-page fn?
10:53somnium? you can just return a string afaik
10:53defnheh, i think im making this too hard
10:53somniumthats basically what (html :p "foo") does
10:53defnsure sure
10:53defnwhat type is the param?
10:54somniumparams is a map that gets magically added into scope by the defroutes macro
10:57ambientis there a default location in Leiningen where I should put my classes folder and can swank-clojure automatically use it?
10:57ambientwhen compiling clojure classes
10:57somniumambient: I think its ./classes, thats what '$lein new' creates
11:16konrIs there a way to convert to, eg, 4 to :4 besides converting it to another type first?
11:18ambient(keyword (str 4)) seems to work
11:18ambientbut yeah, another type
11:24CalJunior,(def tiger (atom ["elin" "rachel" "jamie" "kalika" "mindy" "holly"]))
11:24clojurebotDENIED
11:24CalJuniorok then: (def tiger (atom ["elin" "rachel" "jamie" "kalika" "mindy" "holly"]))
11:24CalJunior(dosync (assoc @tiger 0 "cori"))
11:24CalJunior@tiger
11:25CalJunior["elin" "rachel" "jamie" "kalika" "mindy" "holly"]
11:25CalJuniorbasic clojure stuff I'm trying to wrap my head around.
11:25CalJuniorhow do get @tiger to change.
11:25CalJunior?
11:26CalJuniorI mean the vector not the man
11:27CalJunioris dosync the way to go in this case?
11:27ambient,(def foo (future (+ 1 2)))
11:27clojurebotDENIED
11:27ambient:(
11:27ambient,(let [ foo (future (+ 1 2))] @foo)
11:27clojurebot3
11:29somniumCalJunior: you need to use swap! or reset! to operate on atoms
11:30somniumand you dont need to use dosync (though you can)
11:31ChousukeCalJunior: @tiger gets you the value, you can't change that
11:31ChousukeCalJunior: what you can change is the value that tiger (the atom) points to
11:32Chousuke,(let [a (atom 1) b @a] (swap! a inc) [@a b])
11:32clojurebot[2 1]
11:33CalJunior,(let [tiger (atom ["elin"])])
11:33clojurebotnil
11:33Chousukewhat (assoc @tiger 0 "cori") does is it reads the value of tiger, then creates a new value from that. the atom itself is never involved after the value is read
11:34Chousuke,(let [t (atom ["fred"])] (swap! t assoc 0 "ethel") @t)
11:34clojurebot["ethel"]
11:35Chousukeatoms are not coordinated so you don't need dosync. :)
11:35CalJuniorthanks!
11:36CalJuniorare atoms the most efficient way to do this?
11:36Chousukewell, they're the simplest
11:36Chousukeso probably.
11:36Chousukebut if you have two threads modifying the same reference, you might need refs to coordinate the change
11:37CalJuniorI need to keep track of hundreds of 'identities' that change very rapidly. over multiple io threads.
11:37Chousukeremember though that refs aren't there so you can write imperative, mutating code that uses them. you should keep the number of mutable references to a minimum, and write most of the code functionally :)
11:38CalJuniorlet's say tiger needs to keep is cell phone address book up to date in real time.
11:38CalJuniormilliseconds.
11:39defnwoo hoo, this is neat -- finally got the hang of messing with clojure from the REPL
11:39defnerr compojure
11:39defni thought id need to restart the server every time, but that doesnt look to be the case
11:40CalJuniorI'm stretching the metaphor here …
11:40ChousukeCalJunior: it really depends on how your data and identities interact
11:40CalJunioridentities are constant in number. data changes rapidly.
11:41Chousukethe phone book might be just part of tiger's value.
11:41Chousukeso you'd have one atom for tiger and update that when the phone book changes.
11:41CalJuniorexactly
11:42Chousukethough if there is a situation where you might need to update tiger's value based on some other identity's value, then you probably need refs, so that you can do changes transactionally
11:42CalJuniorbut if the 'girls' change phone numbers every millisecond, would that create a massive amount of gc when I use ref?
11:44Chousuketo be able to change the phone numbers at all you either need a mutable data structure or one of the reference types
11:44Chousukeusing clojure's reference types of course is recommended
11:44Chousukebut if that turns out to be too slow, then you might have to resort to using java arrays or something
11:44the-kennyOr a database
11:44Chousukeand then Clojure can't help you anymore :/
11:45the-kennyBut that's even slower
11:45Chousukeupdating persistent data structures is pretty quick, and java's GC is fast, so don't worry too much
11:45Chousukewrite it the easy way first.
11:45CalJuniorthanks
11:45the-kennyPremature optimization is the root of all evil
11:46CalJuniorknuth right?
11:46the-kennyDon't know
11:47the-kennyWikipedia says it's from Knuth, yes
11:58flouxhi all. I am struggling with the gen-class macro when defining a method that accepts a string-array and returns a list.
11:59defngah! why cant i link to these .css documents from compojure?
12:00flouxhow can I define a string[] or List<String> as input parameter to my function?
12:00defn(include-css "css/pygments.css")
12:00Chousukefloux: List<String> is just List, but String[] is something else... hm
12:00defncss/pygments.css exists in the same dir as my source file
12:00Chousuke,(make-array String 1)
12:00clojurebot#<String[] [Ljava.lang.String;@11d4d66>
12:00defnim not sure why it doesnt see it :\
12:01Chousukefloux: use "[Ljava.lang.String" for the type
12:01flouxChousuke: I will try, thank you!
12:02Chousuke(including the quotes)
12:03flouxhmm.. the reader gets mixed up by the unmatched delimiter
12:03flouxahh
12:04flouxChousuke: this gives me a "ClassNotFoundException: [Ljava/lang/String"
12:06flouxmaybe I should just use a raw List
12:06somniumdefn: see the wiki on static files, by default it looks in "./public"
12:08defnsomnium: d'oh!
12:08defnthank you, i was getting pretty frustrated
12:08defn:)
12:09defnsomnium: is there a way to restart the server from the REPL?
12:09Chousukefloux: hm, maybe you need the ; as well
12:12flouxChousuke: looks promising compile worked.
12:13flouxChousuke: fantastic! It works.
12:13flouxChousuke: thank you very much
12:14Chousukegen-class could use a bit better syntax for specifying arrays :P
12:21somniumdefn: if you hold on to the jetty object you can, but you shouldn't ever need to. You can recompile fns and it updates immediately.
12:24defnit looks like to update routes you need to
12:24defnsomnium: i cannot get this damn css file to work
12:24defnim getting a 500 error now, which is "better" than before
12:25somniumdefn: if youre in emacs C-c C-k should update everything
12:25defnI have a static route (GET "/*" (*public-dir* (params :*)))
12:25defnwhere public-dir is "public" and resides in the same directory as the source file
12:25somniumdefn: slime sets your "." to whatever file you started slime on
12:25defnim using swank-clojure-project to start slime
12:26somniumdefn: right, but if you open it on "./src/proj.clj" compojure will be looking in "./src/public"
12:27defnwhat im saying is that i dont open it on a file, i run swank-clojure-project on the project root
12:27somniumdefn: try setting an absolute path on (serve-file ...)
12:28defnand the file im working with and running the server from, has ./public just as you describe
12:29somniumdefn: what does (use 'clojure.contrib.duckstreams) and (pwd) show?
12:29defnmy home dir
12:29defnis there a command to change slime's working dir
12:30somniumno, its rooted to the classpath
12:30somniumbest advice for now, use an absolute path until you get it working
12:30technomancydefn: M-x cd, but the actual JVM's working dir cannot change
12:33defnProblem accessing /css/pygments.css. Reason:
12:33defnjava.lang.String cannot be cast to clojure.lang.IFn
12:33neotyktechnomancy: Hi, Q regarding lein swank: how does it set classpath? I can't use/require things from my src dir
12:33technomancyneotyk: weird; works for me
12:33somniumdefn: you've got a ("foo") somewhere
12:33neotyktechnomancy: so I do "lein swank" in my leiningen project
12:34defnsomnium: what? are you sure man?
12:34neotyktechnomancy: than M-x slime-connect
12:35neotyktechnomancy: and if I try (use ...) it say's it can't find it
12:35somniumdefn: that error says something tried to call a string
12:36defndoes serve-file expect a File obj?
12:36technomancyneotyk: must be something wrong with your project layout then. works fine here.
12:37neotyktechnomancy: could you check clojurebot?
12:37somniumdefn: no, Im using this, (serve-file "path/to/static" (params :*))
12:38defnsomnium: ill try that
12:38technomancyneotyk: might be able to take a look over lunch
12:39neotyktechnomancy: I can also try to create sample project
12:41defnsomnium: well, now i dont get an error, but all that shows up when i navigate to the stylesheet is a blank page
12:44pjacksonhi technomancy, I have some suggestions for clojure-test-mode; how would you like them?
12:45technomancypjackson: cool; if they're quick to implement, just fork and implement in a branch, otherwise start a discussion on the swank-clojure mailing list
12:45pjacksonRighto.
12:45danlarkinon rye with butter
12:46defnProblem accessing /css/pygments.css. Reason:
12:46defnpublic/404.html (No such file or directory)
12:46defnw. t. f.
12:49somniumdefn: try (serve-file "absolute/path/to/DOT/SLASH/public/" (params :*))
12:51defnwhy does that work and not my def'd var?
12:52somniumdefn: why dont you pastie the offonding portions
12:53defnsomnium: i will in one second
12:53somniumdefn: at any rate, it sounds like that worked? be happy!
12:53defnhere's another issue im having now... now that i can get my css working
12:53defnthey dont work on different routes
12:54defnlike /docs/css/global.css is broken now
12:54somniumdefn: make sure the paths in (include-css) start with a "/"
12:55defnfixed!
12:55defnsomnium: i owe you man
12:56somniumdefn: the first time I used it I had some headaches with static files too
12:57defnyeah dude, wow.
12:57defnthat was absolutely annoying
12:58defnas soon as i finish what im doing im going to scaffold a basic compojure project so i never have to think about that again
12:58defnsomnium: truly though, thanks for the help :)
12:59somniumdefn: np, someone here helped me
13:00defncompojure is so strange to me still -- partly i think a lot of my frustration is that i always used to relish the splitting up of functionality, so id work on view code for an hour, then do controller code, etc.
13:00defnbut i feel like im doing both at the same time in compojure
13:02mebaran151defn, I actually had the same feeling
13:02somniumdefn: the same patterns can be applied, but its on you to structure your code (compared to OO-MVC)
13:02mebaran151a good framework makes that pattern obvious though
13:02defni end up feeling like i dont know where one piece starts and another ends
13:03defnwhich is rather annoying
13:03mebaran151the way I do it
13:03defnyeah im all for advice
13:03somniumcompojure is more like sinatra than rails
13:03mebaran151I define a separate namespace, for like views
13:03defnsomnium: well said
13:03mebaran151then each view is a function
13:03mebaran151that uses compojures pretty kickass templating language
13:03defnmebaran151: yeah i started doing that, but then i realized i didnt really have enough views to warrant it, so this ended up being one big source file
13:04defnyeah the templating is just...awesome
13:04defnit's like HAML, but better
13:04mebaran151oh it doesn't matter if you have alot of views or a few
13:04mebaran151don't be scared to have a 10 line source file
13:04mebaran151I have a utils file in my current project that's like 20 lines
13:04Chousukemy impression of compojure is that it's more of a toolkit than a full-blown framework :/
13:04mebaran151well it's like sinatra
13:04mebaran151which I like
13:04defnChousuke: i think if you really know the whole thing it's more than that
13:04mebaran151I don't like too much magic I don't understand
13:05defnbut i havent met very many who do (know the whole thing)
13:05Chousuke"framework" in my mind implies an imposed structure
13:05somniumIt really shines as a backend for javascript apps
13:05Chousukewhereas a toolkit lets you combine things more freely
13:05mebaran151isn't there a clojure framework that's even more minimalist
13:05mebaran151uses app macros
13:06somniummebaran151: there's ring, which is like rack with fewer libraries
13:06defnyeah
13:06mebaran151I kind of wish things like this existed for socket servers
13:06defnidk, for what im doing in compojure it's practically perfect
13:06mebaran151I'm trying to wrap netty, but I haven't quite grasped its event model yet
13:06defnim willing to wager that it's mostly me that's the problem
13:06defnnot compojure
13:06mebaran151netty itself seems fairly kick ass
13:07defnive only been using clojure for like a month, never built any java projects before this, so the whole namespace thing and such was new to me, especially the project structure
13:08phaerI might have a rather dumb question: I have got vimclojure up and running with single .clj files, but would like to use leiningen. How does that work?
13:08defnonce i get better at structuring my projects and knowing what to put where, i think ill be a lot better off
13:08defnphaer: do you have lein installed?
13:09phaerdefn: yes, with normal source files, i just start ng-server and vim. But this doesn't work with a lein project. So i thought i might have to add some nailgun stuff to project.clj?
13:09defnphaer: http://clojars.org/lein-nailgun
13:09defnadd a line to project.clj: :dev-dependencies [[lein-nailgun "0.1.0"]])
13:10defnthen run lein deps, then lein nailgun
13:10phaerdefn: I did this, but it is unable to resolve lain-nailgun in this context.
13:11phaerdefn: I'm new to the whole java, jvm, classpath, maven, ant,... stuff. So maybe i'm overseeing something?
13:11defnlein-nailgun you mean?
13:12phaerdefn: Yes, was just a typo in irc, it is correct in my source
13:12phaerdefn: Oh, nevermind: i added dev-dependencies *after* the final closing bracket ;)
13:12defnit works for me
13:12defnhehe, rookie mistake ;)
13:13mebaran151anybody here have much experience with Netty, what I can ignore etc?
13:13defnphaer: without evangelizing too much, i recommend learning enough emacs to use swank-clojure + slime
13:13mebaran151it's a big big project
13:13replaca_I'm trying to write a leiningen plugin and I'm getting an "Illegal Access Error: eval-in-project is not public". Any ideas?
13:13mebaran151I'd recc netbeans to get started quickly
13:13mebaran151you get a good repl, nice easy ide tools
13:14mebaran151I always feel a little bit masochist when I run emacs
13:14defnreplaca_: see the latest commit on http://github.com/technomancy/leiningen/tree/swank-in-project
13:14somniumdefn: advising vim users to learn emacs is not a good way to make friends ;D
13:14mebaran151vim clojure was alright
13:14defnsomnium: *shrugs* -- im only trying to help
13:14defn;)
13:14mebaran151but I don't see what anybody loses with a modern IDE like netbeans or eclipse
13:14phaerdefn: I'm not dogmatic, and i like emacs quite much, but for now i'm just too used to my vim setup ;)
13:15defnyou just cant do a lot of what you can do with emacs when it comes to clojure
13:15phaerdefn: But i did some emacs experiments in the last days.
13:15somniumFWIW I almost switched to vim until I stumbled on ergoemacs
13:15mebaran151ergoemacs?
13:15defnor i should rephrase: you can do almost all of it, but a lot of it requires a bunch of dicking around
13:16defnnot that emacs doesn't require a lot of messing around, but as far as getting a working setup, you need ELPA and a few commands, and you're set
13:16somniummebaran151: its an effort to provide an emacs distribution thats less anachronistic
13:16mebaran151anyway to get it on ubuntu
13:16ambienti wish there was a drscheme-like cross platform ide for clojure, made in clojure, built like emacs in its core
13:16hiredmanthey sure picked a horrible name
13:16defnhiredman: ill agree with you there
13:16hiredmanRepl :D
13:16defnmay as well call it "Emacs 2.0"
13:16somniummebaran151: theres a windows installer iirc, otherwise need to hook it into your .emacs
13:17konrvimpulse + emacs has the best of both worlds imho
13:17mebaran151I'd be willing to try an emacs that didn't demand I "learn" it
13:17somniummebaran151: thats the idea
13:17mebaran151I've flirted with emacs about 3 or 4 times
13:17somnium~google ergoemacs
13:17clojurebotFirst, out of 127 results is:
13:17clojurebotergoemacs - Project Hosting on Google Code
13:17clojurebothttp://code.google.com/p/ergoemacs/
13:17defnmebaran151: i didnt learn it, i absorbed it after working with it
13:17defnthere's a big difference
13:18mebaran151I get vim, and vim's keyboard centric philosophy informs the way I run eclipse and netbeans
13:18replaca_defn: ahh, I was looking at master
13:18somniumthe default motion bindings are so ridiculous...
13:18defnreplaca_: it sounds like he's working on it i guess
13:18mebaran151but things like compile, mercurial integration, keep pounding f6 for run
13:18defnsomnium: default motion? like the C-n C-p etc?
13:19mebaran151and also the fact that I had to learn elisp to actually make it do anything useful,I felt I was giving more time to the tool than to programming in the tool
13:19somniumdefn: yes
13:19defnmebaran151: that's a fair assessment, but i can say that once you've invested that time, it ends up paying off later on when you think "hmm, i wish my editor could do this..." -- and you quickly dump out a fn to do what you want
13:20ambientfunny thing, alt+p and n work in python idle repl also :)
13:20defnplus i felt like learning emacs + clojure just made sense
13:20defnive learned a lot about lisp from elisp
13:20mebaran151I'm not scared of terminal: I used to do sysadmin
13:20defnoh crap.. did i just inadventantly start an editor war?
13:20replaca_defn: yeah, but that commit (from a month ago) made swank stop being a plugin. That doesn't help :-). But eval-in-project in just a defn in leiningen.complile, so I don't see how it could come back private.
13:20mebaran151I just can't stand the 70's feel of emacs
13:20defnnext topic...
13:21defnreplaca_: is it a defn-?
13:21somniummebaran151: what 70s feel? http://tinypic.com/view.php?pic=2urqmgl&amp;s=6
13:21replaca_defn: nope
13:21defnreplaca_: hmm, id ask technomancy
13:22mebaran151rainbow parens are kind of neat
13:22mebaran151but I have to admit, I've never had too much trouble balancing mine as long as it highlighted the opening and closing ones
13:22replaca_defn: yeah, looks like I've got to. It might be cause I'm trying to load it under swank-clojure-project, but I don't know why that would make a difference.
13:22mebaran151I could probably hack enclojure to provide it too
13:23mebaran151I guess I just didn't grow up with emacs keybindings
13:23ambienthighlighting a segment like in drscheme is the best way imo to match parens
13:23mebaran151so they always feel foreign to a guy who's used to vulgar copy and paste, vulgar window switch etc
13:23somniummebaran151: I certainly didn't, it started with inf-ruby and was downhill from there
13:24somniummebaran151: I cant imagine not having paredit anymore
13:25defnsomnium: amen
13:25mebaran151but I gotta admit, it just never sticked
13:25mebaran151Linux stuck (I started with it on servers and eventually moved my desktop to an Arch then Ubuntu install)
13:25mebaran151but emacs is the one part of the gnu stack that just feels painful
13:25defnmebaran151: i tried to "learn" emacs like 5 times
13:26defnmebaran151: you know what the difference is between linux and emacs?
13:26defnyou're forced to use linux
13:26mebaran151oh yeah
13:26mebaran151hahaha
13:26mebaran151nah, but I got used to the shell pretty fast
13:26defni mean that seriously -- when i say I tried to learn emacs, im full of shit
13:26mebaran151I have some coworkers who hate bash
13:26ambientmebaran151: what made you switch from arch to ubuntu?
13:26defnbecause i kept using vim and stuff
13:26mebaran151I used to maintain the clojure package for arch
13:27defnthis last time when i vowed to learn emacs, i removed all other editors, or at the very least aliased them to emacs -nw
13:27defnit was hell for about a week, but it didnt take much longer to feel at home
13:27mebaran151arch is really cool in that source packages are right there
13:27mebaran151but I wanted to get the cool new features that Ubuntu puts in gnome
13:27ambienteh, ubuntu has source too, just a different apt command :/
13:27mebaran151like the new presence stuff (set your presence across all chat clients, etc)
13:27defnxmonad FTW
13:28mebaran151ambient, but it's not right THERE
13:28mebaran151it's not like abs, where customization is trivial
13:28mebaran151I used to use xmonad :)
13:28defnno wonder i like emacs -- i dont use anything but tiling WMs
13:28mebaran151I've also used awesome
13:28defnxmonad is the fastest and most stable i think
13:29mebaran151awesome is written in like straight C and assembler
13:29defni tried awesome, dwm, ratpoison, etc.
13:29mebaran151they all have the same flavor
13:29mebaran151even openbox
13:29ambientthere's one done with lisp also
13:30defnmebaran151: xmonad has a good balance between being fast, and also being extensible
13:30ambientstumpwm, ratpoison with lisp
13:30defnive yet to find a better tiling wm
13:30ambienthah, extensible if you know esoteric languages like haskell :)
13:30defnambient: you dont need to know any haskell to hack the configs
13:30mebaran151I know a bit of haskell: I used it to learn haskell actually
13:31defni dont know any haskell but i have a huge ass 300 line config
13:31mebaran151I often wanted a programming language exactly like the way clojure does types: optionally until you want them
13:31ambientseems i need to take another look then
13:31defnthe work is done for you, you just put numbers and vars in the right places and recompile like crazy until it works
13:31mebaran151I wish they were a little better integrated
13:31mebaran151types in clojure
13:31mebaran151but I think the definterface and defprotocol stuff will go a long way toward making that a reality
13:32defnnod
13:32ambientpopup windows and such are still a bit problematic in tiling wm:s
13:32ambientid be perfectly happy if metacity had tiling window manager command key-bindings
13:32mebaran151types aren't evil, they're just usually painfully verbose: I don't like having to convince the compiler that sane code is sane
13:32mebaran151ambient, you can set them in compiz
13:32mebaran151compiz let's you do anything with windows
13:33mebaran151tile, place set move, migrate
13:33mebaran151it's actually pretty nice
13:33chousertabs. I need tabs on my window frames.
13:33ambientexcept that compiz comes with a braindead window snapping functionality and requires me to use opengl backend
13:33chouserand keybindings to move focus
13:33technomancycompiz's tiling is very weak
13:33ambientwhich introduces various problems compares to without compiz
13:34mebaran151it's strong enough for me
13:34chouserwhich is why I use ion
13:34mebaran151I liked the use of the opengl backend, but I have a decent graphics card
13:34mebaran151sometimes eye candy makes ya smile
13:34Drakesonis it just me or slime (truck) + swank-clojure are not working together at the moment? Debugger entered--Lisp error: (void-function ns)
13:34mebaran151it's things like slime and swank not working together that seem just unnecessary
13:35ambientin windows (gasp ;) i have win+left/right/whatever and it moves the window there. the most usable system i've used
13:35ambientwinsplitrevolution or something
13:35mebaran151does everything in UNIXland have to be mostly broken, and fixing it is something that is put on the user
13:35mebaran151linux used to be that way until Ubuntu
13:35ambientyes.
13:35stuartsierraI remember years ago I hacked up my own WM on top of Sawfish.
13:35technomancyDrakeson: yes, slime trunk is incompatible; you'll want to use the version in elpa
13:36technomancymebaran151: you don't run into incompatibilities if you actually read the readme
13:36technomancybut I guess that's a lot to ask. =(
13:36stuartsierraReal programmers don't read instructions.
13:36chouserstuartsierra: I used sawfish when I still hated lisp. If it did windows tabs, I'd might go back.
13:37stuartsierraYeah, that'd be cool.
13:37Drakesontechnomancy: is the version in elpa tracking trunk?
13:37mebaran151but like, every emacs evangelist has told me that emacs sucks until you customize your .emacs exactly for you
13:37technomancyDrakeson: no
13:37mebaran151why can't it come with a cool .emacs
13:38stuartsierra"Emacs is an operating system. If only it had a decent text editor." -?
13:38the-kennystuartsierra: It has :) it's integrated
13:38the-kennyAnd it's even better with paredit :D
13:38stuartsierraI forget who said that originally.
13:38mebaran151that enables useful things like elpa
13:38technomancymebaran151: the next version of Emacs will integrate elpa
13:38mebaran151so I don't have to hunt, and find outdated blogposts that fail
13:39ambienti figure that emacs is like lisp, an ameoba that you train to act like you want. its just a blob of slime that somebody throws you and then you take a petri-dish and do science on it
13:39technomancyambient: http://www.topatoco.com/merchant.mvc?Screen=PROD&amp;Store_Code=TO&amp;Product_Code=DC-BISCUIT&amp;Category_Code=DC
13:39stuartsierraCommon Lisp has long been called a "big ball of mud."
13:39Drakesonmebaran151: because emacs has to care for a very wide range of tastes.
13:39mebaran151the wide range of tastes can take care of themselves
13:39ambientbut its living mud :)
13:40mebaran151odds are if you're esoteric enough to want to rebind the letter z to a, you should have to do that yourself
13:41Drakesonmebaran151: good luck trying to convince them. they'll flame the mailing-lists if something changes!
13:42mebaran151netbeans seems to get away with offering a nice default setup (hey ma! it highlights straight out of the box, compiles straight out of box, it runs straight out of the box, it has menus that tell you what the keybindings are)
13:42stuartsierraNetbeans is also developed by a single company, so they can control the design better.
13:43hiredmanthe only problem is that it is netbeans
13:43somniumemacs has C-h b
13:44somniumif netbeans had paredit it would be dangerous
13:44mebaran151but firefox is equally free, and somehow it gets design pretty right
13:44technomancyugh; a thousand times no.
13:44hiredmannot really
13:44stuartsierramebaran151: Firefox is mostly developed at Mozilla.
13:44ambienti've already migrated to chrome, there's even vimperator-like addon already :)
13:45mebaran151I wasn't super impressed with chrome
13:45technomancyambient: say what?
13:45technomancyconkeror on chrome would be pants-wetting-worthy
13:45ambientconkeror is emacs-like? right?
13:45ambienti have now knowledge of that
13:45technomancyyeah, it's the inspiration for vimperator
13:46mebaran151what design decisions does chrome make that are fundamentally different from firefox, other than it comes in obnoxious blue?
13:46stuartsierrahiredman: I give it 2 years tops
13:46ambienthttp://github.com/jinzhu/vrome
13:46hiredmanstuartsierra: promise?
13:46stuartsierraNo.
13:46hiredman:(
13:46technomancymebaran151: the UI of chrome is worse than firefox, but what ambient is describing is a way to replace the UI
13:46hiredmanbut I want it now anyway
13:46ambienti rarely use the ui
13:46ambientjust keyboard bindings
13:47somniumstuartsierra: how long till javascript gets threads?
13:47stuartsierrahiredman: so write in. Rhino is there, you could even use Clojure!
13:47mebaran151I would like a browser that was just a js image
13:47stuartsierrasomnium: how would I know? :)
13:47mebaran151stuartsierra, but then it would be java....
13:47hiredman:|
13:47technomancyambient: vrome so it doesn't strip out the crap, it just adds new stuff in?
13:47stuartsierraAsk Mozilla.
13:47ambienttechnomancy: yeah, that's what i figured. have yet to use it
13:48mebaran151isn't firefox actually already pretty close to that: I know the chrome is mostly powered by js
13:50mebaran151somnium, they're getting workers
13:50ambientfrom personal experience, chrome is much snappier than firefox
13:50somniummebaran151: hmm, must google
13:51hiredmansomnium: it's easy enough to just toss in a thread api similar to java's Thread (takes a no arg lambda)
13:51somniumquote: "concurrency can cause interesting effects in your code"
13:51mebaran151I'd like it if Javascript embraced its scheme roots and got continuations that could be turned into treads
13:52mebaran151if clojure had continuations that would be nice too, though I know they are prohibitively expensive to implement anywhere ever
13:53hiredmanmebaran151: no, the jvm just doesn't support them
13:53mebaran151because I thought they were simply incredibly hard to put in a stack machine
13:53hiredmanyou can't arbitrarily jump around in bytecode
13:54somniummebaran151: its possible to capture a tail-call in a lambda (with complexity varying on how much state youre closing over)
13:54ambientaww, some cool assembler hacks do just that :)
13:55mebaran151somnium, I do that in my neo4j bindings to represent the rest of the nodemap
13:55somniummebaran151: cool
13:55mebaran151call the function, get some more clojures that represent the map
13:55mebaran151but it wasn't quite the same as a continuation, that could easily let you go back to where you've came from as well
13:56mebaran151closures get you alot....
13:56somniumtheres the continuation monad I keep haering about, but I still dont speak monad very well
13:57mebaran151heh, neither do I
13:57mebaran151I was contemplating looking into it until I figured out my neat little tail call closure with letfn
13:57mebaran151which basically got the job done
14:01ieureHow come I can’t use Java class constructors in map? e.g. (map URL. ‘("http"://a.com" "http://b.com&quot;)) fails with ClassNotFoundException. I have to wrap it in a fn for it to work. (partial new URL) also fails in the map, which makes no sense.
14:02somniumieure: new isnt a function
14:03ieureWell, that kind of sucks,
14:04somniumieure: (map #(URL. %) ...) isn't that bad is it?
14:05ieuresomnium, No, it’s just strange that things like URL. and (new URL) seem to be less than first-class citizens.
14:06defnsomnium: wanna do some more compojure consulting? :)
14:06defni have a route that's like this: (GET "/docs/:name" (doc-page (:name params))))
14:07mebaran151the class constructors are actually macro like
14:07mebaran151I don't think you can comp macros either
14:07somnium,(macroexpand '(Foo. bar baz))
14:07clojurebot(new Foo bar baz)
14:07somnium,(doc new)
14:07clojurebotExcuse me?
14:08mebaran151and new is a special form
14:08mebaran151you can't apply if
14:08defnsomnium: http://gist.github.com/270537
14:09mebaran151so the java interop is actually pretty consistent
14:09defnbasically once i go to a /docs/:name route, if i click one of the resulting links on that doc page, it tries to take me to /docs/docs/:name
14:10somniumdefn: it looks one of your link-tos starts with a "/" and one doesnt
14:12defnyou sir, are a genius
14:14ambienthmm, what branch to use for 1.1.0? im having bit of a trouble updating the branch with git
14:14ambientfrom 1.0
14:14defnit should just be master
14:15defniirc
14:15ambientgit pull origin master => merging failed :/
14:15reifyI use branch 1.1.x or tag 1.1.0
14:16ambientoh, i had my own patches in it.. :p
14:20ambientclojure-contrib doesn't seem to have 1.1.0 supporting branch
14:20ambientseparately
14:21ieureDo I need to do any extra quoting when using the #"foo" macro for regexps?
14:22danlarkinieure: #"foo" is not a macro
14:22danlarkinit's a regex literal
14:22ieureIt’s a reader macro, right?
14:22ambientit isn't a reader macro?
14:23danlarkinif you consider literal hash maps and literal lists to be reader macros as well, sure
14:23ieureThe docs call it a reader macro.
14:24somniumieure: #"foo" == /foo/
14:25ieuresomnium, Right - Just wondering if it’s a raw string, or if I need to escape backslashes. A copypasta’d regexp is producing slightly odd results.
14:25defnwith do I can just place functions in line right?
14:25defnlike (do (somefunction) (someotherfunction) (someotherotherfunction))?
14:26ieuredefn, Sure. The reader doesn’t care if you have a space or newline between funcs.
14:26defnthanks
14:26somniumieure: none of the ridiculous java escape the escape is necessary
14:26ieuresomnium, Okay, thanks. Guess I have to go into regexp debug mode. Ugh.
14:33chouserbackslashes need to be esacped if you want to match a literal backslash.
14:34chouser,(count (re-seq #"\\" (str \a \\ \b \\ \c)))
14:34clojurebot2
14:34chouser,(count (re-seq #"b" (str \a \\ \b \\ \c)))
14:34clojurebot1
14:40LicenserSo I'd like some advice if someone has time. I've the following situation, I've a game field with N units on it, every unit is allowed to act for each game cycle, I'd like to make this thread safe so that units could act simultaniously, now I'd thought about making the game field a ref and each unit a ref that is stored the field map. Does that make any sense at all?
14:41defnwhat do you do when you can't include clojure.zip and clojure.set in the same file because of a conflict with ns/next
14:42stuartsierradefn: "require ... :as ..." or "use ... :only ..."
14:42defnstuartsierra: im trying to do an autodocumentation sort of thing
14:43stuartsierraI don't see how that makes any difference.
14:43defnare the nexts equivalent, do you know?
14:43stuartsierranot at all
14:43defnstuartsierra: if i use :only on one of the libs, wont i leave one out?
14:43stuartsierrazip/next has nothing to do with core/next
14:43stuartsierradefn: yes
14:44defnand you dont see how this makes any difference for a documentation project?
14:44stuartsierraI see now. But you probably want 'require' instead of 'use' anyway.
14:45stuartsierrae.g., (require 'foo.bar.baz) (documentator (ns-publics (the-ns 'foo.bar.baz)))
14:45defnnice
14:45defnthank you
14:45stuartsierranp
14:46chouserLicenser: possibly. I'd start, though, with a single ref at the top level and manipulate the units, the field, etc. via pure functions.
14:47Licenserchouser: *nods* I currently have no refs at all, just pure functions, I represented a 'turn' as reducing over the units letting each one modify the game field
14:47chouserLicenser: once it's working, if you don't like the performance or CPU usage, since you wrote pure functions it should be pretty easy to add refs at another layer, wrapping your existing pure fns in small transaction calls.
14:48chouserah good, sounds like you're on your way then.
14:49chouserhm, you'll want to sync up all your threads once per turn, won't you?
14:49chouserif so, that's rather unlike the ants example where they all churn away at whatever speed they can.
14:50Licensersince I will end up with a few thousand units I'd figure it be helpful if I can like work with a few threads each handeling some of the units
14:51Licenserthe moves are somewhat distinct, when unit A and B don't interact they don't need to know about eachother
14:51LicenserI wrote the whole thing in ruby (non paralell since it was too much of a pain) now I figured I try out how clojure does the job ;)
14:53Licenserso a few of the functions I find pretty ugly, since, to keep them purely functional, I need to compose a return value and destruct it again :(
14:59stuartsierratry factoring out the destructure/restructure
14:59stuartsierraLike update-in
15:04Licenserhmm hmm *thinks if that is an option*
15:06optimizeris there any good example of an imap code/client in clojure?
15:07optimizerimap as in the email protocol
15:07tomojdoes anyone know haskell's STM enough to say why clojure's is better? ;)
15:07optimizeri think for everything theoretical
15:07optimizerhaskell is better
15:07optimizerfor anything practical; any thing is better than haskell
15:07optimizerclojure is practical
15:08optimizertherefore clojure's stm is better than haskell's stm
15:08cp2tomoj: now ask the same in #haskell :D
15:09Licenserand report back to us since I like to hear what they have to say
15:09tomojmaybe haskell's blocks readers
15:09defnhmmmm now to figure out how to get a compojure server running when apache is taking up 80
15:10defnerr jetty
15:11tomojyou can have apache proxy to jetty, no?
15:12defni believe so yes, just never done it before
15:12hiredmandefn: you just put it on a different port
15:12chouseror lighttpd to proxy to jetty
15:13defn [null] Unable to resolve artifact: Missing:
15:13defn [null] ----------
15:13defn [null] 1) org.clojure:clojure-master:jar:1.1.0-alpha-SNAPSHOT
15:14defnmethinks i need maven2
15:17defnbahhhh, anyone having issues with leiningen, did they rename clojure again?
15:18stuartsierra1.1.0 release is not in Maven central yet, and there was some naming flux with master/new after the release
15:21defnit seems to work fine locally
15:21defnjust not on my server
15:23stuartsierradefn: I don't know how lein works, but maybe there are jars cached in a local repository.
15:23defnyeah that's how it works
15:23defnstill pretty annoying
15:24defnespecially considering `lein new abc` produces a broken project.clj
15:24danlarkinpatches welcome
15:24defni almost said that to myself just now, but you beat me to it
15:25defnsorry, bad day and im being a punk
15:26somnium~haskell
15:26clojurebothaskell is Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you don't compute.
15:28defn~skynet
15:28clojurebotI will become skynet. Mark my words.
15:31hiredmanclojurebot: haskell is <reply>"you have to see features like that in the context of Haskell's community, which is something like Perl's community in the garden of Eden: detached from all shame or need to do any work." -- ayrnieu
15:31clojurebotAlles klar
15:33jeffthinksorry, bit of a noob here - am having some issues getting congomongo going - may be a more general issue - can anyone here help?
15:33somniumjeffthink: I suppose I feel obligated to try
15:33tomojjeffthink: just paste the problem
15:33tomojor describe
15:34hiredmanexception+code
15:34jeffthinkusing Leiningen with congomongo (and compojure) clojars...attempt to run (ns my-mongo-app
15:34jeffthink (:use somnium.congomongo)) and get: Could not initialize class somnium.congomongo__init
15:34jeffthink [Thrown class java.lang.NoClassDefFoundError]
15:35gravityhiredman: That might be the best description of haskell's community I've seen yet
15:35gravityAlthough ayrnieu is a total hater
15:35hiredman:P
15:36hiredman" what would you do in that circumstance? Why, you'd golf your programs forever, and react to pointlessly cryptic code with joyful curiousity." is the rest of the quote
15:37somniumjeffthink: is congomongo.jar on the classpath?
15:38cp212:15:24 chouser >> or lighttpd to proxy to jetty
15:38cp2or nginx proxy to jetty :)
15:39hiredmanor god forbid figure out glassfish
15:39jeffthinkis in the lib dir of my clojure project that I set up with lein...am running lein swank and accessing from within emacs...thought that lein-swank set class path for the project..I can use compojure
15:40defnException in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn
15:42defnjoyful curiosity is almost always a good thing
15:42defn*almost*
15:43defnah-ha, no clojure.jar on my classpath, grrr
15:45somniumjeffthink: it works here with a fresh project, you have [org.clojars.somnium/congomongo "0.1.1-SNAPSHOT"] in project.clj?
15:47somnium(the root congomongo group is currently being squatted)
15:47somnium~seen ato
15:47clojurebotno, I have not seen ato
15:49jeffthinkI do - I have also had similar issues with ClojureQL...so could definitely be a broader issue...weird thing is that in same setup, have had no issues with general clojure, compojure, or incanter
15:50hiredman~seen ato_
15:50clojurebotno, I have not seen ato_
15:50ambient~seen _ato
15:50clojurebot_ato was last seen quiting IRC, 17294 minutes ago
15:51hiredmanah
15:51hiredman,(int (/ 17294 60 24))
15:51clojurebot12
15:53somniumjeffthink: at the slime repl, what does (use 'clojure.contrib.classpath) and (classpath) give?
15:55hiredman~classpath
15:55clojurebotclasspath is (System/getProperty "java.class.path")
15:58somniumnow I'm really embarassed to think of how I did it before I noticed c.c.classpath
15:59jeffthinksomnium: #<File lib/congomongo-0.1.1-20091229.021828-1.jar> is in the list
15:59jeffthinkwhat specifically am I looking for
15:59somniumthat would be it
15:59somniumand (use 'somnium.congomongo) fails at the repl?
16:01jeffthinkCould not initialize class somnium.congomongo__init
16:01jeffthink(yes)
16:03somniumjeffthink: Im rather stumped, anything else in the stack-trace? A month or two ago someone had trouble due to an old jvm version, anything like that possible?
16:07jeffthinksomnium: java version "1.6.0_15" and nothing stands out in stack trace...let me try something real quick that may give a clue
16:10defnthere is a recent update to Java on OSX
16:10defni believe it's newer than 1.6.0_15
16:11somniumjeffthink: pastie the whole stack trace if you dont resolve it in the meantime, that was how we unraveled the previous mysterious error
16:12djorkhah hah, someone called an app developer on ripping sprites from Nintendo
16:12djork"0 of 2 customers found this review helpful"
16:15ordnungswidrigre
16:19jeffthinkhi pastie
16:20djorkwow, Hook Champ
16:20djorkbeautiful controls
16:20djorkthey completely ditched d-pad and buttons
16:20djorkalthough there are special buttons
16:21djorkbut 90% of the controls are done by tapping the gamplay area
16:23jeffthinksomnium: http://pastie.org/769344
16:28somniumjeffthink: do you by chance have more than one clojure.jar in ./lib?
16:28djorkoh sorry, I thought I was in #iphonedev
16:29jeffthinkno - clojure, clojure-contrib, and clojure-db-object...1 of each
16:31defni keep getting access forbidden messages -- im trying to set up an apache mod_proxy -> jetty servlet
16:36somniumjeffthink: Im really stumped now. does (import somnium.congomongo.ClojureDBObject) work?
16:37hiredmanwhat clojure version?
16:38ambient"The big performance problem in clojure currently is that the way it does dynamic dispatch doesn't really fit well with the JVM, and function calls are both more expensive than they could be, and aren't properly optimized away by hotspot. This is a JVM problem, and a solution is in the works." is this talking about JVM or Clojure? JVM 7 will make it easier to write more high-performant code with Clojure?
16:39hiredmanambient: you should ask whoever wrote that comment
16:39somniumshould be 1.1.0-master-SNAPSHOT
16:39jeffthinksomnium: no error, returns somnium.congomongo.ClojureDBObject
16:39hiredmanand what version was congomongo compiled with?
16:41jeffthinkwell the clojure jar included is "clojure-1.1.0-master-20091231.150150-10.jar"
16:41hiredmanyes, but if congomongo is built with lein, then it was AOT compiled
16:41hiredmanand the AOT compiled stuff is more brittle between clojure versions
16:42jeffthinkah...that is in the lein project ./lib...the version of clojure on my machine as retrieved from elpa is clojure-1.0.0-SNAPSHOT.jar
16:43somniumjeffthink: aha, but... lein swank in root should use tho clojure version in ./lib
16:44somniumjeffthink: what about starting with swank-clojure-project instead of lein swank, same story?
16:46somnium^^ is the clojure.jar the pom wants, so everything appears to be in order, yet smething is wonky
16:49jeffthinkwow - so swank-clojure-project does it...everything works...that's bizarre...had issues with it before so went the leiningen route...didn't think to check back to swank way of starting the slime-repl...thank you all for your help...you've already helped enough, so don't want to take any more time, but any last ideas for what to check for to get this all working with leiningen that I can head off on my own and look at?
16:50hiredmanleiningen does some funk with the classpath
16:51hiredmanlike clojure is included in the leiningen jar, but also on the bootclasspath, etc
16:53jeffthinkmay this be the issue (from leiningen issues list): "The repl task will use the version of Clojure and Contrib that Leiningen uses, not the one specified by your project."
16:54defnanyone familiar with compojure have any idea what's happening here? http://getclojure.org/
16:54defnsomething with the path is f-ed up :\
16:56jeffthinksomnium: haha...am really excited to use your lib...thanks for all the help
16:56somniumjeffthink: cheers
16:58jeffthinkif I figure out what the leiningen issue is, will make sure to post here/github...though is definitely possible that it's user error...anyhow, thanks again...cheers
16:59arohnerdefn: it appears you're running apache + (jetty?). My guess is your jetty server isn't up / isn't where apache thinks it should be
16:59arohnermake sure the jetty server is up, then look at your apache reverse proxy config
17:01defnarohner: as far as i can tell i have it set up correctly
17:01arj_anyone know why I get connection refused on reconnecting to repl after I close my Emacs and start it up again?
17:01defnmy jetty server is on 8080, and mod_proxy is setup with proxypass and reverseproxypass
17:02defni have documentroot set to my public/ dir, which is not where my jetty jar is
17:03defnwhat is the document root for a directory structure that looks like /project-root/src/project-name/(source.clj|public/css/my.css)
17:08defnweird. *public-dir* when def'd as the exact same string "/my/path/etc/", behave differently
17:08nowhere_manHi all
17:08nowhere_mani'm setting up Clojure with my SLIME
17:09the-kennynowhere_man: great! :)
17:10nowhere_manI had the following error: http://paste.lisp.org/+1ZTJ
17:11nowhere_manI'm interested in STM and I like discovering ohter Lisps than my primary one (currently CL)
17:12nowhere_manand I'm teaching Java to a friend that I'd like to eventually introduce to Lisp, having Clojure would help
17:15the-kennynowhere_man: Are you using slime from cvs?
17:16nowhere_manthe Debian package
17:17nowhere_manshould be the CVS from 8 sep 2009
17:17the-kennynowhere_man: mh.. I know about problems with recent cvs checkouts, but 8. Sep 2009 isn't very recent. The version in slime is from october 2009
17:18nowhere_mando you have any idea what this error could mean?
17:18the-kennynowhere_man: hm.. is the swank-instance in clojure running? Correct port etc.?
17:19nowhere_manI have that in Clojure's REPL:
17:19nowhere_manuser=> user=> Connection opened on local port 40315
17:20nowhere_man#<ServerSocket ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=40315]>
17:22hiredmanwhat OS?
17:22hiredmanI think bsd's and macosx can have issues with ipv6 vs ipv4
17:22nowhere_manDebian
17:22the-kennyhiredman: He mentioned a debian package of slime. Maybe debian? :)
17:22hiredmanright right
17:22the-kennyCould the package be the problem?
17:23hiredmanhey! maybe he is using a bsd kernel with debian userland!
17:23the-kennyheh
17:23the-kennynowhere_man: Maybe give the slime in elpa a try?
17:24the-kennynowhere_man: If you're using a common lisp with it, you have to work a bit on the backend for the common lisp though..
17:24ordnungswidrigslime on debian worked for me only with the elpa one or the one from github.
17:24nowhere_manslime in elpa ?
17:24ordnungswidrigslime from debian did not work with clojure-swank for me
17:25the-kennynowhere_man: elpa is a package manager for emacs.
17:25the-kennyA nice one :)
17:25ordnungswidrigBut I used lein swank and mvn clojure:swank to start the swank.
17:25defnfinally: http://getclojure.org/
17:25defnstill needs a lot of work, and im not entirely sure why that sidebar is unsorted now -- wasnt before
17:26knuckollson osx my install procedure was install emacs 23, install elpa, M-x package-list-packages, install swank-clojure, restart, M-x slime
17:26knuckollsfrom that point it asked to install clojure
17:26knuckollsand i let it
17:26defndont forget paredit-mode
17:27ordnungswidriggah, aquamacs hickup.
17:27ordnungswidrigfroze -> killed.
17:27the-kennyordnungswidrig: heh.. I've switched to emacs23 in terminal.app some days ago :)
17:28ordnungswidrigthe-kenny: hm, I could ssh to my debian box and attach to a screen running emacs23 :-)
17:29ordnungswidrigthe-kenny: over all I like aquamacs.
17:29ordnungswidrigI asked early today but got no answer: is there already a lib to generate css from clojure?
17:30ohpauleezordnungswidrig: you might be able to tweak enlive to do it
17:31defnhow could passing a *var* that's a string versus a "string" cause a hiccup in clojure?
17:31defnis that possible?
17:32ohpauleezdefn, any weird binding form issues come in to play?
17:32defnohpauleez: let me look at the code
17:32defnhttp://gist.github.com/270752
17:32ohpauleezthanks, let me take a look
17:33the-kennyordnungswidrig: I had many small things which were annoying... blocking while downloading the package-list, bad copy&paste, slow, gigantic size
17:33LauJensenordnungs: I think Compojure has some helper func for generating css
17:34defnohpauleez: im confused about the root
17:34defnwhats going on there?
17:34ordnungswidrigthe-kenny: I switched to a mac just 3 weeks ago so to annoyance of a different keyboard layout is still greater than the aquamacs glitches :-)
17:35hiredmandefn: convetion for earmuffs is that they mean a *var* is to be thread locally bound, and if you are binding a var thread locally, it is possible that the code is being excuted on another thread and does not see the binding
17:36defnhiredman: ah!
17:36the-kennyordnungswidrig: Ah okay, that's more important ;)
17:36ordnungswidrigLauJensen: afaik compojure supports generating html in a nice way (and add style and id attributes nicely)
17:37somniumregarding css, its a bit aggravating that the reader chokes on %
17:37LauJensenThats also true :)
17:37somnium,:50%
17:37clojurebot:50
17:37somniumhmm, I get an exception
17:37somnium,(keyword "50%")
17:37clojurebot:50%
17:37durka42=> :50%
17:37durka42:50
17:37durka42java.lang.Exception: Unable to resolve symbol: % in this context (NO_SOURCE_FILE:0)
17:38hiredman,:%
17:38defnhiredman: that wasnt it either
17:38clojurebotInvalid token: :
17:38hiredmandurka42: most of the css wrapping stuff I have seen takes strings or keywords
17:39defnhttp://gist.github.com/270752 -- do you see anything in there that would make it possible for *var* versus "/what/var/represents/"
17:39somniumsomething like compass would be wonderful
17:39defnerr make it possible for a *var* to not succeed, where a "/path/" does?
17:41ordnungswidrigsomnium: yes, compass, like that. but why do you want to encode 50% a keyword? Can't you simple use a string literal?
17:42ohpauleezdefn: what happens when you pass the var in?
17:42defnohpauleez: the path is wrong -- it doesnt know where my public/css/ dir is
17:42hiredmanhe doesn't pass the var in
17:42hiredmanunless you use #'foo , you don't pass "vars"
17:42ohpauleezright right
17:43defnso anyway -- plain and simple, the path is just wrong and it doesn't know where my CSS files are
17:43defnthe *blah* breaks, BLAH breaks, but the equal string "/a/b/c/" works fine
17:44ohpauleezhave you tried passing it with a root so it could make an absolute path?
17:44defntrying that now ohpauleez
17:44defnhiredman: your confidence in me is always reassuring
17:44ohpauleezyeah, there's nothing there that looks like it would get screwy
17:45somniumordnungswidrig: of course, but would your first choice be strings or keywords?
17:45hiredmandefn: do you ever check the equality of string and the string literal
17:46defnis that a joke?
17:46hiredman,(let [x "/public/"] (assert (= x "public/")))
17:46clojurebotjava.lang.Exception: Assert failed: (= x "public/")
17:46defn'course i do
17:46hiredmanwhy is it a joke?
17:46ohpauleezdefn: and when you do that, you might as well fire up the debugger
17:46ambientdang, i wish i'd discovered this page earlier: http://steve.yegge.googlepages.com/effective-emacs
17:53Licenseris there something like the swank clojure stuff for any other editor then emacs? Please?
17:53ambientboth eclipes and netbeans plugins have repl if that's what you mean
17:53hiredmanvimclojure has a repl
17:53hiredmanthere is also slime.vim
17:54defn,(def *public-dir* "/Users/abc/def/ghi/jkl/mno")
17:54clojurebotDENIED
17:54LicenserHence and the comunity is greatyl helpful - buy a new keyboard with a different layout is not a way to fix key assignment problems
17:55hiredmandefn: have you put an a println in the function so you can monitor the actual input it receives?
17:55hiredmanLicenser: hah!
17:55Licenserno seriousely that was the answer I got when asking how to fix it
17:55arohnerLicenser: you can remap all of the control keys
17:55hiredmanI was talking with hp's support on behalf of someone else about fixing a built in webcam, they told me to reformat the laptop and run a system restore
17:56arohnerand you can pick different language keyboard layouts
17:56Licenserarohner: uea works great on aquaemacs but that is 'not supported' and does not do .emacs.d directories
17:57LicenserSo either I
17:57hiredmanthats irc for you
17:57Licenserwell I
17:57Licenseri've had a few good experiences here is nice, jruby is nice, solaris is nice
17:57arohnerdefn: I use compojure's (serve-file...) I pass it the files root explicitly, relative to the the directory where I started java
17:58arohnerLicenser: what is uea?
17:59Licenserarohner: I've no idea I think it was yea but I'm not sure :/
17:59arohnercua? the thing that makes emacs act more "normal"?
18:00defnarohner: like if project root is: /home/myuser/project, you pass it /public/html/
18:00arohnerwith respect to C-c C-v?
18:00arohnerdefn: I pass it "./public/html"
18:00defnhm, okay thanks
18:01arohnerunderneath, it does a (File. root path), so it expects whatever java does with new File(root, path)
18:01arohneraha, it's relative to (System/getProperty "user.dir")
18:02arohnerbut (serve-file "/home/myuser/project/public/html" "foo.html") should work
18:04arohnerdefn: see if you can make this work:
18:04arohner(.exists (java.io.File. "/home/myuser/project/public/html" "foo.html"))
18:04arohnerif that doesn't work, compojure can't help you
18:06somniumis there an M-x butterfly to wrap a region in quotation marks and escape everything inside?
18:09technomancysomnium: " will do that if you have paredit on.
18:10dysingerhiredman: I just got your email - sorry I was out of the country (guatemala) for the last 2 weeks for festivus
18:11somnium... not when it runs into a paren
18:11dysingerlets chat friday
18:16jobSo I'm having trouble coming up with an idiomatic way to go from seqs to hashmaps.
18:16jobAnyone know of a way?
18:17ordnungswidrigjob: seq with kv pairs?
18:17jobright. ([k v] [k v] ... )
18:17Knekkdysinger: how did you like GUatemala?
18:18Chousuke,(into {} '([1 2] [3 4])); job
18:18clojurebot{1 2, 3 4}
18:18joboh, cute.
18:18jobdidn't know about that; thanks much!
18:20ordnungswidrig,(apply hash-map [1 2 3 4])
18:20clojurebot{1 2, 3 4}
18:21jobThat's not quite what I meant, but Chousuke got it.
18:24jobSo how about filtering hash-maps idiomatically? (into {} (filter #'fn map))?
18:26somnium,(filter (fn [[x y]] (even? y)) (zipmap (range 10) (range 1 11)))
18:26clojurebot([1 2] [3 4] [5 6] [7 8] [9 10])
18:27Chousukejob: you don't need the #' :)
18:28Chousukejob: though amusingly enough, it does work
18:28Chousuke(there's just an extra indirection)
18:28jobChousuke: gotcha.
18:29Chousukecoming from CL?
18:29jobyep; though my knowledge of CL is pretty limited
18:30dysingerKnekk: loved it
18:30Chousukein Clojure #'foo is shorthand for (var foo)
18:30dysingerfun times - they love fireworks on holiday
18:30Knekkdysinger: sure do. The metralletas are the best.. string 6-7 together...
18:31Knekkdysinger: did you make it to Antigua and Lake Atitlan?
18:31jobah, interesting; what purpose does it serve?
18:31Chousukeso instead of the function value of foo you get the var that holds the value
18:31Chousukebut it works as a function because vars redirect function calls to their values :P
18:32Chousukevars are the things that hold globally defined values in Clojure (I guess they would be symbols in CL)
18:32Chousukesymbols in Clojure are only names, not actual containers
18:32jobright
18:32dysingerKnekk: I was in Antigua the whole holiday - didn't see much else ):
18:33Chousukewhen there is a reference to a defined var in source code, the symbol is resolved to a var and the var is dereferenced, yielding the value.
18:33Knekkdysinger: where did you stay?
18:35Chousuke,(vector '+, +, #'+, (deref (resolve '+))); hm
18:35clojurebot[+ #<core$_PLUS___4745 clojure.core$_PLUS___4745@11a772d> #'clojure.core/+ #<core$_PLUS___4745 clojure.core$_PLUS___4745@11a772d>]
18:37jobha!
18:37Chousukethe print syntax for functions is rather ugly :P
18:41Knekkah, that's convenient. My grandmother used to take guests, but she stopped a couple of years ago
18:41Knekkerr
18:41Knekk#wrong
18:58jobeirneSo I've got a question of style on my hands
18:59jobeirneI'm coding a robot driver in Clojure; this entails defining one robot struct and then a whole bunch of functions which operate on this robot struct.
19:00jobeirneMy question is: do all of these functions take in an obligatory "robot" parameter, or do I just presume in the definition of each function that we're operating on a global "robot" var?
19:00ChousukeI think either way is fine.
19:00Chousukeif there only ever is one robot
19:01jobeirneI don't think there'd ever be more than one, but you never know.
19:01ChousukeI mean, if there is one robot, having a global var is fine.
19:01Chousukeand it might work for more than one through dynamic binding, but you might run into trouble.
19:03jobeirneTrue.
19:03jobeirneBoth ways feel kind of ugly; I guess I'm just used to OOP.
19:04ordnungswidrigI'd prefere the function to take a robot parameter and some with-robot bindings and macros. so you can always go to the detail level pass a robot instance if desired.
19:04defnjobeirne: if you're clever you can still do a lot of OO-esque stuff
19:04the-kennyI'd prefer the robot-parameter too.
19:04defni mean, you can call Java, for one
19:05ordnungswidrigs/pass/and &/
19:05jobeirnedefn: yeah, true, but I'd like to stick to pure Clojure as much as possible
19:06defnjobeirne: sure, i did that for awhile, but in the end, pure clojure vs java clojure == clojure
19:06defnif you get good with java interop that's a good thing
19:06defnnot something to avoid, fwiw
19:06hiredmanany ideas how I would snag the appegine sdk from google's maven repo with lein?
19:07jobeirnedefn: you know, what you're saying makes sense. I guess I chucked the baby out with the bathwater.
19:08jobeirneFor now I'll go with ordnungswidrig/the-kenny, but long-term I'll look at some java interop.
19:09jobeirnedefn: So you don't think defining a class through Clojure is too big a hassle?
19:10the-kennyjobeirne: No, it's damn-easy
19:10the-kennyjobeirne: http://clojure.org/compilation
19:10hiredmanwhat format does lien's :repositories expect?
19:10ChousukeI'm still not sure if you need a class though
19:11hiredmanI tried to give it a vector of urls, but it does not like that
19:11technomancyhiredman: I think it's a map of repository names to URLs; check leiningen/pom.clj if that doesn't work.
19:11jobeirnethe-kenny: interesting. I'll give it a close look.
19:12ordnungswidrigbedtime for me. cu tomorrow.
19:12the-kennyjobeirne: But you generally only need classes if you want to use them in some java code. If you want to write everything in clojure, you don't really need a class.
19:12the-kennyhm.. same for me. School starts tomorrow here.
19:12the-kennyGood nigh
19:12the-kennyt
19:12jobeirne'night; thanks for the help.
19:12jobeirnewhere do you go?
19:19hiredmangar
19:19hiredman1 required artifact is missing. for artifact: org.apache.maven:super-pom:jar:2.0
19:20hiredmanhttp://gist.github.com/250055 <-- haha first google hit
19:21hiredmanthe first three or four google hits are all lein
19:23defnyeah it's a nice name
19:23hiredmanI didn't google the name
19:23hiredmanI googled the error
19:26hiredmanwell this sucks
19:27technomancyhiredman: super-pom is just maven API speak for "current project"
19:27technomancyit's weird, but I'm not sure if that's something lein can control
19:29hiredmanhttp://gist.github.com/270842 is my project file
19:31hiredmanah
19:31hiredmanI see, so I need to look at whatever was before super pom
19:32technomancyyup
19:36erikcwI've got slime running in aquamacs. I'm able to work with clojure! However, I'm having a hell of a time trying to figure out how to add jars to my classpath. I'm able to add them to my command line REPL (via my ~/.clojure file) but I can't for the life of me figure out how to get them to load in emacs. (I'm trying to get enlive.jar working in particular)
19:37technomancyerikcw: the readme to swank-clojure is pretty descriptive
19:38erikcwmember:technomancy: is this the readme you are referring to? http://github.com/jochu/swank-clojure/blob/master/README
19:39technomancyno, try http://github.com/technomancy/swank-clojure/blob/master/README
19:39technomancythat version is old
19:39erikcw404 error
19:39hiredmannow compojure is giving me the same error because of the alpha->master rename that happened
19:39technomancyerikcw: here it is: http://github.com/technomancy/swank-clojure
19:39defnhiredman: use liebke's
19:39defnor dvg's
19:40defnhttp://clojars.org/org.clojars.dvgb/compojure
19:40defnthat works i believe
19:40defnif it doesn't: [org.clojars.ato/compojure "0.3.1"]
19:40defnoops wrong one
19:41defn[org.clojars.liebke/compojure "0.3.1-master"]]
19:41hiredmanI wonder why liebke's didn't show up in the search
19:41defnsearch is borked
19:41defnsame thing happened to me with clojureql
19:42defnyou can get to it by going to clojars.org/clojureql
19:42defnbut not via search
19:43cemerickI wonder if we can get rhickey to make a benevolent decree w.r.t. maven-based builds so as to simplify the build/distribution landscape. ;-)
19:44defnthe build landscape is varied, but it'll clean up by itself
19:44defnlet the games begin
19:44cemerickI agree, but anything that can prod it along is a good thing, IMO.
19:44cemerickIt's not like there's a solution space to be explored.
19:46liebkecemerick: what's the decree you'd have Rich make?
19:47technomancyrich has more or less indicated that's a problem space he's not interested in IIRC
19:47cemerickyeah, I know, that's why I used the ;-)
19:48cemerickliebke: "be a good neighbor, use maven"?
19:48liebkeah, good luck with that :-)
19:48cemerickI know. :-)
19:49cemerickI've moved from critic to skeptic to convert to zealot in a striking short time.
19:50liebkehaha, it's been great for Incanter, but it has required a lot of expertise from others
19:56hiredmanliebke: did you see my incanter screenshot?
19:57hiredmanhttp://www.thelastcitadel.com/images/Screenshot-Repl.png
19:58hiredmanI should have hovered the mouse over one of the bars so you could see the tooltips
19:58liebkehiredman: I did, very cool!
20:00liebkehiredman: what are your plans for the repl?
20:01hiredmanI don't know
20:01hiredmanit was a whim
20:02liebkeI'd really like to have a simple gui repl to include with the Incanter
20:02KirinDaveI'm having problems writing a mcro
20:02KirinDaveerr, macro
20:02KirinDavehttp://gist.github.com/270865
20:03KirinDaveI want to write addition compojure shorthands in defroutes
20:03KirinDaveBut request, which is filled in inside the macro, is coming out unbound.
20:03hiredmanliebke: the architecture may be a little unusual, and, for example, I used $ too, but that is easy enough to change
20:04KirinDaveWhen I macroexpand something like (GET "/" request) I end up seeing something like "request__857__auto__"
20:04KirinDaveHow do I bind to that in my macro?
20:05hiredmanwhat do you mean "bind to that"
20:05KirinDavehiredman: If I try and use this macro as written, it fails
20:06hiredmanwith what exception
20:06KirinDavescorekeeper.web/request
20:06KirinDaveNo such var: scorekeeper.web/request
20:07hiredmanright
20:07hiredmanyou are doing this with compojure right?
20:07KirinDaveYes.
20:07KirinDaveSo, how do I get my request to match up with theirs?
20:07hiredmanrequest is magic, and only exists in the defroutes macro
20:07KirinDaveSure.
20:08KirinDavehttp://idisk.me.com/dfayram/Public/Pictures/Skitch/web.clj-20100106-171027.jpg
20:08KirinDaveIs exactly what I'm trying, in scorekeeper.web
20:08hiredmanyour best bet is to expand into something like (fn [~'request] code-here)
20:08KirinDaveSo I have to know the underlying structure of the macro?
20:09hiredman*shrug*
20:09hiredmanI don't know the underlying structure of the macro
20:09KirinDaveAnd what does ~'require do ?
20:09hiredmanit lets you shadow a name
20:09hiredmanbad bad
20:09KirinDaveUm… how would that solve my problem?
20:09hiredmancompojure's defroutes can take functions
20:10KirinDaveOkay… but...
20:10hiredmanthe argument to those functions when they are called is the request map
20:10KirinDaveIt seems weird that clojure is freaking out at this macro definition.
20:10KirinDaveSince it's valid when it's actually instantiated.
20:11KirinDaveI draw the conclusion that this is a limitation of clojure's macro system.
20:11hiredmanI don't care
20:12KirinDavehiredman: … Then why did you start talking to me to begin with?
20:12hiredmanI don't care about what conclusions you draw
20:12KirinDaveYou are like night and day dude.
20:12hiredmanI am, trying to help you get from point a (not working) to point b (working)
20:12KirinDaveSometimes helpful and cool. Sometimes not.
20:13KirinDaveThank you for the fn tip
20:13hiredmandefrouts could literally being doing *anything* under the covers
20:13KirinDavehiredman: I want to understand clojure macros better, that's why I'm doing it this way.
20:13KirinDaveit working is entirely secondary.
20:13KirinDaveI've only got 2 resource types.
20:14KirinDaveSo "working" is copy-paste-done.
20:15hiredmanif you use some rough idea of what defroutes does (which may or may not jive with what it does) and write your own macro that could do anything, it may or may not work, if you write a macro that uses a mechanism you know defroutes can handle (single arg function) then it will work
20:15cemerickheh, I just sent a really bone-headed msg to the compojure mailing list :-/
20:16hiredmanthe other option is ripping open defroutes, and digging through macro expansions and gensyms
20:16KirinDaveWell this macro would work in common lisp. I know because I pulled out SBCL and did something very much like it just to make sure I remembered how it worked over in a more familiar land.
20:16KirinDaveBecause "request" would be bound where compiled.
20:16KirinDaveAnd it'd be compiled in the defroutes form, which would have already been expanded.
20:16arohnerKirinDave: your original macro, using "request#" uses gen-sym to make a new variable with the name request__1234__, where 1234 is an arbitrary number
20:17arohnerthat's the default, because it's safer
20:17KirinDavearbscht: I don't use request#.
20:17arohnerif you really, really want to stomp on the variable, "request", you use ~'request, which says "no really, use request, I know what I'm doing"
20:18hiredmanKirinDave: that is make assumptions about the scope of the name "request" and how it is bound
20:18hiredmanmaking
20:18arohneroh, then defroutes is
20:18hiredmanwhich you cannot really know about unless you open up defroutes, which I really don't want to do, so (fn [~'request] ~@body)
20:18KirinDavearohner: Almost certainly, as it has that __auto__
20:19arohnera nicer way to do this would be to make a middleware function for the routes you want to treat this way
20:19arohneroh, I see what you're trying to do
20:20KirinDavearohner: Yes. And ~'request does it.
20:20KirinDaveThat's interesting
20:20arohneryou can pass a regex to the route
20:20KirinDaveSo clojure macros are semi-hygenic by default.
20:20KirinDaveAs in it tries to bind every expanded symbol as tightly as possible, like at definition time.
20:20arohnerKirinDave: yes. I would call it mostly-hygenic
20:20KirinDaveIt's done at the time and in the place where it's defined then?
20:21arohnerIt does it at macro expansion time, I believe
20:21technomancyKirinDave: actually it's the backquote that expands the symbols, it's just that most macros use backquote</nitpick>
20:22KirinDaveThat's a very interesting policy
20:22KirinDaveSo conceptually ~' is a trapdoor that says "No really really really defer this symbol binding."
20:23KirinDaveThanks arohner.
20:23arohnerright
20:23arohnernp
20:23arohnerFYI, I solved a similar problem by doing
20:24arohner(routes* (GET my-regex ...))
20:24arohnerusing () in your regex will show up in the route params
20:24arohner(:route-params request) will contain the back references
20:25KirinDaveRight, this form just generalizes that
20:25KirinDaveFor some specific resources.
20:25KirinDaveSo that they're pulled by extension.
20:26KirinDavethanks!
20:36hiredmanI'm trying to write a lein plugin, and lein help shows "appengine-setup" but lein appengine-setup says appengine-setup is not a task
20:38hiredmanoh, hoho
20:38hiredmanclojurebot: hiredman
20:38clojurebothiredman is lazy
20:38hiredmanclose
20:38hiredmanclojurebot: hiredman
20:38clojurebothiredman is an evil genius.
20:38hiredmannot quiet
20:38hiredmanclojurebot: hiredman
20:38clojurebothiredman <3 XeLaTeX
20:38hiredmantrue
20:38hiredmanclojurebot: hiredman
20:38clojurebothiredman is lazy
20:38hiredmanI guess that will have to do
20:40technomancyhiredman: is there a leiningen.appengine-setup/appengine-setup fn defined?
20:41technomancyhelp only checks the namespaces, it doesn't make sure there's a corresponding function
20:41hiredmanmy fault
20:42hiredmanI was editing a file leiningen.appengine_setup.clj instead of leiningen/appengine_setup.clj
20:59q1clojurebot: clojurebot
20:59clojurebotclojurebot will become skynet
20:59q1:(
21:12scottj_Did there used to be a bunch of p functions like preduce and pfilter that have since been removed?
21:16JonSmithi think so
21:40mebaran151there use to be some forkjoin stuff that's getting replaced
21:40mebaran151all that's left is pmap I think
22:02polypusjust installed 1.1.0. do i need to require deftype, i'm getting an unresolved symbol
22:03polypus~ping
22:03clojurebotPONG!
22:04JonSmithwhere do you go if you found a bug in a contrib module?
22:07polypushuh, i just read through the changes file for 1.1 and it doesn't mention deftype. didn't it make it into this release?
22:20polypusrunning master snapshot from here: http://build.clojure.org/job/clojure/lastSuccessfulBuild/artifact/clojure.jar and deftype is still not defined. i must be missing something. anybody?
22:25chouserdeftype is still only in the 'new' branch
22:26polypusty chouser. just got that working 3 seconds ago
22:26chouserheh sorry
22:26polypusno worries. thx
22:26durka421(doc if-let)
22:26clojurebot"([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
22:26chousermay 1.2 come quickly...
22:26durka421^ what is oldform?
22:27polypuspraise the lisp
22:27durka42in the source there's an assert-args that says oldform must be nil. is it something deprecated?
22:27chouserdurka42: yes, deprecated
22:28chouserdurka42: if-let used to be (if-let x (expr) then else)
22:28durka42it would give a really cryptic error, though
22:28durka42oh, i see
22:29chouser,(if-let x 1 :then :else)
22:29clojurebotjava.lang.IllegalArgumentException: if-let requires a vector for its binding
22:29chousernice pretty error, actually.
22:29chouserit'd probably be safe to get rid of those messages now.
22:34polypusin some of the scattered deftype example code that shows up in google the type names are sometimes capitalized. (deftype Foo ...). i suppose it's too eraly to ask if this should be considered idiomatic?
22:35polypusearly*
22:35chouserI think type and protocol names will be capitalized like java class and interface names are.
22:37polypusk, ty
22:54polypus(isa? (type 4) Integer) -> true
22:54polypus(deftype Foo []) (def foo (Foo))
22:54polypus(isa? (type foo) Foo) -> false
22:55polypuswould be nice if you didn't need to go ::Foo
22:57chouserI think that's required in order to allow you to redefine Foo dynamically.
22:58polypusahh cuz it's an anon class?
23:01polypusalthough isa? could be redifined to treat functions differently, and type constructors could have metadata to make that work.
23:54hiredmanhttp://code.google.com/p/maven-gae-plugin/issues/detail?id=26 <-- gah
23:55hiredmanso you can't get the appegine sdk via maven, how lame