#clojure logs

2011-07-30

00:00luccaI think the second 'dynamic' there means "on the fly" rather than dynamic vs lexical
00:00hiredmanlucca: that doesn't make any sense
00:00luccaBut! I'm very very new and still learning clojure.
00:01luccahiredman: how so?
00:01amalloyagreed, that doesn't make sense. the second one is the one that explicitly says "dynamic vs lexical"
00:01hiredmanlucca: oogada boogada
00:01amalloyhahahahaha
00:01amalloyhere in #clojure we encourage the ability to count to two; ability to form sentences using words is optional
00:02luccaI miscounted; I meant the third dynamic
00:02luccathe one at the END at any rate
00:03hiredmanthe cunning plan is to lure lucca into "saying well that doesn't make sense" and I say "how so?"
00:03hiredmansaying "
00:03luccahahahah
00:05amalloyhiredman: well, re-bait that hook; i'm sure someone less careful will say something senseless soon
00:10amalloytechnomancy: blog post contains "it's a more work"
00:13hiredmanhe also missed my entire rant about C's global codespace vs. jvm land
00:13hiredmanbut I guess it's his blog
00:40technomancyhiredman: actually my point was that the global codespace works fine for users
00:40technomancyjust not for devs
00:41technomancyamalloy: thanks
00:43technomancyhow does cpan run library tests? do they just use a chroot jail or what?
00:43hiredmantechnomancy: I dunno, the jvm hasn't been around to accumulate tooling as much as C has
00:43hiredman(end user package managers
00:43hiredman)
00:43technomancythey must have safeguards in place to prevent people from using cpan as spam relays and such, right?
00:48Blackfoothow should I extend types in clojurescript? just use (.extend Class {...})?
00:50amalloyprobably deftype or reify? i suspect cljs frowns on extending classes just as much as clj does
00:53technomancyso I was thinking... what would clojars look like if it had continued to develop instead of stalling out?
00:54technomancybrainstorming, lots of metadata: URL, license, last update (commit frequency?), LOC/Test LOC, tests pass?, coverage, docs, dependency tree
00:54amalloy~skynet
00:54clojurebotI will become skynet. Mark my words.
00:54technomancyI think test failures and maybe coverage are really the only things there that are really unreasonable given the current infrastructure
00:54amalloytechnomancy: actually, coverage isn't that hard to get kinda-sorta right
00:55amalloyi added a coverage task to cake a few weeks ago
00:55technomancyamalloy: sure, simplistic coverage can be done with radagast
00:55technomancyI'm more concerned about the sandboxing issue
00:55amalloy$google radagast
00:55lazybot[Radagast - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Radagast
00:55technomancyhttps://github.com/technomancy/radagast
00:56amalloynot even in the wiki disambig
00:56hiredmanclojars would sprout an rss feed instead of me having to scrap the page
00:56technomancyamalloy: oh dang; I'll add it
00:56technomancyhiredman: fo sho
00:56technomancynot even showing the link from the pom is tres silly
00:57amalloytechnomancy: looking at the source - you're testing namespaces, yeah?
00:58amalloycake coverage takes a totally different approach. looks up all your public functions, then searches for each (by name) in the source code of test files
00:58technomancyamalloy: uhhh
00:58amalloyi'm not asserting that this is a better approach
00:58technomancyso (when false (my-fun)) would count my-fun?
00:59amalloyyes. obviously it's not perfect
00:59amalloybut it works surprisingly well for *actual* tests
00:59amalloyas opposed to invented worst-cases
00:59technomancyso branch-level coverage is obviously really hard without compiler hooks
00:59amalloytechnomancy: robert hooke might be good for that though?
00:59technomancybut var level coverage is trivial
01:00technomancyI think you'd need a cinc compiler to hooke conditionals
01:00amalloyno, i mean for var-level
01:00technomancyoh yeah, sure
01:00amalloybut you have to actually *run* the tests to see what your coverage is like, if you use hooke. for large test suites, that can be a problem; i like the ability to quickly say "hey what do i have left to add tests for"
01:00technomancyactually since you don't need it to compose it's just alter-var-root
01:01amalloyfair enough
01:01technomancyI guess your version is also a lot easier to run from something like clojars
01:01amalloyright
01:01technomancybut... I don't think coverage is actually useful unless you've also confirmed tests pass
01:02technomancyso before any knowledge about the test suite can be considered valuable, you pretty much have to run it
01:02amalloytechnomancy: (a) don't really agree
01:02amalloy(b) tests won't all run on clojars anyway. the db server you're testing against won't be installed
01:03technomancyfor applications, probably not. but for oss stuff most of them probably would.
01:03technomancyany sql test suites should be able to run against an in-process derby
01:03amalloytechnomancy: aleph-redis?
01:04technomancysure, there are libs with external system-level dependencies
01:04technomancybut they're the minority
01:04amalloybut anyway, i think that even var-level coverage is pretty useful to have on clojars, without needing to know if the tests pass
01:05amalloya library with 80% of its public vars having at least *some* tests is way better than a library with no tests at all
01:05technomancyyeah, I mean to a degree you can trust the author
01:05hiredman*shrug*
01:06hiredmanclojurebot: tests |are| <reply> meh
01:06clojurebotIn Ordnung
01:06technomancyturning clojars into free CI is probably not a sustainable approach anyway
01:06technomancyI'm just curious about it because apparently CPAN pulls it off
01:08technomancyI keep trying to rope in newcomers looking for a project to clojars, but it doesn't seem to stick.
01:08technomancymaybe with ato returning from his MIA status there's a chance
01:09dakronetechnomancy: is there a todo?
01:09dakronetotally easier to work from a project with a todo
01:09technomancydakrone: just a mailing list thread iirc
01:10technomancyhttp://groups.google.com/group/clojars-maintainers/browse_thread/thread/d4149ec96316d5b1
01:10technomancyactually plenty of enhancements on https://github.com/ato/clojars-web/issues too
01:11technomancyproblem is the install instructions don't work for the SCP service out of the box
01:12hiredmanneed a java scp service
01:13technomancymaybe we can swing it as a seajure hack project
01:14hiredmanhttp://mina.apache.org/sshd/
01:14technomancyalso need to get pjstadig to finish procrustes
01:15technomancyhiredman: huh... wonder if that was stable when clojars was created
01:15hiredman"SSHD provides a CommandFactory to support SCP that can be configure in the following way:"
01:15technomancysick logo
01:15hiredmanmaybe not
01:21hiredmanhttp://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/SshServer.java?view=markup 516 looks like it has the hooks for auth you'd need
02:16grant__hey guys, making a game in clojure. i put the whole game in a (future) so that i can interact with it with the REPL. but unfortunately that seems to make all error output go away...which is crucially important! anyone know a solution to this problem?
02:16grant__i'm using vim and vimclojure
02:44amalloy$google raek executor clojure binding
02:44lazybot[brehaut.net] http://brehaut.net/links/
02:44amalloywth
02:45amalloygrant__: http://blog.raek.se/2011/01/24/executors-in-clojure/
02:48grant__wow, whenever i come in here you help me out
02:48grant__i feel like i owe you something :P
03:35triyoI'm trying to figure out how to call this this snippet from my third-party javascript library ... new Showdown.converter().makeHtml(txt) from my ClojureScript code
03:36triyoI tried (js* "new Showdown.converter().makeHtml(~{b-txt}, ~{safe})") which didn't work. It said that the .converter is undefined which is very strange because I just use the library directly in my html, all work fine.
03:36triyoShowdown though is defined and its an object..
03:37triyoNow I'm trying to do something like...showdown (js* "Showdown") .... (.makeHtml (.. showdown (.converter)) txt))
03:38triyoAnyone have a clue what the code should look like in cljs?
04:08lobotomymorning folks
04:09lobotomywhat's a good way to make a static id counter thing in clojure? in my java program, i have: private static long counter = 0; public static synchronized long getNextId() { return counter++; }
04:11lobotomy(my use case there is to just create a unique human-readable "name" for each thing to help with debugging)
04:13amalloylobotomy: ##(doc gensym)
04:13lazybot⇒ "([] [prefix-string]); Returns a new symbol with a unique name. If a prefix string is supplied, the name is prefix# where # is some unique number. If prefix is not supplied, the prefix is 'G__'."
04:16lobotomyamalloy, awesome, cheers
04:17ohwow_Also: (def incr (let [x (ref 0)] (fn [] (dosync (ref-set x (inc @x))))))
04:17ohwow_,(def incr (let [x (ref 0)] (fn [] (dosync (ref-set x (inc @x))))))
04:17clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
04:17ohwow_uh
04:19amalloyohwow_: no offense but i'm gonna throw up, there
04:19amalloy(a) an atom would do fine here, there's no need to synchronize multiple refs; (b) you're looking for alter, not ref-set
04:26ohwow_okay, sorry
04:26ohwow_i am a clojure newbie
04:26amalloyi know. don't take offense; i'm pointing it out so you'll know how to improve
05:17PupenoAnybody awake?
05:26dedeibelzzzZZzzz
05:30dedeibel»you will find out that dedeibel was only a watermellon with a wig and an old cassette recorder making sleeping noises«
05:31ampleyflyI will look forward to that
06:11PupenoWhere I work we have monthly hack days, when we all spend a whole day working on whatever we want, from future products to open source projects. I want to do something Clojure related that will help me learn Clojure better and that also gives back to the community. Any ideas what it could be? I think of two potential tasks: add examples to the documentation of clojure itself (many functions are missing examples that can help understand them)
06:11Pupenomaybe work on clooj.
06:12PupenoAny other ideas?
06:15djpowelljust playing with clojurescript - is there anyway to include additional javascript files to be processed by the closure compiler?
06:16djpowelli've created a closure template, and can't figure out how to call it from clojurescript
07:00lakerhey, what's the best way to handle thousands of connections with clojure?
07:02_atolaker: as in TCP sockets? or HTTP? or...?
07:03lakeryeah, tcp
07:04lakerand it needs to be async
07:04laker1 agent per client going to work?
07:05_atoif you just use normal java sockets then you'll end up with one thread per socket, which is not scalable past a certain point
07:05_atoyou really need select() which is available through nio http://download.oracle.com/javase/6/docs/api/java/nio/channels/Selector.html
07:05_atoit's not very easy to use unfortunately though
07:06lakeryeah i saw that, but i was thinking if there was an easy way
07:06lakerusing the clojure primitives
07:07lakerkinda want to use clojure instead of erlang and doing 1 process/client with erlang is great
07:10_atoAleph might be relevant: https://github.com/ztellman/aleph
07:10_atoI haven't played with it so can't give an opinion on it
07:10lakeri'll check it out, thanks
07:39problem(defmacro m [b] `(do ~@b))
07:39problem(defn t [& b] (m b))
07:40problemgot "Don't know how to create ISeq from: clojure.lang.Symbol"
07:40problemI can't figure it out, can anyone explain that to me? thx
07:41jcromartieproblem: you are trying to unquote paste (~@b) a symbol
07:41jcromartie~@ takes a sequence and puts its contents directly into the macro... so
07:41clojurebot@ has nothing to do with whether sth is evaluated or not
07:42jcromartie(m b) tries to use the symbol 'b as a sequence
07:42jcromartie(defmacro m [& b] `(do ~@b)) is probably what you mean
07:43jcromartiethen b is going to be a sequence of each argument to m
07:44problemjcromartie: thanks for the explanation, but what if i want to pass a sequence to a macro from inside a function?
07:48_atoif the intention is that you can do something like: (t '[(println "hello") (println "world")]) that's not going to be possible. The sequence doesn't exist at compile-time and the macro doesn't exist at run-time.
07:49jcromartieproblem: maybe you are looking for "apply" ?
07:49jcromartiewhat's your goal, problem
07:50jcromartieproblem: what kind of code are you trying to write
07:52problemI am writing something a bunch of functions that use a macro, the functions must take arbitrary arguments.
07:53jcromartieOK :)
07:54jcromartiewell, do you understand how to use & ?
07:54problemsure i do
07:54jcromartiek
07:54jcromartieand apply?
07:54problemyes i do
07:54jcromartie(defmacro m [& args] `(do ~@args)) (defn f [& args] (apply m args))
07:55problemthat solves the problem, thank you very much
07:55ohwow_could you do (defmacro m [a] `(do ~a)) and (defn f [& args] (m args)) ?
07:56jcromartieherp
07:56jcromartieactually
07:56_atomacros can't be applied
07:56jcromartieyeah
07:56jcromartiethanks _ato
07:56jcromartieI think we're back to solving the wrong problem, though
07:56ohwow_macros could not be used as HOF
07:57ohwow_So, would my code work?
07:57_atowell, except http://richhickey.github.com/clojure-contrib/apply-macro-api.html
07:57_atobut that just uses eval
07:57jcromartieOK but for our friend problem here
07:58jcromartieproblem: your name makes parts of this conversation quite ambiguous
07:58_atohehe
07:58problem:)
08:00_atoI don't think there's a good way to do it except to rewrite the macro as a function
08:04problemso does that mean it is generally better to define a macro calling functions instead of to define functions calling macros?
08:07_atoyes. actually it's best to not use macros at all if possible for exactly this kind of reason. they're not as composable as functions
08:08problemthat makes sense
08:09triyoEnlive selectors, is there a way to pass in a value for an id? So instead of [:div#nav :li#specificId] (set-attr :class "active") .... I can do [:div#nav :li#(my-value-passed-in-via-fn] (set-attr :class "active")
08:10ejacksonso weird. in clojurescript when I call methods for Library objects I get the associated code back, rather than the result of executing it
08:10ejacksonanybody seen this ?
08:12triyoejackson: I know why
08:12ejacksongroovy
08:12triyoits a bit different to clojure way of calling methods ion instances
08:13triyoejackson: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure look at the Host interpo section
08:13ejacksonyou may be my new hero !
08:14triyoYou need something like (. sb (toString))) so you need to surround the toString with a set of parenthesis in order to execute the method itself rather than get back the the function def intself
08:14ejacksonchecking this out...
08:15triyoFrom Clojure -> ClojureScript thats a one common gotcha I'd say so far
08:15ejacksontriyo: thanks dude ! that worked out
08:15triyoyou welcome
08:16ejacksonits been fun getting the Library gui stuff going
08:51triyoDoes "slurp" function work with relative paths too?
08:51triyoI have a web app that slurps a content of a file and I wish to only provide the relative path.
08:53triyoHowever, what is the best way to get the relative path and also what is the relative path based on?
08:53triyoclasspath or the location of the file that slurp is ran in/
08:53triyo?
09:04ejacksontriyo: dunno, sorry, no karma payback :(
10:35ejacksontriyo: thanks for the gotcha help. shouted out in post about this stuff: http://boss-level.com/
11:58fmwhow do I set an attribute in ClojureScript? e.g. the equivalent of
11:58fmw goog.dom.getElement("slug").value = "foobar";
11:59fmw(.setAttribute (dom/getElement "slug") "value" "foobar") works initially, but the value doesn't change anymore after I manually type something in the <input /> element
11:59Blackfootfmw: set!
12:00fmwBlackfoot: thanks!
12:01Blackfootyup. haven't tried it with value, but it works for function assignments and fontSize at least :)
12:06fmwBlackfoot: thanks, you are my hero. it works :)
12:06fmwmust've spent 45 minutes trying to figure out how to set an attribute ;)
12:14the-kennyI'm currently using prn-string and read-string for communication between a client/server Clojure & ClojureScript application. However, there seems to be a problem regarding keywords. On the Clojure side, everything works find. Trying to get the name of a keyword gives the same unicode-prefix just like (str :keyword)
12:16the-kenny:foo translates to ﷐'foo
12:17the-kennyAs far as I know, this is intended. However, (name :foo) should give me "foo", right?
12:20Blackfootnot sure what you mean by unicode prefix?
12:20the-kennyKeywords in ClojureScript are represented as Strings with a specific prefix
12:20the-kenny\uFDD0
12:21Blackfootah i see
12:21the-kennyThere's a problem in my application which makes keyword? and name fails to realize that the given string is a keyword
12:22the-kenny(keyword? :foo) returns false in my project :(
12:23the-kennyI'll try re-bootstrapping my ClojureScript
12:25the-kennyhm, still doesn't work when running in browser.
12:25Blackfoot(keyword? :foo) returns false in your browser?
12:26the-kennyYup
12:26the-kennySame code returns true in script/repljs
12:27Blackfootchecking
12:27the-kenny(keyword? :foo) gets compiled to: cljs.core.keyword_QMARK_.call(null,"﷐'foo")
12:28the-kenny(just want to mention it)
12:31Blackfootyea, interesting, i'm seeing that, too
12:32the-kennyHah, at least I'm not the only one :)
12:34the-kennyThere's a difference between "\uFDD0'foo" and (keyword "foo"). At least it prints differently in the javascript console
12:36Blackfootthe-kenny: i think the problem is charAt is not unicode sensitive
12:37Blackfootthe-kenny: keyword? is essentially x.charAt(0)==\uFDDO
12:37the-kennyyup, I have the source in front of me
12:42Blackfoothrm, maybe not. i see what you're saying, I see two characters proceding the keyword in the console
12:43the-kennyMaybe a problem of the compiler with unicode strings?
12:46the-kennySeems to be an encoding problem. The emitted strings are correct prior loding the files in the browser
12:48Blackfooti'm loading html files directly from disk. i wonder if ContentType isn't being set correctly?
12:48the-kennyI'm loading them from the disk too. Let me try it on a webserver
12:53the-kennyHm. I don't know how to set content-encoding on OSX' built-in webserver :) Sorry
12:54Blackfooti'm using chrome, and i fixed it be going to wrench->tools->encoding->Unicode
12:57the-kennyadding <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> to the html fixed it too
12:57Blackfootah nice
13:00Blackfootthe-kenny: are you just trying out clojurescript, or are you using a framework? (eg compojure)
13:01the-kennyI'm working on a web interface (websockets) for a turn-based game I'm working on
13:01the-kennyServer-Side will most likely use compojure in the future, but it's currently only a single html file
13:01the-kennyAnd the we interface isn't very mature yet :) Just started a few days ago
13:02Blackfootcool. i'm wondering what setup to get started on. if people are going to end up using closure templates and such
13:04the-kennyI just made clojurescript a subproject of my project and fire up a repl for compiling clojurescript. Server side hacking is done via Slime
13:04the-kennyThere is much room for improvement
13:07MasseRNow if only clojurescript worked on openjdk :P
13:19the-kennyHah, now I can remove some hacks :) Thanks Blackfoot
13:19Blackfootteam effort :)
14:03TimMcOK, I'd like to make a small Clojure-based website that has a database. What's a good option for hosting?
14:04TimMcand for databases, for that matter.
14:05peteriserinsTimMc: Heroku, perhaps?
14:06peteriserinsTimMc: here's an appropriate blog post: http://thecomputersarewinning.com/post/clojure-heroku-noir-mongo
14:12TimMcCool, I'll check that out.
14:12TimMcOh, is Google App Engine still popular?
14:14Scriptorit has its niche :p
14:15TimMcAnd what is that niche?
14:17Scriptoreither for quick testing or hosting sites that don't expect all that much traffic early on, so a good place to start
14:17ScriptorI don't know how easy it is to set up a clojure app on there, though
14:18TimMcQuick startup is good.
14:18TimMcThis is just an experimental thingy.
14:18Scriptorthen both heroku and GAE should be fine
14:18TimMchmm, OK
14:20TimMcThe Users API on Google App Engine looks nice.
14:37jweissis it bad to have a promise inside the value of an atom?
14:37jweissi am not sure what happens to the atom when the promise is delivered, i guess that doesn't count as a change to the atom?
14:38jweisseg (def blah (atom {:this "hi" :that (promise)}
14:42danlarkinyeah you can deliver to the promise "outside" of the atom
14:43danlarkin(let [a (atom (promise))] (deliver @a :foo) @a)
14:43danlarkin^ that changes the state of the atom without swap! or reset!
15:10jweisshm, in the java.util.concurrent.Executors class, the submit method has 2 overloads, one that takes Callable, and one that takes Runnable. i want to invoke the callable one.
15:11jweissbut i keep getting back nil when i pass a clojure fn in there, i think it's because fn's are both runnable and callable.
15:11danlarkinyes, I've had the same situation -- hint it
15:11jweisstried type hint ^Callable (fn [] "blah") but didn't hel
15:11jweissp
15:11jweissdid i do the hint wrong?
15:12jweissi did (def x (.submit *pool* ^Callable (fn [] "hi there")))
15:12jweissif i do (.get x) -> nil. should get "hi there"
15:13danlarkintry (let [f ^Callable (fn [] "hi there")] (def x (.submit *pool* f )))
15:15jweissdanlarkin: that didn't help
15:17goodieboyanyone know what emacs starter-kit to go with? seems to be several clones on github...
15:18goodieboytechnomancy: are you still working on your emacs-starter-kit? or is eschulte's the one to go with?
15:44technomancygoodieboy: I'm working on the v2 branch currently
15:44technomancyit's a little different and requires emacs 24
15:44goodieboyah ok. yeah i'm using master now
15:45goodieboyhey not sure if you do any ruby or not but.. do you know of a good ruby setup for emacs?
15:46technomancyschulte's might be better for ruby; I haven't kept up with that at all
15:46goodieboyok cool, i might give that a shot
15:46goodieboythanks
15:47technomancyI'm keen on finding a maintainer for the ruby portion of the starter kit v2 though
15:47technomancyjust hasn't happened
15:48goodieboyawesome, good to know
17:28lobotomyhowdy again. i need to bitwise invert 5-bit numbers. how's this solution: (let [l [16 8 4 2 1]] (apply + (map * (reverse (map #(/ (bit-and n %) %) l)) l)))
17:30lobotomy(ok, 5 bits is small enough that i'll just store that in a lookup table, but yeah)
17:38sritchielobotomy: here's a function I wrote for flipping float bits -- https://gist.github.com/1116033
17:40sritchieit should do the trick, without the precondition (or that final Float/intBitsToFloat operation
17:40amalloylobotomy: just bit-xor with 0x1f?
17:40sritchieoh, sorry, wrong problem -- somehow interpreted bitwise inversion as endian inversion
17:41amalloy&(map (partial bit-xor 0x1f) [5 11 18 30])
17:41lazybot⇒ (26 20 13 1)
17:41amalloyor even just subtract from 0x1f, which i guess is the same thing?
17:44lobotomyhmm... but 18 = 10010_2 -> inverted 01001_2 = 9, not 13
17:45amalloyuh, that's not inversion. you missed a bit
17:45amalloyit inverts to 01101, which in fact is 13
17:47lobotomyi don't follow. isn't 18 in binary 10010? and isn't (apply str (reverse "10010")) "01001"?
17:49amalloylobotomy: you want to reverse the bits? really? then don't say invert, which means something totally different
17:49lobotomyahh, of course... my bad
17:49sritchielobotomy: that gist above will do the trick, then -- amalloy helped me with that one a while back
17:52lobotomyi'm writing a puzzle solver, with pieces that consist of edges, and each edge has an invert-edge function (or however that should be done in clojure), which is where i got the terminology :)
17:53amalloy$javadoc Integer toString
17:53lazybothttp://download.oracle.com/javase/6/docs/api/java/lang/Integer.html#toString(int,%20int)
17:54lobotomyin the java version each edge is paired with another (version of the same) edge that points in the opposite direction, at construction time; these are both immutable so the inversion is just done once
17:54lobotomyi'm trying to figure out if i should do that in the clojure version too, or whether that's premature optimisation
17:55amalloy&(-> 18 (Integer/toString 2) reverse (->> (apply str)) (Integer/parseInt 2))
17:55lazybot⇒ 9
17:55amalloythat's probably no good, actually
17:56amalloyyeah. doesn't pad
17:56lobotomyif i don't store the inverted versions then i'll need to create another edge each time an inverted version is needed, and in theory the jvm might not cache or optimise those parts of the code so hmm... yeah, premature optimisation ;)
18:32duck1123is there a logging api for clojurescript, or do I have to use goog.debug
18:41jweissI'm having trouble type hinting a clojure fn as a Callable - no matter what i do the ExecutorService runs it as a runnable, and returns nil
18:45dnolenjweiss: reify Runnable and put the fn inside?
18:45jweissdnolen: you mean callable?
18:46dnolenjweiss: yeah
18:46jweissi would have thought this was exactly what type hints were for, not sure why they don't work
18:46jweissie, (.get (.submit *pool* ^Callable (fn [] "hi")))
18:46jweissreturns nil
18:46amalloyjweiss: is pool hinted also?
18:47amalloyif not, the other hint won't do any good
18:47jweissamalloy: no, i didn't realize i had to hint that too
18:47jweissi have to hint the object type if i want to hint a method arg type?
18:48amalloyif the compiler can't compile into a statically typed method call, it has to use reflection. once it's using reflection, i wouldn't be surprised if it discarded the typehint
18:49jweissso i tried (.get (.submit ^ExecutorService *pool* ^Callable (fn [] "hi")))
18:49jweissstill returns nil
18:49jweissi do still get reflection warning
18:50amalloyand how is pool created? i'll try to reproduce locally
18:50jweissamalloy: (def *pool* (Executors/newFixedThreadPool 2))
18:51amalloy$javadoc java.util.concurrent.ExecutorService
18:51lazybothttp://download.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html
18:51jweissamalloy: yeah i have that page up
18:51amalloywell, i didn't
18:51jweissoh
18:52jweissi thought that was for me :)
18:52jweissseems to me that somehow the submit(Runnable ) is invoked instead of submit(Callable)
18:54amalloyfor me it refuses to compile with the typehints in
18:54jweissi tried setting the fn in a let, like this:
18:54jweiss (let [^Callable f (fn [] "yo")] (.get (.submit ^ExecutorService *pool* ^Callable f)))
18:54jweissthat works
18:54amalloybut try (let [^Callable f (fn [] "")] (.get (.submit ^ExecutorService *pool* f)))
18:54jweissah right forgot the 2nd hint
18:54jweissworks without the 2nd one
18:55jweissaccording to clojure type hint docs, you can hint an expression
18:55jweissbut that doesn't seem to work here
18:55amalloyjweiss: the second typehint makes no difference to me
18:55jweissright, me either
18:56jweissi just forgot to remove it
18:59neotyk`amalloy: jweiss: why you have to hint it? this works for me: (let [f (fn [] "yo")] (.get (.submit *pool* f)))
19:01jweissneotyk`: that does not work for me.
19:01jweissi'm on clojure 1.2
19:02jweissi also tried the suggestion of reify, that also works
19:02amalloyjweiss: interestingly, try (.get (.submit ^ExecutorService *pool* ^Callable (identity (fn [] ""))))
19:02neotyk`I'm on 1.2.1
19:02jweissamalloy: that works also
19:02jweissohhh
19:02amalloyright
19:02jweissone thing i just realized, i am working in a ns that uses serializable.fn
19:03jweisslemme switch
19:03amalloyi think clojure must be special-casing that into "a function hinted to return Callable"
19:05jweisswell, i may just stay away from the type hint voodoo and use reify :)
19:16st3fanhey what is the best slime version to grab?
19:16st3fani see many forks, not sure which one is the best one for clojure work
19:17amalloyjweiss: yeah, confirmed that ^Callable (fn [] x) means "function returning Callable"
19:17amalloy(.get (.submit ^ExecutorService *pool* ^Callable ((fn[] (fn [] "")))))
19:25jweissamalloy: ah, that makes it less voo-doo-ey
19:25amalloyreally? just slapping an identity on the front feels cleaner to me
19:25jweissamalloy: no, i mean you telling me why it behaved like that
19:26amalloythought i already had. i guess 'i think clojure must be special-casing that into "a function hinted to return Callable"' wasn't clear enough
19:27jweissamalloy: it was clear but I didn't read carefully
19:27st3fanhm when i am on emacs 23.3, is ELPA a good way to install all the stuff i need for clojure?
19:29amalloyfor an amusing precedent see, eg, ##(macroexpand '(.getName java.util.regex.Pattern))
19:29lazybot⇒ (. (clojure.core/identity java.util.regex.Pattern) getName)
19:38duck1123does doseq work in clojurescript for going over a collection of elements?
19:38duck1123I seem to be getting an error from seq
19:41JoelMcCrackenif I were to create a simple web application in clojure, where would it be best to proceed from? (taking into account http://stackoverflow.com/questions/3325033/comparison-of-clojure-web-frameworks , however this is from a year ago)
19:41st3fanJoelMcCracken: i'm looking at Noir
19:42JoelMcCrackenah, sinatraesque
19:42duck1123getting started, you'll probably be best off with compojure
19:42amalloyJoelMcCracken: noir is supposed to be good, but i like the more hands-on approach of using ring, compojure, and hiccup
19:42st3fancompojure looks good too
19:42st3fanany good tutorials you guys recommend?
19:43JoelMcCrackeni think i'll probably go that route
19:43duck1123shameless plug for https://github.com/duck1123/ciste
19:43JoelMcCrackenas per amalloy's suggestion and duck1123
19:44JoelMcCrackenha =) i may try it someday
19:48st3fani am evalling a function in my src/hello/core.clj .. but i am greeted with "Unable to resolve symbol: defn in this context"
19:48st3fani just hit C-c C-c right?
19:49st3fani'm a bit stuck of what to do after slime-connect :-/
19:49amalloyst3fan: try C-c C-k
19:49mefestost3fan: C-x C-e to eval a single form i believe
19:49amalloyyeah, i never use C-c C-c anymore. C-M-x is just as good, and breaks less often
19:50st3fancool
19:50st3fanso i have (ns hello.core) on top
19:51st3fandoes that mean i access things in the repl like (hello.core/foo) ?
19:51Scriptoryep
19:51amalloyjust foo is fine, if you put your repl in that namespace
19:51Scriptorthere's a shortcut for putting the repl in the namespace of the file you're currently in
19:52st3fanotherwise just (in-ns 'hello.core) ?
19:52mefestost3fan: also, if you want to stay in the user namespace then you can 'require or 'use it
19:52Scriptoramalloy: what's the shortcut for that?
19:52amalloyC-c M-p
19:52st3fanah yeah that is a nice shortcut
19:53st3fanso all the dependencies that i added in project.clj are added to the classpath right?
19:54mefestost3fan: should be. did you start swank with `lein swank` ?
19:55mefestost3fan: or clojure-jack-in
20:01hanDerPederhow can i get M-. to work with symbols defined in the current project?
20:01st3fanlein swank
20:01st3fanok i think i'm good enough setup to start playing with some real code
20:08mefestois hiccup the preferred html rendering lib for clojure web apps?
20:12duck1123I was using Hiccup, but I just switched to the Google Closure templates
20:13duck1123but that's only because I intend to use them from clojurescript
20:13mefestoah, i just ordered a book on G Closure to get somewhat up to speed on all that stuff
20:13duck1123hiccup used a lot less typing
20:13mefestolooks pretty interested from the mild reading i've done on it
20:13duck1123the one with the bird?
20:14mefestoyea, "Closure: The Definitive Guide"
20:14duck1123have the pdf open as we speak
20:15mefestohave you used g closure long?
20:15duck1123trying to figure out why I can't loop over these elements
20:15duck1123couple hours
20:16duck1123I'm just now writing my script, did my template conversion over the past week
20:32duck1123seq is supposed to work for arrays, right? I keep getting errors.
20:35Scriptorit'll convert an array into an insteance of ISeq
20:36duck1123and that's where the exception is hapening
20:36duck1123looks like it's hapening in the else block of ISeqable
20:37duck1123should I be following master, or should I stick to "stable" builds if there are any?
20:47duck1123for the record (dorun (for [i (range (alength elements))] (aget elements i))) did the trick
20:47duck1123not as natural as doing simply (doseq but it'll do
21:11st3fanis org.clojure/java.jdbc decent?
21:11st3fanor should i use something else?
21:19scottjst3fan: if that's the new clojure.contrib.sql, then that's by far the most popular tool. you could also look at clojureql
21:19ohpauleezst3fan: It depends on what you're looking for. It's very decent, you might want to also look at clojureql
21:23st3fan:-)
21:23st3fanoh wait it moved to clojure.contrib?
21:24st3fani grabbed this from org.clojure/java.jdbc
21:25scottjsounds fine
21:34amalloyst3fan: it moved *from* contrib
21:36amalloycontrib is, over the course of the next hundred years, being dismantled into several separate libraries
21:38ohpauleezhaha, well put
21:52st3fanoh
23:04luccaI've tried lein search, but it seems to want to download a maven index, which now seems to be forbidden... is there a workaround or a better way to do these things?
23:11goodieboyanyone using noir?