#clojure logs

2012-06-05

00:04gf3WEEEOOOOOOOOOOO
00:04gf3REFERENCE HEAPING
00:13eggsbyis anyone here familiar w/ aleph? I'm trying to use the udp aspect but every time I try to enqueue a message to the receiving port I get ":lamina/already-realized!", anyone familiar?
00:14eggsbyhttps://github.com/ztellman/aleph/wiki/UDP and https://www.refheap.com/paste/3002
00:22eggsbyah, I had to dereference the channel
00:48phearthecealHey guys, I'm back
00:48phearthecealI'm stuck on problem 21 on 4clojure
00:48pheartheceal"Write a function which returns the Nth element from a sequence."
00:49phearthecealBut I can't use the 'nth' function
00:49phearthecealI'm confused on how I can keep incrementing a variable until it reaches the nth place I'm looking for
00:50xumingmingvuse first/next
00:51phearthecealI am
00:51kovasbyou can also do it recursively
00:51phearthecealI figured out how to go through the list recursively
00:51gf3Can't simply use drop/first I guess?
00:51kovasbinstead of incrementing, pass the number in as an argument
00:51kovasbin addition to the remaining list
00:52phearthecealThe function can only take two arguments though
00:52phearthecealhttp://www.4clojure.com/problem/21#prob-title
00:52phearthecealOtherwise I would have done that first
00:52gf3pheartheceal: recur inside the function
00:53phearthecealcan I recure two arguments?
00:53kovasbyou can make an anonymous function that iterates exactly n times
00:53kovasbyour main function gets n, creates this anonymous function and then invokes it with the list
00:54phearthecealha!
00:54phearthecealGot it
00:54phearthecealthanks gf3
00:54pheartheceal(fn [l x] (if (= x 0) (first l) (recur (rest l) (- x 1))) )
00:55gf3Woo!
00:56eggsbyI wonder why it won't let you use destructuring there
00:56eggsby(fn [[f & r] n] ;...)
01:23amalloy&(macroexpand-1 '(fn [[f & r] n] n)) ;; eggsby
01:23lazybot⇒ (fn* ([p__10985 n] (clojure.core/let [[f & r] p__10985] n)))
01:23amalloy&(macroexpand '(clojure.core/let [[f & r] p__10985] n))
01:23lazybot⇒ (let* [vec__10993 p__10985 f (clojure.core/nth vec__10993 0 nil) r (clojure.core/nthnext vec__10993 1)] n)
03:02TheBusbyAny idea why clojure.core.reducers/fold in Clojure "1.5.0-alpha1" would throw NoClassDefFoundError for jsr166y/ForkJoinTask on Java 1.7 ?
03:13lekure
03:39TheBusbyguessing maybe AOT compilation is for Java 1.6 and not 1.7?
03:42amalloyi think it got AOTed against 1.7, actually; usually people with an issue like this are running 1.6
03:47TheBusbythat's what I thought, which is why I'm finding this error strange
03:49TheBusbyamalloy: recompiled clojure-1.5.0-alpha1.jar from source, and everything works fine now
03:50TheBusbylooks like [org.clojure/clojure "1.5.0-alpha1"] is compiled on Java 1.6 :(
03:53amalloyTheBusby: if you can figure out how, i'm sure rich would love a patch for actually-dynamically deciding where the framework lives, instead of doing it at AOT time
03:53amalloythat code's near the beginning of clojure.core.reducers
03:53TheBusbyI was looking at it a minute ago, to make sure I didn't have anything setup incorrectly
03:54TheBusbyunfortunately I'm not too familiar with the Java eco-system, so that isn't an area I can dive into without spending a lot of up front time. I'm sorry :(
03:57amalloyTheBusby: no need to apologize; nobody's paying you to do it
03:58amalloythat said, i don't think it's a java-oriented task at all. i think the existing code can be made to work with a little bit of ugly fiddling just in clojure
03:59amalloyeg, instead of checking in compile-if, define fjinvoke (and similar functions) so that, the first time they're called, they do the checking and alter-var-root themselves to an appropriate function, compiled via eval
03:59TheBusbyamalloy: I can think of a number of simple dirty ways to do it, but since this is at such a low level it needs to be done very cleanly...
04:00TheBusbyahh, didn't know about alter-var-root
04:23michaelr525hello
04:29augustlhttps://github.com/tavisrudd/redis-clojure makes no mention of any documentation - anyone know where I can find it?
04:30clgvaugustl: you probably have use 'doc then
04:32clgvaugustl: or check the source of redis/core.clj - if you dont learn anything from it, you should probably not use this lib
04:32michaelr525i wonder why the solution in the comment here: http://www.snowfrog.net/2012/06/04/4clojure-97-pascals-triangle/ fails with stackoverflow even after replacing (nth) with (take 1 (drop n))
04:32michaelr525does anyone know?
04:34clgvmichaelr525: its written recursively without tail recursion. so it will consume the stack until nothing is left for large inputs
04:34clgvyou'd have the same problem in other languages that have no built-in tail call optimization
04:36clgvmichaelr525: if you want to write that programm, you can use a dynamic programming style instead of recursion
04:38amalloyclgv: you'd have the same problem in any language with TCO as well, unless you're suggesting the compiler is so smart it can rewrite this algorithm to be tail-recursive
04:38michaelr525clgv: i though that lazy sequences somehow solve that, no?
04:38michaelr525thought
04:38amalloymichaelr525: they can, but you have to be delicate
04:38clgvamalloy: right, that phrasing above was not ideal ;)
04:38amalloyhave you looked at anyone else's solution?
04:39clgvmichaelr525: yes they can. you can look at the first comment
04:39michaelr525nope, i've just stumbled on this blog and it looked interesting since I've implemented a large lazy seq a few days ago and it worked really well without overflowing
04:39michaelr525clgv: i'm talking about the first comment :)
04:40augustlclgv: ah, I'm not yet used to the fact that docs are built-in to the language :)
04:40clgvaugustl: but that core.clj seems not to have much doc strings anyway
04:41clgvmichaelr525: oh? it shouldnt stackoverflow but heapoverflow since he is holding on to the head of the lazyseq
04:41amalloyclgv: no, he is recursing indefinitely
04:42amalloyhttps://gist.github.com/2873658 is a solution that works for any N
04:42clgvamalloy: in the first comment with the next-row function? I think thats lazy and should work if he wouldn stick to the head. but I never used lazy-cat so I might be mistaken about how it works
04:43tomojclojure.string/replace should be named clojure.string/replace-all
04:43tomojoh well
04:43tomoj:rename {replace replace-all}
04:43amalloyclgv: i guess that's true, it's not the most-obvious kind of stackoverflow
04:44amalloybut it is a pretty common sort; see here for the example i always use:
04:44amalloy$google stackoverflow prime sieve dbyrne
04:44lazybot[recursion - Recursive function causing a stack overflow - Stack ...] http://stackoverflow.com/questions/2946764/recursive-function-causing-a-stack-overflow
04:44ro_stis there something like ruby's resque in clojure?
04:45ro_stgoogle it, ro_st!
04:46clgvamalloy: oh right. the rows are not realized in the call to `next-row`
04:46michaelr525so it's a 'holding the head' case?
04:47clgvmichaelr525: nope. you can fix it with a doall wrapped around the body of next-row. holding on to the head can be fixed by moving the iterate statement into the pascal function
04:48michaelr525amalloy: isn't this stuff compile time only? : `(0 ~@row)
04:48amalloyit's just shorthand for (concat [0] row)
04:48amalloyshorthand which is most often useful when writing macros, but in no way restricted to it
04:48clgvamalloy: uuuh thats an evil trick for minimizing the golf score ;)
04:49michaelr525:)
04:50clgvamalloy: but your solution should have the same "map-stacking issue".
04:50amalloymmmm, you think so?
04:50amalloyyes, i suppose it will. it's a subtle trick to get used to
04:51amalloyas always you can fix it with a doall
04:56michaelr525i don't understand how doall fixes anything, the doc says it's holding on the head
04:56michaelr525,(doc doall)
04:57clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
04:59augustlin ring, is it correct to say that the handler might get called multiple times for one request? It seems that middlewares typically manually call the handler function
04:59augustl..when you use middlewares, that is, typically via the threading macro
05:01augustlseems kind of odd, since handlers might have side effects like writing to a databse
05:02clgvmichaelr525: doall realizes the row hence there will be no recursive stacking of map statements
05:02tomojI have some mutable state (settable static fields in java) that I can't easily avoid using from clojure
05:02tomojI have two functions, lex and parse. lex needs the fields set one way, parse the other, and parse calls lex once
05:03tomojhow can I avoid concurrency problems?
05:04tomojI mean, one way is to just synchronize all lex and parse calls, but what's better?
05:04antares_tomoj: you can just lock. (locking obj …)
05:04tomojbut then only one thread will be used, while I could be running multiple parses or multiple lexes at a time
05:05antares_tomoj: that's not true. You can use any number of threads. They will have to wait on the lock some of the time, but that's how things are with mutable shared state.
05:06tomojoh, right, but I mean it will all be synchronized
05:06antares_tomoj: also, what kind of state do you share between parsers?
05:06tomojonly one parse or lex happening at the same time
05:06antares_I can't think of any
05:06tomojthe only state is this static field which configures the behavior of an external library I'm using
05:07antares_tomoj: set it once and don't modify it in your parser
05:07tomojit's a boolean field that needs to be true when lex runs and false when parse runs
05:07antares_tomoj: then just use a lock
05:08antares_there is no magical solution to shared global state in a 3rd-party library.
05:08augustlanyone got some examples of doing side effects (database stuff) in ring?
05:08tomojI'm not looking for a magical solution, I'm looking for a real solution
05:08antares_so either avoid this shared state in your design (why do parsers and lexers need to constantly reconfigure external library?) or lock
05:08tomojone solution is to run a big batch of lexes first and then run a big batch of parses
05:08tomojlocking means I only use one core
05:08tomojyes?
05:08clojurebotyes is is
05:09antares_tomoj: sorry but that's not true
05:09antares_tomoj: locking means the section of code that is locked will be accessible to one thread at a time but all the other work can proceed in any number of threads
05:09tomojthere basically is no other work
05:09antares_tomoj: but more importantly, you cannot avoid it in your case unless you don't run lexers and parsers separately
05:10antares_which may be a good idea if you can do it
05:10antares_tomoj: do you have any profiling results that show that lock contention is really the bottleneck?
05:11tomojlock contention?
05:11augustlseems like you have to do side effects in a middleware in Ring. So my handler should return a key that the middleware can read to do data operations.
05:12antares_tomoj: the time spent by threads waiting for the lock to be released
05:13tomojwell the answer is no
05:14tomojif I have 8 cores and I can run 8 parses at a time and 8 lexes at a time, why wouldn't this by ~8x faster than 1 parse and 1 lex at a time?
05:14michaelr525clgv: sorry, i still don't get it :) everything seems lazy here and the sequence of rows realized when pascal is called..
05:14antares_tomoj: because your current algorithm has inherent mutable shared state
05:14antares_tomoj: I suggest that you learn what lock contention is and run some profiles
05:14antares_otherwise it's a bit like that Web Scale movie
05:14tomojI can run 8 parses and 8 lexes (separately) at a time even with the mutable state
05:15antares_then do it
05:15tomojlocking means I can only run 1 parse or 1 lex
05:15tomojor is that wrong?
05:15antares_tomoj: that's incorrect
05:15antares_for *that particular locked critical section* it is true but there should be some other work involved
05:15antares_other than flipping that boolean field
05:15antares_otherwise what your parser and lexer are doing?
05:16tomojok, right, if my minimal processing of the results is the bottleneck, then yeah
05:16tomojthe parser and lexer are in the external library
05:16tomoj(the calls to which need to be in the critical section)
05:17antares_tomoj: use locking first, run some profiling with VIsualVM, it will be clear from the thread tab if there is serious contention or not (if all lines are mostly red, there is)
05:17antares_and in that case, run all lexers first and then all parsers
05:17antares_using a countdown latch, for example, to make sure you run parsers only when all lexers have finished
05:17michaelr525clgv: but i understand that somehow the problem is caused by (map) which is recursive, right?
05:17clgvmichaelr525: the problem is that each row is not realized until you access the lazyseq of 'iterate. that means that you get something like (map + (lazy-cat ... (map + (lazy-cat ... (map ...)) (lazy-cat (map ...) ...)) (lazy-cat (map + (lazy-cat ... (map ...)) (lazy-cat (map ...) ...) ...))
05:17tomojantares_: thanks
05:20ro_stOT: email hosting. want to stop using godaddy. suggestions?
05:20ro_st(please)
05:20clgv=> nil
05:23tomojI assume gmail doesn't satisfy
05:25ro_stit's a bit expensive.. $5pm
05:25ro_stwe're in south africa. our currency is $ * 8.
05:26ro_sti found rackspace email for $2 which looks great
05:26ro_stprobably go with them, and dnsimple.com for dns/ssl
05:27michaelr525clgv: i think i'm beginning to see it now, in order to get row N iterate is actually building a recursive call graph of (next-row (next-row (next-row..
05:28michaelr525clgv: ok, now i understand why doall fixes it :)
05:28michaelr525thanks!!
05:30michaelr525ro_st: why not run your own?
05:31ro_stmichaelr525: don't want the headache, tbh
05:31ro_stmoving away from self-host towards cloud. time is more important than money for us, now. small startup starting to get big work
05:32ro_stanyone got clojure code in production on heroku? wanting to see if i can ballpark reqs/sec to get an idea of how many dynos i'll need
05:33ro_sti guess i should just put something up and hammer it!
05:34ordnungswidrigro_st: exactly. measure yourself.
05:35ro_sti would be keen to hear from others what sort of perf they're getting, though
05:36ordnungswidrigro_st: I'd suppose that very depends on the application, won't it?
05:37ro_stof course. which is precisely why i'd like to hear from others. what apps get what throughput?
05:38ordnungswidrigI see.
05:38ro_stbeing heroku, the underlying platform is very even. comparisons between apps will be a lot more telling because you really are comparing the apps, not the apps and the stacks they're on
05:38ordnungswidrigro_st: that's a point. supposed the platform is really even :-) I cannot judge on that.
05:38ordnungswidrigbrb
05:41vijaykiranro_st: you might be interested in discussion here: http://news.ycombinator.com/item?id=4062364 if you haven't seen that already
05:44ro_stthanks, i had read the post but not the discussion
05:52borkdudeis there anything against just using public fields in internal "dtos" that are not exposed via public apis?
05:52borkdudeinstead of all the getter/setter malarkey
05:58michaelr525after using amazon for a month I realized just how expensive they are, went on and rented a dedicated server at hetzner. but i am just using it for my projects which are not generating revenue at the moment. a financed startup should probably use the cloud imo
06:13ro_stwhen comparing the costs of cloud vs a salary for a fulltime devops person, the cloud wins
06:38antares_ro_st: not if you need a lot of RAM or good IOPS
06:39antares_in that case, you quickly run into thousands of $ per month with a bunch of extra large instances and EBS volumes. Plus, AWS is not 0 maintenance: instances go down sometimes randomly, throughput is not very predictable.
06:39ro_stour app is such that there isn't a big io requirement. we don't work with manual file writes outside of marginal things like profile pics
06:40ro_stit's very much straight-forward request > database > html/json > response type stuff
06:41ro_stheroku will take us from where we are now (couple thousand users, couple hundred concurrent) to the point where it makes sense to hire a full time dev-ops and run our own metal
06:42ro_stonce we get to the end of that sentence, we should have more than enough revenue to do that properly
06:42ro_stthanks for your feedback, antares_. good to know. i'm not naive enough to think that it's a silver bullet
07:36ro_stwhy do i not get locals in the exception browser, but i do when using swank/debug?
07:39winkI have weird performance experiences on EC2 large
07:40winknot sure I'd ever go there again
07:53michaelr525hello
07:53kij_Heey
07:58ro_stusing korma sql, i keep getting "Message: Communications link failure" errors
07:58ro_stif i re-run then it goes through ok
08:03gfredericks,:/
08:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :/>
08:04kij_ro_st: still on mysql ?
08:07ro_stkij_: aye
08:11ro_stbusy writing clj to convert mysql data to mongo
08:13kij_ro_st: I dont use mysql, but cant you find something in the server logs?
08:14antares_mysql has the famous "server gone away" issue with connections that may be stale for hours
08:14antares_when the server just closes down the connection
08:14antares_so on the 1st request it fails but then decent clients try to reconnect
08:15antares_although if there's constant activity, it is probably something else
08:16mittchelIf you save something in an atom.. is this saved only for the lifetime of the application or also when you rerun the program?
08:16antares_mittchel: atoms and other clojure reference types are in-memory
08:22gfrederickscore.logic has compelled me to type "expresso"
08:28kij_gfredericks: care to explain ?
08:31gfrederickskij_: it was just an espresso joke; a core.logic naming convention appends 'o' to words
08:33kij_gfredericks: Ahh, sure. :) neato
08:42TimMcor other vowels
08:44tomoj,(.replaceAll (re-matcher #"\\s" "foo bar") "")
08:44clojurebot"foo bar"
08:44tomoj,(.replaceAll (re-matcher #"b" "foo bar") "")
08:44clojurebot"foo ar"
08:44tomojwhy?
08:44clojurebotWhy is why
08:44clgv,(.replaceAll (re-matcher #"\s" "foo bar") "")
08:44clojurebot"foobar"
08:45clgvregexp literals are special - you dont need to escape the backslash
08:45TimMcclojurebot: forget Why |is| why
08:45clojurebotI forgot that Why is why
08:46tomojaha
08:46tomojthanks
08:46clgvwhy?
08:46clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
08:46clgvlol^^
08:46TimMcIt's got a few, but that one sucked.
08:46foxdonut&(inc TimMc)
08:46lazybotjava.lang.RuntimeException: Unable to resolve symbol: TimMc in this context
08:59clgv(inc TimMc)
08:59lazybot⇒ 7
08:59foxdonut(inc clgv)
08:59lazybot⇒ 3
09:00clgv$karma foxdonut
09:00lazybotfoxdonut has karma 1.
09:01clgv,(println "(dec clgv)")
09:01clojurebot(dec clgv)
09:01lazybot⇒ 2
09:01clgv;)
09:02foxdonutclgv: lol, that's clever
09:02clgv,(println "(inc clgv)")
09:02clojurebot(inc clgv)
09:02lazybot⇒ 3
09:02clgvyeah. clojurebot is a willing slave ^^
09:02foxdonut(map inc [clgv TimMc])
09:03clgvthats not implemented ;)
09:08foxdonut(inc lazybot)
09:08lazybot⇒ 5
09:11clgv(inc lazybot 10)
09:11lazybot⇒ -1
09:11clgv(inc lazybot)
09:11lazybot⇒ 6
09:11clgv(inc clojure)
09:11lazybot⇒ 5
09:20gfredericks,(dotimes [n 3] (println "(inc cheating)"))
09:21clojurebot(inc cheating)
09:21lazybot⇒ 1
09:21clojurebot(inc cheating)
09:21lazybot⇒ 2
09:21clojurebot(inc cheating)
09:21lazybot⇒ 3
09:21Hodappwhat do you folks use Clojure for?
09:21Hodapp...besides harassing those poor bots
09:21alexyakushevSometimes we harass people with it
09:22gfredericksmucking with logic programming
09:23Hodappgfredericks: ooh, like what?
09:25foxdonutHodapp: web development
09:26Hodappfoxdonut: whaaaaaaaaat?
09:27Hodappthat looks like taking a page from the Paul Graham playbook
09:28TimMcHodapp: I wrote my wedding gift registry site in Clojure.
09:28HodappWhy didn't you just do it in something simple like PHP?
09:29TimMc$google PHP is a fractal of bad design.
09:29foxdonutHodapp: PHP? You've got to be joking.
09:29lazybot[PHP: a fractal of bad design - fuzzy notepad] http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
09:29HodappTimMc: I like that article. "fractal of bad design" is very descriptiove.
09:29Hodapp-o
09:30foxdonutHodapp: PHP is to web development what McDonald's is to food.
09:30kilonhorse meat ?
09:30foxdonutsure it's quick, easy, cheap, and tasty, but in the long run it's really bad for your health!
09:30augustlis there a guide somewhere on clojure.org for -> and ->> etc?
09:31borkdude,(doc ->)
09:31clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
09:31borkdude,(doc ->>)
09:31clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
09:31Hodappfoxdonut: I've been lucky enough to have not written more than 40 lines of PHP in my life.
09:31augustlother than the (doc) which is very minimal :)
09:32Hodappfoxdonut: I wasn't aware anyone used Clojure for web development.
09:32Hodappnot that I'd really checked.
09:32borkdudeHodapp my students are also making a small webapp in clojure as a final product, it's not that difficult if you know where to start (noir)
09:32foxdonutHodapp: it's actually a really good fit. f(request) = response.
09:32borkdudeHodapp small course, only 5 lessons
09:33Hodappborkdude: link?
09:33augustlHodapp: why not use clojure to build web apps? I think functional paragdims are a great fit for the web. You get a request in, and have to return a response.
09:33Hodappaugustl: Mostly because every time I hear "web app" I reach for the bourbon.
09:33borkdudeHodapp link to what?
09:33TimMc$google clojure noir
09:33lazybot[Noir] http://webnoir.org/
09:33augustlHodapp: so the web is your pet peeve or something? :)
09:34TimMcWeb programming is a mess.
09:34cemerickHodapp: well done, sir! :-)
09:34Hodappaugustl: No, I've just had to use Java EE.
09:34kilonweb is a mess
09:34augustlI'm not a big fan of noir though.. It uses a bunch of side effects for a lot of things, like setting cookies
09:34foxdonutHodapp: I can respect your running away from web development, but that has nothing to do with using Clojure or anything else for it.
09:34augustlinstead of just returning something
09:35zomgHodapp: the last time I had to use Java EE, I jumped ship
09:35augustlI've used compojure for a small site, and I'm about to try it for a big site now
09:35HodappThat was one thing I found appealing about how CGI and FastCGI worked.
09:35borkdudeaugustl how would you set a cookie without making that a side effect?
09:36Hodappfoxdonut: Yes, I know that that's the case.
09:36borkdudeaugustl return a new running webserver for each request? ;)
09:36augustlborkdude: return something that causes Set-Cookie to be set
09:36zomgYou could build a response object or whatever is the correct terminology in Clojure lingo
09:36augustlborkdude: typically, your handler ends up returning {:status 200 :body "foo" :headers {}} etc, so you just add "Set-Cookie" as a header
09:36borkdudeyes, I guess that is possible
09:37augustlor as ring/compojure does it, {:status 200 :cookie {.....}} and does the heavy lifting for you
09:37borkdudeaugustl I guess you could also do it by falling back to compojure in noir? I didn't really go this far yet
09:37augustlprobably, but I don't see what noir really brings to the table, other than defpage which is kind of useful
09:38solussd_is it possible to have emacs/swank just abort immediately on exception, rather than me having to explicitly abort? It'd be nice to see the exception in another buffer, but be able to just carry on
09:38augustlI'd prefer a compojure-defpage over noir any day though :)
09:38borkdudeaugustl it's easy for beginners I guess
09:38borkdudeaugustl you can do a lot of stuff by just looking at the noir api
09:38solussd_I like noir b/c it works nicely with things like fetch. :D
09:39augustlborkdude: easy for beginners is not really important for me...
09:39augustlnot because I'm not a beginner, I am
09:39augustlbut because in 1 month I won't be, and then I'll never be a beginner again :)
09:39foxdonutI think learning noir as a beginner is a mistake.
09:39gfredericksHodapp: a program that generates various expressions for 42
09:39augustlso I prefer to optimize for the post-beginner stage ;)
09:39solussd_and noir isnt robbing you of any power- it's just making a few things simpler
09:39foxdonutI prefer the bottom-up approach. Learn ring, then compojure, then noir, so you understand what noir is doing for you.
09:40augustlI suppose noir is also nice if you don't want to deal with functional programming
09:40augustlbut rather thread local state and all that jazz
09:41zomgWhat are the pros of using Clojure in web dev vs. something else?
09:41zomgJust wondering if there's something neat, like type-safe routes or type-safe URL generation like in Haskell web stacks
09:41borkdudetype-safe?
09:42borkdudein clojure?
09:42zomgHey I'm a noob :)
09:42cshell_Probably the same benefits as using Clojure anywhere else
09:42augustlweb dev is one of those cases where parallellism isn't really that much of a big deal in OOP, as you typically do one thread per request, and don't share things across requests, etc
09:42augustldue to the request/response nature
09:43augustlbut yeah, what cshell said :)
09:43borkdudethe benefit for using clojure in web dev is: you can use clojure
09:43cshelllol
09:43zomgI'd count "not being fucking hard to learn" as one if comparing against haskell...
09:43zomg=)
09:43augustlthe other day I was cleaning up my page.clj into two files, one for getting them, routing them etc, and one for dealing with one single page. It was as simple as just extracting the functions, since I didn't have any shared state in an object etc
09:43cshellhaha, depends on who you ask I guess :)
09:44borkdudethe con in using clojure in web dev is though: you have to use clojure ;P
09:44augustlthis is a FP benefit though, not specificailly clojure..
09:44cshellI think using Clojure for web dev is much simpler than using the Java web stacks in my experience
09:44borkdudewell not exactly, you can defer to the underlying host of course
09:44augustlzomg: of course the major benefit for clojure is that it's hosted on platforms with huge ecosystems
09:44augustlzomg: finding libs to do, say, parsing of MS excel files might be harder in Haskell than for the JVM or .Net
09:45cshellzomg: augustl is right, it works wonderfully on Heroku
09:45zomgcshell: yeah definitely, although my exposure to java web stacks isn't very big, I do remember them being very much a PITA :P
09:45zomgaugustl: true
09:45augustlzomg: ask the same question in 1 month when I've written a large-ish web app with Clojure :)
09:46zomgThe large amount of libs for Java was always a big pro for Java in my books but I just never really liked the enterpriseyness of everything =)
09:46borkdudeone benefit in using clojure is maybe also: you can use clojurescript on the client side of things
09:46augustlhopefully my peers won't kill me for ninjaing in clojure
09:46augustlzomg: compared to Ruby, I've grown to like the libs on the Java platform. Not the frameworks mind you, but the libs
09:46augustllike the apache HTTP lib, it has EVERYTHING and is 100% standards compliant, etc
09:46borkdudezomg books?
09:46ordnungswidriganyone tried openshift with clojure webapps yet?
09:47augustl(I'm new to the JVM)
09:47zomgborkdude: huh?
09:47borkdudezomg "was always a big pro for Java in my books" is this a saying in English? (sorry, my bad)
09:47zomgAh :)
09:48zomgYeah, it's sort of like saying "in my opinion" or such
09:48borkdudezomg yeh ok, I sort of figured
09:48augustlin my book*
09:48augustlafaik ;)
09:48zomghaha, could be :P
09:49duck1123he has more than one book
09:49augustlone book for each hat?
09:50zomghats hats hats hats
09:50zomgand pootis
09:50zomgIf you don't get that, let's just say I've played too much TF2
09:50zomg=)
09:50borkdudeTF2 isn't that a Microsoft game where you can commit code etc?
09:51zomgThankfully no :D
09:51borkdude:P
09:51foxdonutaugustl I don't eat ham ;)
09:51zomgAlthough I have used that MS game where you can commit code, but before you must check out the file for your personal use
09:51zomgAnd then when I forgot to commit and went off to holidays, the sysadmin had to unlock all my files for everyone else...
09:51aduaugustl: how long have you been speaking English?
09:52freiksenethave anyone used riak with clojure? Is clj-riak okay to use or is it better to use java lib?
09:52augustladu: hard to tell.. 15 years on paper, had english in school, not sure how long I've been really using english.
09:53duck1123freiksenet: there's the clojurewerkz one
09:53zomgSounds about as long as I have if counting when we had english in school
09:53antares_freiksenet: http://clojureriak.info
09:53antares_freiksenet: look no further
09:53freiksenetaha, thanks
09:53freiksenetmissed that one because of the weird name
09:54borkdudetalking about web dev, has anyone used struts2?
09:54duck1123with clojure?
09:54borkdudeI have to acquaint myself with it
09:54borkdudeno, just as it is
09:55borkdudeit would be nice if clojure could somehow be smuggled in of course
09:55antares_borkdude: it's the state of the art of crappy old frameworks ("before Rails" frameworks, basically)
09:55foxdonutborkdude: yes I've used S2. You have to learn it for work?
09:55borkdudeantares_ what would be a newer better framework for java?
09:55borkdudefoxdonut yes
09:55augustlantares_: Rails doesn't get enough credit for changing the scene :)
09:56antares_borkdude: there's probably more than one but Play (playframework.org) is the way to go, I'd say
09:56duck1123I have a new Java web-dev project on the horizon. I'm trying my hardest to figure out how I could convince them to let me use Ring
09:56augustlduck1123: there's a talk about that, how to get clojure into the enterprise
09:56antares_augustl: oh come on, whether you like Rails and its approach and community, it did shake things in the WEb frameworks world considerably, like nothing else in the 2000s :)
09:56augustlduck1123: basically, tell them that it's still Java, only different syntax (which is true)
09:56duck1123I tried looking into Play, but I ran into too much that wasn't finished
09:56augustlantares_: isn't that what I said?
09:57foxdonutborkdude: does it have to be S2 or could it be something else?
09:57antares_augustl: sorry, hard to understand things over the IRC after 11 hours of programming :(
09:57augustlantares_: haha, I know the feeling
09:57borkdudefoxdonut it's kind of decided already for this year, but it could be any web framework
09:57borkdudefoxdonut for java that is
09:58Hodappit gets really frustrating at work because what I end up with is 10 different dismissals that all boil down to "I don't know this language, and that means I'm not top dog anymore."
09:58borkdudefoxdonut it's for a course with a "first introduction into frameworks"
09:58Hodapp"No one uses this, it must not be useful", etc.
09:58antares_borkdude: I'd say Play 2 is as friendly as it gets in the Java landscape today
09:58borkdudeantares_ good to know, I'll keep that in mind
09:58augustlHodapp: sounds like making the best possible products isn't the biggest concern :)
09:59foxdonutborkdude: personally, for Java web development, I like Stripes (I'm biased on that one), and Spring MVC
09:59aduHodapp: can you give me an example "dismissal"?
09:59augustlpersonally, I discarded Play when I saw they used exceptions for control flow in order to get a Ruby-like API.. (This was Play 1.x though)
10:00antares_freiksenet: let me know if you run into any issues, missing docs or any other problem with Welle. There's also a separate mailing list (clojure-riak google group).
10:00freiksenetantares_: looks very nice so far
10:00freiksenetis lack of secondary index support a protocol buffer problem or WIP?
10:00freikseneti mean lack of supports during protocol buffer connection
10:00antares_freiksenet: it is a Riak 1.1 limitation
10:00freiksenetok
10:01antares_in the future Riak versions, PBC will be feature complete
10:01duck1123I've been impressed with the clojurewerkz libraries. I'm deep in the middle of yanking Karras out and replacing it with Monger
10:01antares_freiksenet: actually, with Welle 2i will work for PBC (they *should*)
10:01antares_freiksenet: but this is because Welle/Riak Java driver cheat under the hood and use HTTP for 2i ;)
10:01Hodappadu: "Yeah, sure, functional programming is a neat idea, and it's cool in theory, but no one uses it. For real programming, other languages are better."
10:01antares_duck1123: cool. Monger will go RC1 in a week or two :)
10:02jcrossley3ordnungswidrig: clojure on openshift is pretty straightforward: just hand it a war built with 'lein ring uberwar'. it's also possible to run immutant on there: https://github.com/projectodd/polyglot-openshift-example
10:02augustlHodapp: some articles on FP briefly mention "big ultra scalable finance systems tend to use FP", I wish they also typically included references on that..
10:02freiksenetantares_: sounds good.
10:02duck1123I'm at the point where I only have a few failing tests left to fix. (then a lot more to write)
10:02borkdudeantares_ my students don't know scala though, is that a problem with using play2?
10:02aduHodapp: sounds drain bamaged
10:02antares_borkdude: play has Java API
10:02antares_borkdude: so no, it is not
10:02Hodappaugustl: Oh, I mentioned Erlang at Ericsson, and some big financial firms that used OCaml. These were ignored.
10:03antares_play was created to be used with scala or java
10:03Hodappadu: pseudo-intellectual in many ways, really.
10:03duck1123finding the right docs for Play can be a pain because of the big changes between 1 and 2 and the Java/Scala split
10:03borkdudeantares_ I see some configuration in http://www.playframework.org/documentation/2.0.1/NewApplication using scala I think
10:04jweissis there an equivalent of "slime-connect" in Eclipse/CCW? i can't find where to connect to an existing swank server.
10:04antares_borkdude: http://www.playframework.org/documentation/2.0.1/JavaHome
10:04Hodappadu: curiously, such discussions always culminate in "therefore, C++."
10:04borkdudeantares_ ok tnx
10:05aduHodapp: that's like saying: oh, nails are great and all, but nobody uses them
10:05tomojany better way to write #(if (#{"foo" "bar"} (first %)) (second %) %) ?
10:05adu"we build every building out of paper these days, it's so green"
10:05Hodappadu: well, of course not. Who's ever seen a nail anyway?
10:06augustlany suggestions for which Erlang book I should read? :)
10:07Kototamahi, is there a way to have the ring.middleware.stacktrace working with SLIME? i just get the stacktrace displayed as text but not the slime debugger on it
10:07borkdudeantares_ do you recommend a book for play2, or just the online docs?
10:07augustlHodapp: is the argument typically that content-free btw? No one uses FP, OOP is better for real programming - that doesn't actually say anything about anything
10:07aduHodapp: after researching the US federal reserve system, I've come to the conclusion that most people are too lazy to think about anything
10:07Hodappadu: The justification that it's easier to find a trained monkey who can write C++/Java than a trained monkey who can write $other_language also comes up a lot.
10:08aduHodapp: that's new-world-order thinking, power-to-the-overlords thinking, we should be empowering the code monkeys instead
10:08augustlHodapp: that's pretty common - optimizing for the 0.5% of the time as an employee when you aren't familiar with the systems..
10:09Hodappaugustl: Yes, it's fairly content-free and it seems to apply to every single paradigm except their favorite one.
10:11augustlHodapp: I guess your only choice is to make it seem like using FP was their own idea :) Which is kind of trickster-y, but also useful since it'll make the people actually realize why FP is good as a side effect (no pun intended)
10:11Hodappaugustl: The problem is that they're almost always going to aim for the side of reinventing the wheel in a piss-poor way before they'll use someone else's wheel.
10:12Hodappalso, I'd be more likely to pay attention to their arguments if their conception of OOP in any way resembled what Alan Kay came up with when he coined the term
10:13antares_borkdude: I've read the Scala version, it's pretty good
10:13augustlin more general terms I suppose my point is that everyone is better off if you try to "help" them to see the light, rather than being angry at them. Not that I know which of those you're actually doing, just saying.
10:17TimMcThe other day I pointed out to my boss that it would be easier for a new employee to learn Clojure than to get the hang of several Java EE frameworks that don't like to cooperate.
10:17TimMcHe was dubious, but it's definitely true for my experience...
10:18ordnungswidrig*g*
10:18ordnungswidrigtimmc: you're right. and it would not be bound to application server / web development stuff
10:19borkdudeTimMc I think that might be true for Java EE stuff, but learning Clojure without Java itself is a bit difficult I think
10:19augustlTimMc: that's an interesting point
10:20TimMcborkdude: Nah, we're already a Java shop, so that's taken care of.
10:20borkdudeTimMc I mean, you will run into Java Exceptions, interop stuff, later on
10:20cshellTimMc: I have had similar conversations, but the problem that comes up is that Clojure is too advanced for our 'average' developer
10:21TimMccshell: And why are we hiring "average" developers?
10:21TimMcborkdude: It's when you try to combine CXF, Jetty, Velocity, Jackson, etc. there's a *huge* amount of domain-specific knowledge you need to load up on.
10:21cshellTimMc: My question was similar but was "why don't we get rid of the average developers"
10:21TimMcheh
10:21augustlit's a valid argument that your employees aren't skilled enough, but I don't think that's actually the case every time it's brought up
10:22HodappTimMc: I find it very curious that the lead dev here reminds us at least once a day how the average person is "completely retarded", but in matters of programming languages, when he says "no one uses this" - which is frequently - he's basically deferring to the average person's opinion.
10:22cshellTimMc: It's amazing how many people don't want to learn anything beyond what they already know (OO)
10:22borkdudeI think Clojure can be learned by average developers, if they get proper education and if they are willing to learn
10:22TimMcI suppose it's hard for someone who has always used languages that enforce a strict language/program separation to understand that you can compare the learning of the two on a level playing field.
10:23TimMcborkdude: And we totally have above-average devs here anyway, so I'm not concerned about that. :-)
10:24cshellI've been trying to mentor developers on FP and the benefits, but I discovered they didn't even know how to write automated tests or do anything with DI or anything other than just throw code together to make it work
10:24TimMcHodapp: That's excellent.
10:25augustlcshell: in those cases, the urge for OO is probably rooted in familiarity, most likely via schooling
10:25cshellaugustl: I agree
10:26TimMcMaybe one day I will make a list of all the "languages" I have had to learn in Java Enterprise land.
10:26gtrakcshell: start with trying to get them to think about what they're doing in general
10:26borkdudeaugustl it begs for the question, why did it became the default in schooling?
10:26borkdudebecome
10:26augustlI know that when I was a noob programmer that did Rails, I wouldn't take you seriously if you suggested a "scientific" language like Clojure, and say to you that Ruby is designed for programmers, not computers!! etc :)
10:26augustlborkdude: that's an article I'd love to read :)
10:26cshellgtrak: yeah, I realized I have to go all the way back to the beginning
10:27gtrakkind of a chicken and egg
10:27borkdudeaugustl chicken and egg there also: somehow it became popular, so schools didn't so Fortran, Modula, Ada, etc but Java
10:28borkdudeaugustl which sucks!
10:28borkdude;)
10:28borkdudeaugustl you have to ask the question: why did it become popular in general
10:28cshellOO was considered much better for larger systems than procedural programming, which isn't necessarily the same as Functional Programming
10:29cshelland for the most part they were all single threaded way back then
10:29augustlmy thesis, not based in any research whatsoever, is that OOP is easier to teach, since it can be modelled (ish) to real world stuff
10:29augustlteach, not learn, mind you
10:29borkdudecshell why didn't ML become very popular
10:29clojurebotthe best solution is not to use xml at all
10:29cshellIt seems like when OO first came out, separations of concerns was at the opposite end of the spectrum from where it is today - we were taught to build classes that contained data AND programming logic
10:30cshellborkdude: I was too young back then, but I was reading that Lisp wasn't very popular before because of the overhead it took - maybe that had an impact on the adoption of ML
10:30augustlit would be interesting to see research on the learning curve of OOP vs FP, for people that's never programmed before
10:30augustls/that's/that have/
10:30borkdudeaugustl I think a lot of kiddo's start with javascript nowadays
10:30cshellI've arrived at the opinion that doing OO correctly leads you naturally into FP
10:31cshellas you can do the same things, but with much less code (ie more elegantly)
10:31aduI don't see OOP and FP as mutually exclusive, but I do see that languages tend to be only good at one at a time
10:31TimMcaugustl: At Northeastern the CS Fundies class uses PLT Scheme^W^W Racket. People seem to pick it up pretty quickly.
10:31augustlwhat I do like to say about OP is that it basically boils down to FP under the hood - values and functions.
10:31cshelladu: That's my problem with Scala, it allows you to mix :(
10:32aducshell: why is that a problem?
10:32augustl[myThing foo] in ObjC becomes objc_myThing(self, selector, foo), etc
10:32TimMc(compared to, say, the intro-level Java course I took elsewhere)
10:32augustlTimMc: that's interesting
10:32TimMc(both courses had excellent professors, by the way)
10:32borkdudeThe first programming course at my university was in Miranda
10:32cshelladu: The problems I've seen are that Java devs don't understand FP enough to leverage it so they try to use Scala like Java and that can make for really bad code
10:32TimMcborkdude: The IM client? :-P
10:33aducshell: if you take the unit of granularity to be functions, and analogize them with windows, then OOP is a kind of window manager, and FP is a toolkit, and X11 allows you to mix and match
10:33cshelladu: I like Clojure cause it "has a strong opinion on things and forces you down those paths"
10:33borkdudeTimMc http://en.wikipedia.org/wiki/Miranda_(programming_language)
10:34borkdudeit is similar to Haskell
10:34aduborkdude: Miranda users mostly migrated to Haskell
10:35borkdudeI don't know what the philosophy behind this choice was: maybe filtering out students who weren't up to it
10:35borkdudeor maybe a didactical reason that FP is indeed easy to learn to a good way to start
10:36borkdudeit wasn't a very up to date language: where are the libraries for web dev etc
10:36Hodappcshell: Interestingly, OOP as originally described and implemented by Alan Kay ends up being closer to agent-oriented programming or actor model.
10:36aduborkdude: what choice?
10:36borkdudeadu teaching Miranda in the first programming course on university
10:36aduHodapp: the actor model is getting old, the propagator model is the new kid on the block
10:37borkdudeadu now they migrated to Haskell as well
10:37adupropagators++
10:38borkdudeadu and they don't teach it in the first year anymore
10:38aduI think computer science education is crap
10:39borkdudeall FP academia in the Netherlands seem to be interested in Haskell now, Lisp/Clojure is ignored
10:39adubut then again, I don't know from personal experience, since none of the schools I've been to allowed me to take any classes
10:39gfredericksoh man
10:40borkdudeadu ah, your school didn't allow you to take classes?
10:40aduborkdude: yes
10:40borkdudewhat kind of school is that?
10:40aduI wanted to take compiler construction, and parsing theory, and they said, NO, you have to take intro to java first
10:41borkdudeadu I guess it's a bootstrapping problem
10:41aduwell, I bootstrapped outside the system, I've been programming since I was 9 years old
10:42cljs-newbieHow do I use goog.dom.query - I know pinot e.g but not clear
10:42cljs-newbieI am using the browser repl
10:42cljs-newbieIs goog.dom.query included in default goog.jar
10:43TimMcadu: Yeah, that's rough.
10:45aduhow different are clojure and clojurescript?
10:45gfredericks(defmacro -inc [& rest] `(fn -inc [] ~@rest)) ;; sneeeky
10:46gfredericksadu: less different than java and javascript
10:47borkdudeecmascript
10:47aduborkdude: I prefer to call them oak and livescript
10:47gfredericksecmascript is very different from ecma
10:51TimMcgfredericks: Explain that code!
10:53gfredericksTimMc: it means wherever you see -inc you don't even know if it's calling a macro or a function
10:55borkdudegfredericks whoa dude, you discovered the fixed point operator of macro's :P
10:55clgvgfredericks: it's callung the macro
10:55gfredericksTimMc: I didn't write it, I'm just trying to understand it
10:55clgv*calling
10:55TimMcNot buying it. (inc- 1 2 3) expands to (fn -inc [] 1 2 3). What's the deal?
10:56gfredericksthat's true it should be statically analyzable
10:56gfredericks(-inc 1 2 (-inc)) though
10:56clgv"-inc" in "(fn -inc ..)" is only for recursive reference and it's included in the name of the java class for that fn
10:56gfredericksthis is in the core.logic source code
10:57gfredericksline 771
10:57clgvhmm ok if you inject (-inc) in the macro you get an infinite recursion
10:58gfredericksI think maybe most calls to -inc are in the context of macros, so it might still be the case that't's difficult to tell what's going on
10:58TimMcMacro-expansion happens first, so any occurrence of (-inc ...) inside another (-inc ...) is also a macro call.
10:58TimMc-inc doesn't def anything.
10:59gfredericksTimMc: that can't be true
10:59gfredericks(-inc 1 2 (-inc)) expands to (fn -inc [] (1 2 (-inc)))
10:59gfrederickswhich should blow the stack
10:59gfredericksat runtime
10:59gfredericksor maybe (fn -inc [] 1 2 (-inc)) ; either way
10:59ivanuser=> ((-inc 1 2 (-inc)))
10:59ivanStackOverflowError user/eval61/-inc--62 (NO_SOURCE_FILE:3)
11:00cmajor7is there a way to use noir's validation (e.g. "vali/on-error", …) with twitter bootstrap forms (e.g. <fieldset class="control-group error">…)? or maybe there is some clojurescript way?
11:00borkdudeis it possible to contruct a macro which expands to itself?
11:00gfredericksborkdude: I think so
11:00TimMcborkdude: (defmacro y-do-you-ask [] &form)
11:00gfredericksthat was easy
11:00ivanwhen you do that you get a StackOverflowError clojure.core/concat/fn--3833 (core.clj:663)
11:01TimMcgfredericks: Or not, oops.
11:01borkdudeTimMc I mean a macro which expands to its definition
11:01ivanyeah, that's what I tried
11:01gfredericksborkdude: a macro that defs itself?
11:02gfredericksa macro that solves the first-cause problem in philosophy?
11:02borkdudegfredericks yes
11:02gfredericksa quine-macro
11:02borkdudegfredericks it would be nice if we could reply to the philosophers: we solved it with a macro
11:02TimMc(defmacro it [] `(it))
11:03gfredericksTimMc: no it has to def itself not just call itself
11:03gfredericks(defmacro it [] ...) should expand to (defmacro it [] ...)
11:03TimMcOh, I thought you wanted (it) to expand to (it).
11:03gfredericksyou got that earlier with &form
11:04TimMcDid I?
11:04gfrederickssure
11:04gfredericksit blows the stack but that happens necessarily
11:04augustlI have a bunch of vectors, how do I turn them all into one "flattened" vector?
11:04gfredericksapply concat
11:05gfredericks(comp vec (partial apply concat))
11:05augustlgfredericks: ah, just found concat, thanks :) getting better and better at navigating the cheat sheet ;)
11:05TimMcgfredericks: The form I posted expands to: (do (clojure.core/defn y-do-you-ask ([&form &env] &form)) (. (var y-do-you-ask) (setMacro)) (var y-do-you-ask))
11:05gfredericksTimMc: wtf.
11:06gfrederickswhich one?
11:06borkdude,(into [] (concat [1 2 3] [4 5 6]))
11:06clojurebot[1 2 3 4 5 ...]
11:06TimMcOh, that's the defmacro itself. Oops!
11:07gfredericks,(reduce (partial apply conj)[1 2 3] [4 5 6])
11:07clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
11:07TimMcborkdude: How is (partial into []) different from vec?
11:07gfredericksit's 4 characters longer
11:08gfredericks(def out-of seq)
11:08mfexaugustl, ##(reduce into [[1 2 3] [4 5 6] [7 8]])
11:08lazybot⇒ [1 2 3 4 5 6 7 8]
11:10TimMcmfex: Doesnt' work when you have no vectors.
11:10borkdudeTimMc I guess you could provide an init
11:10gfredericksvectors were assumed
11:11gfredericks"I have a bunch of vectors" said the vector-bearer
11:11augustlI also don't actually have a vector of vectors, I just have some refs to vectors
11:11borkdudeI guess TimMc means zero vectors instead of "other types"
11:11TimMcYes, but ##(reduce into [])
11:11lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: core$into
11:11mfexTimMc, yes indeed. More importantly don't use concat when you can only use vectors
11:11borkdude,(into [] (concat nil))
11:11clojurebot[]
11:12gfredericks,(into [] (concat))
11:12clojurebot[]
11:12borkdude(why is there no concatv etc ;))
11:12TimMc&(concat (concat (concat) (concat)) (concat) (concat))
11:12lazybot⇒ ()
11:13borkdudeTimMc try reading that line aloud 10 times without making a mistake
11:13TimMcgfredericks: OK, now I see how weird -inc is. And I'm going to set fire to this browser tab that has core.logic's source in it. Burn the witch!
11:13gfredericksTimMc: don't burn it I'm trying to write condr
11:14hyPiRionconcatv would essentially just be ##(reduce into [] [[1 2 3] '(4 5 6) #{7 8 9}]) (and sets will be randomly iterated, of course.)
11:14lazybot⇒ [1 2 3 4 5 6 7 8 9]
11:15hyPiRionOr eventually (reduce conj [] ...)
11:15borkdudehyPiRion I know how to write one ;)
11:16hyPiRionThen why would you need one? ;)
11:16borkdudehyPiRion so I don't need to write it ;)
11:16hyPiRionHeh.
11:17gfredericksthere is _some_ benefit to having _some_ functions in core
11:18hyPiRionI just wonder how often concatv would be used.
11:19gfredericks,(+ 1 (- (- (+ 337 394) 337) 353))
11:19clojurebot42
11:19hyPiRionAlso, concat is lazy, concatv cannot be. It's kind of a dangerous territory to give them the same name.
11:19hyPiRionAt least I think so.
11:19borkdudehyPiRion map / mapv in clojure 1.4, same thing?
11:19gfrederickshyPiRion: map vs mapv?
11:20hyPiRion(mapv...?)
11:20hyPiRionOh well, dangit. My point went out the window.
11:21borkdude,(clojure-version)
11:21clojurebot"1.4.0-master-SNAPSHOT"
11:21borkdude,(mapv identity [1 2 3] [1 2 3] [1 2 3])
11:21clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$identity>
11:21borkdudeof course
11:22gfredericks,(mapv list [1 2 3] [1 2 3] [1 2 3])
11:22clojurebot[(1 1 1) (2 2 2) (3 3 3)]
11:22hyPiRionThat being said though, I'd like to know by name which functions are lazy and which functions who are not.
11:22borkdude,(mapv identity (concat [1 2 3] [4 5 6]))
11:22clojurebot[1 2 3 4 5 ...]
11:23hyPiRion##(map inc (range)) vs. ##(mapv inc (range))
11:23gfrederickshyPiRion: I'd like to know by name which functions are macros
11:23lazybot(map inc (range)) java.lang.OutOfMemoryError: Java heap space
11:23lazybot(mapv inc (range)) Execution Timed Out!
11:23gfrederickso_O
11:24borkdudewhat other …v functions were added in 1.4?
11:24TimMcThat's rather startling.
11:24hyPiRionThat's weird. I thought it would only evaluate the first 5 elements.
11:24hyPiRion(And die on the last one)
11:24borkdudeis there a function that gives all the vars that were added in 1.4?
11:24gfredericks,(apropos "v")
11:24clojurebot(val vector-of remove-method get-validator derive ...)
11:24TimMcborkdude: There can be!
11:24borkdudeI mean not a function, but an expression
11:26hyPiRionIsn't that put in the metadata?
11:26hyPiRion(:macro (meta %))
11:26hyPiRion,(:macro (meta #'defn))
11:26clojurebottrue
11:27TimMc,(for [v (vals (ns-publics 'clojure.core)) :let [since (:added (meta v))] :when (= since "1.4")] v)
11:27clojurebot(#'clojure.core/mapv #'clojure.core/*data-readers* #'clojure.core/filterv #'clojure.core/default-data-readers #'clojure.core/ex-info ...)
11:28borkdudeTimMc tnx!
11:28gfredericks,(->> (apropos "v" (map str) (filter #(re-matches #"v$")))
11:28clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
11:28borkdudeTimMc I guess this expression deserves a tweet on @learnclojure
11:28gfredericks,(->> (apropos "v") (map str) (filter #(re-matches #"v$" %)))
11:28clojurebot()
11:28borkdudeso filterv
11:28TimMcborkdude: Needs cleanup.
11:28gfredericks,(->> (apropos "v") (map str) (filter #(re-matches #".*v$" %)))
11:28clojurebot("mapv" "filterv")
11:28Vinzentbtw, don't you think that ex-info and ex-data are, well, suboptimal?
11:29TimMcborkdude: (.sym v) will get the var's name.
11:30TimMc,(for [[n v] (ns-publics 'clojure.core) :let [since (:added (meta v))] :when (= since "1.4")] n)
11:30clojurebot(mapv *data-readers* filterv default-data-readers ex-info ...)
11:30bobryIs it possible to re-export all functions from the nested namespace in cljs? For instance I have top level namespace -- 'ui', and a bunch of nested namespaces 'ui.dialog', 'ui.button' etc
11:31TimMcVinzent: Their names are for sure.
11:33borkdudeTimMc are you on twitter btw?
11:34TimMcborkdude: Nope.
11:34TimMcI don't need credit, though.
11:34borkdudedo you mind me tweeting it?
11:34borkdude:)
11:35VinzentTimMc, yeah - why not just call it 'exception' and make it a map? and why it was included so suddenly (there was a lot of polemics about exceptions before 1.3, IIRC, and it was decided to not include exception's stuff in core)?
11:36TimMcVinzent: I actually haven't followed the exception stuff too closely. It's a mess.
11:36Vinzentyeah, unfortunately
11:37juhu_chapaHi all! How do I import javax.mail.Flags.Flag.DELETED?
11:37borkdude(import '….)
11:37TimMcjuhu_chapa: I'm guessing one of those is an inner class?
11:37borkdudeor in an ns macro: (:import ...)
11:37borkdudeah right inner classes… $ right?
11:38Vinzentyeah: foo.bar$inner
11:38TimMcimport Flags$Flag, then you have Flags$Flag/DELETED
11:38juhu_chapaTimMc: you are right@!
11:39TimMcjuhu_chapa: If you're going to deal with a lot of those, there's import-static: https://github.com/baznex/imports/blob/master/src/org/baznex/imports.clj
11:40juhu_chapaTimMc: thanks a lot!
11:47TimMcjuhu_chapa: The rename fn may actually be preferable, so you could do (rename javax.mail.Flags$Flag 'MF) and then use MF/DELETED
11:48borkdude,(doc rename)
11:48clojurebotExcuse me?
11:49borkdudeTimMc ah from the link you posted ok
11:51oskarth1is there a library for image generation like svgo for golang?
11:51hyPiRionImage generation?
11:51oskarth1basically typing in what the image should be like
11:51oskarth1draw circle and compose different shapes etc
11:52oskarth1like overtone but for images, I guess
11:52oskarth1https://github.com/ajstarks/svgo that's for golang
11:52Vinzentoskarth1, I have a link for such project in my followed repos, but github is down, so I can't give it to you.
11:53meayes
11:53meayou want to use Quil
11:53oskarth1ah too bad
11:53TimMcgithub WORKSFORME
11:53meaoskarth1 - https://github.com/quil/quil
11:53oskarth1mea: ah, looks neat - thanks!
11:53HodappThere are Clojure bindings for Processing.
11:53Vinzentoh, it's already works, yeah. That's the project I was talking about: https://github.com/mikera/clisk
11:54HodappIncanter maybe?
11:54oskarth1Vinzent: will have a look at that too, thanks
11:54oskarth1I think incanter is more about graphs and tables, no?
11:54meaoskarth1: no problem. I am actually using that right now so funny you asked for something so specific
11:54hyPiRionYeah, Incanter is basically R for Clojure.
11:54oskarth1ha
11:54oskarth1mea: what are you using it for?
11:55gfrederickswriting macroexpand-all is hard
11:55hyPiRiongfredericks: Are you allowed to use macroexpand-1?
11:56mfexgfredericks, clojure.walk/macroexpand-all?
11:57meaoskarth1: I am using it for a summer research gig. We built a robot with a projector and camera and so I'm using Quil to build interactive projections
11:58gfredericksmfex: I'm writing a version that only expands macros from clojure.core.logic :)
11:59mfexgfredericks, adding a filter to the source of clojure.walk/macroexpand-all should work
11:59samaaronMea: you must email me with a description of your Quil work
11:59samaaronI'd love to hear about it
12:00measamaaron: when I am done with it, I'll put it up on github :)
12:00gfredericksmfex: yeah I think I got it working
12:00gfredericksa bit more involved than just a filter, but not too bad
12:01samaaronBe sure to ping me when you do
12:02samaaronAlso please email any images that look interesting so I can tweet them from the quil account @quilist
12:02samaaronQuil is more fun when you share the love
12:02meahaha, I agree. I am just learning clojure so the code isn't going to be spectacular, but the end result should be neat
12:03meait is basically a light graffiti project
12:03meait projects an mspaint like interface and then you can draw with it
12:03meabut hey! it's in Quil!
12:03samaaronSounds awesome
12:03Hodappooh, so Quil uses Processing too?
12:04samaaronSeriously
12:04samaaronI need screenshots!
12:05samaaronHodapp: yup, processing is under the good
12:05samaaronHood, silly Android keyboard
12:06measamaaron: will do. you'll have them by Thursday since that's when I need to present it haha
12:06aduscreenshots?
12:06antares_travis-ci.org now supports testing against multiple JDKs: http://about.travis-ci.org/blog/support_for_multiple_jdks/. Please test your libraries against OpenJDK 7 ;)
12:08measamaaron: quick question though - key-pressed? is just a boolean right? it doesn't work like the keyPressed() processing function
12:10gtrakhow do I get docs for a ns from the repl?
12:11oskarth1mea: cool :)
12:23technomancymea: we're having a quil night on Thursday too; cool
12:23meatechnomancy: here on #clojure?
12:24technomancyno, at the seattle group
12:24technomancyhttp://seajure.github.com
12:25meatoo bad I'm in NY
12:25meaheh
12:28gfredericksNY is the seattle of NY
12:28lekuuh what?
12:29meaNY is the capital of the world, according to idiots and marketers
12:29lekuit might as well be
12:30lekui'm not sure if I can think of a more important city for AMerican's besides D.C.
12:30meaSF
12:30leku?
12:30meaSan Francisco, daddy-o
12:30lekulast I checked SF didn't host 2 stock exchanges
12:31antares_politically, SF is not too important. Chicago?
12:31lekuChicago is an important city but probably not more important than NYC
12:31gfredericksSF is the DC of Chicago
12:31lekuwhat hte fuck gfred
12:32lekulol
12:32antares_gfredericks: haha
12:32technomancyOmaha is the new black.
12:32lekuND is the new SF!
12:32lekuHUZZAH
12:32cgagND?
12:32clojurebotsharing code between client and server is not as simple or great as it sounds: http://blog.ianbicking.org/2011/03/30/js-on-server-and-client-is-not-a-big-deal/
12:33lekunorth dakota
12:33lekulots of oil mining going on now
12:33lekuor drilling or wahtever you call it, frack mining
12:33gfredericksfracking is the new gold rush?
12:33lekuyep
12:34oskarth1how do I check the doc of say, defproject (lein) by using (doc …)?
12:35antares_oskarth1: given that defproject is referred to in the current namespace, (doc defproject)
12:35antares_otherwise, you need to require the namespace defproject comes from and (doc leiningen.some.ns/defproject)
12:35technomancyoskarth: good question. unfortunately the docstring of defproject is more or less useless; `lein help sample` is much more enlightening.
12:36technomancyoskarth: you bring up a good point; I'll improve the docstring.
12:36oskarthtechnomancy: cool and thanks!
12:36lekutechnomancy you work on lein?
12:36technomancyleku: yeah
12:36lekunice
12:36lekuwell done
12:37mealots of big hitters in here
12:37oskarthindeed, it's really really good
12:37technomancythanks
12:37lekuI'm glad I discovered clojure and all these great tools
12:37lekuI was about to start using CL and some of their frameworks
12:37lekubut they seem pretty old/hobbled together
12:38technomancyquicklisp is going in the right direction, but it might be too little too late
12:38lekucool
12:39mealeku: yeah, clojure is awesome. I've only been using it for a few days, but its so powerful
12:39lekuyeah quicklisp seems likea nice repos of unorganized stuff
12:39lekuthere are no package descriptions or anything
12:39technomancywell that's been a problem with Leiningen too historically
12:39technomancypeople don't always include relevant metadata
12:39lekuhm
12:40lekumea: agreed..really looking forward to doing live coding
12:40lekuclojure+live coding in repl+heroku=win
12:41aduI've been using clojure for about an hour
12:41lekuhah
12:41aduI like it
12:41lekuhave you used other Lisps?
12:41aduleku: yes, mostly schemes
12:41lekuk
12:41adualso, I wrote a scheme
12:41lekuheh
12:47aduso
12:47aduis it possible to write a server-side app with mixed languages? like Groovy/Clojure?
12:48xcliteadu: why wouldn't it be?
12:49aduwell, I don't know
12:49DaoWenadu: you could write a server-side app mixing whatever languages you want (they don't even need to be JVM-based)---it's just a question of how hard the interop will be
12:50technomancysupposedly there's a groovy plugin for leiningen: https://github.com/kurtharriger/lein-groovyc
12:50aduwell, I'm thinking job-wise
12:50adumy boss is a stickler for JVM
12:51glitch99bahh - I know this exists but does anyone know the function that takes two arrays and zips it into an array of pairs?
12:51aduzipmap?
12:51glitch99without it being a map preferably
12:51Bronsaseq the map
12:51dnolenglitch99: (map vector v1 v2)
12:52dnolen,(map vector [1 2 3] [4 5 6])
12:52clojurebot([1 4] [2 5] [3 6])
12:52S11001001Bronsa: dup keys
12:52glitch99AH
12:52Bronsaoh, right
12:52dnolenadu: quite few people in this IRC making a living writing server side Clojure apps.
12:52glitch99Thanks all!
12:53adudnolen: sounds promising, I'll let my boss know :)
12:54dnolenadu: you'll recognize some names here - http://dev.clojure.org/display/community/Clojure+Success+Stories, Twitter uses it too.
12:55lekuadu: what about clojurescript?
12:55ejacksondnolen: what is this twitter of which you speak, wise man ?
12:55aduleku: what about it?
12:55lekuinstead of groovy
12:56lekunm i guess i dont know much about groovy
12:56adui thought clojurescript was client-side
12:56adugroovy compiles to JVM
12:56lekuk
12:57lekui wonder what AKamai is using clojure for
12:57hiredmanthey may not be using it anymore
12:57lekuah
12:57hiredmanthey acquired someone that was
12:58lekuthere are a lotof MIT nerds at AKAM, wouldn't be surprised if they were i guess
12:59aduooo GSoC
12:59aduTyped Clojure?
13:01solussdis there an issue with using macros for reader literals?
13:01solussdI get arity exceptions
13:02dnolenadu: yeah Ambrose Bonnaire-Sargeant is working on that. Neat stuff.
13:02aduI'm quite fond of Typed Racket, will it be anything like that?
13:03dnolenadu: very much inspired by Typed Racket
13:03adu:)
13:04S11001001akamai is still using clojure, according to the last boston clojure, but it's definitely not a product of akamai's mitness, still all comes from that acquisition
13:04TimMchiredman: The acquisition (Velocitude, I think?) is no more, as far as I know... but they're still using it somewhere.
13:04S11001001as TimMc says, yes, Velocitude
13:04S11001001(I worked there)
13:04lekuahh ok s11
13:04TimMcVelocitude isn't completely dead?
13:04lekuwhat did they do?
13:04S11001001I don't know about velocitude, but the team expanded into other clojure projects
13:05TimMcleku: Something about proxying sites for mobile browsers, I think.
13:05S11001001yep
13:05lekuhmm
13:05TimMcA friend of mine at Akamai said it didn't really fit Akamai's overall business strategy.
13:05lekuso they nixed it?
13:06TimMcNot sure. Sounds like it's not exactly a growing team, though.
13:06meaQuestion: how can I import processing libs (like .jars) into quil?
13:09dnolenmea: if using lein, best to declare them as dependencies in your project.clj, if not possible you can drop them in a folder and add that folder to your :extra-classpaths project.clj option. technomancy might have more advice.
13:10meamea: if I declare them in project.clj, do I need to put them in a specific folder
13:10gfredericksdnolen: the function-that-returns-random-goal implementation of condr fails to always return a random leaf of the search tree, since if the randomnly selected goal fails the whole search fails instead of trying the next thing
13:11dnolenmea: you can't just declare jars, they need to be something that's available via a maven repository (Central, Clojars etc).
13:12dnolengfredericks: read up on condu
13:12meadnolen: oh, so if I am using Processing / Java jars, I ought to use the :extra-classpaths option then eh?
13:12gfredericksdnolen: yessir
13:12dnolengfredericks: condu is cut + succeed *once*
13:13sergeyhello
13:13dnolenmea: if you have a bunch of jars and their are not available via some Maven repository, yes then manage them yourself.
13:13meadnolen: okay, excellent. thank you
13:13sergeyis there any real world tutorial about clojure where something is created during it?
13:14technomancyactually :extra-classpath-dirs is deprecated
13:14technomancymea: first thing to do is report a bug with whoever has jars they're not putting in a repository, because that's just crazy
13:14technomancythen you can use the lein-localrepo plugin
13:14technomancysergey: the peepcode screencast does that
13:15technomancydisclaimer: I'm the author
13:15dnolentechnomancy: probably not going to happen among the Processing community. Something like :extra-classpath-dirs still useful.
13:15dnolentechnomancy: and what's the lein2 way of dealing with checkouts dir?
13:15technomancydnolen: I don't think anything's changed about checkouts
13:15technomancyat least not intentionally
13:16sergeytechnomancy, thanks, I'll try peepcode screencasts, do you know any other sources?
13:16solussdhmm, even the simplest macro used as a 'reader literal' throws an artily exception, e.g. (defmacro blah [x] x) with data_readers.clj containing {stuff/blah my project.stuff/blah} running #blah "hi" throws an arty exception.
13:16solussd*arity. stupid lion autocorrect
13:16technomancyanyway I'd still report bugs even if they're likely to be ignored
13:16technomancyhopefully the cumulative effect over time will sink in and help them see the light
13:16meahhaha
13:17raph_amiardis there an easy way to reset a clojure session in swank-clojure ?
13:17TimMcsolussd: What would it mean to use a macro that way?
13:17solussdraph_amiard: M-x slime-disconnect followed by clojure-jack-in?
13:18solussdTimMc: nothing. :) I have this macro I'm trying to use as a reader literal: (defmacro dbg [x] `(let [x# ~x] (println "dbg:" '~x "=" (with-out-str (pr x#))) x#))
13:19solussdTimMc: it's the arity exception that confuses me. :/
13:20nDuffHrm; I'm having trouble avoiding reflection in calling a variadic Java method: http://stackoverflow.com/questions/10901756
13:21S11001001I don't think into-array gets inferred
13:21gfredericksmonads are hard
13:21S11001001^"[java.lang.String;" (into-array...
13:21S11001001nDuff
13:23S11001001theoretically you could add an :inline for into-array that DTRT for a compile-time-known element type arg
13:29TimMcsolussd: Macros take two extra args at the front: &form and &env
13:30solussdTimMc: so no way to use them with read literals then, huh. :(
13:30antares_nDuff: hint it as ^strings?
13:32TimMcsolussd: Extract the guts as a fn (to use for literal parsing) and call that fn from the macro.
13:34solussdTimMc: thanks
13:36cgagscheme
13:36cgagwoops
13:36aduwhat?
13:36clojurebotwhat is wrong with you
13:40sergeyexit
13:40sergeyendsession
13:40S11001001xb
13:40duck1123there is no leaving #clojure
13:43gfredericks"sudo exit" and then type in your password
13:45eightywhat's the idiomatic way to read a file in my project's dev/ folder?
13:45eightyi know there's a good way to do this :)
13:45S11001001what dev/?
13:45eightyjust a folder in my project
13:45eightyS11001001: i just want to read in dev/foo.txt
13:46S11001001what about when your code's in a jar?
13:47antares_eighty: clojure.java.io/resource if it happens to be on the classpath
13:47antares_otherwise, clojure.java.io/file + slurp should be sufficient
13:47antares_(/file will accept and resolve relative paths)
13:48eightyantares_: there it is. exactly. thanks man.
13:48antares_eighty: my bad, /resource also will require calling clojure.core/slurp on it
13:48eightyright right
13:48eightyk
13:57oskarth"lein cljsbuild once" => "That's not a task." using lein-cljsbuild sample simple project. Any ideas?
14:00technomancylooks like you need to make sure the plugin is installed right
14:01oskarthyeah right, does lein deps not install plugins?
14:02technomancyit does as long as they're declared right
14:06aduwhat does ^: mean?
14:07TimMcadu: ^ attaches metadata to forms for the compiler; the ^:foo form is shorthand for ^{:foo true}
14:07aduoh
14:08raekdoes anyone know what the recommended way to deref a Lamina async result with a timeout is?
14:12raekare you supposed to use read-channel* or is it an internal function? (it has no docstring)
14:13nDuffantares_: "Unable to resolve classname: strings"
14:13nDuffS11001001: java.lang.ClassNotFoundException: [java/lang/String;
14:13S11001001maybe an l in there
14:14S11001001just do (class (into-array String []))
14:14S11001001see what it prints
14:14nDuff^"[Ljava.lang.String;" does indeed do the trick
14:14nDuffheh.
14:15antares_nDuff: yeah, that :)
14:15nDuffS11001001: do you want the credit on StackOverflow, or shall I answer it myself?
14:15S11001001answer it yourself
14:16S11001001though a better answer would be for you to write a variant of into-array with that :inline I mentioned :)
14:19gfredericksfor some reason hacking together a condr with code I don't understand gives me results I don't understand :)
14:20nDuffS11001001: Heh. I can find some minimal documentation on definline, which clearly is implemented _using_ :inline, but I'm having trouble googling up a description of the semantics of :inline proper.
14:20antares_technomancy: heroku still runs OpenJDK 6, correct?
14:20dnolengfredericks: gist?
14:20S11001001sort of like http://xach.com/clhs?q=define-compiler-macro
14:21technomancyantares_: that's currently the default; going to upgrade soon.
14:21gfredericksdnolen: sure; I macroexpanded a conde and tried to write code that produced a similar structure but at runtime
14:21technomancyyou can upgrade with buildpacks, but we haven't stitched those together so they compose quite yet
14:21dnolengfredericks: why?
14:21dnolengfredericks: you didn't use condo?
14:21dnolengfredericks: grr, I mean condu
14:22lekuwhat the heck are all tehse condo/condus?
14:22dnolenleku: see The Reasoned Schemer
14:22lekurgr
14:23lekuis it something I have to know right now
14:23S11001001nDuff: the best way to figure it out is to read core.clj; there are tons of :inline usage examples there
14:23lekuto begin using clojure effectively?
14:24dnolenleku: no
14:24dnolenleku: it's a library for doing relational programming, not necessary in the slightest.
14:24gfredericksdnolen: https://gist.github.com/2876680
14:24gfredericksincluded example usage and unexpected behavior
14:25dnolengfredericks: don't have time to look to closely, use condu
14:26dnolengfredericks: condu is like conde, but once a goal succeeds it stops, and that goal can only succeed once which sounds like what you want.
14:26gfredericksdnolen: I guess I don't understand how it helps. What I ultimately want is something like conde except instead of picking results from each clause round-robin, it picks them at random
14:26dnolengfredericks: so shuffle the goals, and try them with condu, once one succeeds it'll stop.
14:26gfredericksdnolen: and in particular the randomness should be runtime randomness, so not just a conde-like macro that shuffles the clauses
14:27dnolengfredericks: reshuffle the goals on every run.
14:27XPherioribdknox: You alive?
14:27gfredericksdon't you have to do it at compile time to do condu? If you `(condu ~@(shuffle clauses)), that's compile time
14:27lekuwish i understood this code
14:28gfredericksleku: my gist? I wish I understood it too :)
14:28lekuya
14:28lekudefrel +o ^:index x ^:index y ^:index z
14:28leku?
14:28dnolenleku: familiar with Prolog.
14:28S11001001in fact, here's my most general advice for all clojurians
14:28S11001001read core.clj instead of the docs generated from it
14:29dnolengfredericks: no you don't have to do it compile time.
14:29dnolenleku: I mean that as a question.
14:29DaoWenleku: they're doing logic programming with core.logic
14:29lekunope
14:29lekuok
14:29gfredericksdnolen: how do you vary the args to a macro at runtime?
14:29gfrederickseval?
14:29clojureboteval is sometimes useful - but only sometimes
14:30gfredericksoh hm
14:30dnolengfredericks: (defn try [clauses] (condu (first clauses) (try (rest clauses)))
14:30dnolengfredericks: where clauses has been shuffled.
14:30gfredericksdnolen: k, will go think that over -- thanks!
14:32TimMcHmm. Why was arity-based dispatch in CLJS a problem? arguments.length seems to give the arity-of-use just fine...
14:33dnolenTimMc: slow
14:33TimMcOK. :-)
14:33dnolenTimMc: but we do that too when fns are used higher order.
14:36aduthis is my first time using lein
14:36aduhttp://paste.lisp.org/display/129852
14:36aduwhat does that mean?
14:37adamspghadu: looks like you've got an old "lein" script.
14:37TimMcOof, what's bringing in an old beta release of Clojure?
14:38adamspghit appears to be trying to pull in 1.2.0-beta !?
14:38aduadamspgh: hmm I just download it 5 mins ago
14:38TimMcOh, yep: "Downloading Leiningen now"
14:38TimMcadu: From Github? On the right branch?
14:38aduTimMc: from macports
14:38adamspghthe latest release of clojure is 1.4.0, which lein 2.pre will pull in.
14:38adamspghah.
14:38adamspghgrab lien from github
14:38aduwhere is that?
14:38adamspghor lein, even ! (oops)
14:39TimMc$google lein github
14:39lazybot[technomancy/leiningen · GitHub] https://github.com/technomancy/leiningen
14:39adamspghhttps://github.com/technomancy/leiningen
14:39adugit://github.com/technomancy/leiningen.git?
14:39clojureboteg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging
14:39TimMcRead the README.
14:41technomancymacports is not to be trusted
14:41TimMctechnomancy: Which package systems *are* to be trusted with lein?
14:41technomancythere's only one package manager that's trustworthy at all.
14:42aduok trying again with the github version
14:42technomancywell, actually maybe nix too, though the only reason you can trust nix is that you know you can roll back any trouble it causes by rewinding time =)
14:43S11001001wouldn't trust any
14:43technomancyTimMc: homebrew seems OK regarding lein, but it's got other issues
14:44technomancyleiningen doesn't exactly stretch the limits of what a package manager does; it's pretty hard to screw up
14:45aduok, this is what I get with the latest lein: http://paste.lisp.org/display/129853
14:46aduok perhaps I should also mention that I'm trying to follow http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html
14:46TimMcPretty sure that's not the latest lein.
14:46TimMcDoes `which lein` show you the path you expect?
14:46hiredmanyour project.clj is specifying a bogus version for clojure and contrib
14:46aduTimMc: yes
14:47aduhiredman: so I'm following the wrong tutorial
14:47hiredman~blog
14:47clojurebotmake a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive
14:47TimMcOh, ew. It's definitely the tutorial's fault.
14:47hiredmanclojurebot: jerk
14:47clojurebotyou cut me deep, man.
14:47hiredman~blog post
14:47clojurebotblogs are never to be trusted
14:48aduare these better? http://learn-clojure.com/clojure_tutorials.html
14:48S11001001true clojurebot
14:48TimMcI'm kind of intrigued that the beta1 isn't still available.
14:48dnolenadu: Clojure is a rapidly changing ecosystem, anything with a publish date older than 1 year is suspect.
14:48aduok
14:48XPheriorIs there any reason that JSON would render inside HTML markup if the document type is application/json?
14:49dnolenadu: I recommend the new O'Reilly book. most online resources that aren't pure reference just aren't up to date.
14:56aduI think (.) was the most difficult syntax to wrap my head around
14:57TimMcXPherior: That question didn't make much sense.
14:59pbostromadu: the noir framework is a decent place to get started with web apps, it's a nice wrapper around ring, compojure, and hiccup, which your old blog post uses: http://webnoir.org/
14:59adupbostrom: I'll take a look
15:00dwierengacan someone help me out with this? i'm not sure what it's complaining about: http://pastebin.com/9GeQ359E
15:01TimMcdwierenga: You'll want to get an actual stack trace pinpointing where the error occurred.
15:01dwierengait *should* be a very simple "run this query, dump the result set to a CSV file"
15:01amalloyspit wants a string, not a data structure
15:01amalloyi think
15:02dwierengaTimMc: i have no idea how to interpret those stack traces :/
15:02amalloydwierenga: that's no reason to not provide them when you ask for help. presumably someone in this world can read them
15:03TimMcdwierenga: Skim until you find your own files, then see what line numbers are responsible (and what the next thing in the stack was.)
15:03adusweet
15:03adunoir worked first time!
15:03dwierengaamalloy: oh.. i didn't realize he was asking to see them, i read it as *I* should go read it
15:03hiredmanamalloy: nah, spit takes whatever
15:03adunoir++
15:04amalloy(inc noir)
15:04lazybot⇒ 1
15:04hiredmanalthough, doesn't write-csv write to a csv file? why would you use that with spit?
15:05dwierengahiredman: the description of write-csv is "Given a sequence of sequences of strings, returns a string of that table
15:05oskarthfollowing lein-cljs simple tutorial. How come a clojurescript hello world is like 10k LOCs generated and is there any way to reduce it by a couple of magnitudes?
15:05TimMcdwierenga: That too, actually. They're not *fun* to read, but you can figure them out without too much work.
15:05dwierengain CSV format, with all appropriate quoting and escaping.
15:06hiredmandwierenga: ok
15:06TimMcoskarth: Because everything is included when you don't turn on optimizations.
15:06amalloydwierenga: and are you giving it a sequence of sequences of strings? it looks to me like you're giving it a vector of a result-set
15:06hiredmandwierenga: have you looked a the example usage from the readme of data.csv?
15:07oskarthTimMc: I tried some optimizations (assuming you mean in the project.clj file) but it didn't seem to make *that* much of a difference. Is there some other way to minify it down a reasonable size?
15:07dnolenoskarth: that's the whole point of advanced compilation. Though don't expect anything tiny - the code generated by CLJS is usually competitive in size with jQuery.
15:07oskarthmaybe I used the wrong type hints
15:07oskarthok I see
15:07dwierengaamalloy: i have no idea! that's what i'm asking (i think..)
15:08oskarththanks
15:08dwierengahiredman: i'm not sure where i'd find the readme of data.csv??
15:08lazybotdwierenga: Uh, no. Why would you even ask?
15:08hiredman~google clojure.data.csv
15:08clojurebotFirst, out of 6370 results is:
15:08clojurebotclojure/data.csv · GitHub
15:08clojurebothttps://github.com/clojure/data.csv
15:09dwierengahiredman: i'm not using that, i'm using https://github.com/davidsantiago/clojure-csv
15:09dnolenoskarth: that said, when you generate tons of code (which tends to happen when using macros) advanced compilation is close to magic.
15:10dnolenoskarth: instead of 600k of JS, you still get something around or smaller than jQuery.
15:10oskarthdnolen: yeah, that's true. Looking forward to you coming to HS btw!
15:10oskarthyeah
15:10dwierengashould i use clojure/data.csv instead?
15:10hiredman*shrug*
15:10dnolenoskarth: looking forward to it as well!
15:22nDuffIs it desired behavior that I have to have a class imported into the local namespace to be able to use a function from a different namespace tagged as returning that type?
15:23TimMcnDuff: What version of Clojure?
15:23nDuffTimMc: 1.4.0
15:23TimMcAnd ew, that sounds annoying.
15:23nDuff(and, yes; it can be worked around by fully-qualifying the class names, but ugh)
15:26XPheriorI've seen this compiler error pop up in several different cases on Google. "No matching field found: getRoot for class clojure.lang.Var" Is this common for contrib libraries?
15:27borkdudeXPherior it happens when you define var without a root binding and then get its value
15:28aduso clojure's defn works like scheme's define with case-lambda?
15:29borkdudeadu yes, with different syntax
15:30XPheriorborkdude: Hm, alright.
15:30aduborkdude: of course
15:31borkdudeXPherior well no, actually that doesn't happen
15:31amalloyborkdude, XPherior: not correct. it happens when you run code AOT-compiled against one versino of clojure (usually contrib) against a different version
15:31borkdudeXPherior I don't know then
15:31borkdudeamalloy ok
15:32XPheriorborkdude: Ever seen it in this context? api.server=> (use 'clojure.contrib.sql)
15:32XPheriorIllegalArgumentException No matching field found: getRoot for class clojure.lang.Var clojure.lang.Reflector.getInstanceField (Reflector.java:271)
15:32mrtentjeIs there a way with webnoir to hold a map or list or sequence of all active sessions?
15:37TimMcXPherior: The first problem is that you are using old monolithic contrib, which is a bad start already.
15:37TimMcThat means you're also using an old version of clojure.
15:39XPheriorTimMc: Using Clojure 1.4
15:39XPheriorTimMc: Can't find the new smaller SQL library though
15:40XPheriorOh duh! I could just use Korma
15:40pbostrom_mrtentje: noir will let you access the session of each request, but you would have to manage the data structure yourself
15:42TimMcXPherior: clojure.java.jdbc?
15:42TimMcMonolithic contrib was written against 1.2 and earlier.
15:44XPheriorTimMc: Korma looks like it'll do. Thank you for the information!"
15:47pbostrom_mrtentje_: you can do something like (noir.cookies/get "ring-session") on each request and add it to your data structure
16:09oskarthis it possible to get clojuredocs examples via something like (doc fn)? would be really useful
16:10Iceland_jack↑ second that
16:10dakroneoskarth: lein2's repl has (cdoc ...)
16:10dakroneto retrieve clojuredocs examples
16:10oskarthdakrone: nice! thanks, that's reason enough to upgrade :)
16:11hyPiRionlein2 also contain (source ...), which I find rather satisfying.
16:12oskarthhyPiRion: I think that's in clojure.repl already
16:12oskarthmaybe it's different, don't know
16:15hyPiRionLooks similar, yes.
16:17technomancyI think lein repl has some magic to allow it to be invoked from any ns
16:24pepijndevosDoes clojure-py does some automatic pushing and popping for bytecode ops?
16:24RaynesMan, clojure-py is the best thing ever. I wish I had less trouble figuring it out.
16:24augustlhow do you do private defs, like defn-?
16:25tbaldridge@pepijndevos explain?
16:26Raynespepijndevos: If you're ever bored and looking for a project to do for someone called Raynes, rewrite https://github.com/Raynes/refh in clojure-py. For bonus points, write a refheap client library in it first, but if you're willing to give those points up you can just use https://github.com/aburdette/pyheap
16:26RaynesThe bonus points are redeemable for two weeks worth of ass kissing and praise.
16:28technomancytwo weeks??
16:28lazybottechnomancy: Uh, no. Why would you even ask?
16:30emezeskeaugustl: I believe (defn- ...) is short for (defn ^:private ...)
16:30emezeskeaugustl: So for def it would be (def ^:private ...)
16:31neotykis there a lein-chrome-ext, similar to lein-gnome?
16:31technomancyneotyk: not afaik. I think people have tried using cljs to write conkeror extensions, but I don't think anyone's gotten it working.
16:32augustlemezeske: ah, I'll look that up, thanks
16:33augustlwhat's a good place to look up stuff like that? I see (def ^:private ..) and wonder what the ^ is doing. Is there a full list of all the syntax somewhere?
16:33augustlaaand just found it in the cheat sheet, nvm :)
16:33emezeskeaugustl: also, check the docs for def: http://clojure.org/special_forms
16:34emezeskeaugustl: In general, the ^ reader macro sets metadata for the following form AFAIK
16:34neotyktechnomancy: chrome extension is a bit complex
16:34augustlemezeske: thanks
16:42borkdudeneotyk how was euroclojure?
16:42borkdudeneotyk and how did your presentation go?
16:43neotykborkdude: euroclojure was great :)
16:43neotykborkdude: but I was stressed by presenting in front of it, a lot
16:44borkdudeneotyk did laser beams come out of rich's eyes?
16:44neotykborkdude: don't think I made good advertising for http.async.client
16:46borkdudeneotyk did you stick with the emacs approach?
16:46neotykborkdude: nah, but it was very interesting to hear rich
16:46neotykborkdude: sure, emacs all the way
16:48borkdudeneotyk I'll be awaiting the video's then from euroclojure
16:49neotykborkdude: there will be so much butter to watch :D
16:49borkdudebutter?
16:49neotyks/butter/better/
16:50borkdudebetter than what?
16:50neotykthan my preso
16:50borkdudeneotyk at least you went on stage at the first euroclojure, not many people can say that ;)
16:51neotykborkdude: true that
17:21meawould anyone find this idea helpful: a clojure script that extracts jars and lists the names of the contained .class files and then lists them as imports in core.clj
17:21meaor perhaps I am just importing in a foolish way
17:22technomancymea: slamhound sorta does that
17:24meatechnomancy: so it automatically detects what libraries are missing?
17:24meamissing / needed
17:24technomancymea: no, it just fixes your ns form assuming your classpath is already correct
17:24meaokay
17:25meathat is actually what I needed thanks
17:25meai think i'll code up my idea anyway for practice :)
17:25amalloymea: isn't that just like... jar tf $JAR | perl "something or other"?
17:25amalloyi would hesitate to write it in clojure; it's not really our wheelhouse
17:26technomancywe have a wheelhouse?
17:38jcrossley3seancorfield: how would you feel about making clojure.java.jdbc/transaction* dynamically rebindable?
17:50seancorfieldjcrossley3: i'm not in favor of dynamic binding - what's the use case you have in mind?
17:52jcrossley3seancorfield: XA managed transactions; having a TransactionManager coordinate multiple resources in a single transaction. to do that, no resource can setAutoCommit, or commit, or rollback. only the manager can do that.
17:53seancorfieldsince transaction is just a thin macro wrapper for transaction*, why not directly use a different function based on the XA stuff?
17:53jcrossley3everything will just work if i can rebind transaction* to simply call (func) :)
17:53jcrossley3seancorfield: i'm open to that, but i'm unclear exactly what you mean.
17:54seancorfieldclojure/core indicated they would prefer an API on c.j.jdbc that allowed functions / values to be passed into functions rather than relying on dynamic binding
17:54seancorfieldperhaps a with-transaction construct that allowed you to pass a transaction management function? (which could default to the same current implementation)
17:55technomancyseancorfield: have you looked into HStore at all?
17:56seancorfieldtechnomancy: i have not - URL?
17:56technomancyhttps://postgres.heroku.com/blog/past/2012/3/14/introducing_keyvalue_data_storage_in_heroku_postgres/
17:56jcrossley3seancorfield: the only problem i see with that is existing libs built on core.jdbc, e.g. clojureql and korma.
17:56technomancyI'm playing around with it and it's quite nice, but a bit rough around the edges to use with clojure.java.jdbc
17:56technomancybut that may just be because the regular JDBC driver is not very good
17:57hiredmanjcrossley3: it is unlikely that korma has seen any large scale use
17:57jcrossley3hiredman: define "large scale" relative to clojure sql libs. :)
17:59oskarthwhat's a good way to generate / update images with quil on a web page?
18:00hiredmanjcrossley3: it is unlikely to be used anywhere with large amounts of data, and it is unlikely that any large clojure projects use it (simply based on timing)
18:01hiredmanI could be wrong
18:01jcrossley3hiredman: do you think there are any heavily used clojure jdbc/sql libs?
18:02hiredmanwe use java.jdbc at work
18:02hiredmanbut we don't keep that much data in sql regardless
18:02seancorfieldeven so, ibdknox has already expressed interest in switching korma to use the new as-yet-undesigned function api to c.j.jdbc so it would adapt to the new transaction machinery pretty quickly i suspect
18:03muhoois there a quick hack using proxy to get access to a "protected" method of a java class?
18:03muhooseems like there might be, but i have no java-fu
18:03augustlis ring.middleware.reload/wrap-reload from ring-devel recursive? Or do I have to manually add all the folders? It defaults to "src", but my code is in src/**/*.clj
18:03seancorfieldthen users of korma could work with XA managed transactions by whatever API korma exposed on top of the new c.j.jdbc ... make sense?
18:04weavejesteraugustl: It's recursive
18:04augustlweavejester: I've never gotten it to work for some reason..
18:04augustlI add it immediately after my main handler, but it doesn't seem to pick up the changes I make
18:04weavejesteraugustl: Is your main handler referenced as a var?
18:05jcrossley3seancorfield: it makes sense, but i would prefer to allow existing apps to "just work" if at all possible.
18:05weavejesteraugustl: You need to pass your final handler to the adapter as a var, otherwise when you reload your source code, it won't get the new changes.
18:05hiredmanjcrossley3: you can always redef transaction*
18:05augustlweavejester: I have a server.clj where I launch a ring.adapter.jetty/run-jetty. The app is just a def in the same file
18:06augustlweavejester: I see
18:06jcrossley3hiredman: i'm kinda scared to, since it would affect all threads, and i only want to affect the one invovled with the xa tx.
18:07weavejesteraugustl: The lein-ring plugin will do wrap-reload for you, by the way.
18:07hiredmanjcrossley3: you can redef it to using a binding
18:07augustlweavejester: ah, that's useful
18:07jcrossley3hiredman: point me to an example?
18:08hiredmanuh, something like (ns foo.bar) … (in-ns 'clojure.java.jdbc.internal) (def ^:dynamic transaction** transaction*) (def transaction* [& args] (apply transaction** args)) (in-ns 'foo.bar) …
18:09hiredmanreach in a monkey patch it
18:09hiredmanand
18:10jcrossley3i'll study on that for a temp solution, hiredman, thanks
18:11bbloomdnolen: any objection to a whitespace cleanup patch? theres a bunch of files with tabs mixed in & it's bothering me ever so slightly :-)
18:11jcrossley3seancorfield: should i create an issue to track variable tx mgmt somewhere?
18:12augustlweavejester: that's odd, using lein-ring, and it doesn't seem to reload when I change my source files
18:12dnolenbbloom: whitespace cleanup patches are the lowest priority of all.
18:12bbloomdnolen: i figured as much :-)
18:13weavejesteraugustl: It should do… If you can reproduce the problem in a small project, let me know and I can try and fix it.
18:13augustlweavejester: will do
18:13hiredmanjcrossley3: https://github.com/hiredman/clojurebot/blob/master/src/hiredman/triples.clj#L29 has something similar, minus the dynamic binding stuff, it reaches in to the namespace and replaces the function
18:13weavejesteraugustl: You're using "lein ring server" right?
18:13jcrossley3hiredman: thanks, man
18:14bbloomdnolen: i'm working on the keyword perf thing we talked about. should be able to eliminate the prototype modifications to string & still maintain fast paths for pretty much all the keyword stuff. i'll let you know how it goes
18:17augustlweavejester: yeah
18:24seancorfieldhiredman: jcrossley3: btw, clojure.java.jdbc.internal is no more - everything's in clojure.java.jdbc now
18:24jcrossley3seancorfield: yep
18:25seancorfieldtechnomancy: quick emacs Q - what's the fancy paredit command that switches two levels of s-exps around? URL to the docs is fine - i can't find a reference manual style page for all the paredit stuff right now... still googling (shoulda bookmarked it!)
18:25hiredmanseancorfield: yeah, some day I will get around to upgrading
18:25dnolenbbloom: if you're thinking about your integer approach - how were you planning on handling the fact that we need to call hash on everything? special casing in the hash fn?
18:25bbloomdnolen: so my thought is that i'm going to flesh out a proper Keyword type
18:25bbloomdnolen: and then go from there
18:26augustlweavejester: https://github.com/augustl/lein-ring-reload-test here's a reproducible example
18:26augustlperhaps I'm doing it wrong :)
18:28jcrossley3seancorfield: 'C-h m' should show you. search for barfage
18:28technomancyseancorfield: maybe convolute?
18:29dnolenbbloom: cool, that would be the way to go, one suggest, I would avoid putting anything in to a real JS object, cljs.core.KEYWORDS.foo_munged preferred, then keyword subject to Closure optimizations.
18:30augustlweavejester: perhaps the way I split my routes into "views" is a bit too unconventional..
18:30bbloomdnolen: huh?
18:30dnolenbbloom: no foo["keyword"]
18:30bbloomdnolen: why not?
18:30dnolenbbloom: Closure optimizations
18:31bbloomdnolen: oh you mean as a string. oh yeah
18:31bbloomdnolen: i didn't plan to access as a string
18:31seancorfieldtechnomancy: yes, convolute... i hope it does what i want :)
18:31bbloomdnolen: foo.keyword is totaly how i planned on it :-)
18:31technomancynever used it myself
18:32seancorfieldmaybe it's amalloy who loves it so much then? and, yes, convolute did exactly what i wanted!
18:32bbloomdnolen: first up i'm going to flesh out the Keyword and Symbol types -- i'll probably temporarily disable HashObj while i do that. get those working correctly, then figure out how to get HashObj and keyword literals and keyword invokes to be fast
18:33amalloyyeah, i'm the one who advertises convolute
18:33dnolenbbloom: my suggestion would be to do what Clojure does - Symbol & Keyword should have name, mutable hash field, and meta.
18:33bbloomdnolen: I thought keyword didn't have meta?
18:33dnolenbbloom: oops right
18:33bbloomdnolen: i'll look at their implementations for sure.
18:34bbloomdnolen: i'd also like to compare possible HashObj tweaks
18:34dnolenbbloom: HashObj, you mean ObjMap?
18:34bbloomdnolen: dur yeah
18:34bbloomdnolen: brain fart
18:35dnolenbbloom: sure, though I'd rather see optimizations around PersistentHashMap, ObjMaps are very fast except for updates.
18:36bbloomdnolen: for example, i want to test a two level hash. for example the first level being the type & the second level being the keys of that type. so you'd have (in javascript) {s: {"i am a string": …}, k: {"iamakeyword": …}, …}
18:37dnolenbbloom: that just involves more copying, so what's the benefit?
18:37bbloomdnolen: rather than allocating the extra garbage for (str \xx \: name) etc each time
18:38bbloomdnolen: just thinking aloud, probably not a big difference. my thoughts are still a little fuzzy there. going to get the Keyword and Symbol types first & then measure what gets slower & optimize those things first
18:39dnolenbbloom: yeah any changes to ObjMap and PHM requires lots of benchmarking.
18:40bbloomdnolen: yup, but the symbol & keyword types have the potential to eliminate a lot of special cases. if we can make them just as fast & make strings faster across teh board, it's worth the time to benchmark :-)
18:42dnolenbbloom: there's no reason to do anything fancy with Keywords & Symbols in the case of ObjMap in my opinion - use name. string based property lookup in JS is very fast.
18:43dnolenbbloom: I agree about Symbol, Keyword simplifying a lot of logic around strings - that stuff stinks right now.
18:43bbloomdnolen: yeah, the reason i'm thinking about ObjMap is because changing the representation of keywords and symbols changes the implementation of objmap because i need to coerce to and from strings when going into or out of the map
18:43bbloomdnolen: trying to make that not get any slower
18:46bbloomdnolen: although, i guess (keys obj-map) is far less important to optimize than (:key obj-map) :-)
18:46dnolenbbloom: I don't see why you need to coerce, you have name and ObjMap stores its keys. (or (identical? key ...) (identical? (.name key) ...))
18:47dnolenbbloom: er (.-name key)
18:47dnolenbbloom: (:key obj-map ...) is pretty fast, though I think we could see 2X perf jump if we don't allocate wrapper at the call site like we do now.
18:48dnolenbbloom: what I want to see get fast is (map :key ...), that's like 100X slower right now or something.
18:48bbloomdnolen: yeah, i'm gonna eliminate that allocation & replace it with a property access
18:48bbloomdnolen: what's the bottleneck with map?
18:49dnolenbbloom: because that'll result in String.prototype.call
18:49bbloomdnolen: oh, that's what i figured. well, i've already deleted that code path locally, so we'll see what happens when i get everything working again :-)
18:52bbloomdnolen: interestingly, the clojure Keyword implementation stores a symbol, not a string
18:53bbloomdnolen: and Symbol stores ns and name separately, along with a mutable _str memoization
18:54seancorfieldtechnomancy: i like the monokai theme - thanx for that rec on twitter - but the paren highligting is a bit too subtle for me... is that easy to change?
18:54technomancyprobably, but I don't know the details of how
18:55seancorfield'k... maybe i'll have a dig around...
18:57muhoooh java, how i hate thee: https://www.refheap.com/paste/3008
18:57bbloomdnolen: has anyone experimented with implementing ObjMap's assoc in terms of javascript's prototype? it would be non-copying
18:58dnolenbbloom: bbloom prototype chain lookups are not fast.
18:58bbloomdnolen: ok, makes sense
18:59bbloomdnolen: linked list recursive implementation, generally?
19:00oskarthwhat's the inverse function of clojure.java.io/file? That is, a java file -> string fn.
19:02dnolenbbloom: no, mostly because nothing will be faster than JS Objects for access time. we have an update threshold in place to convert to PHMs which takes care of large amounts of data.
19:02amalloy&(str (java.io.File. "/foo/bar"))
19:02lazybot⇒ "/foo/bar"
19:03seancorfieldtechnomancy: that was easy - edit .emacs.d/elpa/monokai-theme-0.0.7/monokai-theme.el and reload the theme
19:03oskarthoh. thanks.
19:04dnolenbbloom: I would be very surprised if you can beat PHM for update/access for anything but small maps.
19:05bbloomdnolen: i don't expect to. i'm just exploring.
19:08dnolenbbloom: definitely worth looking into, perhaps there are other persistent data structures which don't require so much array allocation.
19:08technomancyseancorfield: that'll work until you move machines I guess
19:08dnolenbbloom: I'm beginning to suspect the poor state of JS GC (outside of V8) is why the numbers aren't as good on JSC and SM.
19:09bbloomdnolen: that's why i'm wondering about reducing allocations when working with keywords, symbols, etc
19:10dnolenbbloom: 2-3 fields isn't much to allocate - Clojure persistent data structures generally want (make-array 32)
19:16nDuffBlegh. Having trouble convincing an OSGi classloader to allow clojure/core/incubator.clj to be provided by a different bundle than the one that owns clojure.core
19:17st3vehey anyone here work with the "noir" framework much?
19:17nDuffst3ve: played with it briefly, decided I need something more powerful, moved to Compojure
19:18ibdknoxnDuff: more powerful?
19:18PeregrinePDXnoir uses Compojure doesn't it? And all of Compojure is available in noir....
19:18PeregrinePDXSo I don't see how it's any less powerful it just has certain assumptions baked into it.
19:19PeregrinePDXYou might not like those assumptions which is fine.
19:19ibdknoxyeah it does.
19:19technomancythe age old framework-vs-library question
19:20PeregrinePDXDefinitely.
19:20technomancyit's lightweight for a framework, but it's a framework.
19:20nDuffibdknox: *shrug* -- the full power of compojure may have been available, but it wasn't obvious at the time how to access the parts I needed.
19:21ibdknoxlike?
19:21nDuffDon't know. Weeks ago, and my memory operates on a scale of days; I'd have to try again to get a fresher / more useful opinion.
19:21ibdknoxokidoke, just wondering :)
19:28emezeskeibdknox: I ended up moving away from noir when I needed to start grouping routes together in more complex ways
19:28emezeskeibdknox: It was doable in noir, but there basically wasn't much of an advantage at that point
19:28beffbernardst3ve: what was your question about noir?
19:28gfrederickshuh; core.logic's conde is _not_ semantically the same as RS's condi.
19:29st3veoh, thanks, beffbernard, i was just letting everyone finish up arguing about it ;)
19:29emezeskeibdknox: noir is really nice, but it sounded like you wanted to hear about someone not using it :)
19:29emezeskeibdknox: The driving force behind more complex route groupings was cemerick/friend, btw.
19:30beffbernardst3ve: FYI, ibdknox is the author of noir
19:30ibdknoxemezeske: I don't have the bandwidth to do it right now, but I thought about writing a couple of simple things to make it really easy to just wrap all the non-routing things around compojure
19:30ibdknoxthen you can have the best of both worlds
19:30emezeskenice!
19:30emezeskethat would indeed be sweet.
19:30ibdknoxit would be really easy to do
19:30ibdknoxjust take a lil time
19:31emezeskeI was thinking about putting together some cemerick/friend + noir thing, to make that combo easy
19:31emezeskeBut I ended up not building that out for lack of time :(
19:32ibdknoxI know the feeling :)
19:32hiredmantime is the fire
19:32emezeskeYou more than me!
19:34st3vewell i'm an absolute neophyte to noir, but i've read through the tutorials and howtos and think it looks neat. i also saw that there is mentioned a thing called stringtemplate, which i could use to work with, say, a pile of html from my designer colleague
19:34st3vebut it wasn't clear how i'd go about fitting the stringtemplate stuff into the clojure bits. is there any specific documentation on that?
19:37nDuffibdknox: ...actually, I just remembered what it was that was being problematic with noir -- I wanted to route on a different piece of request data (:path-info rather than :uri, maybe?)
19:42lekuwhat does Rich Hickey mean by "boxed version" of something?
19:43rlbleku: Integer vs int, for example, I imagine -- if that means anything to you.
19:44lekuhm no..
19:44rlbi.e. whether or not there's a heap allocated object for the particular item.
19:44rlb(at least to some approximation, I believe)
19:44gfredericksjvm has both primitive numbers and proper objects
19:44gfredericksbooleans are primitive too I guess
19:45gfredericksall the primitives have "boxed" object analogues
19:45rlbyou'd much rather have an int/long/double, but the jvm requires a full-blown object in many circumstances
19:45rlb(where much rather means wrt perf/allocation)
19:45lekuk
19:47rlbleku: if that didn't make sense, I'd be happy to try again ;>
19:47wmealingAnyone here use lein2 midje lazytest ?
19:48lekuI'm thinking I'm not at the point in my learning of clojure/lisp yet to undersatnd waht you mean possibly
19:48rlbleku: what language are you coming from?
19:48lekui know perl pretty well
19:48rlb(or language(s))
19:48wmealingNo matter what I configure in the project files, or profiles.clj it doesn't seem to find the correct class for lazytest
19:49rlbhmm, can't think of a really good analog there offhand. Familiar with C or C++ at all?
19:49gfredericksleku: it has a lot more to do with java/jvm than with lisp
19:49lekusome C yeah
19:50gfrederickse.g., with clojurescript there's not really a relevant analogue
19:50technomancyleku: in an ideal world, everything would be an object. but that causes a lot more garbage collection to be necessary among other issues, so primitives are a low-overhead way to store numbers
19:50rlbOK, so wrt memory a C int/long/double is more like a stack allocated C int/long/double, and a java/clojure Integer is more like malloc(sizeof(Integer))...
19:50lekugotcha
19:50leku(techno)
19:50rlbexcept of course, you have initialization, GC, etc.
19:50rlbclojure more or less hides all of that from you
19:51rlbit automatically converts back and forth
19:51lekuit turns a primitive into an object?
19:51rlbleku yes, that's the core of boxing/unboxing
19:52lekuok i understand a bit
19:53lekuthanks
19:53rlbleku: and in java, int[] is fairly similar to C's int[], etc.
19:54rlb..which is clojure's (int-array [1 2 3])
19:55rlbAnd should be much more efficient wrt storage than [1 2 3], but it's likely not what you want in clojure most of the time.
19:55st3veibdknox: don't mean to bug you, but in case you missed my question - is there any documentation on using stringtemplate within noir? or a howto, or tutorial, or anything?
19:56rlb(since an int[] array isn't immutable)
19:56lekuso [1 2 3] and (int-array [1 2 3]) are different?
19:56rlb*very*
19:57rlbleku: feel free to pretend that you don't know about int-array for now.
19:57lekuk
19:57lekui feel like i dont know anything for now :)
19:58rlbit's useful for interop with java, and if you need to pack the maximum number of native ints into the smallest space , but since it's not immutable, it doesn't play well with the rest of clojure.
19:58lekui have so many tabs open in chrome of stuff to read they're all blending together
19:58lekurlb: ah ok
19:58rlba clojure vector like [1 2 3] is immutable, so when you change it, what you really get is a very efficient copy.
19:58technomancyif you're just learning clojure you should probably ignore the primitive stuff if you can get away with it
19:58beffbernardst3ve: check out the comment: http://www.reddit.com/r/Clojure/comments/ablcc/string_interpolation_in_clojure/
19:58rlb(i.e. copy on write)
19:58technomancyit's much more consistent to pretend the entire world made of objects
19:58rlbish
19:59rlbright -- what technomancy said...
19:59lekuk
19:59st3vesweet!
19:59wmealingwhat, the world isnt made of objects ?
19:59st3vebeffbernard: thank you! that's exactly the kind of simple example i need. something like that, i can use as a jumping-off point to learn all other necessary information.
20:00lekuwhen I want to change a vector, do I have to do so implicitly, meaning make a copy, add data, or does clojure see what i'm trying to do and do that for me?
20:00st3vefor me, it's always that first bit of how-to that's the toughest. so, thanks. i'm bookmarking that.
20:01beffbernardst3ve: glad I could help
20:01gfredericksleku: the mechanisms for "changing" vectors only work by making copies
20:01st3veibdknox: i would encourage you to add a simple example like what beffbernard linked, into the docs on the "html" section of the tutorials.
20:01lekuk
20:02lekust3ve: you might want to send him an email?
20:02gfredericksleku: to change a vector you call the assoc function and pass it that vector. it gives you a new vector back, and the old one hasn't changed.
20:02st3vesure, i can do that.
20:02gfredericks,(let [v1 [1 2 3], v2 (assoc v1 1 20)] (list v1 v2))
20:02clojurebot([1 2 3] [1 20 3])
20:03rlbleku: btw, if you haven't seen it yet, I found the cheatsheet helpful - http://clojure.org/cheatsheet
20:03lekucool, thanks
20:04gfredericksI like how leku asks about boxing and it takes us five minutes to get to "don't you worry about that"
20:04lekuhaha
20:04lekui'm confused about that assoc
20:05lekuhow come it only added the last element of the v1 vector?
20:05rlbleku: assoc created a new vector with the value you wanted changed.
20:05amalloyleku: (assoc v1 1 20) is a bit like: v1[1] = 20
20:05rlb(though it creates the new vector efficiently -- it doesn't make a fully copy)
20:05lekuwhat did you say you wanted changed?
20:05rlbs/fully/full/
20:06leku(assoc v1 1 20)
20:06lekuyou're changing 1 in v1 to 20?
20:06rlb,(doc assoc)
20:06clojurebot"([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)."
20:06lekuwouldn't it be 20 2 3 then?
20:06gfredericksleku: not the 1 value, the 1th position
20:06lekuok
20:06lekugot it
20:07gfredericks,(let [v1 [:a :b :c], v2 (assoc v1 1 20)] (list v1 v2))
20:07clojurebot([:a :b :c] [:a 20 :c])
20:07lekunice
20:07lekugood examples, thanks :)
20:07gfredericksnp
20:08lekuwhat if you didn't know the position, only the value?
20:09gfrederickswell that'd be a different kind of thing. And not fully specified yet -- i.e., what do you want to do if there are duplicates?
20:09amalloythen you usually shouldn't be using a vector, but a map
20:09rlbfwiw, when I was toying with the trivial perf test the other day (to generate a ton of random integers), it was in reference to this: http://blog.cdleary.com/2012/06/simple-selfish-and-unscientific-shootout/
20:09gfredericksI don't think there's a core function for this because it doesn't come up much in practice. as amalloy says.
20:09amalloy&(doc replace) ;; gfredericks
20:09lazybot⇒ "([smap coll]); Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap"
20:10lekuk
20:10rlbI got a simple clojure version to about 25s, close to java's 18s -- which was good enough for me...
20:11gfredericksamalloy: yeah well I didn't mean "clojure.core", I meant "core" as in "functions I care about"
20:11gfredericksso neener neener
20:11amalloygot it
20:11amalloyreplace is kinda lame anyway
20:11gfredericksit's funny I was thinking to myself "a good name for that function would be "replace""
20:14gfredericks,(replace #{:b 20} [:a :b :c])
20:14clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentHashSet cannot be cast to java.util.Map>
20:14gfredericks,(replace {:b 20} [:a :b :c])
20:14clojurebot[:a 20 :c]
20:14gfredericksI bet that vector thing is an optimization
20:19seancorfieldtechnomancy: i store .emacs.d on dropbox and symlink it so it's sync'd to all my machines :)
20:19seancorfield(sorry for slow response, was away working on a database - with a clojure repl)
20:21technomancyseancorfield: that's not going to work very well across machines; .elc bytecode is not compatible across different Emacs versions
20:24technomancyI don't understand the appeal of dropbox for source code.
20:25brehautits like git, but with few of the advantages
20:26technomancyI do crazy experimental things in my code all the time that I don't want propagated.
20:28brehautoh thats easy. just copy all your code into another directory that isnt in drop box and copy it back later. what could go wrong!
20:30gtrak`I do git in dropbox
20:31technomancygit add -f .svn && git commit -m "Just to be extra safe."
20:31seancorfieldtechnomancy: i use the same version of emacs on all my machines - so far the dropbox/symlink thing has worked very well...
20:32seancorfieldbut good to know about .elc bytecode compatibility
20:32technomancyjust sounds a bit too close to checking in jar files for comfort
20:32ibdknoxst3ve: use comb or stencil instead, unless you *have* to use string template
20:33seancorfieldand i don't store _my_ code in dropbox - i just use it to share certain folders between machines (and more importantly between machines and my phone and ipad)
20:33technomancyconfig is code
20:33gtrak`I also recently put a local svn server dir under git while I messed with it with git-svn
20:34seancorfieldonce i'd figured out how to do a hard symlink on windows, it also meant i could keep emacs on my XP VM in sync with my Mac and my Ubuntu netbook :)
20:34seancorfieldi don't version my emacs config - i don't see the point
20:34technomancyo_O
20:35wmealingi'm addon happy, nice to be able to revert and keep backups of working configs.
20:35wmealingincluding the config code
20:35seancorfieldi don't mess with my emacs config much... just a few small tweaks to keep it sane across mac/ubuntu and cocoa/terminal on mac
20:36brehautseancorfield: i just use technomancies config for my emacs; its already in git
20:36brehauts/ies/y's/
20:37cemericktechnomancy: what do you mean, "rough around the edges" re: hstore + jdbc?
20:38technomancycemerick: the only driver I could find is distributed with some crazy openstreetmap thing; I had to pull a few classfiles out of a jar and repackage it as org.clojars.technomancy/jdbc-hstore
20:38technomancyalso you have to pour all maps into/out of a PGHStore object
20:38cemerickhuh
20:38technomancyit fails to inspire confidence
20:38cemericktechnomancy: the examples I've seen all make it look like it's just string/varchar data going in and out?
20:39technomancycemerick: maybe you can use it on a lower-level without this; this is the only thing that works with j.u.Map
20:39cemerickoh, I see
20:40cemerickso presumably you can spit xml into an hstore xml column without a problem.
22:04lekuanyone using linode or aws for personal stuff? such as just havinga linux env for development or random things like IRC?
22:05amalloyleku: 4clojure.com lives on my linode
22:06hiredmanI just moved clojurebot on to a t1.micro
22:06amalloyoh, and lazybot lives there too
22:06hiredmanjust yesterday?
22:06hiredmanyes, yesterday
22:08lekujust wondering if it is worth the expense
22:09hiredmanhttp://aws.amazon.com/free/faqs/
22:09hiredmanthere are free usage tiers
22:09lekuhmm
22:09brehautleku: by linode do you mean linode specifically or linux VPSs in general?
22:09hiredmanthe t1.micro is free, but I am going to be paying whatever for the extra ebs volume I guess
22:10hiredmanI have irc messages going through amazon's sqs which costs me around $1.50 a month
22:10lekulinux VPSs in general I guess, I see linode is a popular one tho?
22:11lekuwhat do you mean by that hiredman?
22:11brehautwell, slicehost and rimuhosting are both popular
22:11bbloomdnolen: any tips for finding bugs in advanced mode? for example, "Cannot read property 'ga' of null" on a random line is kinda tricky to trace back to a particular spot
22:11brehautive got a prgmr.com vps because its cheap as and im not doing anything serious with it
22:11hiredmanleku: I irc on a remote machine, but I like getting growl notifications, so I have a little clojure programming that more or less feeds the irc log in to a queue, and another clojure program running locally that pulls it from the queue and growls it
22:12lekuoh fancy
22:13lekuare you doing a tail on that log? or do you do it in a batch mode?
22:13lekumaybe out of cron?
22:14hiredmanhttps://github.com/hiredman/Howler/blob/master/src/Howler/core.clj
22:15hiredmanhttps://github.com/hiredman/Howler/blob/master/src/Howler/core.clj#L60 is the remote part that feeds the queue
22:15lekucool
22:17lekuso whats the gravatar stuff do?
22:18lekuallow you to display someones avatar associated with their nickname in a growl popup?
22:20lekualso waht is with the locking/acquire/release ?
22:20hiredmanlimit the number of growl notify processes running
22:20hiredmanI had an issue with previous versions of growl where they would not terminate
22:21johnmn3so I'm taking my first foray into databases/sql
22:21johnmn3any suggestions?
22:21brehautjohnmn3: from clojure or in general?
22:21johnmn3clojure
22:21johnmn3(but it is still my first foray into db)
22:22brehautso are you wanting suggestions on RDBM systems, clojure librarys or both?
22:22johnmn3my first thought was "korma and sqlite3"
22:22johnmn3but there seems to be minimal docs out there on the combo
22:22johnmn3maybe couchdb..?
22:23brehautwell couchdb is interesting, but its not an SQL db
22:23brehautits not a relational DB at all
22:23brehautyou need to know that your data model fits that of couch before you select it.
22:23johnmn3I did use granger's "simpledb" from his noir example site, when I played with that.
22:25johnmn3I'd like to persist some of my clojure data structures
22:26dnolenbbloom: nearly impossible to find bugs in advanced mode, use simple or whitespace.
22:26lekuwhat was that persistent object database in Symbiotics ?
22:26bbloomdnolen: that's what i figured :-)
22:26lekuerr symbolics
22:26dnolenbbloom: another reason for source maps.
22:26johnmn3in fact, the solution that most closely maps to clojures datastructures would be preferrable.. though I know I /should/ learn sql
22:26bbloomdnolen: good point.
22:26hiredmanjohnmn3: you don't need sql for that
22:26bbloomdnolen: so i have *most* things working again with an explicit symbol and keyword type -- no optimizations yet, but perf isn't *terrible*
22:27hiredmanif you just want to persist datastructures you can use prn/read to the filesystem
22:27lekusymbolics statice
22:27brehautwhich is exactly what ibdknox's simpledb appears to do
22:27lekuhas that been replicated at all by anyone in modern days?
22:27dnolenbbloom: that kind of patch is no good if it's not actually faster :)
22:28lekuhttp://www.sts.tu-harburg.de/~r.f.moeller/symbolics-info/statice.html
22:28hiredmana notch up from prn/read (because it allows for sharing) is something like https://github.com/hiredman/sunyata
22:28johnmn3hiredman: I know, but I'd like something a little more industrious than that, I'd guess. Say I want to run an intranet service... it'll have between 10 and 100 users... I don't even know the right db vocabulary to tell you what I should or shouldn't need. :/
22:29bbloomdnolen: yeah, of course! but i can git commit & then go try various optimizations
22:29johnmn3hmm, looking at sunyata
22:29bbloomdnolen: i found a few other bugs while i'm poking around. i'll send patches or just file them
22:29hiredmanjohnmn3: sunyata is really just a toy
22:30dnolenbbloom: cool, looking forward to seeing where it goes! :) feel free to create a patch + ticket, I'll try it out when you think it's ready.
22:30hiredmanjohnmn3: I would be very surprised if prn/read didn't work find for 10 to 100 users
22:30hiredmanfine
22:30hiredmanat that scale just about anything would work
22:30brehauthiredman: except perhaps mysql
22:30brehaut~rimshot
22:30clojurebotBadum, *tish*
22:31hiredmanhiho
22:32hiredmansunyata is actually what I use locally to map irc nicks to email addresses so I can get gravatars for my notifications
22:32brehautjohnmn3: i dont think anyone can really make a suggestion without knowing more about what you are actually building, and what your motivation is. are you specifically wanting to learn about DBs? or are you specifically trying to write an app
22:33johnmn3brehaut: both, but they don't have to necessarily depend on each other.
22:34bbloomdnolen: no brainer: http://dev.clojure.org/jira/browse/CLJS-304
22:35jedmtnmanis there a better way to write this: (filter #(> (get % :score) 1) stuff)
22:35johnmn3one example... at work I have to munge data... everybody uses excel.. I'm no excel wizard.. however, when I pull the data in to clojure datastructures, I'm pretty efficient, and more powerful than with excel. So I'd like a persistent clojure db where I can add data to it over time and build metrics and reports as it grows
22:35brehautjohnmn3: well if you want to learn about DBs, learning the relational model (SQL is relational, but relational is not just SQL). Once you have grasped that, you can look at other models and understand better what you are trading off.
22:36johnmn3well, I'm not a "data munger" as I probably wouldn't be using excel if that was my thing.. but, you know, I just have to build metrics for the team and whatnot, so I'm trying to transition to clojure instead of excel for that work.
22:36brehaut, (filter (comp (partial <= 1) :score) [{:score 1} {:score 0} {:score 2}]) ;; johnmn3
22:36clojurebot({:score 1} {:score 2})
22:36tomojis there a nice way to allow foo(bar, {baz: bing}) from js and (foo bar :baz bing) in cljs?
22:37brehauterr sorry, jedmtnman ^
22:37dnolenbbloom: cool thx
22:38tomojthinking about something nuts like exporting the cljs version then doing a set! to stick the js version in - but even if that worked at all, I think it'd only work under advanced, and it's crazy
22:38jedmtnmanbrehaut: thanks, i thought it might be with partial, i just couldn't see it.
22:38johnmn3hiredman: is sunyata like: https://github.com/ibdknox/simpledb ??
22:38lazybotjohnmn3: Uh, no. Why would you even ask?
22:38brehaut,(remove (comp (partial > 1) :score) [{:score 1} {:score 0} {:score 2}]) ;; jedmtnman perhaps ;)
22:38clojurebot({:score 1} {:score 2})
22:38tomojwell I suppose I can just check whether the first of the rest args is a keyword
22:41jedmtnmanbrehaut: thanks again
22:42johnmn3hiredman: in sunyata's readme, what do you mean by "shared"?
22:46johnmn3infinispan? Isn't that for datacenters or somethign?
22:56johnmn3is there a place where all of ccw's keybindings can be found?
23:01wmealingjohnmn3, its not for desktops, if thats what you mean
23:02wmealingimmutant makes infinispan access pretty simple
23:02johnmn3wmealing: yea, I'll be doing most stuff on my desktop. what little I'll do on a server probably won't have infinispan either.
23:03wmealinghttps://docs.jboss.org/author/pages/viewpage.action?pageId=3737165
23:04wmealingjohnmn3, you're not mixing up infinispan with infiniband are you ?
23:04johnmn3oooh, yea
23:05johnmn3which is a SAN networking thing, right?
23:05wmealingwell, you can connect a bunch of devices to it, sans also
23:06wmealingive seen other infiniband machines, sans, some very high resolution cameras... that kind of stuff
23:06wmealingits for big bandwidth, low latency application, cost a fortune
23:11johnmn3_wmealing: ah
23:11johnmn3_I'm liking the simplicity of granger's simpledb
23:12wmealingexample anywhere ?
23:12wmealingyou mean like amazon simpledb ?
23:12johnmn3_no, unfortunate choice of name
23:13johnmn3_https://github.com/ibdknox/simpledb/blob/master/src/simpledb/core.clj
23:13wmealingam i reading that right, it only syncs on clean shutdown ?
23:14wmealingoh it schedules it every now and again
23:14johnmn3_what about just adding an add-watch to an atom with a map in it, and writing to a file (similar to granger's simpledb) everytime the data is touched? Bad for performance?
23:14wmealingcould be, but do you care ?
23:15wmealingunless you have significant amount of data, its probably not going to be a big deal
23:15wmealing(that wasn't being a smart ass, that was a legit question)
23:15wmealingand you're right about one thing, that is likable.
23:16johnmn3_Well, if I do a (map #(persist ...) bunch-o-data) does the add-watch trigger on every item in bunch-o-data, or just the whole thing.
23:16johnmn3_well, yes
23:16johnmn3_bad example
23:16wmealingyeah, i imagine so
23:16wmealingif you did a map put, i think it would not
23:17johnmn3_point is, if I treat the map in the atom like a normal map in an atom, and I have an operation that does iterates across that collection or another, that may trigger lots of unnecessary writes, I suppose.
23:18bbloomdnolen: any reason to maintain the deprecated HashMap?
23:18johnmn3_even reading the atom may trigger another write
23:19wmealingjohnmn3_, i'm pretty new at clojure, but how did you come to the conclusion that reading would write (from the example given ?)
23:20johnmn3_wmealing: I'm talking about adding an add-watch: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/add-watch
23:20johnmn3_"Adds a watch function to an agent/atom/var/ref reference. The watch
23:20johnmn3_fn must be a fn of 4 args: a key, the reference, its old-state, its
23:20johnmn3_new-state. Whenever the reference's state might have been changed,
23:20johnmn3_any registered watches will have their functions called."
23:20johnmn3_ugh, ma'bad
23:21johnmn3_okay, so that just says "when changed"
23:21johnmn3_so a read should not trigger the watcher
23:21wmealingyeah
23:21amalloyerc strikes again, johnmn3_?
23:21wmealinganother erc user :)! hi
23:21johnmn3_smuxi
23:21wmealingoh
23:22dnolenbbloom: hanging around as reference for perf benchmarks, it will get dead code eliminated.
23:22johnmn3_on windows here
23:22johnmn3_smuxi seems like a decent xchat-alike
23:23bbloomdnolen: thanks
23:23bbloomdnolen: one important thing to note about any potential Keyword type. identical? will return true for any interned, known keywords, but not for any dynamic ones. this differs from clojure, which has the benefit of interning strings using weak references
23:25johnmn3_so, for (map #(swap! persistent-atom (fn [x] (assoc @persistent-atom :this %))) thousand-items)
23:25johnmn3_does that trigger a thousand events on the watch or just one?
23:25dnolenbbloom: yeah
23:26bbloomdnolen: no big deal, but i did have to change defprotocol to use = instead of identical? in one or two places -- im still working out some kinks like that and then ill run a bunch of benchmarks
23:33johnmn3_user=> (map #(swap! a (fn [x] %)) [1 2 3 4 5]) -> (its happening, its happening, its happening, its happening, its happening, 1 2 3 4 5)
23:33johnmn3_yea
23:34johnmn3_so maybe using an add-watcher to persist a ref is a little dangerous on io
23:34wmealingyep
23:51bbloomdnolen: why are ObjMaps promoted to persistent versions based on update-count ? i assume that was optimized empirically, but i don't understand why
23:55dnolenbbloom: what do you mean?
23:55bbloomdnolen: (deftype ObjMap [meta keys strobj update-count ^:mutable __hash]
23:56bbloomupdate-count is checked against cljs.core.ObjMap/HASHMAP_THRESHOLD
23:56dnolenbbloom: updating anything but the smallest ObjMap is crazy slow
23:56bbloomdnolen: yeah, but that's not size, that's number of changes
23:56dnolenbbloom: why shouldn't we promote after N updates?
23:56dnolenbbloom: we do both.
23:56bbloomdnolen: i see you do both. I'm asking why that's faster :-)
23:57dnolenbbloom: because updating anything but the smallest maps is very slow.
23:58bbloomdnolen: dissoc increments update-count. if you alternated assoc & dissoc of the same key, you'd never have (count keys) > 1
23:58bbloomdnolen: yet it will still be promoted
23:58dnolenbbloom: because it's map that keeps changing frequently - it will become the bottleneck.
23:59dnolenbbloom: look at the benchmarks, most are 1000000 iters, but assoc on ObjMap is 100000
23:59dnolenbbloom: it's that slow.