#clojure logs

2011-06-23

00:37rhdoengesI am proficient with vim and learning clojure. Is vimclojure/slimv effective or should I just learn emacs?
00:38Scriptorrhdoenges: I've heard some complaints about it, and learning the basics of emacs isn't too hard
00:40rhdoengesScriptor: I guess I'll go watch the PeepCode screencast about emacs.
00:42rhdoengesI might as well learn emacs if I'm going to be learning clojure; I can kill two birds with one stone
00:55scgilardiinc
00:55amacdec
00:55amalloy(juxt inc dec)
00:58amacthat is very zen.
01:01rhdoenges#(dec (inc %))
01:02amalloyamac: juxt is always the right answer
01:06rhdoengesbut what is the question
01:09amacjuxt is also the question
01:13rhdoenges,(map #(% 1) ((juxt juxt juxt) inc dec))
01:13clojurebot([2 0] [2 0])
01:13rhdoenges(juxt juxt juxt)
01:16Scriptor,(doc juxt)
01:16clojurebot"([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
01:18rhdoenges,(map #(flatten (% 1)) ((juxt juxt juxt) inc dec))
01:18clojurebot((2 0) (2 0))
01:18rhdoenges,(flatten (map #(% 1) ((juxt juxt juxt) inc dec)))
01:18clojurebot(2 0 2 0)
01:19rhdoenges[I like juxt. I dislike juxt.]
01:34halfprogrammer[I Ꞁıʞǝ ɾnxʇ˙ I pıslıʞǝ ɾnxʇ˙]
01:36rhdoengeshalfprogrammer: shit is deep, man.
01:36halfprogrammerrhdoenges: ɥǝ ɥǝ ɥǝ
01:37rhdoengeshalfprogammer: what are you using to generate that text?
01:37Scriptorrhdoenges: it's somewhere online, just google for 'upside down text'
01:37halfprogrammerrhdoenges: I am using weechat for irc. There is a 'flip' plugin available for that
01:38rhdoengesI shall try to write it in clojure now.
01:59amalloyrhdoenges: write it in clojure? isn't it basically: (1) look up unicode for upside-down letters, (2) type in a hashmap literal?
02:14zakwilsonYour new password is clojureql.core.RTable@bb998e4d <-- I don't think that's quite right.
02:19hiredmanI bet those password strength widgets would give it a pass
02:34amalloyhiredman: two pairs in a row of repeated characters? laughably weak
02:43rhdoengesamalloy: I'm learning clojure. it will be good for me
02:44rhdoengesamalloy: also I'm curious about stdout/stdin
02:44amalloyrhdoenges: cool beans. every problem is a good candidate for a learning project
02:46amalloyi love clojure (functional programming in general, i guess?). if my code compiles, nine times out of ten it yields the right answer
03:00sunniboI'm making a twitter client with clojure-twitter. (twitter/favorites) works well, but (twitter/destroy-favorite) does'nt work. it generates a 400 error and tells me that I have to use GET method. it's weird.
03:01sunnibohttp://dev.twitter.com/doc/post/favorites/destroy/:id says the supported request method is POST and DELETE
07:42void_how do I turn {:a 1 :b 2} into (list :a 1 :b 2) ?
07:42opqdonut,(apply concat (seq {:a 1 :b 2}))
07:42clojurebot(:a 1 :b 2)
07:43opqdonut(the order of the key-value pairs will be undeterministic)
07:43opqdonut(unless you use sorted-map)
07:46void_doesn't matter, thanks!
08:00jaju,(+ 1 2)
08:00clojurebot3
08:00jaju(+ 1 2)
08:00clojurebot3
08:03solussdclojure is deterministic!
08:04solussd(* 1 2)
08:04clojurebot2
08:04solussdhm
08:05jaju(println "hello")
08:05opqdonut,(println "hello")
08:05clojurebothello
08:05opqdonutslightly different
08:06jajuoh thanks!
08:06jajuinteresting
08:06jajuclojurebot accepts function definitions too?
08:06jajutrying
08:06jaju(defn mul [x y] (* x y))
08:06jaju,(defn mul [x y] (* x y))
08:06clojurebotDENIED
08:07jaju,(defn mul [x y] (* x y))
08:07clojurebotDENIED
08:07jajuoh cool!
08:07Fossinope
08:07Fossiit's sandboxed
08:07Fossiand def is evil ;)
08:07jajumy first time here - so, exploring a bit :)
08:07manutterI think you can use letfn to make temporary functions though
08:07Fossiyou can also message it in private
08:07jajucool stuff!
08:07Fossiif you wanna toy around a whole lot :)
08:08manutter,(letfn [(plus [a b] (+ a b))] (plus 1 2))
08:08clojurebot3
08:08manutterheh :)
08:08jajuoh no - just exploring. I'd rather have clojure discussions! :)
08:08jajucool - thanks for the tip
08:08Fossithere's also sexpbot and another one
08:08Fossi#()
08:08manutterThe letfn is more useful on 4clojure.org
08:08Fossi#(= 1 1 )
08:08jajumaybe - when I do not have a clojure repl around, this might be handy!
08:08Fossi#(+ 1 1)
08:09manutter##(= 1 1)
08:09sexpbot⟹ true
08:09Fossiah, that was it
08:09manutterI've seen some cool bot commands but I don't remember may of them
08:09jaju##(+ 1 1)
08:09sexpbot⟹ 2
08:09manutter~botsnack
08:09clojurebotThanks, but I prefer chocolate
08:09jajunice
08:09manutter~chocolate
08:09clojurebotNo entiendo
08:10jajuhaha
08:10manutterclojurebot: you lie.
08:10clojurebotGabh mo leithscéal?
08:10manutterclojurebot: help
08:10clojurebothttp://www.khanacademy.org/
08:10manutterlol
08:10jaju:)
08:10jajuclojurebot: what's your name?
08:10clojurebotamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
08:11manutternot the answer I was looking for, but a good link nonetheless
08:13jaju~corn
08:13clojurebotHuh?
08:13jaju~corn
08:13clojurebotexcusez-moi
08:13jaju~coffee
08:13clojurebotPardon?
08:14jaju(doc +)
08:14clojurebot"([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0."
08:14jaju(source +)
08:14jaju,(source +)
08:14clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
09:13manutterI shiver a little when I have to document code that uses variables like $magic_function_name
09:16manutterthen again, it IS php...
09:40kryftHmm, what's the difference between PersistentArrayMap and PersistentHashMap? JoC apparently refers to the former as a hash map.
09:44manutterI'm getting the impression that PersistentArrayMaps maintain order but can't hold as many values, whereas PersistentHashMap can be bigger but does not maintain order
09:45manutterThat's googling for both terms and skimming a few blogs, so don't quote me
09:46TobiasRaederyeah just based on the names the array map probably holds all data in an array the hash map in a hash based tree/trie
09:46TobiasRaeder-> lookups in long/large arrays might get expensive but should keep insertion order
09:46TobiasRaedersince the hashmap will distribute the data based on the hashes there is no way to reconstruct the insertion order
09:47TobiasRaederbut faster lookup on larger maps
09:47TobiasRaedersame here - dont quote me on it ;) just a quick look at the implementation and thinking about the names
09:50kryftSounds logical. I was just confused by JoC page 98: ".. a new hash map can be created idiomatically ..: (into {} [[:a 1] [:b 2]])
09:50kryft"
09:52TobiasRaederyeah
09:52TobiasRaeder{} creates an array map and not a hash-map
09:52TobiasRaederseems like a typoe
09:52pjstadigThe ordering of keys by PersistentArrayMap is just coincidental, and not a guarantee, the array map is just faster for smaller number of keys, and automatically promotes to a PersistentHashMap at some threshold (8 keys I think)
09:52TobiasRaedermhm
09:52TobiasRaeder&(class (hash-map))
09:52sexpbot⟹ clojure.lang.PersistentArrayMap
09:53TobiasRaederthats really interesting
09:53manutter&(class {})
09:53sexpbot⟹ clojure.lang.PersistentArrayMap
09:53kryft&(class (hash-map :a 1))
09:53sexpbot⟹ clojure.lang.PersistentHashMap
09:53pjstadigi think the term "hash map" can be applied to both since they both implement the same set of methods
09:53pjstadigi wouldn't get hung up on the names
09:54manutter&(class {:a 1 :b 2 :c 3 :d 4 :e 5 :f 6 :g 7 :h 8 :i 9})
09:54sexpbot⟹ clojure.lang.PersistentHashMap
09:55manutterYeah, I think "hash map" is a non-implementation-specific term meaning "access values by key"
09:55pjstadig,(class {:a 1 :b 2 :c 3 :d 4 :e 5 :f 6 :g 7 :h 8})
09:55clojurebotclojure.lang.PersistentArrayMap
09:55pjstadig,(class {:a 1 :b 2 :c 3 :d 4 :e 5 :f 6 :g 7 :h 8 :i 9})
09:55clojurebotclojure.lang.PersistentHashMap
09:55manutterPHashMap vs PArrayMap are just implementation details that should be ignored in most cases.
09:56djpowellHmm, is there a bug with aset on 2-d arrays?
09:56djpowell,(aset (make-array Integer/TYPE 3 3) 0 0 1)
09:56clojurebot1
09:56djpowellgrr
09:56djpowell#(aset (make-array Integer/TYPE 3 3) 0 0 1)
09:56manutter,(doc make-array)
09:56clojurebot"([type len] [type dim & more-dims]); Creates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."
09:56djpowellwhat ver is sexpbot, and how do i talk to it?
09:57manutter&(doc make-array)
09:57sexpbot⟹ "([type len] [type dim & more-dims]); Creates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects f... http://gist.github.com/1042576
09:57mrBliss&(clojure-version)
09:57sexpbot⟹ "1.2.0"
09:57djpowell&(aset (make-array Integer/TYPE 3 3) 0 0 1)
09:57sexpbot⟹ 1
09:57mrBliss,(clojure-version)
09:57clojurebot"1.2.0"
09:57djpowell&(clojure-version)
09:57sexpbot⟹ "1.2.0"
09:57djpowellah
09:57manutter(doc aset)
09:57clojurebot"([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."
09:57djpowellok - it fails in clojure 1.3
09:57pjstadigneither of the bots is running 1.2.1...tsk tsk
09:58manutter(insert famous obiwan quote here...)
10:01djpowellit seems to be a bug anyway, i'll file a report
10:09djpowellah, it is the new default behaviour of longs that is doing it - the aset value is getting converted to a Long rather than an Integer
10:10djpowelloh, hang on; the aset-int method works. everyone normally seems to suggest avoiding that
10:10gfrlogI am getting very strange behavior from "lein uberjar" -- it's throwing a java.util.zip.ZipException for various files in src/resources/public
10:11gfrlogdoesn't seem to be a particular file, because renaming or deleting the offending file doesn't help
10:11djpowellon windows?
10:11gfrlogI should say the exception message is "duplicate entry: <filename>"
10:11gfrlogI'm on linux
10:12djpowellah k. I seemed to have an issue with odd file permissions recently, but it doesn't sound like that
10:12gfrlogguess I should see if "lein jar" fails as well
10:12djpowelldo you have a file of the same name in src and resources?
10:12gfrlognope
10:12gfrlognothing weird like that
10:13gfrlogsame exception for "lein jar"
10:14gfrlog"lein ring server-headless" succeeds though, and I believe it properly serves the files in src/resources/public
11:01pyrclojure 1.3 has a deref with timeout and timeout-val possible,nice!
11:16technomancygfrlog: there's probably a duplicate in your dependencies. maybe uberjar needs debug logging to track that kind of thing down
11:21fliebelLife is still a vector.
11:26chouser##(= == =)##
11:26sexpbot⟹ false
11:26chousergood, just checking.
11:26Fossi#(- _ -)
11:26Fossi##(- _ -)
11:26sexpbotjava.lang.Exception: Unable to resolve symbol: _ in this context
11:26TobiasRaederwhat is the most idiomatic way to convert a string to an int?
11:27pjstadigInteger/parseInt
11:27Fossii thought there was a wrapper somewhere
11:27TobiasRaedermhm
11:27TobiasRaederkk
11:27TobiasRaederif i find it ill use it otherwise just write something
11:28jcromartiewhat do y'all think of DDD? http://domaindrivendesign.org/resources/ddd_terms
11:28jcromartieseems like a good match
11:28chouserparseInt is good. You can use (read), but you may be surprised by the results.
11:28manuttera good match for clojure?
11:28manutterjcromartie: ^^
11:29jcromartieyes manutter
11:29tomojthe DDD book I have has like three good chapters then a bunch of OOP BS
11:29jcromartiehah
11:30tomojguess I ought to slog through it to try to get the point anyway :/
11:34jcromartieI think that glossary maps really nicely to lots of clojure concepts
11:34jcromartieespecially the difference between value and identity
12:14timvisherhi all
12:14arohnertimvisher: hi
12:14timvisheris there a function I can easily combine with some that will return the thing matched from a seq?
12:14timvisherhoo boy that was a bad explanation.
12:14timvisherlet me gist something
12:15timvisherhttps://gist.github.com/1042882
12:15timvisherbasically, i find myself someing over a seq a lot and then returning the thing that I was searching for by duplicating it
12:15timvisherbecause the only thing I know to do is to use =
12:16timvisherwhich is a predicate
12:16arohnerthe return value of some is the thing it matched
12:16timvisheri know
12:16timvishernot quite though
12:16timvisherit's the return value of the function that returned non-nil
12:17timvisherso in other words, ,(some #(= 1 %) [1 2 3 4 5])
12:17timvisher,(some #(= 1 %) [1 2 3 4 5])
12:17clojurebottrue
12:17timvisherwhereas
12:17timvisher,(some identity [nil nil 1])
12:17clojurebot1
12:17arohner(some #(if (= "png" %) % nil) extensions)
12:17mrBliss,(or (first (filter #(= 1 %) [1 2 3 4 5])) :else)
12:17clojurebot1
12:18arohneroh yeah. I do first filter a lot
12:18timvisherarohner: wow, not sure why i didn't think of that
12:18timvishergoes to show how blind you can get when you're stairing at your own code
12:18timvisherthanks for the tips, arohner and mrBliss
12:28gfrlogdeffing things that depend on IO is really messy I'm finding out :(
12:28tomojisn't #(if (= "png" %) % nil) #{"png"}
12:29no_mindany plans for proposing clojure miniconf at linux.conf.au ?
12:29tomoj,(doc some)
12:29clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
12:29arohnertomoj: doh. yeah, that's better
12:50redline6561_Hi. Sorry if this question is dumb but are there plans to extend leiningen to handle a use-case more like cljr? My background is CL and I miss being able to fire up SLIME and have access to all my globally installed libs. :-P
12:53manutterredline6561_: Have you looked at jark?
12:53redline6561_manutter: Nope. Haven't heard of it.
12:54davekongIs using a map or doing the equivalent with a list comprehension more efficient? Is one way considered more idiomatic than the other?
12:54manutterah, you might like it, http://icylisper.in/jark
12:54technomancyredline6561_: why not create a project to contain your libs?
12:54manutter(I think that's the right url...)
12:54manutter(yeah, that works)
12:55redline6561_technomancy: Mostly to be able to experiment with new libs and try things that I might not necessarily have a specific project in mind for.
12:55redline6561_Admittedly, I could have (or leiningen could ship with) a default/experiments project for screwing around.
12:55redline6561_It's just extra work vs my old start emacs, M-x slime process...so I was curious. :)
12:56redline6561_manutter: Interesting, thanks!
12:56technomancyredline6561_: well, the JVM prevents you from adding new deps without restarting anyway
12:56technomancyso it's never going to be like CL
12:56cemericktechnomancy: maybe have `lein repl` add the most recent versions of all artifacts in ~/.m2 to the classpath if there's no project.clj? :-P
12:56redline6561_technomancy: :( Yeah, that's the impression I got.
12:56technomancycemerick: can't tell if you're serious. =)
12:57redline6561_cemerick +1000
12:57cemericktechnomancy: sure, why not? Print a warning, maybe with a link that explains what's going on, and let 'em have at it.
12:57pjstadigugh
12:57manutterwhat if your .m2 contains incompatible libs?
12:58pjstadigterrible idea
12:58technomancydoesn't perf degrade with a ginormous classpath?
12:58sotHi, Does anyone know in what new module str-join is in?
12:58cemerickonly when loading resources
12:58manutterbut while we're on this topic, does lein support like a user.clj global file?
12:58cemerickClearly not intended for "real work" — but it'd be hard to beat for experimentation and newbies.
12:58technomancymaybe a separate "mega-repl" task; probably not suitable for the default
12:59pjstadigmanutter: clojure supports it,if it's on the classpath
12:59manuttermaybe lein isn't the right place for that, though
12:59redline6561_mega-repl sounds acceptable to me.
12:59technomancymanutter: there's ~/.lein/init.clj which runs in lein's process
13:00manutteryeah, I'm trying to figure out how to have some util routines that are available whenever I fire up a repl
13:00redline6561_I like clojure a lot and have been glad to see leiningen gain traction...but the remaining extra functionality found in cljr/jark/cake is functionality I really like.
13:00redline6561_Would prefer not to have several build/lib tools.
13:00redline6561_Mega-repl is certainly the main thing in my mind. Less concerned with scripting + persistent jvm.
13:00technomancyI've yet to see a convincing explanation for how that's different from just creating a throwaway project
13:01technomancybut mega-repl would be easy-peasy to implemnet as a plugin
13:01cemerickredline6561_: I think we're going to see continued proliferation of such tools for a while.
13:01manutterbut if I just do clojure-jack-in then I haven't necessarily launched my repl from lein, so lein isn't the right place for it
13:01technomancymanutter: maybe you want user-level plugins?
13:01redline6561_That's totally fair, not trying to be pushy. It was just a late evening and I went, "Ugh. Create a pretend project? No." and went to bed.
13:01manutterredline6561_: it seems to me that the focus of lein and jark are somewhat different, build tool vs repl tool
13:02redline6561_^^ technomancy. It's certainly a workable solution, if not an ideal one.
13:02redline6561_manutter: True. cemerick: Duly noted. Thanks.
13:02technomancyredline6561_: I think psychologically it's different. I'm just not sure if technically it is
13:02redline6561_UX is all about psychology. :)
13:02technomancymaybe if there were just a project auto-generated in ~/.lein/scratch or something
13:02redline6561_Technically, yeah, it's pretty much identical.
13:03manuttertechnomancy: if I install a plugin with "lein plugin install", does that make it available to all my projects automatically?
13:03technomancymanutter: yeah
13:05manutterOk, so I create a project with lein new, but then I just fire up emacs and do clojure-jack-in, will it stlll be there?
13:05redline6561_technomancy: Thanks for leiningen. Excited for search in 1.6. Will be quite nice for a Quicklisp guy like myself. :D
13:06technomancymanutter: sure
13:06arohnerdavekong: no, one isn't more idiomatic than the other. it's user preference
13:06manuttertechnomancy: cool! I'd have thought you needed a lein swank or something, but this suits my purposes
13:07technomancyjack-in just delegates to swank
13:08mattmitchellhow can i easily convert a hash map into a vector: {:names ["one" "two"] :id 100} would become [:names ["one" "two"] :id 100] ???
13:08pjstadigstarting a repl is not the same thing as a build tool, and perhaps having a standard CLI for clojure would be a better solution
13:08mattmitchell(map vec {}) almost does it, but I want the top level flattened
13:09gfrlogmattmitchell: ##(apply concat (seq {:names ["one" "two"] :id 100}))
13:09sexpbot⟹ (:names ["one" "two"] :id 100)
13:09mattmitchellgravity: awesome thank you
13:09gfrlogI guess pass that to vec if you really do need a vector
13:09technomancypjstadig: a novel idea!
13:09gfrlogmattmitchell: no problem :)
13:10gfrlog##(mapcat {:names ["one" "two"] :id 100})
13:10sexpbotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$map
13:10gfrlog##(mapcat identity {:names ["one" "two"] :id 100})
13:10sexpbot⟹ (:names ["one" "two"] :id 100)
13:10gfrlogmaybe that's a little simpler
13:12mattmitchellgfrlog: cool, yeah i like that
13:14gfrlogmattmitchell: note that the order of the pairs is not defined
13:15mattmitchellgfrlog: you mean ordering of the keys could possibly change?
13:26gfrlogmattmitchell: yes
13:26gfrlog,(map seq [{:foo 1 :bar 2} {:bar 2 :foo 1}])
13:26clojurebot(([:foo 1] [:bar 2]) ([:bar 2] [:foo 1]))
13:27gfrlogthat is apparently a bad example
13:27gfrlogprobably small maps use arrays
13:27gfrlogbut I don't think that's something you're supposed to depend on
13:28mattmitchellgfrlog: ok, so is it possible a key/value could get messed up in the resulting list?
13:28gfrlogmattmitchell: I mean that you should assume {:foo 1 :bar 2} could come out either as [:foo 1 :bar 2] or [:bar 2 :foo 1]
13:28gfrlogbut NOT anything like [:foo 2 :bar 1] or [1 2 :foo :bar]
13:28gfrlogat least not with the code we used above
13:28mattmitchellgfrlog: ahh ok yes, that's fine
13:29mattmitchellthank you for clarifying
13:29gfrlogno problem
13:31gfrlogtechnomancy: removing my src/resources directory causes the [uber]jar tasks to succeed -- does that go along with or contradict your "duplicate dependencies" suggestion?
13:32technomancygfrlog: must be a dupe between your project and a dep then
13:32technomancyif the error message doesn't make it clear what file is conflicting, that should be addressed
13:33gfrlogtechnomancy: it does, but each time I delete a file a new file is the culprit. Some of the files have rather unique names too
13:33technomancydo you have your own project as a dependency? =)
13:33gfrlogI have 4 files in src/resources total, and it blamed all 4 of them as I deleted the others
13:34gfrlogtechnomancy: I hope not :)
13:34gfrlogtechnomancy: the project's not on clojars or anything like that
13:35gfrlogtechnomancy: I guess I'll start hacking away at the project until I get a minimal example of the error
13:37technomancygfrlog: actually uberjar keeps a running set of all files already included and automatically omits dupes
13:37technomancyso somehow your project is working around that
13:37gfrlogtechnomancy: did I mention than "lein jar" fails the same way? so it's not an uberjar thing
13:37technomancyoh, I didn't catch that
13:39gfrlogtechnomancy: and "lein ring server" succeeds, and the app correctly serves the static files from src/resources
13:39gfrlogI've never had an issue with that, and also never tried building a jar until now
13:52gfrlogI bet this is me not using :resources-path correctly
13:52gfrlogcuz I have the project down to about nothing and it's still failing
13:54cemerickdnolen: See, it looks like you have quite the cheering section, at the very least. :-)
13:55dnolencemerick: heh
14:01gfrlogtechnomancy: if this isn't a minimal example I don't know what is :) https://github.com/fredericksgary/isuckatlein
14:02gfrlogI'm sure it'll end up being some missing key in the project.clj
14:04dnolenthough it's a bit disappointing that people think types for Clojure are "advanced", "hard". A logic engine gives you most of a type system for "free". The HM type checker for Prolog is 890 LOC. I don't expect a HM type checker on top of core.logic for Clojure to be significantly more than that.
14:05dnolenin Typed Racket it sounds like a lot of the actual complexity comes from integrating untyped code.
14:09technomancygfrlog: mv src/resources .
14:09technomancyit's odd that it would fail that way though
14:10amalloytechnomancy, gfrlog: foo-whatever.bar is on the classpath twice, with different paths. that sounds to me like a bad plan
14:10technomancyI see what's going on; the mechanism for trimming the filename is the same for files in src or in resources
14:10technomancyso it gets confused if there is overlap
14:10technomancyhowever, there shouldn't bever be overlap
14:11pyrhey
14:11gfrlogso I'm misunderstanding how to use :resources-path?
14:11pyri'm having a clojure problem that's related to my understanding of java i think
14:11technomancygfrlog: you only set :resources-path if for some reason you don't want to keep your resources in the resources/ dir in the project root
14:12technomancyif resources/ exists, it will use it without any configuration in project.clj
14:12pyri have an exception occurring nested within futures and when I catch it and print the full trace
14:12gfrlogtechnomancy: okay. I guess I don't mind moving it.
14:12pyrit seems it doesn't go "deep" enough
14:12technomancygfrlog: in fact, resources is explicitly for things that don't belong in src anyway
14:12technomancyso src/resources is kind of contradictory
14:12amalloypyr: each thread has its own stack
14:13pyrhttp://pastie.org/2112344
14:13gfrlogtechnomancy: how about this: :dev-resources-path "test/resources"
14:13pyramalloy: the pastie is the function I use to catch the trace
14:13gfrlogtechnomancy: i.e., is there a better place for dev-resources?
14:14technomancygfrlog: same thing; just mkdir test-resources
14:14technomancy(will be moved to dev-resources in 2.0)
14:14gfrlogtechnomancy: okay. Cool, thanks.
14:14amalloypyr: you're explicitly catching e and e.getCause
14:14amalloywhat about the cause of the cause of e?
14:14technomancyno need for all this nesting
14:14amalloyand so on down the line
14:15hiredman,(doc root-cause)
14:15clojurebotI don't understand.
14:15hiredmanclojurebot: jerk
14:15clojurebotGabh mo leithscéal?
14:15hiredman,(require 'clojure.stacktrace)
14:15clojurebotnil
14:15hiredman,(doc root-cause)
14:15clojurebotExcuse me?
14:15pyrah ok
14:15amalloywhen java prints a stacktrace, it explicitly runs through all the nested .getCause's and prints them all. you only do two
14:15hiredmanclojurebot: for real?
14:15clojurebotGabh mo leithscéal?
14:16pyrok, alright, I didn't get what getCause was, didn't read thoroughly enough
14:16pyrso yeah, I should instead loop while getCause returns something
14:16pyrand print my trace
14:17pjstadigor just use clojure.stacktrace/root-cause
14:17pjstadigi think hiredman is trying to tell you that root-cause already does the looping for you
14:17pjstadig'(doc clojure.stacktrace/root-cause)
14:17pjstadig,(doc clojure.stacktrace/root-cause)
14:18clojurebot"([tr]); Returns the last 'cause' Throwable in a chain of Throwables."
14:18amalloypjstadig: but it doesn't
14:18amalloywell. it does. but it only returns the last exception, not all the ones on the way
14:18pjstadigsure
14:18pjstadigbut usually the last one is the interesting one
14:19pyrthanks for the clarifications anyhow :)
14:19pyri still get lost in java details, my burden for coming from a non jvm background i guess
14:22pyreasier than I had feared, thanks to leiningen mostly
14:22gfrlogI'm a fan of leiningen
14:33timvisheranyone know off the top of their heads how to get clj-time (or joda time) to honor DST?
14:33choffsteinHey all. I have developed a jetty app that runs perfectly on my local machine when I run it as a jar, but I would like to deploy it as a war. I've heard this can be done with a few leiningen plugins, but am having some serious trouble figuring out how to package it all up and how to construct my servlet. Anyone here familiar with building and deploying jars that wouldn't mind me asking them a few questions in private?
14:34choffstein(only to not clutter this channel with stupid questions)
14:34timvisheri thought it did it automatically but i'm seeing incorrect results that are an hour slow
14:34timvisherchoffstein: go for it, bro. i do nothing but ask stupid questions here and i haven't been banned yet!
14:34timvisher'fraid i won't be much use to you, though
14:34Scriptorchoffstein: don't worrying about cluttering the channel, it's not all that busy
14:34timvisheri'm still pre-deployment with my web app
14:35Scriptorand other might be interested in the discussion!
14:37choffsteinWell, I guess the first question would be is: does anyone know of a very, very barebones example of a lein project set up to be deployed as a war using ring?
14:38choffsteinEvery tutorial online seems to do it a different way
14:38timvisherchoffstein: what about this? https://github.com/weavejester/compojure-example
14:38choffsteinThe second question would be: I use a "public" directory for my static files (css / javascript) in the root directory of my lein project -- any idea how to get this wrapped in to my war file?
14:39ibdknoxyou just need to put it in a resources folder
14:39timvisherin fact, is this what you're looking for? https://github.com/weavejester/lein-ring
14:41choffstein...wow, that was simple
14:41choffsteinI need to stop spending 2 hours trying to solve things myself and just come ask you guys
14:41timvisher,drinks
14:41clojurebotjava.lang.Exception: Unable to resolve symbol: drinks in this context
14:41timvisherboo
14:41timvisherused to #emacs
14:41timvisheranyway,
14:41timvisherdrinks all around!
14:42timvishercan anyone help with my clj-time question?
14:42timvisherwhy might it not appear to be honoring DST?
14:48choffsteinAny idea why ring's warp-file might not be playing nice with the resources folder?
14:48choffsteine.g. saying files not found?
14:50timvishernot off hand but you could verify through an http watcher that the paths are actually correct
14:51timvisherI had issues with utf-8 in my app
14:53timvisherunfortunately, i only know ring as it's exposed by compojure
14:53choffsteinholy shit. it works...
14:53choffsteinThis isn't supposed to work...
14:55timvisherheh
14:55timvisherthat could be a good thing
15:03timvishercan anyone help with my clj-time question?
15:03timvisherwhy might it not appear to be honoring DST?
15:04amalloytimvisher: not really enough information there for anyone to help, i think? i don't know anything about clj-time, but if i did i don't think i'd know what, specifically, your problem is
15:05timvisherlet me explain then
15:05timvisheri'm playing with clj-time at the repl
15:06timvisherI do (now) and it returns, as expected, this instant in GWT
15:06timvisherGMT*
15:06Somelauw(- \h \a)
15:06timvisherexcept that instead of 20 being returned for (hour (now))
15:06timvisherI get 19
15:07Somelauw= 7 or something in java. But can I get the same result in clojure without translating to int?
15:07timvisheras if DST wasn't in effect at the moment
15:07jcromartieSomelauw: no
15:07timvishermake sense?
15:07timvishereverything I've read about joda time is that it handles DST automagically
15:07jcromartieSomelauw: (defn char- [& chars] (apply - (map int chars)))
15:08jcromartieand if you want, (defn char- [& chars] (char (apply - (map int chars))))
15:08jcromartieto keep it in the char type
15:08jcromartieso, (char- \z 1) => \y
15:09Somelauwokay, thansk
15:11ibdknoxtimvisher: are you sure you have the locale set correctly?
15:11timvisherdon't even know enough to tell you
15:12timvisheris there a ! function I have to call in clj-time to set that?
15:13ibdknoxtry this:
15:13ibdknox(def time-format (tform/formatter "h:mma" (ctime/default-time-zone)))
15:13ibdknoxwhoops
15:13ibdknoxyou'll need to require:
15:13ibdknox [clj-time.core :as ctime]
15:13ibdknox [clj-time.format :as tform]
15:14ibdknox(tform/unparse time-format (ctime/now))
15:14ibdknoxsee if that gives you the correct time
15:16timvisherthat indeed seems to do it
15:16timvisherthough it only returns it for GMT
15:16timvisherwhy wouldn't the time-zone-for-offset -5 work, though?
15:16ibdknoxweird, that returns PST for me
15:16timvisherare they returning different things?
15:17timvisheractually
15:17timvisheri'm calling it wrong
15:19ibdknox(tform/show-formatters)
15:19ibdknoxthat will show you every format
15:19ibdknoxone of which is :local-time
15:20ibdknoxso you could also do this:
15:21ibdknox(tform/unparse (:local-time tform/formatters) (ctime/now))
15:21ibdknoxI believe
15:24timvisherthat's strange, my show-formatters doesn't include local-time
15:25timvisherso the issue seems to be that the DateTime returned by (time/to-time-zone (time/now) (time/default-time-zone)) is in fact correct
15:25timvisherbut the call (time/to-time-zone (time/now) (time/time-zone-for-offset -5)) is off by an hour
15:26timvisherwhich doesn't make sense to me because they should be returning the same TimeZone
15:27ibdknoxhm :local-time is in the source
15:27ibdknoxwhat version are you using?
15:28timvisherit's strange because it in fact works, but it's not listed when I call the show function
15:29ibdknoxI see, does it get you what you want?
15:29timvisherit actually returns 19
15:29timvisherwhich is very odd
15:29timvisherversion is 0.3.0
15:30timvisherhttps://gist.github.com/1043415
15:34ibdknoxI'm not sure, using my custom formatter and setting it to the default-time-zone gives me PST as I would expect
15:35timvisherwhat if you call it with (time-zone-for-offset -8) ?
15:35timvisheror whatever the offset is for PST
15:36ibdknoxit's off by one then
15:36ibdknox11:35 instead of 12:35
15:36timvisherinteresting
15:36timvishermaybe i'm misunderstanding the semantics of that call
15:37ibdknoxwell given that DST is a national thing
15:37ibdknoxnot a time-zone thing
15:37ibdknoxthat's what I would expect
15:37ibdknoxother countries will be in that time zone, so it's giving me the mathematically correct time
15:37choffsteinAnyone have any experience deploying war files to amazon's elastic beanstalk?
15:37timvisherbut why then would the default-time-zone return something different than the your time-zone calculated via an offset
15:38ibdknoxit's the locale
15:38timvisherchoffstein: have you seen https://github.com/weavejester/lein-beanstalk
15:38choffsteinjesus, weavejester just has everything
15:38ibdknox#<CachedDateTimeZone America/Los_Angeles>
15:38ibdknoxis what (ctime/default-time-zone)
15:38timvisherthe man is prolific
15:39ibdknoxreturns
15:39timvisherah
15:39timvisherso they're returning different types
15:39timvisherthat's interesting
15:39ibdknoxyep
15:40timvisherso what do you think the usefulness of time-zone-for-offset would be then?
15:40timvishergiven that you would have to manually keep track of DST.
15:40timvisheri can't think of any reasonable uses for it off the top of my head
15:40ibdknoxNo one else has DST ;)
15:41timvisheractually, London is in DST at the moment
15:41gfrlogwhy wouldn't you arbitrarily change your clocks?
15:41timvisherthere are a number of locations that do this awful thing to us
15:41timvisher:)
15:41ibdknoxlol
15:41gfrlogwe're demonstrating that the time is whatever we say it is
15:41ibdknoxit's better to stick to a standard, I think
15:41gfrlogif we can't do that it's a slippery slope
15:42ibdknoxbut I'm sure there's a magical way to get all of the DST's to work out
15:42ibdknoxyou'll likely need to look more into Joda to figure that out
15:44VT_entityhey, all. Anyone have any experience with "seque"
15:44choffsteinokay ... very specific question. When using "lein ring war", I keep getting a "ZipException: duplicate entry" error with my servlet.clj file. Anyone know why that may be happening? Is it a name clash?
15:44choffstein"lein war" works fine...
15:44gfrlogthat's weird...
15:45VT_entityI'm trying to peek and pop off of a seque, but I think I'm doing it wrong, and the documentation is really slim.
15:45davekongI spent some time trying to figure out how to quickly load a 120MB binary file (unsigned ints) into an array of longs and eventually came up with code that works but it still pretty slow (90s on my machine). I am wondering if there is an obvious way to speed this up by a factor of ten or so. http://www.pastie.org/2112719
15:45timvishergfrlog: i'm already convinced that you should store only UTC times
15:45gfrlogchoffstein: do you have a resources directory?
15:45timvisheri'm now concerned with display
15:45gfrlogtimvisher: amen
15:45timvisherthat's where i started running into the issue we've been discussing
15:45choffsteingfrlog: yep
15:46gfrlogchoffstein: it's just "/resources"?
15:46gfrlognot anywhere weird?
15:46choffsteingfrlog: Exact error: "Exception in thread "main" java.util.zip.ZipException: duplicate entry: /WEB-INF/classes/portal/servlet.clj (NO_SOURCE_FILE:0)"
15:46davekongto-byte-array from contrib.io is very fast, but it is unclear to me how to write a to-long-array equivalent
15:46timvisherit looks like the way to set it up will be to store the long "America/New_York" time-zone in the customer account rather than the offset, which is what i was hoping for
15:46choffsteinyep, nothing weird. "lein ring server" works fine.
15:47gfrlogchoffstein: Okay. I had a strangely similar problem earlier today that technomancy helped me figure out. Sounds like it's probably unrelated though.
15:48choffsteinah, gotcha. thanks for trying anyway :)
15:49timvisherchoffstein: i'm sure you've checked that you don't actually have 2 servlet.clj files?
15:52choffsteinas far as I can tell, I don't :)
15:52timvisherjust making sure
15:52timvisherhow familiar are you with jarring from the commandline?
15:52timvishercould you try to do it outside of lein?
15:52timvisherand see if you still get the same problem
15:53choffsteinnot hugely familiar. i've always been a c++ / ruby guy
15:53timvisheror maybe see if any of the various and sundry IDEs out there support a lein project and try exporting?
15:54timvisherhmm
15:54timvisherfraid I'm entirely out of my depth at this point
15:54timvisheri only ever built wars 'by hand' using the ant task
15:54timvisherand i believe lein is backed by maven
15:54timvisherhope someone can help
15:54amalloytimvisher: lein is backed by maven *and* ant
15:54choffsteinit's alright. i'll figure it out
15:55amalloymaven for dependency resolution, ant for building, iiuc
15:57choffsteinhmmm ... looks like "lein ring uberjar" is expecting everything to be in WEB-INF/ ... that could be a problem
15:57timvisherah good ol `wtf`
15:57timvishershame it doesn't work well with M-|
15:58choffsteinhmmm ... or maybe not. gotta dig deeper into the source.
15:58choffstein"use the source, choffstein..."
16:06choffsteinhmm ... just changing my servlet.clj to another file name and changing all my servlet references to that new name in the project and web.xml files made it work. That is very ... very odd.
16:09timvisherchoffstein: just had a though
16:09timvisherthought*
16:10timvisherit's possible that ring uberjar is generating a servlet.clj file for you
16:10timvisherauto'magically' as it were
16:10timvisherand then yours is conflicting
16:10timvisherare you sure there isn't an alternative to get things into the servlet.clj file?
16:11choffsteinyeah, that is what I am guessing (hence why I tried changing it) -- but i'm not seeing that in the source
16:11timvishermaybe passing a map in project.clj or something?
16:11choffsteinwell, it works fine now. I just had to rename and remap. it's just strange that it seemed to be a restricted name -- but i'm not seeing that in the lein-ring source code
16:12timvisheryou could always ask weavejester on github
16:13timvisherhe's ordinarily quite responsive in my experience
16:13timvisherin fact, i just realized i've been assuming he's a guy this whole time
16:13timvisherhmm
16:14amalloytimvis, her
16:15timvisher:)
16:15choffsteinon the internet, we're all just dudes pretending to be women
16:16timvisherah the days of aol chat rooms, they were different times
16:16timvisherbetter yet, compuserve chat rooms
16:16timvisherbut then again, here i am in irc
16:16timvisherwondering whether weavejester is a guy or a girl
16:16timvisheri hate clearcase
16:16timvisher...
16:16Somelauwtimvishster
16:18gfrlogtimvi-she-r
16:19gfrlogI think I got lucky. I had no idea before making the comment that his named had both "she" and "her" as substrings.
16:19gfrlogaw crap I just assumed timvisher was a dude
16:20timvishergfrlog: there you go assuming!
16:20timvisheryou know when you assume you make an ass out of all of us.
16:20gfrlogno that's what happens when you assallus
16:24OscarZhi.. what's the relation between Clojure and Scala ? Both seem to be FP languages on top of JVM.. are there some specific issues with Scala where Clojure wanted to go other way?
16:25OscarZI'm just trying to get an overview of the FP languages that are available..
16:26technomancyOscarZ: the syntaxes and type systems are the most obvious differences. also scala is hybrid OO/FP while Clojure is "just" FP.
16:27SomelauwThey are both functional but differ a lot I think.
16:27__name__Clojure is lispy, Scala is not at all.
16:28timvisherOscarZ: I'd recommend googling. Reams have been written on this subject
16:28timvisheri think __name__ has the most fundamental difference though
16:29gfrlog(inc __name__)
16:29sexpbot⟹ 1
16:29__name__Yay, I am 1 now.
16:29SomelauwI think clojure is easy to compile but might not always work the first time. Scala is really hard to compile, but often works the first time.
16:29gfrlogSomelauw: that sounds like static vs. dynamic
16:29technomancygfrlog: (swap! ~name inc)
16:30OscarZOk.. I'm a Java programmer trying to learn some FP.. I've been looking at Haskell a bit before
16:30gfrlog(swap! technomancy inc)
16:30gfrlogtechnomancy: what I meant is I agree :)
16:30technomancythough I've always been partial to dinc
16:30gfrlogd for what?
16:30technomancydouble
16:30gfrlogphonetics?
16:30technomancy(def dinc (comp inc inc))
16:31gfrlogah ha
16:31timvisherOscarZ: fwiw, i chose Clojure over Scala in your situation because I knew Clojure would push me pretty strongly towards FP where Scala seemed much more like Groovy with FP tacked on
16:31technomancyvery extreme situations may call for oinc
16:31__name__oinc?
16:31gfrlog(apply comp (take 8 (repeat inc)))
16:31timvisherit's not impossible or even terribly difficult to write non-functional code in Clojure, but the whole language pushes you that way
16:31timvisherwhereas Scala is far more agnostic
16:31hiredmane.g. if you have an off by one error and are missing a long
16:31technomancygfrlog: exactly
16:32timvisherit seems like the 'best' Scala programmers write mostly FP, but it takes awhile to get there
16:32technomancyclojurebot: oinc is octo-inc: (apply comp (take 8 (repeat inc)))
16:32clojurebotIk begrijp
16:32amalloySomelauw: heathen. clojure code works the first time, almost always. it's so functional that you don't have to be careful with bookkeeping
16:32OscarZtimvisher: Ok I see, I'd really like to learn the FP way of thinking and I guess its better to go with more "pure" FP .. that's why I looked at Haskell first
16:32gfrlogtimvisher: I've heard some java programmers describe doing similiar things in java
16:32gfrlogjust with less closures I guess
16:32timvishergfrlog: true
16:32OscarZbut find it too big leap to actually start using Haskell in some real work where the existing code base is in Java
16:32timvisherI've heard that if you really want to push/punish yourself, you go Haskell
16:33timvisherBut it's also been a life long dream of mine to learn lisp so
16:33timvisher..
16:33timvisherah
16:33gfrlogclojurebot: oinc?
16:33clojurebotoinc is octo-inc: (apply comp (take 8 (repeat inc)))
16:33timvisherwell yeah, if you need to integrate on the JVM you basically should choose between Scala and Clojure
16:33amalloyanyone have a link to fogus's 140-character obfuscated-oinc tweet?
16:34OscarZBut I understand Haskell is really elegant language in terms of being "pure FP", so I guess thats a good place to learn at least some basic concepts
16:34timvisheryeah
16:34timvisherI liked Channel9s Intro to FP by Meijer
16:34gfrlogOscarZ: as somebody with almost no experince in haskell, I agree
16:34timvisher,google Channel9 Intro to Functional Programming Meijer
16:34clojurebotjava.lang.Exception: Unable to resolve symbol: google in this context
16:34timvisher,,google Channel9 Intro to Functional Programming Meijer
16:34clojurebotjava.lang.Exception: Unable to resolve symbol: google in this context
16:34timvisherbah
16:34amalloy(defn oinc "fourteen" [n] (reduce + n (map #(%) (repeat (.length ((keyword (apply str (map char [100 111 99]))) (meta (var oinc)))) #(*)))))
16:34timvisherhow do I do that
16:34gfrloguse $google with sexpbot
16:34amalloy$google hello
16:34sexpbotFirst out of 118000000 results is: Hello
16:34sexpbothttp://www.hellomagazine.com/
16:34gfrlogmaybe ~google works for clojurebot
16:34timvisher$google Channel9 Intro to Functional Programming Meijer
16:34sexpbotFirst out of 978 results is: Erik Meijer's MSDN Channel 9 lecture series on functional ...
16:34sexpbothttp://lambda-the-ultimate.org/node/3642
16:35amalloygfrlog: yes, i think so
16:35gfrlog~google sexpbot
16:35clojurebotFirst, out of 149 results is:
16:35clojurebotIntroduction to sexpbot » Bathroom Reading Material
16:35clojurebothttp://blog.raynes.me/?p=82
16:35timvisherlooks about right
16:35OscarZthanks, I'll have a look on that video
16:37timvisherbut honestly, I learned more about FP by watching through the Clojure blip.tv channel and reading through The Joy of Clojure than anywhere else, probably
16:37timvisherat least to start off with
16:37timvishernot to mention getting ad-hoc code reviews here in this fine channel
16:37timvisher^_^
16:37OscarZok :)
16:40choffsteinanyone have any experience using lein-beanstalk?
16:41timvishergod i am a nerd...
16:41__name__gfrlog: That must have been hard.
16:42gfrlog__name__: I was just thinking how weird that was in hindsight. Learning about the actor stuff at the same time.
16:42__name__Erlang is painful I guess.
16:42__name__Its syntax is just, well.
16:42nishantcan anyone here help me with clj-http?
16:42gfrlogit definitely is. I found it fun in that kind of painful way that writing assembly code is also fun.
16:42__name__I find C fun in that way.
16:43gfrlogyeah. I still think it is a strange mix of high-level and low-level
16:43gfrlogkind of exotic I guess
16:43amalloy~anyone
16:43clojurebotPlease do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.
16:43drewrb
16:44gfrlogdrewr: c
16:45drewrsry little slip of the finger there
16:46gfrlog:)
16:50amacClojurebot seems cranky
16:50amac~botsnack
16:50clojurebotThanks! Can I have chocolate next time
16:52amalloythat's new
16:55gfrlogclojurebot: botsnack?
16:55clojurebotThanks! Can I have chocolate next time
16:55gfrlogit was a question.
17:01ibdknoxdoes anyone know of an alternative to clojure.contrib.find-namespaces? I'm trying to remove my dependency on contrib in Noir
17:03ibdknoxnm, tools.namespace appears to be the replacement
17:09Raynesibdknox: Where are you using it in noir?
17:10ibdknoxto load a dir's worth of views
17:10ibdknoxas opposed to individually requiring them
17:10ibdknoxnoir.server/load-views
17:18ibdknoxRaynes: thoughts?
17:21Raynesibdknox: I was just wondering how you were using it. I thought I was going to need it for something myself recently, but found all-ns. Looks like you actually need it though.
17:22ibdknoxRaynes: ah, yes. I think in this case it's the way to go.
17:23bdeshamoff-topic, but does anyone know of a C++ equivalent of marginalia?
17:24ibdknoxbdesham: not off the top of my head, but it's based on Docco, so searching for a C++ docco might get you somewhere
17:24bdeshamibdknox: great, thanks
17:25stuartsierranoweb is a language-agnostic version of Knuth's original literate programming thing.
17:26bdeshamstuartsierra: will look into that too, thanks
17:33sotHi. Is using future the same as creating a thread in java? I have a few background processes that I need to spawn, and am using future, but am seeing some erratic behaviour.
17:35stuartsierraFutures use the same thread pool as send-off.
17:37stuartsierraSo each future gets its own thread, but the thread pool is allow to cache and reuse the thread after the future completes.
17:37stuartsierragotta go
17:38sotI'm using zeromq and have a number of event loops that listen and send on sockets, and wondering if using future to start these loops is correct.
17:47hugodanyone know if something like contrib.condition will be in 1.3?
17:48technomancyhugod: it won't be in 1.3, but http://github.com/scgilardi/slingshot is the successor of c.c.condition and is awesome.
17:49hugodtechnomancy: thanks, missed that
17:49technomancyhugod: it hasn't been widely publicized
17:55bsteuberwhere can I put init stuff for the user-namespace like (use 'clojure.repl) with leiningen/swank setup?
17:55technomancyput :repl-init foo.repl in project.clj where foo.repl is the namespace
17:56bsteuberyeah but I have like 10 projects
17:56bsteuberand would prefer a global solution
17:57technomancyhm... you could do it with a hook in ~/.lein/init.clj, but I guess that should be standardized. open an issue?
17:57bsteuberI expected .clojure/user.clj or swank-clojure-init-files to work, but neither did with this setup
17:57bsteuberok I'll do that :)
17:58hiredmanyou can create a project where you keep your stuff
17:58hiredmanand add it as a checkout to all your other projects
17:59bsteubercheckouts are nice in general, just stumpled across them
17:59bsteubertechnomancy: could you elaborate on the exact hook I'd need?
18:01technomancybsteuber: off the top of my head: (add-hook #'leiningen.compile/get-readable-form (fn [orig j project form init] (orig j project form `(do ~init (load-file "/home/me/.lein/user.clj")))))
18:02technomancybasically expanding the init arg to every eval-in-project invocation
18:02bsteubergreat, I'll try that (and still file a ticket) :)
18:16choffsteinanyone here have any experience distributing clojure web projects as .war files?
18:18bsteuberchoffstein: got it working once or twice - what's your problem?
18:19hiredmanchoffstein: lein ring is nice
18:20choffstein"lein ring server" seems to work fine, but when I create a .war using "lein ring uberwar" and upload it to amazon's aws beanstalk, it doesn't seem to work at all. I was wondering if there is a good way to locally test the war file created by lein ring without having to install apache and tomcat.
18:21bsteuberI think I used jetty for that
18:21hiredmanchoffstein: you've seen lein-beanstalk?
18:22choffsteinyeah -- lein-beanstalk doesn't seem to work for me
18:23choffsteinah, I'll try jetty
18:23bsteubertechnomancy: great, just added needed use/require clauses and it works!
18:24bsteuberso thanks a lot
18:27timvisherchoffstein: installing tomcat or jetty and running a war file is dead simple
18:27timvisherit might be worthwhile deploying it locally first just to test it.
18:27choffsteinI'm about to try jetty
18:27timvishernice
18:29technomancybsteuber: if you want it nicer in leiningen 1.6, you could submit a patch =)
18:30bsteuberok I'll try :)
18:30technomancymaybe a leiningen.core/add-init macro that could swap a form into an atom that leiningen.compile/get-readable-form could use?
18:31bsteuberwhy not just support .lein/user.clj?
18:31bsteuberand do what you did with your hook when it exists
18:32bsteuberthat's what I'd do without knowing better :)
18:32technomancyyeah, no reason to have an atom really. just be sure to honor leiningen.util.paths/leiningen-home instead of hard-coding ~/.lein
18:33bsteubergood
18:40sjlSo for my first non-toy project in Clojure I'm working on a simple Minecraft bot. If anyone has a few minutes to look at my code so far and tell me how to clean it up and make it more idiomatic, I'd love it.
18:40sjlhttps://bitbucket.org/sjl/clojurecraft/src/c6c71945637c/src/clojurecraft/core.clj
18:40sjlThere's a lot of repetition that I think could probably be removed.
18:41the-kennyFirst thought on write-packet: use case, this does a constant-time lookup
18:42the-kennyOr implement this with multimethods, this would make it extensible (probably unnecessary)
18:43the-kennyAlso, you can pass assoc more than one key value pair: (assoc m :foo 42 :bar 23) will assoc :foo and :bar
18:43sjlthe-kenny: wow, I completely missed case. Thanks!
18:43sjlYeah, I knew that, but now that you mention it I can clean up those ugly assoc chains with it too
18:43the-kennyOh, and when you just want to populate a map (like in all the read-stuff), just use the map-syntax
18:44the-kenny{:foo 23, :bar 42} (the , is optional)
18:44the-kennyThis removes the need for most assoc and ->
18:45sjlthe-kenny: well, about that, is it guaranteed to parse the vals in the order I list them?
18:45the-kennyOh, I haven't thought of that. Not sure.
18:45sjlthe-kenny: the -read-whatever's need to be executed sequentially because the bytes are sent in a specific order
18:45the-kennyI understand
18:45sjlThat's why I did the -> thing, I wasn't sure and just wanted to get a player on the screen, hah
18:46sjlthe-kenny: same deal with the multiple-arg assocs
18:46the-kennyI'm pretty sure the order of multi-arg assocs is guaranteed
18:47sjlhmm
18:47the-kennyIf order is important and if you don't want the whole assoc stuff to be gone, you could also do something like (zipmap [(-read-int stream) ...] [:eid ...])
18:48bsteuberor write it like (into {} [[:first (do-somehting)] [:second ...
18:48sjlmm, I think I'd rather keep the pairs together for readability
18:48the-kennybsteuber's suggestion is more readable :)
18:49sjlbut is the evaluation order of the vector of pairs guaranteed?
18:49sjl(same question as the eval-order of map literals, really)
18:49bsteuberyes for vectors it is
18:49bsteuberbut I'd still just use one big assoc :)
18:51sjlok, according to http://clojure.org/evaluation it looks like function arguments are guaranteed to be eval'ed left to right
18:51sjlso one big assoc should work
18:52choffsteinegads. I thought this would be easy. jetty doesn't seem to like my war file. can't find "web-app" description ... and yet, there it is in WEB-INF/web.xml...
18:52sjlit still feels... dangerous, though.
18:53amalloysjl: it's guaranteed. doesn't get any safer than that :P
18:53the-kennysjl: You can always take a look at the implementation of assoc :)
18:53sjlHeh, I'm not worried about now -- I'm worried about a few months from now when the implementation of assoc changes :)
18:54rkbuchmannThat would mean that evaluation in general would change
18:54rkbuchmannand that is very unlikely
18:55amalloysjl: can you point me at a place where you're worried about order of evaluation? there's a lot of code there and i don't want to scan through all of it
18:56amalloyoh, read-packet-login
18:56the-kennyevery read/write operation :)
18:56sjlamalloy: Yeah, any of the read-packet-whatever ops
18:57sjlrkbuchmann: Yeah, seems like a pretty significant change, so I guess it's safe to assume it won't happen any time soon.
18:59choffsteinokay, can anyone with some jetty experience give me a bit of help? I am having some trouble figuring out if there is something wrong with my .war, or if there is something wrong with my jetty setup...
18:59bsteuberI'm sure order of function evaluation is guaranteed in the "spec"
19:00amalloysjl: fwiw, the current compiler does eval map literals in order
19:00amalloyi don't know whether it's guaranteed
19:00sjlamalloy: Hmm, I think I'll stick with assoc. Not much more verbose, and the wiki says it's safe.
19:00bsteuberah right that should be okay too :)
19:00bsteuberjust after the map is constructed the order can change
19:01amalloyyes
19:02choffsteindamn you jetty. you should not be this hard to figure out. what the crap.
19:03bsteuberprobably it's just some simple thing you need to do different
19:04bsteuberdid you check your web.xml for syntax errors?
19:08choffsteinyep. Nothing that i can see.
19:08choffsteinI tried turning the warnings off in jetty, but get a whole new slew of problems
19:08choffstein"sealing violation"
19:09bsteubermight help to start from some example project on github
19:09choffsteinseems I am hunting an endangered species...
19:09bsteuberwhich of course I can't find right now :)
19:09amalloy(inc choffstein)
19:09sexpbot⟹ 1
19:09choffsteineh?
19:10bsteuber(inc choffstein)
19:10sexpbot⟹ 2
19:10bsteuberok this is for polls
19:10bsteuberthought some nice way to insult people via sexpbot
19:11bsteuberat least "you're a null" is insulting in German
19:12amalloychoffstein: seal-hunting made me laugh. so you get a sexpbot karma credit
19:12choffsteinah, gotcha
19:12bsteuber(dec choffstein)
19:12sexpbotYou want me to leave karma the same? Fine, I will.
19:12amalloy!
19:12bsteuberlol?
19:12amalloythat sounds broked
19:13rbuchmann(doc inc)
19:13clojurebot"([x]); Returns a number one greater than num."
19:13rbuchmannbah
19:13amalloy$karma choffstein
19:15amalloyi'm probably the one who broke that, but it's not clear to me how
19:15amalloy(dec Raynes)
19:15sexpbot⟹ 4
19:15amalloyinteresting. dec works
19:15Raynes(inc amalloy)
19:15sexpbot⟹ 10
19:15amalloyfunny funny. cause i'm the one who should be getting dec'd for breaking shit :P
19:16rbuchmann(inc amalloy)
19:16sexpbot⟹ 11
19:18choffsteinwar files are confusing
19:18rbuchmannwar is hell my friend... :)
19:18choffsteinit seems war files + static resources (not served) + ring = no no
19:19choffsteinI am trying to use files that don't get served, but rather get read by my webserver. I am finding out that such a situation doesn't really work so well...
19:19rbuchmannhm, but surely that must be a pretty common scenario...?
19:19iwillighi guys, is there a way i can look up a function in a namespace by a string, i am thinking of something like python's getattr
19:19choffsteinone would think
19:20choffsteinthis is getting rather frustrating. why does it work in "lein ring server" but not as a war under jetty. What in the world am I doing wrong...
19:20Raynesiwillig: look at resolve and ns-resolve. Might be what you're after. I don't use Python though, so don't hold me to it. ;)
19:21hiredmanstrip your project down to a single handler function and if that works slowly build it back up and see where it breaks
19:23choffsteinhiredman: yeah ... that sounds horrible.
19:23choffsteinhiredman: but unfortunately is looking like the way I will have to go...
19:24hiredmanchoffstein: look, if you know how to read stack traces and are familiar with the jvm you most likely won't have to, but if you aren't what other option is there?
19:24choffstein...I can read stack traces, thanks. these aren't stack trace issues.
19:25choffsteinThis is trying to figure out why jetty isn't liking my war file
19:25hiredman*shrug* I don't know what more you want, you just complain about jetty over and over
19:26hiredmanno pastebins with errors, no explantions of this or that, just "I have this project, it doesn't work" for the last few hours
19:27RaynesMan, there are better ways to go about requesting more information.
19:27hiredmanpeople *compulsively* click on urls, so it is very easy to get people to look at errors, logs, etc
19:27choffsteinhiredman: fair enough. I'd love to give a pastebin with an error and a stack-trace, but there isn't one.
19:27hiredmanthen how do you know it isn't working?
19:27choffsteinhiredman: the stacktrace is in jetty and only goes down into the configuration levels of jetty (e.g. the XML parser)
19:28hiredmanchoffstein: that is a stacktrace
19:28choffsteinhiredman: so the only relevant part is the top level exception, which I have already asked about
19:28choffsteinBasically, I'm not an idiot. If I had more information to give, trust me, I would.
19:28hiredmanwell then, strip it down and rebuild it then
19:28hiredmanno, you have tons of information
19:29hiredmanyou have namespace names, you have files, you have bytecode you have xml
19:29hiredmanyou have *everything*
19:29choffsteinhiredman: And sometimes, I can't give everything because they are proprietary projects. But the issues I am running into are generic enough and are about setting up your application to be appropriately distributed as a war file, which I am unfamiliar with.
19:30Rayneschoffstein: gist that stacktrace.
19:30choffsteinRaynes: the jetty one?
19:30bsteuberif need the help so badly, put a minimal non-working setup on github
19:30RaynesSure. Whatever stacktrace you're getting.
19:30bsteuberthere's you missing somewhere
19:30hiredman^-
19:30bsteuber"a you"
19:30bsteuberwhatever :)
19:30RaynesHe seems fairly certain that your stacktrace is the key to infinity and beyond, so gist it and we can see.
19:31choffsteinhttps://gist.github.com/1043893
19:31RaynesBefore this channel turns into ##c
19:33Rayneschoffstein: Furthermore, that is an excellent idea. If you can get a minimal example of what isn't working for people here to see, it'll be easier to debug the problem.
19:34choffsteinRaynes: I'm doing it as we speak. Hopefully I'll have a barebones up in a few minutes.
19:34hiredmanchoffstein: what version of jetty?
19:34RaynesCool. :)
19:34choffstein5.1.10
19:34hiredmanvery old
19:34choffsteininstalled it from macports.
19:34hiredmanugh
19:34hiredmannever install jars via system package managers
19:35choffsteindidn't know it was going to come as a jar.
19:35choffsteindidn't know anything about jetty until a couple hours ago
19:35hiredmanhttp://blogs.webtide.com/janb/entry/jetty_runner jetty-runner is what you want
19:35hiredmanget the latest version, you'll be fine
19:36choffsteinalright, thanks.
19:36bsteuberinstall all java libraries with leiningen
19:37bsteuberjarvana.com is great for finding the maven names
19:37hiredmanI guess you could jetty-runner via lein, but I would just download the jar as needed
19:37hiredmanjava -jar jetty-runner.jar some.war
19:38bsteubersorry, raynes :)
19:38Raynes<3
19:38bsteuberyou mean for confusion with lein install?
19:39RaynesMaven blows away any common understanding of what 'install' means to people. jars are copied around and such.
19:40RaynesIt's just confusing is all.
19:40bsteuber:)
19:43bsteubergood night everyone
19:44bsteuberor day or whatever :)
19:44amalloy~ugt
19:44clojurebotugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html
19:45bsteuberhaha, thanks, I'll keep that in mind :)
19:47pdkholy shit
19:47pdkjoy of clojure in mobi/epub
19:47RaynesCalm down.
19:47pdkbut god descended man
19:48technomancypdk: that was like two thousand years ago
19:49choffsteinAh, fuck. Okay ... so jetty-runner makes my war file run perfectly.
19:49pdki think jesus only had lisp 1.5 then though
19:49hiredmantechnomancy: so not available in epub?
19:49choffsteinthat's ... awesome and horrible at the same time
19:49choffsteinThanks for thinking of the version issue hiredman
19:49hiredmanchoffstein: right the xml lein ring
19:49hiredmangenerates was too new
19:52choffsteinahhh, that makes sense
19:52choffsteinhmm. now all of a sudden I have to wonder why my war isn't working with the amazon beanstalk :D but that is a whole new can of worms....
20:30choffsteinAnyone try using lein-beanstalk yet?
22:27justinkowhat's the best way to install aquamacs on os x?
22:30dnolenjustinko: I recommend Cocoa Emacs 23 unless you really, really, realy don't want to learn standard Emacs bindings.
22:32justinkodnolen: aquamacs seems so popular, even Hickey uses it
22:34justinkodnolen: okay I see your point http://stackoverflow.com/questions/1096009/carbon-vs-aqua-vs-cocoa-emacs-builds
22:36dnolenjustinko: acquamacs is fine, but I've run into weird edge cases here and there which made me abandon it.
22:38Scriptorany word on what the theme for clojure/conj would be?
22:39cemerickI didn't think there was to be a theme.
22:40Scriptorit mentions on the website how they want to "weave a common theme", apparently there was one last year?
22:42justinkodnolen: this how you installed cocoa emacs? http://emacsformacosx.com/
22:42dnolenjustinko: yes
23:07jamiltronWhat is the easiest way to read a single character from the console? I have tried monadic-io-streams' read-char but that seems to always give me back an instance of the function no matter how I use it.
23:18technomancyhandy little VM setup courtesy of justinlilly: https://github.com/Seajure/emacs-clojure-vagrant
23:18technomancyjust in case M-x clojure-jack-in isn't easy enough...
23:19justinkotechnomancy: I'm about to buy your peepcode screencast
23:20justinkoquick question: you guys map control to caps-lock?
23:20justinkolike VIM users do?
23:20technomancyjustinko: absolutely
23:21ScriptorI mapped escape to caps lock :)
23:21justinkoScriptor: so then you use control...?
23:22dnolenjustinko: I got sick of Emacs pinky, control barely helps. Control -> Command, Meta -> Option
23:22justinkomy pinky would break off
23:22dnolenthumbs are your strongest fingers spare your pinkies.
23:22justinkoyeah command is fine
23:23justinkooption is as bad as pinky though...
23:23Scriptorjustinko: one advantage of windows on a macbook, left thumb always on the command button
23:23Scriptoreh, I just move my thumb a bit
23:23gkoIs/will there be a unified Clojure/Common Lisp SLIME version?
23:24dnolenjustinko, Many interesting Meta commands involve chords, no need for pinky on option.
23:24justinkoif the left thumb get's tired of command, you can use the other! (on mac)
23:24justinkodnolen: yeah u use the ring finger for option, right?
23:25technomancygko: there could be in the future if 0) the slime devs are open to it and 1) someone from Clojure land cares enough to coordinate with them.
23:25technomancybut 1) is probably not going to be me
23:25justinkodnolen: ring finger isn't bad
23:25dnolenjustinko: depends really. I have a Kinesis, so I think my chording patterns are influenced by that.
23:26islonwhy I cannot do this? (apply and [true true false])
23:26dnolenjustinko: with Kinesis it's trivial to use both thumbs and a finger on another key at the same time which is hard on standard keyboards.
23:29justinkodnolen: damn you going to make me buy a kinesis? :)
23:29dnolenjustinko: heh, no. I really only use that at work.
23:30dnolenit's just influenced my typing to be more thumb-centric and less obsessed about moving off home keys.
23:32symboleislon: I believe it's because and is a macro? I'm probably wrong.
23:32dnolenislon: symbole: yup, and is a macro.
23:33dnolen,(macroexpand '(and true false false))
23:33clojurebot(let* [and__3468__auto__ true] (if and__3468__auto__ (clojure.core/and false false) and__3468__auto__))
23:36justinkodnolen: wait a minute, you maintain textmate-clojure, yet you use emacs?
23:37islonyeah i know
23:38dnolenjustinko: barely maintain. I was hoping more people would step up to help me since it's so simplistic (thanks to cake). Oh well, the TextMate people seem to use and like it well enough.
23:38islonbut i want to apply and to a seq
23:39dnolen,(every? [true false false])
23:39clojurebotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$every-QMARK-
23:39cemerickislon: use (every? boolean [true true false …])
23:39dnolen,(every? identity [true false false])
23:39clojurebotfalse
23:40dnolen,(every? identity [true true true])
23:40clojurebottrue
23:41gkotechnomancy: OK... but how do devs using both CL and Clojure manage this? My solution is to define a function slime, which will ask me if I want to use CVS (for CL) or ELPA (for Clojure) version and load the appropriate version... But then, I can't use the other version without side effects (after reloading) in the same Emacs session...
23:41isloncemerick: thanks!
23:42cemerickislon: dnolen's is semantically the same, FWIW
23:42dnolengko: I think the CL / Clojure crossover is small, thus the state of things.
23:42islonok
23:43dnolenpersonally I just use LispWorks Personal Edition if I'm messin' w/ CL. Nicer than Slime anyhow and you still get all the Emacs commands.
23:47gkodnolen: I use SLIME with LW Pro with slime-connect, because I can't have the listener and editor in the same window.
23:50dnolengko: I see. Yeah that stinks. The more CL people use Clojure, hopefully the more the SLIME folks care to keep things compatible. I remember I tried in the early Clojure days at running both, but it was painful and I gave up.
23:51symboleWasn't somebody working on an editor for Clojure?
23:51dnolensymbole: I think there's been a couple of attempts but nothing with legs.
23:52symboleMust be a diffucult project, considering that it has to be quite extensible.
23:56cemericksymbole: as in, a reimagination of emacs but using Clojure instead of elisp?
23:57dnolensymbole: I think a full fledged extensible editor would be too ambitious. Something lightweight, like text editor + REPL would be welcome for newcomers. DrRacket's editor is a good reference point.