2012-06-05
| 00:04 | gf3 | WEEEOOOOOOOOOOO |
| 00:04 | gf3 | REFERENCE HEAPING |
| 00:13 | eggsby | is 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:14 | eggsby | https://github.com/ztellman/aleph/wiki/UDP and https://www.refheap.com/paste/3002 |
| 00:22 | eggsby | ah, I had to dereference the channel |
| 00:48 | pheartheceal | Hey guys, I'm back |
| 00:48 | pheartheceal | I'm stuck on problem 21 on 4clojure |
| 00:48 | pheartheceal | "Write a function which returns the Nth element from a sequence." |
| 00:49 | pheartheceal | But I can't use the 'nth' function |
| 00:49 | pheartheceal | I'm confused on how I can keep incrementing a variable until it reaches the nth place I'm looking for |
| 00:50 | xumingmingv | use first/next |
| 00:51 | pheartheceal | I am |
| 00:51 | kovasb | you can also do it recursively |
| 00:51 | pheartheceal | I figured out how to go through the list recursively |
| 00:51 | gf3 | Can't simply use drop/first I guess? |
| 00:51 | kovasb | instead of incrementing, pass the number in as an argument |
| 00:51 | kovasb | in addition to the remaining list |
| 00:52 | pheartheceal | The function can only take two arguments though |
| 00:52 | pheartheceal | http://www.4clojure.com/problem/21#prob-title |
| 00:52 | pheartheceal | Otherwise I would have done that first |
| 00:52 | gf3 | pheartheceal: recur inside the function |
| 00:53 | pheartheceal | can I recure two arguments? |
| 00:53 | kovasb | you can make an anonymous function that iterates exactly n times |
| 00:53 | kovasb | your main function gets n, creates this anonymous function and then invokes it with the list |
| 00:54 | pheartheceal | ha! |
| 00:54 | pheartheceal | Got it |
| 00:54 | pheartheceal | thanks gf3 |
| 00:54 | pheartheceal | (fn [l x] (if (= x 0) (first l) (recur (rest l) (- x 1))) ) |
| 00:55 | gf3 | Woo! |
| 00:56 | eggsby | I wonder why it won't let you use destructuring there |
| 00:56 | eggsby | (fn [[f & r] n] ;...) |
| 01:23 | amalloy | &(macroexpand-1 '(fn [[f & r] n] n)) ;; eggsby |
| 01:23 | lazybot | ⇒ (fn* ([p__10985 n] (clojure.core/let [[f & r] p__10985] n))) |
| 01:23 | amalloy | &(macroexpand '(clojure.core/let [[f & r] p__10985] n)) |
| 01:23 | lazybot | ⇒ (let* [vec__10993 p__10985 f (clojure.core/nth vec__10993 0 nil) r (clojure.core/nthnext vec__10993 1)] n) |
| 03:02 | TheBusby | Any idea why clojure.core.reducers/fold in Clojure "1.5.0-alpha1" would throw NoClassDefFoundError for jsr166y/ForkJoinTask on Java 1.7 ? |
| 03:13 | leku | re |
| 03:39 | TheBusby | guessing maybe AOT compilation is for Java 1.6 and not 1.7? |
| 03:42 | amalloy | i think it got AOTed against 1.7, actually; usually people with an issue like this are running 1.6 |
| 03:47 | TheBusby | that's what I thought, which is why I'm finding this error strange |
| 03:49 | TheBusby | amalloy: recompiled clojure-1.5.0-alpha1.jar from source, and everything works fine now |
| 03:50 | TheBusby | looks like [org.clojure/clojure "1.5.0-alpha1"] is compiled on Java 1.6 :( |
| 03:53 | amalloy | TheBusby: 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:53 | amalloy | that code's near the beginning of clojure.core.reducers |
| 03:53 | TheBusby | I was looking at it a minute ago, to make sure I didn't have anything setup incorrectly |
| 03:54 | TheBusby | unfortunately 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:57 | amalloy | TheBusby: no need to apologize; nobody's paying you to do it |
| 03:58 | amalloy | that 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:59 | amalloy | eg, 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:59 | TheBusby | amalloy: 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:00 | TheBusby | ahh, didn't know about alter-var-root |
| 04:23 | michaelr525 | hello |
| 04:29 | augustl | https://github.com/tavisrudd/redis-clojure makes no mention of any documentation - anyone know where I can find it? |
| 04:30 | clgv | augustl: you probably have use 'doc then |
| 04:32 | clgv | augustl: or check the source of redis/core.clj - if you dont learn anything from it, you should probably not use this lib |
| 04:32 | michaelr525 | i 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:32 | michaelr525 | does anyone know? |
| 04:34 | clgv | michaelr525: its written recursively without tail recursion. so it will consume the stack until nothing is left for large inputs |
| 04:34 | clgv | you'd have the same problem in other languages that have no built-in tail call optimization |
| 04:36 | clgv | michaelr525: if you want to write that programm, you can use a dynamic programming style instead of recursion |
| 04:38 | amalloy | clgv: 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:38 | michaelr525 | clgv: i though that lazy sequences somehow solve that, no? |
| 04:38 | michaelr525 | thought |
| 04:38 | amalloy | michaelr525: they can, but you have to be delicate |
| 04:38 | clgv | amalloy: right, that phrasing above was not ideal ;) |
| 04:38 | amalloy | have you looked at anyone else's solution? |
| 04:39 | clgv | michaelr525: yes they can. you can look at the first comment |
| 04:39 | michaelr525 | nope, 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:39 | michaelr525 | clgv: i'm talking about the first comment :) |
| 04:40 | augustl | clgv: ah, I'm not yet used to the fact that docs are built-in to the language :) |
| 04:40 | clgv | augustl: but that core.clj seems not to have much doc strings anyway |
| 04:41 | clgv | michaelr525: oh? it shouldnt stackoverflow but heapoverflow since he is holding on to the head of the lazyseq |
| 04:41 | amalloy | clgv: no, he is recursing indefinitely |
| 04:42 | amalloy | https://gist.github.com/2873658 is a solution that works for any N |
| 04:42 | clgv | amalloy: 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:43 | tomoj | clojure.string/replace should be named clojure.string/replace-all |
| 04:43 | tomoj | oh well |
| 04:43 | tomoj | :rename {replace replace-all} |
| 04:43 | amalloy | clgv: i guess that's true, it's not the most-obvious kind of stackoverflow |
| 04:44 | amalloy | but it is a pretty common sort; see here for the example i always use: |
| 04:44 | amalloy | $google stackoverflow prime sieve dbyrne |
| 04:44 | lazybot | [recursion - Recursive function causing a stack overflow - Stack ...] http://stackoverflow.com/questions/2946764/recursive-function-causing-a-stack-overflow |
| 04:44 | ro_st | is there something like ruby's resque in clojure? |
| 04:45 | ro_st | google it, ro_st! |
| 04:46 | clgv | amalloy: oh right. the rows are not realized in the call to `next-row` |
| 04:46 | michaelr525 | so it's a 'holding the head' case? |
| 04:47 | clgv | michaelr525: 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:48 | michaelr525 | amalloy: isn't this stuff compile time only? : `(0 ~@row) |
| 04:48 | amalloy | it's just shorthand for (concat [0] row) |
| 04:48 | amalloy | shorthand which is most often useful when writing macros, but in no way restricted to it |
| 04:48 | clgv | amalloy: uuuh thats an evil trick for minimizing the golf score ;) |
| 04:49 | michaelr525 | :) |
| 04:50 | clgv | amalloy: but your solution should have the same "map-stacking issue". |
| 04:50 | amalloy | mmmm, you think so? |
| 04:50 | amalloy | yes, i suppose it will. it's a subtle trick to get used to |
| 04:51 | amalloy | as always you can fix it with a doall |
| 04:56 | michaelr525 | i don't understand how doall fixes anything, the doc says it's holding on the head |
| 04:56 | michaelr525 | ,(doc doall) |
| 04:57 | clojurebot | "([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:59 | augustl | in 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:59 | augustl | ..when you use middlewares, that is, typically via the threading macro |
| 05:01 | augustl | seems kind of odd, since handlers might have side effects like writing to a databse |
| 05:02 | clgv | michaelr525: doall realizes the row hence there will be no recursive stacking of map statements |
| 05:02 | tomoj | I have some mutable state (settable static fields in java) that I can't easily avoid using from clojure |
| 05:02 | tomoj | I have two functions, lex and parse. lex needs the fields set one way, parse the other, and parse calls lex once |
| 05:03 | tomoj | how can I avoid concurrency problems? |
| 05:04 | tomoj | I mean, one way is to just synchronize all lex and parse calls, but what's better? |
| 05:04 | antares_ | tomoj: you can just lock. (locking obj …) |
| 05:04 | tomoj | but then only one thread will be used, while I could be running multiple parses or multiple lexes at a time |
| 05:05 | antares_ | 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:06 | tomoj | oh, right, but I mean it will all be synchronized |
| 05:06 | antares_ | tomoj: also, what kind of state do you share between parsers? |
| 05:06 | tomoj | only one parse or lex happening at the same time |
| 05:06 | antares_ | I can't think of any |
| 05:06 | tomoj | the only state is this static field which configures the behavior of an external library I'm using |
| 05:07 | antares_ | tomoj: set it once and don't modify it in your parser |
| 05:07 | tomoj | it's a boolean field that needs to be true when lex runs and false when parse runs |
| 05:07 | antares_ | tomoj: then just use a lock |
| 05:08 | antares_ | there is no magical solution to shared global state in a 3rd-party library. |
| 05:08 | augustl | anyone got some examples of doing side effects (database stuff) in ring? |
| 05:08 | tomoj | I'm not looking for a magical solution, I'm looking for a real solution |
| 05:08 | antares_ | so either avoid this shared state in your design (why do parsers and lexers need to constantly reconfigure external library?) or lock |
| 05:08 | tomoj | one solution is to run a big batch of lexes first and then run a big batch of parses |
| 05:08 | tomoj | locking means I only use one core |
| 05:08 | tomoj | yes? |
| 05:08 | clojurebot | yes is is |
| 05:09 | antares_ | tomoj: sorry but that's not true |
| 05:09 | antares_ | 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:09 | tomoj | there basically is no other work |
| 05:09 | antares_ | tomoj: but more importantly, you cannot avoid it in your case unless you don't run lexers and parsers separately |
| 05:10 | antares_ | which may be a good idea if you can do it |
| 05:10 | antares_ | tomoj: do you have any profiling results that show that lock contention is really the bottleneck? |
| 05:11 | tomoj | lock contention? |
| 05:11 | augustl | seems 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:12 | antares_ | tomoj: the time spent by threads waiting for the lock to be released |
| 05:13 | tomoj | well the answer is no |
| 05:14 | tomoj | if 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:14 | michaelr525 | clgv: sorry, i still don't get it :) everything seems lazy here and the sequence of rows realized when pascal is called.. |
| 05:14 | antares_ | tomoj: because your current algorithm has inherent mutable shared state |
| 05:14 | antares_ | tomoj: I suggest that you learn what lock contention is and run some profiles |
| 05:14 | antares_ | otherwise it's a bit like that Web Scale movie |
| 05:14 | tomoj | I can run 8 parses and 8 lexes (separately) at a time even with the mutable state |
| 05:15 | antares_ | then do it |
| 05:15 | tomoj | locking means I can only run 1 parse or 1 lex |
| 05:15 | tomoj | or is that wrong? |
| 05:15 | antares_ | tomoj: that's incorrect |
| 05:15 | antares_ | for *that particular locked critical section* it is true but there should be some other work involved |
| 05:15 | antares_ | other than flipping that boolean field |
| 05:15 | antares_ | otherwise what your parser and lexer are doing? |
| 05:16 | tomoj | ok, right, if my minimal processing of the results is the bottleneck, then yeah |
| 05:16 | tomoj | the parser and lexer are in the external library |
| 05:16 | tomoj | (the calls to which need to be in the critical section) |
| 05:17 | antares_ | 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:17 | antares_ | and in that case, run all lexers first and then all parsers |
| 05:17 | antares_ | using a countdown latch, for example, to make sure you run parsers only when all lexers have finished |
| 05:17 | michaelr525 | clgv: but i understand that somehow the problem is caused by (map) which is recursive, right? |
| 05:17 | clgv | michaelr525: 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:17 | tomoj | antares_: thanks |
| 05:20 | ro_st | OT: email hosting. want to stop using godaddy. suggestions? |
| 05:20 | ro_st | (please) |
| 05:20 | clgv | => nil |
| 05:23 | tomoj | I assume gmail doesn't satisfy |
| 05:25 | ro_st | it's a bit expensive.. $5pm |
| 05:25 | ro_st | we're in south africa. our currency is $ * 8. |
| 05:26 | ro_st | i found rackspace email for $2 which looks great |
| 05:26 | ro_st | probably go with them, and dnsimple.com for dns/ssl |
| 05:27 | michaelr525 | clgv: 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:28 | michaelr525 | clgv: ok, now i understand why doall fixes it :) |
| 05:28 | michaelr525 | thanks!! |
| 05:30 | michaelr525 | ro_st: why not run your own? |
| 05:31 | ro_st | michaelr525: don't want the headache, tbh |
| 05:31 | ro_st | moving away from self-host towards cloud. time is more important than money for us, now. small startup starting to get big work |
| 05:32 | ro_st | anyone 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:33 | ro_st | i guess i should just put something up and hammer it! |
| 05:34 | ordnungswidrig | ro_st: exactly. measure yourself. |
| 05:35 | ro_st | i would be keen to hear from others what sort of perf they're getting, though |
| 05:36 | ordnungswidrig | ro_st: I'd suppose that very depends on the application, won't it? |
| 05:37 | ro_st | of course. which is precisely why i'd like to hear from others. what apps get what throughput? |
| 05:38 | ordnungswidrig | I see. |
| 05:38 | ro_st | being 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:38 | ordnungswidrig | ro_st: that's a point. supposed the platform is really even :-) I cannot judge on that. |
| 05:38 | ordnungswidrig | brb |
| 05:41 | vijaykiran | ro_st: you might be interested in discussion here: http://news.ycombinator.com/item?id=4062364 if you haven't seen that already |
| 05:44 | ro_st | thanks, i had read the post but not the discussion |
| 05:52 | borkdude | is there anything against just using public fields in internal "dtos" that are not exposed via public apis? |
| 05:52 | borkdude | instead of all the getter/setter malarkey |
| 05:58 | michaelr525 | after 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:13 | ro_st | when comparing the costs of cloud vs a salary for a fulltime devops person, the cloud wins |
| 06:38 | antares_ | ro_st: not if you need a lot of RAM or good IOPS |
| 06:39 | antares_ | 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:39 | ro_st | our 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:40 | ro_st | it's very much straight-forward request > database > html/json > response type stuff |
| 06:41 | ro_st | heroku 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:42 | ro_st | once we get to the end of that sentence, we should have more than enough revenue to do that properly |
| 06:42 | ro_st | thanks for your feedback, antares_. good to know. i'm not naive enough to think that it's a silver bullet |
| 07:36 | ro_st | why do i not get locals in the exception browser, but i do when using swank/debug? |
| 07:39 | wink | I have weird performance experiences on EC2 large |
| 07:40 | wink | not sure I'd ever go there again |
| 07:53 | michaelr525 | hello |
| 07:53 | kij_ | Heey |
| 07:58 | ro_st | using korma sql, i keep getting "Message: Communications link failure" errors |
| 07:58 | ro_st | if i re-run then it goes through ok |
| 08:03 | gfredericks | ,:/ |
| 08:03 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :/> |
| 08:04 | kij_ | ro_st: still on mysql ? |
| 08:07 | ro_st | kij_: aye |
| 08:11 | ro_st | busy writing clj to convert mysql data to mongo |
| 08:13 | kij_ | ro_st: I dont use mysql, but cant you find something in the server logs? |
| 08:14 | antares_ | mysql has the famous "server gone away" issue with connections that may be stale for hours |
| 08:14 | antares_ | when the server just closes down the connection |
| 08:14 | antares_ | so on the 1st request it fails but then decent clients try to reconnect |
| 08:15 | antares_ | although if there's constant activity, it is probably something else |
| 08:16 | mittchel | If you save something in an atom.. is this saved only for the lifetime of the application or also when you rerun the program? |
| 08:16 | antares_ | mittchel: atoms and other clojure reference types are in-memory |
| 08:22 | gfredericks | core.logic has compelled me to type "expresso" |
| 08:28 | kij_ | gfredericks: care to explain ? |
| 08:31 | gfredericks | kij_: it was just an espresso joke; a core.logic naming convention appends 'o' to words |
| 08:33 | kij_ | gfredericks: Ahh, sure. :) neato |
| 08:42 | TimMc | or other vowels |
| 08:44 | tomoj | ,(.replaceAll (re-matcher #"\\s" "foo bar") "") |
| 08:44 | clojurebot | "foo bar" |
| 08:44 | tomoj | ,(.replaceAll (re-matcher #"b" "foo bar") "") |
| 08:44 | clojurebot | "foo ar" |
| 08:44 | tomoj | why? |
| 08:44 | clojurebot | Why is why |
| 08:44 | clgv | ,(.replaceAll (re-matcher #"\s" "foo bar") "") |
| 08:44 | clojurebot | "foobar" |
| 08:45 | clgv | regexp literals are special - you dont need to escape the backslash |
| 08:45 | TimMc | clojurebot: forget Why |is| why |
| 08:45 | clojurebot | I forgot that Why is why |
| 08:46 | tomoj | aha |
| 08:46 | tomoj | thanks |
| 08:46 | clgv | why? |
| 08:46 | clojurebot | why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone |
| 08:46 | clgv | lol^^ |
| 08:46 | TimMc | It's got a few, but that one sucked. |
| 08:46 | foxdonut | &(inc TimMc) |
| 08:46 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: TimMc in this context |
| 08:59 | clgv | (inc TimMc) |
| 08:59 | lazybot | ⇒ 7 |
| 08:59 | foxdonut | (inc clgv) |
| 08:59 | lazybot | ⇒ 3 |
| 09:00 | clgv | $karma foxdonut |
| 09:00 | lazybot | foxdonut has karma 1. |
| 09:01 | clgv | ,(println "(dec clgv)") |
| 09:01 | clojurebot | (dec clgv) |
| 09:01 | lazybot | ⇒ 2 |
| 09:01 | clgv | ;) |
| 09:02 | foxdonut | clgv: lol, that's clever |
| 09:02 | clgv | ,(println "(inc clgv)") |
| 09:02 | clojurebot | (inc clgv) |
| 09:02 | lazybot | ⇒ 3 |
| 09:02 | clgv | yeah. clojurebot is a willing slave ^^ |
| 09:02 | foxdonut | (map inc [clgv TimMc]) |
| 09:03 | clgv | thats not implemented ;) |
| 09:08 | foxdonut | (inc lazybot) |
| 09:08 | lazybot | ⇒ 5 |
| 09:11 | clgv | (inc lazybot 10) |
| 09:11 | lazybot | ⇒ -1 |
| 09:11 | clgv | (inc lazybot) |
| 09:11 | lazybot | ⇒ 6 |
| 09:11 | clgv | (inc clojure) |
| 09:11 | lazybot | ⇒ 5 |
| 09:20 | gfredericks | ,(dotimes [n 3] (println "(inc cheating)")) |
| 09:21 | clojurebot | (inc cheating) |
| 09:21 | lazybot | ⇒ 1 |
| 09:21 | clojurebot | (inc cheating) |
| 09:21 | lazybot | ⇒ 2 |
| 09:21 | clojurebot | (inc cheating) |
| 09:21 | lazybot | ⇒ 3 |
| 09:21 | Hodapp | what do you folks use Clojure for? |
| 09:21 | Hodapp | ...besides harassing those poor bots |
| 09:21 | alexyakushev | Sometimes we harass people with it |
| 09:22 | gfredericks | mucking with logic programming |
| 09:23 | Hodapp | gfredericks: ooh, like what? |
| 09:25 | foxdonut | Hodapp: web development |
| 09:26 | Hodapp | foxdonut: whaaaaaaaaat? |
| 09:27 | Hodapp | that looks like taking a page from the Paul Graham playbook |
| 09:28 | TimMc | Hodapp: I wrote my wedding gift registry site in Clojure. |
| 09:28 | Hodapp | Why didn't you just do it in something simple like PHP? |
| 09:29 | TimMc | $google PHP is a fractal of bad design. |
| 09:29 | foxdonut | Hodapp: PHP? You've got to be joking. |
| 09:29 | lazybot | [PHP: a fractal of bad design - fuzzy notepad] http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ |
| 09:29 | Hodapp | TimMc: I like that article. "fractal of bad design" is very descriptiove. |
| 09:29 | Hodapp | -o |
| 09:30 | foxdonut | Hodapp: PHP is to web development what McDonald's is to food. |
| 09:30 | kilon | horse meat ? |
| 09:30 | foxdonut | sure it's quick, easy, cheap, and tasty, but in the long run it's really bad for your health! |
| 09:30 | augustl | is there a guide somewhere on clojure.org for -> and ->> etc? |
| 09:31 | borkdude | ,(doc ->) |
| 09:31 | clojurebot | "([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:31 | borkdude | ,(doc ->>) |
| 09:31 | clojurebot | "([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:31 | Hodapp | foxdonut: I've been lucky enough to have not written more than 40 lines of PHP in my life. |
| 09:31 | augustl | other than the (doc) which is very minimal :) |
| 09:32 | Hodapp | foxdonut: I wasn't aware anyone used Clojure for web development. |
| 09:32 | Hodapp | not that I'd really checked. |
| 09:32 | borkdude | Hodapp 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:32 | foxdonut | Hodapp: it's actually a really good fit. f(request) = response. |
| 09:32 | borkdude | Hodapp small course, only 5 lessons |
| 09:33 | Hodapp | borkdude: link? |
| 09:33 | augustl | Hodapp: 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:33 | Hodapp | augustl: Mostly because every time I hear "web app" I reach for the bourbon. |
| 09:33 | borkdude | Hodapp link to what? |
| 09:33 | TimMc | $google clojure noir |
| 09:33 | lazybot | [Noir] http://webnoir.org/ |
| 09:33 | augustl | Hodapp: so the web is your pet peeve or something? :) |
| 09:34 | TimMc | Web programming is a mess. |
| 09:34 | cemerick | Hodapp: well done, sir! :-) |
| 09:34 | Hodapp | augustl: No, I've just had to use Java EE. |
| 09:34 | kilon | web is a mess |
| 09:34 | augustl | I'm not a big fan of noir though.. It uses a bunch of side effects for a lot of things, like setting cookies |
| 09:34 | foxdonut | Hodapp: I can respect your running away from web development, but that has nothing to do with using Clojure or anything else for it. |
| 09:34 | augustl | instead of just returning something |
| 09:35 | zomg | Hodapp: the last time I had to use Java EE, I jumped ship |
| 09:35 | augustl | I've used compojure for a small site, and I'm about to try it for a big site now |
| 09:35 | Hodapp | That was one thing I found appealing about how CGI and FastCGI worked. |
| 09:35 | borkdude | augustl how would you set a cookie without making that a side effect? |
| 09:36 | Hodapp | foxdonut: Yes, I know that that's the case. |
| 09:36 | borkdude | augustl return a new running webserver for each request? ;) |
| 09:36 | augustl | borkdude: return something that causes Set-Cookie to be set |
| 09:36 | zomg | You could build a response object or whatever is the correct terminology in Clojure lingo |
| 09:36 | augustl | borkdude: typically, your handler ends up returning {:status 200 :body "foo" :headers {}} etc, so you just add "Set-Cookie" as a header |
| 09:36 | borkdude | yes, I guess that is possible |
| 09:37 | augustl | or as ring/compojure does it, {:status 200 :cookie {.....}} and does the heavy lifting for you |
| 09:37 | borkdude | augustl I guess you could also do it by falling back to compojure in noir? I didn't really go this far yet |
| 09:37 | augustl | probably, but I don't see what noir really brings to the table, other than defpage which is kind of useful |
| 09:38 | solussd_ | 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:38 | augustl | I'd prefer a compojure-defpage over noir any day though :) |
| 09:38 | borkdude | augustl it's easy for beginners I guess |
| 09:38 | borkdude | augustl you can do a lot of stuff by just looking at the noir api |
| 09:38 | solussd_ | I like noir b/c it works nicely with things like fetch. :D |
| 09:39 | augustl | borkdude: easy for beginners is not really important for me... |
| 09:39 | augustl | not because I'm not a beginner, I am |
| 09:39 | augustl | but because in 1 month I won't be, and then I'll never be a beginner again :) |
| 09:39 | foxdonut | I think learning noir as a beginner is a mistake. |
| 09:39 | gfredericks | Hodapp: a program that generates various expressions for 42 |
| 09:39 | augustl | so I prefer to optimize for the post-beginner stage ;) |
| 09:39 | solussd_ | and noir isnt robbing you of any power- it's just making a few things simpler |
| 09:39 | foxdonut | I prefer the bottom-up approach. Learn ring, then compojure, then noir, so you understand what noir is doing for you. |
| 09:40 | augustl | I suppose noir is also nice if you don't want to deal with functional programming |
| 09:40 | augustl | but rather thread local state and all that jazz |
| 09:41 | zomg | What are the pros of using Clojure in web dev vs. something else? |
| 09:41 | zomg | Just wondering if there's something neat, like type-safe routes or type-safe URL generation like in Haskell web stacks |
| 09:41 | borkdude | type-safe? |
| 09:42 | borkdude | in clojure? |
| 09:42 | zomg | Hey I'm a noob :) |
| 09:42 | cshell_ | Probably the same benefits as using Clojure anywhere else |
| 09:42 | augustl | web 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:42 | augustl | due to the request/response nature |
| 09:43 | augustl | but yeah, what cshell said :) |
| 09:43 | borkdude | the benefit for using clojure in web dev is: you can use clojure |
| 09:43 | cshell | lol |
| 09:43 | zomg | I'd count "not being fucking hard to learn" as one if comparing against haskell... |
| 09:43 | zomg | =) |
| 09:43 | augustl | the 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:43 | cshell | haha, depends on who you ask I guess :) |
| 09:44 | borkdude | the con in using clojure in web dev is though: you have to use clojure ;P |
| 09:44 | augustl | this is a FP benefit though, not specificailly clojure.. |
| 09:44 | cshell | I think using Clojure for web dev is much simpler than using the Java web stacks in my experience |
| 09:44 | borkdude | well not exactly, you can defer to the underlying host of course |
| 09:44 | augustl | zomg: of course the major benefit for clojure is that it's hosted on platforms with huge ecosystems |
| 09:44 | augustl | zomg: finding libs to do, say, parsing of MS excel files might be harder in Haskell than for the JVM or .Net |
| 09:45 | cshell | zomg: augustl is right, it works wonderfully on Heroku |
| 09:45 | zomg | cshell: yeah definitely, although my exposure to java web stacks isn't very big, I do remember them being very much a PITA :P |
| 09:45 | zomg | augustl: true |
| 09:45 | augustl | zomg: ask the same question in 1 month when I've written a large-ish web app with Clojure :) |
| 09:46 | zomg | The 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:46 | borkdude | one benefit in using clojure is maybe also: you can use clojurescript on the client side of things |
| 09:46 | augustl | hopefully my peers won't kill me for ninjaing in clojure |
| 09:46 | augustl | zomg: compared to Ruby, I've grown to like the libs on the Java platform. Not the frameworks mind you, but the libs |
| 09:46 | augustl | like the apache HTTP lib, it has EVERYTHING and is 100% standards compliant, etc |
| 09:46 | borkdude | zomg books? |
| 09:46 | ordnungswidrig | anyone tried openshift with clojure webapps yet? |
| 09:47 | augustl | (I'm new to the JVM) |
| 09:47 | zomg | borkdude: huh? |
| 09:47 | borkdude | zomg "was always a big pro for Java in my books" is this a saying in English? (sorry, my bad) |
| 09:47 | zomg | Ah :) |
| 09:48 | zomg | Yeah, it's sort of like saying "in my opinion" or such |
| 09:48 | borkdude | zomg yeh ok, I sort of figured |
| 09:48 | augustl | in my book* |
| 09:48 | augustl | afaik ;) |
| 09:48 | zomg | haha, could be :P |
| 09:49 | duck1123 | he has more than one book |
| 09:49 | augustl | one book for each hat? |
| 09:50 | zomg | hats hats hats hats |
| 09:50 | zomg | and pootis |
| 09:50 | zomg | If you don't get that, let's just say I've played too much TF2 |
| 09:50 | zomg | =) |
| 09:50 | borkdude | TF2 isn't that a Microsoft game where you can commit code etc? |
| 09:51 | zomg | Thankfully no :D |
| 09:51 | borkdude | :P |
| 09:51 | foxdonut | augustl I don't eat ham ;) |
| 09:51 | zomg | Although I have used that MS game where you can commit code, but before you must check out the file for your personal use |
| 09:51 | zomg | And then when I forgot to commit and went off to holidays, the sysadmin had to unlock all my files for everyone else... |
| 09:51 | adu | augustl: how long have you been speaking English? |
| 09:52 | freiksenet | have anyone used riak with clojure? Is clj-riak okay to use or is it better to use java lib? |
| 09:52 | augustl | adu: hard to tell.. 15 years on paper, had english in school, not sure how long I've been really using english. |
| 09:53 | duck1123 | freiksenet: there's the clojurewerkz one |
| 09:53 | zomg | Sounds about as long as I have if counting when we had english in school |
| 09:53 | antares_ | freiksenet: http://clojureriak.info |
| 09:53 | antares_ | freiksenet: look no further |
| 09:53 | freiksenet | aha, thanks |
| 09:53 | freiksenet | missed that one because of the weird name |
| 09:54 | borkdude | talking about web dev, has anyone used struts2? |
| 09:54 | duck1123 | with clojure? |
| 09:54 | borkdude | I have to acquaint myself with it |
| 09:54 | borkdude | no, just as it is |
| 09:55 | borkdude | it would be nice if clojure could somehow be smuggled in of course |
| 09:55 | antares_ | borkdude: it's the state of the art of crappy old frameworks ("before Rails" frameworks, basically) |
| 09:55 | foxdonut | borkdude: yes I've used S2. You have to learn it for work? |
| 09:55 | borkdude | antares_ what would be a newer better framework for java? |
| 09:55 | borkdude | foxdonut yes |
| 09:55 | augustl | antares_: Rails doesn't get enough credit for changing the scene :) |
| 09:56 | antares_ | borkdude: there's probably more than one but Play (playframework.org) is the way to go, I'd say |
| 09:56 | duck1123 | I 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:56 | augustl | duck1123: there's a talk about that, how to get clojure into the enterprise |
| 09:56 | antares_ | 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:56 | augustl | duck1123: basically, tell them that it's still Java, only different syntax (which is true) |
| 09:56 | duck1123 | I tried looking into Play, but I ran into too much that wasn't finished |
| 09:56 | augustl | antares_: isn't that what I said? |
| 09:57 | foxdonut | borkdude: does it have to be S2 or could it be something else? |
| 09:57 | antares_ | augustl: sorry, hard to understand things over the IRC after 11 hours of programming :( |
| 09:57 | augustl | antares_: haha, I know the feeling |
| 09:57 | borkdude | foxdonut it's kind of decided already for this year, but it could be any web framework |
| 09:57 | borkdude | foxdonut for java that is |
| 09:58 | Hodapp | it 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:58 | borkdude | foxdonut it's for a course with a "first introduction into frameworks" |
| 09:58 | Hodapp | "No one uses this, it must not be useful", etc. |
| 09:58 | antares_ | borkdude: I'd say Play 2 is as friendly as it gets in the Java landscape today |
| 09:58 | borkdude | antares_ good to know, I'll keep that in mind |
| 09:58 | augustl | Hodapp: sounds like making the best possible products isn't the biggest concern :) |
| 09:59 | foxdonut | borkdude: personally, for Java web development, I like Stripes (I'm biased on that one), and Spring MVC |
| 09:59 | adu | Hodapp: can you give me an example "dismissal"? |
| 09:59 | augustl | personally, 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:00 | antares_ | 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:00 | freiksenet | antares_: looks very nice so far |
| 10:00 | freiksenet | is lack of secondary index support a protocol buffer problem or WIP? |
| 10:00 | freiksenet | i mean lack of supports during protocol buffer connection |
| 10:00 | antares_ | freiksenet: it is a Riak 1.1 limitation |
| 10:00 | freiksenet | ok |
| 10:01 | antares_ | in the future Riak versions, PBC will be feature complete |
| 10:01 | duck1123 | I've been impressed with the clojurewerkz libraries. I'm deep in the middle of yanking Karras out and replacing it with Monger |
| 10:01 | antares_ | freiksenet: actually, with Welle 2i will work for PBC (they *should*) |
| 10:01 | antares_ | freiksenet: but this is because Welle/Riak Java driver cheat under the hood and use HTTP for 2i ;) |
| 10:01 | Hodapp | adu: "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:01 | antares_ | duck1123: cool. Monger will go RC1 in a week or two :) |
| 10:02 | jcrossley3 | ordnungswidrig: 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:02 | augustl | Hodapp: 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:02 | freiksenet | antares_: sounds good. |
| 10:02 | duck1123 | I'm at the point where I only have a few failing tests left to fix. (then a lot more to write) |
| 10:02 | borkdude | antares_ my students don't know scala though, is that a problem with using play2? |
| 10:02 | adu | Hodapp: sounds drain bamaged |
| 10:02 | antares_ | borkdude: play has Java API |
| 10:02 | antares_ | borkdude: so no, it is not |
| 10:02 | Hodapp | augustl: Oh, I mentioned Erlang at Ericsson, and some big financial firms that used OCaml. These were ignored. |
| 10:03 | antares_ | play was created to be used with scala or java |
| 10:03 | Hodapp | adu: pseudo-intellectual in many ways, really. |
| 10:03 | duck1123 | finding the right docs for Play can be a pain because of the big changes between 1 and 2 and the Java/Scala split |
| 10:03 | borkdude | antares_ I see some configuration in http://www.playframework.org/documentation/2.0.1/NewApplication using scala I think |
| 10:04 | jweiss | is there an equivalent of "slime-connect" in Eclipse/CCW? i can't find where to connect to an existing swank server. |
| 10:04 | antares_ | borkdude: http://www.playframework.org/documentation/2.0.1/JavaHome |
| 10:04 | Hodapp | adu: curiously, such discussions always culminate in "therefore, C++." |
| 10:04 | borkdude | antares_ ok tnx |
| 10:05 | adu | Hodapp: that's like saying: oh, nails are great and all, but nobody uses them |
| 10:05 | tomoj | any better way to write #(if (#{"foo" "bar"} (first %)) (second %) %) ? |
| 10:05 | adu | "we build every building out of paper these days, it's so green" |
| 10:05 | Hodapp | adu: well, of course not. Who's ever seen a nail anyway? |
| 10:06 | augustl | any suggestions for which Erlang book I should read? :) |
| 10:07 | Kototama | hi, 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:07 | borkdude | antares_ do you recommend a book for play2, or just the online docs? |
| 10:07 | augustl | Hodapp: 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:07 | adu | Hodapp: after researching the US federal reserve system, I've come to the conclusion that most people are too lazy to think about anything |
| 10:07 | Hodapp | adu: 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:08 | adu | Hodapp: that's new-world-order thinking, power-to-the-overlords thinking, we should be empowering the code monkeys instead |
| 10:08 | augustl | Hodapp: that's pretty common - optimizing for the 0.5% of the time as an employee when you aren't familiar with the systems.. |
| 10:09 | Hodapp | augustl: Yes, it's fairly content-free and it seems to apply to every single paradigm except their favorite one. |
| 10:11 | augustl | Hodapp: 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:11 | Hodapp | augustl: 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:12 | Hodapp | also, 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:13 | antares_ | borkdude: I've read the Scala version, it's pretty good |
| 10:13 | augustl | in 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:17 | TimMc | The 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:17 | TimMc | He was dubious, but it's definitely true for my experience... |
| 10:18 | ordnungswidrig | *g* |
| 10:18 | ordnungswidrig | timmc: you're right. and it would not be bound to application server / web development stuff |
| 10:19 | borkdude | TimMc I think that might be true for Java EE stuff, but learning Clojure without Java itself is a bit difficult I think |
| 10:19 | augustl | TimMc: that's an interesting point |
| 10:20 | TimMc | borkdude: Nah, we're already a Java shop, so that's taken care of. |
| 10:20 | borkdude | TimMc I mean, you will run into Java Exceptions, interop stuff, later on |
| 10:20 | cshell | TimMc: I have had similar conversations, but the problem that comes up is that Clojure is too advanced for our 'average' developer |
| 10:21 | TimMc | cshell: And why are we hiring "average" developers? |
| 10:21 | TimMc | borkdude: 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:21 | cshell | TimMc: My question was similar but was "why don't we get rid of the average developers" |
| 10:21 | TimMc | heh |
| 10:21 | augustl | it'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:22 | Hodapp | TimMc: 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:22 | cshell | TimMc: It's amazing how many people don't want to learn anything beyond what they already know (OO) |
| 10:22 | borkdude | I think Clojure can be learned by average developers, if they get proper education and if they are willing to learn |
| 10:22 | TimMc | I 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:23 | TimMc | borkdude: And we totally have above-average devs here anyway, so I'm not concerned about that. :-) |
| 10:24 | cshell | I'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:24 | TimMc | Hodapp: That's excellent. |
| 10:25 | augustl | cshell: in those cases, the urge for OO is probably rooted in familiarity, most likely via schooling |
| 10:25 | cshell | augustl: I agree |
| 10:26 | TimMc | Maybe one day I will make a list of all the "languages" I have had to learn in Java Enterprise land. |
| 10:26 | gtrak | cshell: start with trying to get them to think about what they're doing in general |
| 10:26 | borkdude | augustl it begs for the question, why did it became the default in schooling? |
| 10:26 | borkdude | become |
| 10:26 | augustl | I 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:26 | augustl | borkdude: that's an article I'd love to read :) |
| 10:26 | cshell | gtrak: yeah, I realized I have to go all the way back to the beginning |
| 10:27 | gtrak | kind of a chicken and egg |
| 10:27 | borkdude | augustl chicken and egg there also: somehow it became popular, so schools didn't so Fortran, Modula, Ada, etc but Java |
| 10:28 | borkdude | augustl which sucks! |
| 10:28 | borkdude | ;) |
| 10:28 | borkdude | augustl you have to ask the question: why did it become popular in general |
| 10:28 | cshell | OO was considered much better for larger systems than procedural programming, which isn't necessarily the same as Functional Programming |
| 10:29 | cshell | and for the most part they were all single threaded way back then |
| 10:29 | augustl | my 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:29 | augustl | teach, not learn, mind you |
| 10:29 | borkdude | cshell why didn't ML become very popular |
| 10:29 | clojurebot | the best solution is not to use xml at all |
| 10:29 | cshell | It 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:30 | cshell | borkdude: 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:30 | augustl | it would be interesting to see research on the learning curve of OOP vs FP, for people that's never programmed before |
| 10:30 | augustl | s/that's/that have/ |
| 10:30 | borkdude | augustl I think a lot of kiddo's start with javascript nowadays |
| 10:30 | cshell | I've arrived at the opinion that doing OO correctly leads you naturally into FP |
| 10:31 | cshell | as you can do the same things, but with much less code (ie more elegantly) |
| 10:31 | adu | I 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:31 | TimMc | augustl: At Northeastern the CS Fundies class uses PLT Scheme^W^W Racket. People seem to pick it up pretty quickly. |
| 10:31 | augustl | what I do like to say about OP is that it basically boils down to FP under the hood - values and functions. |
| 10:31 | cshell | adu: That's my problem with Scala, it allows you to mix :( |
| 10:32 | adu | cshell: why is that a problem? |
| 10:32 | augustl | [myThing foo] in ObjC becomes objc_myThing(self, selector, foo), etc |
| 10:32 | TimMc | (compared to, say, the intro-level Java course I took elsewhere) |
| 10:32 | augustl | TimMc: that's interesting |
| 10:32 | TimMc | (both courses had excellent professors, by the way) |
| 10:32 | borkdude | The first programming course at my university was in Miranda |
| 10:32 | cshell | adu: 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:32 | TimMc | borkdude: The IM client? :-P |
| 10:33 | adu | cshell: 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:33 | cshell | adu: I like Clojure cause it "has a strong opinion on things and forces you down those paths" |
| 10:33 | borkdude | TimMc http://en.wikipedia.org/wiki/Miranda_(programming_language) |
| 10:34 | borkdude | it is similar to Haskell |
| 10:34 | adu | borkdude: Miranda users mostly migrated to Haskell |
| 10:35 | borkdude | I don't know what the philosophy behind this choice was: maybe filtering out students who weren't up to it |
| 10:35 | borkdude | or maybe a didactical reason that FP is indeed easy to learn to a good way to start |
| 10:36 | borkdude | it wasn't a very up to date language: where are the libraries for web dev etc |
| 10:36 | Hodapp | cshell: Interestingly, OOP as originally described and implemented by Alan Kay ends up being closer to agent-oriented programming or actor model. |
| 10:36 | adu | borkdude: what choice? |
| 10:36 | borkdude | adu teaching Miranda in the first programming course on university |
| 10:36 | adu | Hodapp: the actor model is getting old, the propagator model is the new kid on the block |
| 10:37 | borkdude | adu now they migrated to Haskell as well |
| 10:37 | adu | propagators++ |
| 10:38 | borkdude | adu and they don't teach it in the first year anymore |
| 10:38 | adu | I think computer science education is crap |
| 10:39 | borkdude | all FP academia in the Netherlands seem to be interested in Haskell now, Lisp/Clojure is ignored |
| 10:39 | adu | but 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:39 | gfredericks | oh man |
| 10:40 | borkdude | adu ah, your school didn't allow you to take classes? |
| 10:40 | adu | borkdude: yes |
| 10:40 | borkdude | what kind of school is that? |
| 10:40 | adu | I wanted to take compiler construction, and parsing theory, and they said, NO, you have to take intro to java first |
| 10:41 | borkdude | adu I guess it's a bootstrapping problem |
| 10:41 | adu | well, I bootstrapped outside the system, I've been programming since I was 9 years old |
| 10:42 | cljs-newbie | How do I use goog.dom.query - I know pinot e.g but not clear |
| 10:42 | cljs-newbie | I am using the browser repl |
| 10:42 | cljs-newbie | Is goog.dom.query included in default goog.jar |
| 10:43 | TimMc | adu: Yeah, that's rough. |
| 10:45 | adu | how different are clojure and clojurescript? |
| 10:45 | gfredericks | (defmacro -inc [& rest] `(fn -inc [] ~@rest)) ;; sneeeky |
| 10:46 | gfredericks | adu: less different than java and javascript |
| 10:47 | borkdude | ecmascript |
| 10:47 | adu | borkdude: I prefer to call them oak and livescript |
| 10:47 | gfredericks | ecmascript is very different from ecma |
| 10:51 | TimMc | gfredericks: Explain that code! |
| 10:53 | gfredericks | TimMc: it means wherever you see -inc you don't even know if it's calling a macro or a function |
| 10:55 | borkdude | gfredericks whoa dude, you discovered the fixed point operator of macro's :P |
| 10:55 | clgv | gfredericks: it's callung the macro |
| 10:55 | gfredericks | TimMc: I didn't write it, I'm just trying to understand it |
| 10:55 | clgv | *calling |
| 10:55 | TimMc | Not buying it. (inc- 1 2 3) expands to (fn -inc [] 1 2 3). What's the deal? |
| 10:56 | gfredericks | that's true it should be statically analyzable |
| 10:56 | gfredericks | (-inc 1 2 (-inc)) though |
| 10:56 | clgv | "-inc" in "(fn -inc ..)" is only for recursive reference and it's included in the name of the java class for that fn |
| 10:56 | gfredericks | this is in the core.logic source code |
| 10:57 | gfredericks | line 771 |
| 10:57 | clgv | hmm ok if you inject (-inc) in the macro you get an infinite recursion |
| 10:58 | gfredericks | I 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:58 | TimMc | Macro-expansion happens first, so any occurrence of (-inc ...) inside another (-inc ...) is also a macro call. |
| 10:58 | TimMc | -inc doesn't def anything. |
| 10:59 | gfredericks | TimMc: that can't be true |
| 10:59 | gfredericks | (-inc 1 2 (-inc)) expands to (fn -inc [] (1 2 (-inc))) |
| 10:59 | gfredericks | which should blow the stack |
| 10:59 | gfredericks | at runtime |
| 10:59 | gfredericks | or maybe (fn -inc [] 1 2 (-inc)) ; either way |
| 10:59 | ivan | user=> ((-inc 1 2 (-inc))) |
| 10:59 | ivan | StackOverflowError user/eval61/-inc--62 (NO_SOURCE_FILE:3) |
| 11:00 | cmajor7 | is 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:00 | borkdude | is it possible to contruct a macro which expands to itself? |
| 11:00 | gfredericks | borkdude: I think so |
| 11:00 | TimMc | borkdude: (defmacro y-do-you-ask [] &form) |
| 11:00 | gfredericks | that was easy |
| 11:00 | ivan | when you do that you get a StackOverflowError clojure.core/concat/fn--3833 (core.clj:663) |
| 11:01 | TimMc | gfredericks: Or not, oops. |
| 11:01 | borkdude | TimMc I mean a macro which expands to its definition |
| 11:01 | ivan | yeah, that's what I tried |
| 11:01 | gfredericks | borkdude: a macro that defs itself? |
| 11:02 | gfredericks | a macro that solves the first-cause problem in philosophy? |
| 11:02 | borkdude | gfredericks yes |
| 11:02 | gfredericks | a quine-macro |
| 11:02 | borkdude | gfredericks it would be nice if we could reply to the philosophers: we solved it with a macro |
| 11:02 | TimMc | (defmacro it [] `(it)) |
| 11:03 | gfredericks | TimMc: no it has to def itself not just call itself |
| 11:03 | gfredericks | (defmacro it [] ...) should expand to (defmacro it [] ...) |
| 11:03 | TimMc | Oh, I thought you wanted (it) to expand to (it). |
| 11:03 | gfredericks | you got that earlier with &form |
| 11:04 | TimMc | Did I? |
| 11:04 | gfredericks | sure |
| 11:04 | gfredericks | it blows the stack but that happens necessarily |
| 11:04 | augustl | I have a bunch of vectors, how do I turn them all into one "flattened" vector? |
| 11:04 | gfredericks | apply concat |
| 11:05 | gfredericks | (comp vec (partial apply concat)) |
| 11:05 | augustl | gfredericks: ah, just found concat, thanks :) getting better and better at navigating the cheat sheet ;) |
| 11:05 | TimMc | gfredericks: 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:05 | gfredericks | TimMc: wtf. |
| 11:06 | gfredericks | which one? |
| 11:06 | borkdude | ,(into [] (concat [1 2 3] [4 5 6])) |
| 11:06 | clojurebot | [1 2 3 4 5 ...] |
| 11:06 | TimMc | Oh, that's the defmacro itself. Oops! |
| 11:07 | gfredericks | ,(reduce (partial apply conj)[1 2 3] [4 5 6]) |
| 11:07 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 11:07 | TimMc | borkdude: How is (partial into []) different from vec? |
| 11:07 | gfredericks | it's 4 characters longer |
| 11:08 | gfredericks | (def out-of seq) |
| 11:08 | mfex | augustl, ##(reduce into [[1 2 3] [4 5 6] [7 8]]) |
| 11:08 | lazybot | ⇒ [1 2 3 4 5 6 7 8] |
| 11:10 | TimMc | mfex: Doesnt' work when you have no vectors. |
| 11:10 | borkdude | TimMc I guess you could provide an init |
| 11:10 | gfredericks | vectors were assumed |
| 11:11 | gfredericks | "I have a bunch of vectors" said the vector-bearer |
| 11:11 | augustl | I also don't actually have a vector of vectors, I just have some refs to vectors |
| 11:11 | borkdude | I guess TimMc means zero vectors instead of "other types" |
| 11:11 | TimMc | Yes, but ##(reduce into []) |
| 11:11 | lazybot | clojure.lang.ArityException: Wrong number of args (0) passed to: core$into |
| 11:11 | mfex | TimMc, yes indeed. More importantly don't use concat when you can only use vectors |
| 11:11 | borkdude | ,(into [] (concat nil)) |
| 11:11 | clojurebot | [] |
| 11:12 | gfredericks | ,(into [] (concat)) |
| 11:12 | clojurebot | [] |
| 11:12 | borkdude | (why is there no concatv etc ;)) |
| 11:12 | TimMc | &(concat (concat (concat) (concat)) (concat) (concat)) |
| 11:12 | lazybot | ⇒ () |
| 11:13 | borkdude | TimMc try reading that line aloud 10 times without making a mistake |
| 11:13 | TimMc | gfredericks: 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:13 | gfredericks | TimMc: don't burn it I'm trying to write condr |
| 11:14 | hyPiRion | concatv would essentially just be ##(reduce into [] [[1 2 3] '(4 5 6) #{7 8 9}]) (and sets will be randomly iterated, of course.) |
| 11:14 | lazybot | ⇒ [1 2 3 4 5 6 7 8 9] |
| 11:15 | hyPiRion | Or eventually (reduce conj [] ...) |
| 11:15 | borkdude | hyPiRion I know how to write one ;) |
| 11:16 | hyPiRion | Then why would you need one? ;) |
| 11:16 | borkdude | hyPiRion so I don't need to write it ;) |
| 11:16 | hyPiRion | Heh. |
| 11:17 | gfredericks | there is _some_ benefit to having _some_ functions in core |
| 11:18 | hyPiRion | I just wonder how often concatv would be used. |
| 11:19 | gfredericks | ,(+ 1 (- (- (+ 337 394) 337) 353)) |
| 11:19 | clojurebot | 42 |
| 11:19 | hyPiRion | Also, concat is lazy, concatv cannot be. It's kind of a dangerous territory to give them the same name. |
| 11:19 | hyPiRion | At least I think so. |
| 11:19 | borkdude | hyPiRion map / mapv in clojure 1.4, same thing? |
| 11:19 | gfredericks | hyPiRion: map vs mapv? |
| 11:20 | hyPiRion | (mapv...?) |
| 11:20 | hyPiRion | Oh well, dangit. My point went out the window. |
| 11:21 | borkdude | ,(clojure-version) |
| 11:21 | clojurebot | "1.4.0-master-SNAPSHOT" |
| 11:21 | borkdude | ,(mapv identity [1 2 3] [1 2 3] [1 2 3]) |
| 11:21 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$identity> |
| 11:21 | borkdude | of course |
| 11:22 | gfredericks | ,(mapv list [1 2 3] [1 2 3] [1 2 3]) |
| 11:22 | clojurebot | [(1 1 1) (2 2 2) (3 3 3)] |
| 11:22 | hyPiRion | That being said though, I'd like to know by name which functions are lazy and which functions who are not. |
| 11:22 | borkdude | ,(mapv identity (concat [1 2 3] [4 5 6])) |
| 11:22 | clojurebot | [1 2 3 4 5 ...] |
| 11:23 | hyPiRion | ##(map inc (range)) vs. ##(mapv inc (range)) |
| 11:23 | gfredericks | hyPiRion: I'd like to know by name which functions are macros |
| 11:23 | lazybot | (map inc (range)) java.lang.OutOfMemoryError: Java heap space |
| 11:23 | lazybot | (mapv inc (range)) Execution Timed Out! |
| 11:23 | gfredericks | o_O |
| 11:24 | borkdude | what other …v functions were added in 1.4? |
| 11:24 | TimMc | That's rather startling. |
| 11:24 | hyPiRion | That's weird. I thought it would only evaluate the first 5 elements. |
| 11:24 | hyPiRion | (And die on the last one) |
| 11:24 | borkdude | is there a function that gives all the vars that were added in 1.4? |
| 11:24 | gfredericks | ,(apropos "v") |
| 11:24 | clojurebot | (val vector-of remove-method get-validator derive ...) |
| 11:24 | TimMc | borkdude: There can be! |
| 11:24 | borkdude | I mean not a function, but an expression |
| 11:26 | hyPiRion | Isn't that put in the metadata? |
| 11:26 | hyPiRion | (:macro (meta %)) |
| 11:26 | hyPiRion | ,(:macro (meta #'defn)) |
| 11:26 | clojurebot | true |
| 11:27 | TimMc | ,(for [v (vals (ns-publics 'clojure.core)) :let [since (:added (meta v))] :when (= since "1.4")] v) |
| 11:27 | clojurebot | (#'clojure.core/mapv #'clojure.core/*data-readers* #'clojure.core/filterv #'clojure.core/default-data-readers #'clojure.core/ex-info ...) |
| 11:28 | borkdude | TimMc tnx! |
| 11:28 | gfredericks | ,(->> (apropos "v" (map str) (filter #(re-matches #"v$"))) |
| 11:28 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 11:28 | borkdude | TimMc I guess this expression deserves a tweet on @learnclojure |
| 11:28 | gfredericks | ,(->> (apropos "v") (map str) (filter #(re-matches #"v$" %))) |
| 11:28 | clojurebot | () |
| 11:28 | borkdude | so filterv |
| 11:28 | TimMc | borkdude: Needs cleanup. |
| 11:28 | gfredericks | ,(->> (apropos "v") (map str) (filter #(re-matches #".*v$" %))) |
| 11:28 | clojurebot | ("mapv" "filterv") |
| 11:28 | Vinzent | btw, don't you think that ex-info and ex-data are, well, suboptimal? |
| 11:29 | TimMc | borkdude: (.sym v) will get the var's name. |
| 11:30 | TimMc | ,(for [[n v] (ns-publics 'clojure.core) :let [since (:added (meta v))] :when (= since "1.4")] n) |
| 11:30 | clojurebot | (mapv *data-readers* filterv default-data-readers ex-info ...) |
| 11:30 | bobry | Is 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:31 | TimMc | Vinzent: Their names are for sure. |
| 11:33 | borkdude | TimMc are you on twitter btw? |
| 11:34 | TimMc | borkdude: Nope. |
| 11:34 | TimMc | I don't need credit, though. |
| 11:34 | borkdude | do you mind me tweeting it? |
| 11:34 | borkdude | :) |
| 11:35 | Vinzent | TimMc, 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:36 | TimMc | Vinzent: I actually haven't followed the exception stuff too closely. It's a mess. |
| 11:36 | Vinzent | yeah, unfortunately |
| 11:37 | juhu_chapa | Hi all! How do I import javax.mail.Flags.Flag.DELETED? |
| 11:37 | borkdude | (import '….) |
| 11:37 | TimMc | juhu_chapa: I'm guessing one of those is an inner class? |
| 11:37 | borkdude | or in an ns macro: (:import ...) |
| 11:37 | borkdude | ah right inner classes… $ right? |
| 11:38 | Vinzent | yeah: foo.bar$inner |
| 11:38 | TimMc | import Flags$Flag, then you have Flags$Flag/DELETED |
| 11:38 | juhu_chapa | TimMc: you are right@! |
| 11:39 | TimMc | juhu_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:40 | juhu_chapa | TimMc: thanks a lot! |
| 11:47 | TimMc | juhu_chapa: The rename fn may actually be preferable, so you could do (rename javax.mail.Flags$Flag 'MF) and then use MF/DELETED |
| 11:48 | borkdude | ,(doc rename) |
| 11:48 | clojurebot | Excuse me? |
| 11:49 | borkdude | TimMc ah from the link you posted ok |
| 11:51 | oskarth1 | is there a library for image generation like svgo for golang? |
| 11:51 | hyPiRion | Image generation? |
| 11:51 | oskarth1 | basically typing in what the image should be like |
| 11:51 | oskarth1 | draw circle and compose different shapes etc |
| 11:52 | oskarth1 | like overtone but for images, I guess |
| 11:52 | oskarth1 | https://github.com/ajstarks/svgo that's for golang |
| 11:52 | Vinzent | oskarth1, I have a link for such project in my followed repos, but github is down, so I can't give it to you. |
| 11:53 | mea | yes |
| 11:53 | mea | you want to use Quil |
| 11:53 | oskarth1 | ah too bad |
| 11:53 | TimMc | github WORKSFORME |
| 11:53 | mea | oskarth1 - https://github.com/quil/quil |
| 11:53 | oskarth1 | mea: ah, looks neat - thanks! |
| 11:53 | Hodapp | There are Clojure bindings for Processing. |
| 11:53 | Vinzent | oh, it's already works, yeah. That's the project I was talking about: https://github.com/mikera/clisk |
| 11:54 | Hodapp | Incanter maybe? |
| 11:54 | oskarth1 | Vinzent: will have a look at that too, thanks |
| 11:54 | oskarth1 | I think incanter is more about graphs and tables, no? |
| 11:54 | mea | oskarth1: no problem. I am actually using that right now so funny you asked for something so specific |
| 11:54 | hyPiRion | Yeah, Incanter is basically R for Clojure. |
| 11:54 | oskarth1 | ha |
| 11:54 | oskarth1 | mea: what are you using it for? |
| 11:55 | gfredericks | writing macroexpand-all is hard |
| 11:55 | hyPiRion | gfredericks: Are you allowed to use macroexpand-1? |
| 11:56 | mfex | gfredericks, clojure.walk/macroexpand-all? |
| 11:57 | mea | oskarth1: 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:58 | gfredericks | mfex: I'm writing a version that only expands macros from clojure.core.logic :) |
| 11:59 | mfex | gfredericks, adding a filter to the source of clojure.walk/macroexpand-all should work |
| 11:59 | samaaron | Mea: you must email me with a description of your Quil work |
| 11:59 | samaaron | I'd love to hear about it |
| 12:00 | mea | samaaron: when I am done with it, I'll put it up on github :) |
| 12:00 | gfredericks | mfex: yeah I think I got it working |
| 12:00 | gfredericks | a bit more involved than just a filter, but not too bad |
| 12:01 | samaaron | Be sure to ping me when you do |
| 12:02 | samaaron | Also please email any images that look interesting so I can tweet them from the quil account @quilist |
| 12:02 | samaaron | Quil is more fun when you share the love |
| 12:02 | mea | haha, I agree. I am just learning clojure so the code isn't going to be spectacular, but the end result should be neat |
| 12:03 | mea | it is basically a light graffiti project |
| 12:03 | mea | it projects an mspaint like interface and then you can draw with it |
| 12:03 | mea | but hey! it's in Quil! |
| 12:03 | samaaron | Sounds awesome |
| 12:03 | Hodapp | ooh, so Quil uses Processing too? |
| 12:04 | samaaron | Seriously |
| 12:04 | samaaron | I need screenshots! |
| 12:05 | samaaron | Hodapp: yup, processing is under the good |
| 12:05 | samaaron | Hood, silly Android keyboard |
| 12:06 | mea | samaaron: will do. you'll have them by Thursday since that's when I need to present it haha |
| 12:06 | adu | screenshots? |
| 12:06 | antares_ | 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:08 | mea | samaaron: quick question though - key-pressed? is just a boolean right? it doesn't work like the keyPressed() processing function |
| 12:10 | gtrak | how do I get docs for a ns from the repl? |
| 12:11 | oskarth1 | mea: cool :) |
| 12:23 | technomancy | mea: we're having a quil night on Thursday too; cool |
| 12:23 | mea | technomancy: here on #clojure? |
| 12:24 | technomancy | no, at the seattle group |
| 12:24 | technomancy | http://seajure.github.com |
| 12:25 | mea | too bad I'm in NY |
| 12:25 | mea | heh |
| 12:28 | gfredericks | NY is the seattle of NY |
| 12:28 | leku | uh what? |
| 12:29 | mea | NY is the capital of the world, according to idiots and marketers |
| 12:29 | leku | it might as well be |
| 12:30 | leku | i'm not sure if I can think of a more important city for AMerican's besides D.C. |
| 12:30 | mea | SF |
| 12:30 | leku | ? |
| 12:30 | mea | San Francisco, daddy-o |
| 12:30 | leku | last I checked SF didn't host 2 stock exchanges |
| 12:31 | antares_ | politically, SF is not too important. Chicago? |
| 12:31 | leku | Chicago is an important city but probably not more important than NYC |
| 12:31 | gfredericks | SF is the DC of Chicago |
| 12:31 | leku | what hte fuck gfred |
| 12:32 | leku | lol |
| 12:32 | antares_ | gfredericks: haha |
| 12:32 | technomancy | Omaha is the new black. |
| 12:32 | leku | ND is the new SF! |
| 12:32 | leku | HUZZAH |
| 12:32 | cgag | ND? |
| 12:32 | clojurebot | sharing 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:33 | leku | north dakota |
| 12:33 | leku | lots of oil mining going on now |
| 12:33 | leku | or drilling or wahtever you call it, frack mining |
| 12:33 | gfredericks | fracking is the new gold rush? |
| 12:33 | leku | yep |
| 12:34 | oskarth1 | how do I check the doc of say, defproject (lein) by using (doc …)? |
| 12:35 | antares_ | oskarth1: given that defproject is referred to in the current namespace, (doc defproject) |
| 12:35 | antares_ | otherwise, you need to require the namespace defproject comes from and (doc leiningen.some.ns/defproject) |
| 12:35 | technomancy | oskarth: good question. unfortunately the docstring of defproject is more or less useless; `lein help sample` is much more enlightening. |
| 12:36 | technomancy | oskarth: you bring up a good point; I'll improve the docstring. |
| 12:36 | oskarth | technomancy: cool and thanks! |
| 12:36 | leku | technomancy you work on lein? |
| 12:36 | technomancy | leku: yeah |
| 12:36 | leku | nice |
| 12:36 | leku | well done |
| 12:37 | mea | lots of big hitters in here |
| 12:37 | oskarth | indeed, it's really really good |
| 12:37 | technomancy | thanks |
| 12:37 | leku | I'm glad I discovered clojure and all these great tools |
| 12:37 | leku | I was about to start using CL and some of their frameworks |
| 12:37 | leku | but they seem pretty old/hobbled together |
| 12:38 | technomancy | quicklisp is going in the right direction, but it might be too little too late |
| 12:38 | leku | cool |
| 12:39 | mea | leku: yeah, clojure is awesome. I've only been using it for a few days, but its so powerful |
| 12:39 | leku | yeah quicklisp seems likea nice repos of unorganized stuff |
| 12:39 | leku | there are no package descriptions or anything |
| 12:39 | technomancy | well that's been a problem with Leiningen too historically |
| 12:39 | technomancy | people don't always include relevant metadata |
| 12:39 | leku | hm |
| 12:40 | leku | mea: agreed..really looking forward to doing live coding |
| 12:40 | leku | clojure+live coding in repl+heroku=win |
| 12:41 | adu | I've been using clojure for about an hour |
| 12:41 | leku | hah |
| 12:41 | adu | I like it |
| 12:41 | leku | have you used other Lisps? |
| 12:41 | adu | leku: yes, mostly schemes |
| 12:41 | leku | k |
| 12:41 | adu | also, I wrote a scheme |
| 12:41 | leku | heh |
| 12:47 | adu | so |
| 12:47 | adu | is it possible to write a server-side app with mixed languages? like Groovy/Clojure? |
| 12:48 | xclite | adu: why wouldn't it be? |
| 12:49 | adu | well, I don't know |
| 12:49 | DaoWen | adu: 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:50 | technomancy | supposedly there's a groovy plugin for leiningen: https://github.com/kurtharriger/lein-groovyc |
| 12:50 | adu | well, I'm thinking job-wise |
| 12:50 | adu | my boss is a stickler for JVM |
| 12:51 | glitch99 | bahh - I know this exists but does anyone know the function that takes two arrays and zips it into an array of pairs? |
| 12:51 | adu | zipmap? |
| 12:51 | glitch99 | without it being a map preferably |
| 12:51 | Bronsa | seq the map |
| 12:51 | dnolen | glitch99: (map vector v1 v2) |
| 12:52 | dnolen | ,(map vector [1 2 3] [4 5 6]) |
| 12:52 | clojurebot | ([1 4] [2 5] [3 6]) |
| 12:52 | S11001001 | Bronsa: dup keys |
| 12:52 | glitch99 | AH |
| 12:52 | Bronsa | oh, right |
| 12:52 | dnolen | adu: quite few people in this IRC making a living writing server side Clojure apps. |
| 12:52 | glitch99 | Thanks all! |
| 12:53 | adu | dnolen: sounds promising, I'll let my boss know :) |
| 12:54 | dnolen | adu: you'll recognize some names here - http://dev.clojure.org/display/community/Clojure+Success+Stories, Twitter uses it too. |
| 12:55 | leku | adu: what about clojurescript? |
| 12:55 | ejackson | dnolen: what is this twitter of which you speak, wise man ? |
| 12:55 | adu | leku: what about it? |
| 12:55 | leku | instead of groovy |
| 12:56 | leku | nm i guess i dont know much about groovy |
| 12:56 | adu | i thought clojurescript was client-side |
| 12:56 | adu | groovy compiles to JVM |
| 12:56 | leku | k |
| 12:57 | leku | i wonder what AKamai is using clojure for |
| 12:57 | hiredman | they may not be using it anymore |
| 12:57 | leku | ah |
| 12:57 | hiredman | they acquired someone that was |
| 12:58 | leku | there are a lotof MIT nerds at AKAM, wouldn't be surprised if they were i guess |
| 12:59 | adu | ooo GSoC |
| 12:59 | adu | Typed Clojure? |
| 13:01 | solussd | is there an issue with using macros for reader literals? |
| 13:01 | solussd | I get arity exceptions |
| 13:02 | dnolen | adu: yeah Ambrose Bonnaire-Sargeant is working on that. Neat stuff. |
| 13:02 | adu | I'm quite fond of Typed Racket, will it be anything like that? |
| 13:03 | dnolen | adu: very much inspired by Typed Racket |
| 13:03 | adu | :) |
| 13:04 | S11001001 | akamai 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:04 | TimMc | hiredman: The acquisition (Velocitude, I think?) is no more, as far as I know... but they're still using it somewhere. |
| 13:04 | S11001001 | as TimMc says, yes, Velocitude |
| 13:04 | S11001001 | (I worked there) |
| 13:04 | leku | ahh ok s11 |
| 13:04 | TimMc | Velocitude isn't completely dead? |
| 13:04 | leku | what did they do? |
| 13:04 | S11001001 | I don't know about velocitude, but the team expanded into other clojure projects |
| 13:05 | TimMc | leku: Something about proxying sites for mobile browsers, I think. |
| 13:05 | S11001001 | yep |
| 13:05 | leku | hmm |
| 13:05 | TimMc | A friend of mine at Akamai said it didn't really fit Akamai's overall business strategy. |
| 13:05 | leku | so they nixed it? |
| 13:06 | TimMc | Not sure. Sounds like it's not exactly a growing team, though. |
| 13:06 | mea | Question: how can I import processing libs (like .jars) into quil? |
| 13:09 | dnolen | mea: 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:10 | mea | mea: if I declare them in project.clj, do I need to put them in a specific folder |
| 13:10 | gfredericks | dnolen: 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:11 | dnolen | mea: you can't just declare jars, they need to be something that's available via a maven repository (Central, Clojars etc). |
| 13:12 | dnolen | gfredericks: read up on condu |
| 13:12 | mea | dnolen: oh, so if I am using Processing / Java jars, I ought to use the :extra-classpaths option then eh? |
| 13:12 | gfredericks | dnolen: yessir |
| 13:12 | dnolen | gfredericks: condu is cut + succeed *once* |
| 13:13 | sergey | hello |
| 13:13 | dnolen | mea: if you have a bunch of jars and their are not available via some Maven repository, yes then manage them yourself. |
| 13:13 | mea | dnolen: okay, excellent. thank you |
| 13:13 | sergey | is there any real world tutorial about clojure where something is created during it? |
| 13:14 | technomancy | actually :extra-classpath-dirs is deprecated |
| 13:14 | technomancy | mea: 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:14 | technomancy | then you can use the lein-localrepo plugin |
| 13:14 | technomancy | sergey: the peepcode screencast does that |
| 13:15 | technomancy | disclaimer: I'm the author |
| 13:15 | dnolen | technomancy: probably not going to happen among the Processing community. Something like :extra-classpath-dirs still useful. |
| 13:15 | dnolen | technomancy: and what's the lein2 way of dealing with checkouts dir? |
| 13:15 | technomancy | dnolen: I don't think anything's changed about checkouts |
| 13:15 | technomancy | at least not intentionally |
| 13:16 | sergey | technomancy, thanks, I'll try peepcode screencasts, do you know any other sources? |
| 13:16 | solussd | hmm, 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:16 | solussd | *arity. stupid lion autocorrect |
| 13:16 | technomancy | anyway I'd still report bugs even if they're likely to be ignored |
| 13:16 | technomancy | hopefully the cumulative effect over time will sink in and help them see the light |
| 13:16 | mea | hhaha |
| 13:17 | raph_amiard | is there an easy way to reset a clojure session in swank-clojure ? |
| 13:17 | TimMc | solussd: What would it mean to use a macro that way? |
| 13:17 | solussd | raph_amiard: M-x slime-disconnect followed by clojure-jack-in? |
| 13:18 | solussd | TimMc: 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:19 | solussd | TimMc: it's the arity exception that confuses me. :/ |
| 13:20 | nDuff | Hrm; I'm having trouble avoiding reflection in calling a variadic Java method: http://stackoverflow.com/questions/10901756 |
| 13:21 | S11001001 | I don't think into-array gets inferred |
| 13:21 | gfredericks | monads are hard |
| 13:21 | S11001001 | ^"[java.lang.String;" (into-array... |
| 13:21 | S11001001 | nDuff |
| 13:23 | S11001001 | theoretically you could add an :inline for into-array that DTRT for a compile-time-known element type arg |
| 13:29 | TimMc | solussd: Macros take two extra args at the front: &form and &env |
| 13:30 | solussd | TimMc: so no way to use them with read literals then, huh. :( |
| 13:30 | antares_ | nDuff: hint it as ^strings? |
| 13:32 | TimMc | solussd: Extract the guts as a fn (to use for literal parsing) and call that fn from the macro. |
| 13:34 | solussd | TimMc: thanks |
| 13:36 | cgag | scheme |
| 13:36 | cgag | woops |
| 13:36 | adu | what? |
| 13:36 | clojurebot | what is wrong with you |
| 13:40 | sergey | exit |
| 13:40 | sergey | endsession |
| 13:40 | S11001001 | xb |
| 13:40 | duck1123 | there is no leaving #clojure |
| 13:43 | gfredericks | "sudo exit" and then type in your password |
| 13:45 | eighty | what's the idiomatic way to read a file in my project's dev/ folder? |
| 13:45 | eighty | i know there's a good way to do this :) |
| 13:45 | S11001001 | what dev/? |
| 13:45 | eighty | just a folder in my project |
| 13:45 | eighty | S11001001: i just want to read in dev/foo.txt |
| 13:46 | S11001001 | what about when your code's in a jar? |
| 13:47 | antares_ | eighty: clojure.java.io/resource if it happens to be on the classpath |
| 13:47 | antares_ | otherwise, clojure.java.io/file + slurp should be sufficient |
| 13:47 | antares_ | (/file will accept and resolve relative paths) |
| 13:48 | eighty | antares_: there it is. exactly. thanks man. |
| 13:48 | antares_ | eighty: my bad, /resource also will require calling clojure.core/slurp on it |
| 13:48 | eighty | right right |
| 13:48 | eighty | k |
| 13:57 | oskarth | "lein cljsbuild once" => "That's not a task." using lein-cljsbuild sample simple project. Any ideas? |
| 14:00 | technomancy | looks like you need to make sure the plugin is installed right |
| 14:01 | oskarth | yeah right, does lein deps not install plugins? |
| 14:02 | technomancy | it does as long as they're declared right |
| 14:06 | adu | what does ^: mean? |
| 14:07 | TimMc | adu: ^ attaches metadata to forms for the compiler; the ^:foo form is shorthand for ^{:foo true} |
| 14:07 | adu | oh |
| 14:08 | raek | does anyone know what the recommended way to deref a Lamina async result with a timeout is? |
| 14:12 | raek | are you supposed to use read-channel* or is it an internal function? (it has no docstring) |
| 14:13 | nDuff | antares_: "Unable to resolve classname: strings" |
| 14:13 | nDuff | S11001001: java.lang.ClassNotFoundException: [java/lang/String; |
| 14:13 | S11001001 | maybe an l in there |
| 14:14 | S11001001 | just do (class (into-array String [])) |
| 14:14 | S11001001 | see what it prints |
| 14:14 | nDuff | ^"[Ljava.lang.String;" does indeed do the trick |
| 14:14 | nDuff | heh. |
| 14:15 | antares_ | nDuff: yeah, that :) |
| 14:15 | nDuff | S11001001: do you want the credit on StackOverflow, or shall I answer it myself? |
| 14:15 | S11001001 | answer it yourself |
| 14:16 | S11001001 | though a better answer would be for you to write a variant of into-array with that :inline I mentioned :) |
| 14:19 | gfredericks | for some reason hacking together a condr with code I don't understand gives me results I don't understand :) |
| 14:20 | nDuff | S11001001: 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:20 | antares_ | technomancy: heroku still runs OpenJDK 6, correct? |
| 14:20 | dnolen | gfredericks: gist? |
| 14:20 | S11001001 | sort of like http://xach.com/clhs?q=define-compiler-macro |
| 14:21 | technomancy | antares_: that's currently the default; going to upgrade soon. |
| 14:21 | gfredericks | dnolen: sure; I macroexpanded a conde and tried to write code that produced a similar structure but at runtime |
| 14:21 | technomancy | you can upgrade with buildpacks, but we haven't stitched those together so they compose quite yet |
| 14:21 | dnolen | gfredericks: why? |
| 14:21 | dnolen | gfredericks: you didn't use condo? |
| 14:21 | dnolen | gfredericks: grr, I mean condu |
| 14:22 | leku | what the heck are all tehse condo/condus? |
| 14:22 | dnolen | leku: see The Reasoned Schemer |
| 14:22 | leku | rgr |
| 14:23 | leku | is it something I have to know right now |
| 14:23 | S11001001 | nDuff: the best way to figure it out is to read core.clj; there are tons of :inline usage examples there |
| 14:23 | leku | to begin using clojure effectively? |
| 14:24 | dnolen | leku: no |
| 14:24 | dnolen | leku: it's a library for doing relational programming, not necessary in the slightest. |
| 14:24 | gfredericks | dnolen: https://gist.github.com/2876680 |
| 14:24 | gfredericks | included example usage and unexpected behavior |
| 14:25 | dnolen | gfredericks: don't have time to look to closely, use condu |
| 14:26 | dnolen | gfredericks: 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:26 | gfredericks | dnolen: 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:26 | dnolen | gfredericks: so shuffle the goals, and try them with condu, once one succeeds it'll stop. |
| 14:26 | gfredericks | dnolen: and in particular the randomness should be runtime randomness, so not just a conde-like macro that shuffles the clauses |
| 14:27 | dnolen | gfredericks: reshuffle the goals on every run. |
| 14:27 | XPherior | ibdknox: You alive? |
| 14:27 | gfredericks | don't you have to do it at compile time to do condu? If you `(condu ~@(shuffle clauses)), that's compile time |
| 14:27 | leku | wish i understood this code |
| 14:28 | gfredericks | leku: my gist? I wish I understood it too :) |
| 14:28 | leku | ya |
| 14:28 | leku | defrel +o ^:index x ^:index y ^:index z |
| 14:28 | leku | ? |
| 14:28 | dnolen | leku: familiar with Prolog. |
| 14:28 | S11001001 | in fact, here's my most general advice for all clojurians |
| 14:28 | S11001001 | read core.clj instead of the docs generated from it |
| 14:29 | dnolen | gfredericks: no you don't have to do it compile time. |
| 14:29 | dnolen | leku: I mean that as a question. |
| 14:29 | DaoWen | leku: they're doing logic programming with core.logic |
| 14:29 | leku | nope |
| 14:29 | leku | ok |
| 14:29 | gfredericks | dnolen: how do you vary the args to a macro at runtime? |
| 14:29 | gfredericks | eval? |
| 14:29 | clojurebot | eval is sometimes useful - but only sometimes |
| 14:30 | gfredericks | oh hm |
| 14:30 | dnolen | gfredericks: (defn try [clauses] (condu (first clauses) (try (rest clauses))) |
| 14:30 | dnolen | gfredericks: where clauses has been shuffled. |
| 14:30 | gfredericks | dnolen: k, will go think that over -- thanks! |
| 14:32 | TimMc | Hmm. Why was arity-based dispatch in CLJS a problem? arguments.length seems to give the arity-of-use just fine... |
| 14:33 | dnolen | TimMc: slow |
| 14:33 | TimMc | OK. :-) |
| 14:33 | dnolen | TimMc: but we do that too when fns are used higher order. |
| 14:36 | adu | this is my first time using lein |
| 14:36 | adu | http://paste.lisp.org/display/129852 |
| 14:36 | adu | what does that mean? |
| 14:37 | adamspgh | adu: looks like you've got an old "lein" script. |
| 14:37 | TimMc | Oof, what's bringing in an old beta release of Clojure? |
| 14:38 | adamspgh | it appears to be trying to pull in 1.2.0-beta !? |
| 14:38 | adu | adamspgh: hmm I just download it 5 mins ago |
| 14:38 | TimMc | Oh, yep: "Downloading Leiningen now" |
| 14:38 | TimMc | adu: From Github? On the right branch? |
| 14:38 | adu | TimMc: from macports |
| 14:38 | adamspgh | the latest release of clojure is 1.4.0, which lein 2.pre will pull in. |
| 14:38 | adamspgh | ah. |
| 14:38 | adamspgh | grab lien from github |
| 14:38 | adu | where is that? |
| 14:38 | adamspgh | or lein, even ! (oops) |
| 14:39 | TimMc | $google lein github |
| 14:39 | lazybot | [technomancy/leiningen · GitHub] https://github.com/technomancy/leiningen |
| 14:39 | adamspgh | https://github.com/technomancy/leiningen |
| 14:39 | adu | git://github.com/technomancy/leiningen.git? |
| 14:39 | clojurebot | eg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging |
| 14:39 | TimMc | Read the README. |
| 14:41 | technomancy | macports is not to be trusted |
| 14:41 | TimMc | technomancy: Which package systems *are* to be trusted with lein? |
| 14:41 | technomancy | there's only one package manager that's trustworthy at all. |
| 14:42 | adu | ok trying again with the github version |
| 14:42 | technomancy | well, 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:43 | S11001001 | wouldn't trust any |
| 14:43 | technomancy | TimMc: homebrew seems OK regarding lein, but it's got other issues |
| 14:44 | technomancy | leiningen doesn't exactly stretch the limits of what a package manager does; it's pretty hard to screw up |
| 14:45 | adu | ok, this is what I get with the latest lein: http://paste.lisp.org/display/129853 |
| 14:46 | adu | ok perhaps I should also mention that I'm trying to follow http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html |
| 14:46 | TimMc | Pretty sure that's not the latest lein. |
| 14:46 | TimMc | Does `which lein` show you the path you expect? |
| 14:46 | hiredman | your project.clj is specifying a bogus version for clojure and contrib |
| 14:46 | adu | TimMc: yes |
| 14:47 | adu | hiredman: so I'm following the wrong tutorial |
| 14:47 | hiredman | ~blog |
| 14:47 | clojurebot | make 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:47 | TimMc | Oh, ew. It's definitely the tutorial's fault. |
| 14:47 | hiredman | clojurebot: jerk |
| 14:47 | clojurebot | you cut me deep, man. |
| 14:47 | hiredman | ~blog post |
| 14:47 | clojurebot | blogs are never to be trusted |
| 14:48 | adu | are these better? http://learn-clojure.com/clojure_tutorials.html |
| 14:48 | S11001001 | true clojurebot |
| 14:48 | TimMc | I'm kind of intrigued that the beta1 isn't still available. |
| 14:48 | dnolen | adu: Clojure is a rapidly changing ecosystem, anything with a publish date older than 1 year is suspect. |
| 14:48 | adu | ok |
| 14:48 | XPherior | Is there any reason that JSON would render inside HTML markup if the document type is application/json? |
| 14:49 | dnolen | adu: I recommend the new O'Reilly book. most online resources that aren't pure reference just aren't up to date. |
| 14:56 | adu | I think (.) was the most difficult syntax to wrap my head around |
| 14:57 | TimMc | XPherior: That question didn't make much sense. |
| 14:59 | pbostrom | adu: 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:59 | adu | pbostrom: I'll take a look |
| 15:00 | dwierenga | can someone help me out with this? i'm not sure what it's complaining about: http://pastebin.com/9GeQ359E |
| 15:01 | TimMc | dwierenga: You'll want to get an actual stack trace pinpointing where the error occurred. |
| 15:01 | dwierenga | it *should* be a very simple "run this query, dump the result set to a CSV file" |
| 15:01 | amalloy | spit wants a string, not a data structure |
| 15:01 | amalloy | i think |
| 15:02 | dwierenga | TimMc: i have no idea how to interpret those stack traces :/ |
| 15:02 | amalloy | dwierenga: that's no reason to not provide them when you ask for help. presumably someone in this world can read them |
| 15:03 | TimMc | dwierenga: Skim until you find your own files, then see what line numbers are responsible (and what the next thing in the stack was.) |
| 15:03 | adu | sweet |
| 15:03 | adu | noir worked first time! |
| 15:03 | dwierenga | amalloy: oh.. i didn't realize he was asking to see them, i read it as *I* should go read it |
| 15:03 | hiredman | amalloy: nah, spit takes whatever |
| 15:03 | adu | noir++ |
| 15:04 | amalloy | (inc noir) |
| 15:04 | lazybot | ⇒ 1 |
| 15:04 | hiredman | although, doesn't write-csv write to a csv file? why would you use that with spit? |
| 15:05 | dwierenga | hiredman: the description of write-csv is "Given a sequence of sequences of strings, returns a string of that table |
| 15:05 | oskarth | following 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:05 | TimMc | dwierenga: That too, actually. They're not *fun* to read, but you can figure them out without too much work. |
| 15:05 | dwierenga | in CSV format, with all appropriate quoting and escaping. |
| 15:06 | hiredman | dwierenga: ok |
| 15:06 | TimMc | oskarth: Because everything is included when you don't turn on optimizations. |
| 15:06 | amalloy | dwierenga: 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:06 | hiredman | dwierenga: have you looked a the example usage from the readme of data.csv? |
| 15:07 | oskarth | TimMc: 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:07 | dnolen | oskarth: 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:07 | oskarth | maybe I used the wrong type hints |
| 15:07 | oskarth | ok I see |
| 15:07 | dwierenga | amalloy: i have no idea! that's what i'm asking (i think..) |
| 15:08 | oskarth | thanks |
| 15:08 | dwierenga | hiredman: i'm not sure where i'd find the readme of data.csv?? |
| 15:08 | lazybot | dwierenga: Uh, no. Why would you even ask? |
| 15:08 | hiredman | ~google clojure.data.csv |
| 15:08 | clojurebot | First, out of 6370 results is: |
| 15:08 | clojurebot | clojure/data.csv · GitHub |
| 15:08 | clojurebot | https://github.com/clojure/data.csv |
| 15:09 | dwierenga | hiredman: i'm not using that, i'm using https://github.com/davidsantiago/clojure-csv |
| 15:09 | dnolen | oskarth: that said, when you generate tons of code (which tends to happen when using macros) advanced compilation is close to magic. |
| 15:10 | dnolen | oskarth: instead of 600k of JS, you still get something around or smaller than jQuery. |
| 15:10 | oskarth | dnolen: yeah, that's true. Looking forward to you coming to HS btw! |
| 15:10 | oskarth | yeah |
| 15:10 | dwierenga | should i use clojure/data.csv instead? |
| 15:10 | hiredman | *shrug* |
| 15:10 | dnolen | oskarth: looking forward to it as well! |
| 15:22 | nDuff | Is 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:23 | TimMc | nDuff: What version of Clojure? |
| 15:23 | nDuff | TimMc: 1.4.0 |
| 15:23 | TimMc | And ew, that sounds annoying. |
| 15:23 | nDuff | (and, yes; it can be worked around by fully-qualifying the class names, but ugh) |
| 15:26 | XPherior | I'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:27 | borkdude | XPherior it happens when you define var without a root binding and then get its value |
| 15:28 | adu | so clojure's defn works like scheme's define with case-lambda? |
| 15:29 | borkdude | adu yes, with different syntax |
| 15:30 | XPherior | borkdude: Hm, alright. |
| 15:30 | adu | borkdude: of course |
| 15:31 | borkdude | XPherior well no, actually that doesn't happen |
| 15:31 | amalloy | borkdude, XPherior: not correct. it happens when you run code AOT-compiled against one versino of clojure (usually contrib) against a different version |
| 15:31 | borkdude | XPherior I don't know then |
| 15:31 | borkdude | amalloy ok |
| 15:32 | XPherior | borkdude: Ever seen it in this context? api.server=> (use 'clojure.contrib.sql) |
| 15:32 | XPherior | IllegalArgumentException No matching field found: getRoot for class clojure.lang.Var clojure.lang.Reflector.getInstanceField (Reflector.java:271) |
| 15:32 | mrtentje | Is there a way with webnoir to hold a map or list or sequence of all active sessions? |
| 15:37 | TimMc | XPherior: The first problem is that you are using old monolithic contrib, which is a bad start already. |
| 15:37 | TimMc | That means you're also using an old version of clojure. |
| 15:39 | XPherior | TimMc: Using Clojure 1.4 |
| 15:39 | XPherior | TimMc: Can't find the new smaller SQL library though |
| 15:40 | XPherior | Oh duh! I could just use Korma |
| 15:40 | pbostrom_ | mrtentje: noir will let you access the session of each request, but you would have to manage the data structure yourself |
| 15:42 | TimMc | XPherior: clojure.java.jdbc? |
| 15:42 | TimMc | Monolithic contrib was written against 1.2 and earlier. |
| 15:44 | XPherior | TimMc: Korma looks like it'll do. Thank you for the information!" |
| 15:47 | pbostrom_ | mrtentje_: you can do something like (noir.cookies/get "ring-session") on each request and add it to your data structure |
| 16:09 | oskarth | is it possible to get clojuredocs examples via something like (doc fn)? would be really useful |
| 16:10 | Iceland_jack | ↑ second that |
| 16:10 | dakrone | oskarth: lein2's repl has (cdoc ...) |
| 16:10 | dakrone | to retrieve clojuredocs examples |
| 16:10 | oskarth | dakrone: nice! thanks, that's reason enough to upgrade :) |
| 16:11 | hyPiRion | lein2 also contain (source ...), which I find rather satisfying. |
| 16:12 | oskarth | hyPiRion: I think that's in clojure.repl already |
| 16:12 | oskarth | maybe it's different, don't know |
| 16:15 | hyPiRion | Looks similar, yes. |
| 16:17 | technomancy | I think lein repl has some magic to allow it to be invoked from any ns |
| 16:24 | pepijndevos | Does clojure-py does some automatic pushing and popping for bytecode ops? |
| 16:24 | Raynes | Man, clojure-py is the best thing ever. I wish I had less trouble figuring it out. |
| 16:24 | augustl | how do you do private defs, like defn-? |
| 16:25 | tbaldridge | @pepijndevos explain? |
| 16:26 | Raynes | pepijndevos: 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:26 | Raynes | The bonus points are redeemable for two weeks worth of ass kissing and praise. |
| 16:28 | technomancy | two weeks?? |
| 16:28 | lazybot | technomancy: Uh, no. Why would you even ask? |
| 16:30 | emezeske | augustl: I believe (defn- ...) is short for (defn ^:private ...) |
| 16:30 | emezeske | augustl: So for def it would be (def ^:private ...) |
| 16:31 | neotyk | is there a lein-chrome-ext, similar to lein-gnome? |
| 16:31 | technomancy | neotyk: not afaik. I think people have tried using cljs to write conkeror extensions, but I don't think anyone's gotten it working. |
| 16:32 | augustl | emezeske: ah, I'll look that up, thanks |
| 16:33 | augustl | what'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:33 | augustl | aaand just found it in the cheat sheet, nvm :) |
| 16:33 | emezeske | augustl: also, check the docs for def: http://clojure.org/special_forms |
| 16:34 | emezeske | augustl: In general, the ^ reader macro sets metadata for the following form AFAIK |
| 16:34 | neotyk | technomancy: chrome extension is a bit complex |
| 16:34 | augustl | emezeske: thanks |
| 16:42 | borkdude | neotyk how was euroclojure? |
| 16:42 | borkdude | neotyk and how did your presentation go? |
| 16:43 | neotyk | borkdude: euroclojure was great :) |
| 16:43 | neotyk | borkdude: but I was stressed by presenting in front of it, a lot |
| 16:44 | borkdude | neotyk did laser beams come out of rich's eyes? |
| 16:44 | neotyk | borkdude: don't think I made good advertising for http.async.client |
| 16:46 | borkdude | neotyk did you stick with the emacs approach? |
| 16:46 | neotyk | borkdude: nah, but it was very interesting to hear rich |
| 16:46 | neotyk | borkdude: sure, emacs all the way |
| 16:48 | borkdude | neotyk I'll be awaiting the video's then from euroclojure |
| 16:49 | neotyk | borkdude: there will be so much butter to watch :D |
| 16:49 | borkdude | butter? |
| 16:49 | neotyk | s/butter/better/ |
| 16:50 | borkdude | better than what? |
| 16:50 | neotyk | than my preso |
| 16:50 | borkdude | neotyk at least you went on stage at the first euroclojure, not many people can say that ;) |
| 16:51 | neotyk | borkdude: true that |
| 17:21 | mea | would 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:21 | mea | or perhaps I am just importing in a foolish way |
| 17:22 | technomancy | mea: slamhound sorta does that |
| 17:24 | mea | technomancy: so it automatically detects what libraries are missing? |
| 17:24 | mea | missing / needed |
| 17:24 | technomancy | mea: no, it just fixes your ns form assuming your classpath is already correct |
| 17:24 | mea | okay |
| 17:25 | mea | that is actually what I needed thanks |
| 17:25 | mea | i think i'll code up my idea anyway for practice :) |
| 17:25 | amalloy | mea: isn't that just like... jar tf $JAR | perl "something or other"? |
| 17:25 | amalloy | i would hesitate to write it in clojure; it's not really our wheelhouse |
| 17:26 | technomancy | we have a wheelhouse? |
| 17:38 | jcrossley3 | seancorfield: how would you feel about making clojure.java.jdbc/transaction* dynamically rebindable? |
| 17:50 | seancorfield | jcrossley3: i'm not in favor of dynamic binding - what's the use case you have in mind? |
| 17:52 | jcrossley3 | seancorfield: 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:53 | seancorfield | since transaction is just a thin macro wrapper for transaction*, why not directly use a different function based on the XA stuff? |
| 17:53 | jcrossley3 | everything will just work if i can rebind transaction* to simply call (func) :) |
| 17:53 | jcrossley3 | seancorfield: i'm open to that, but i'm unclear exactly what you mean. |
| 17:54 | seancorfield | clojure/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:54 | seancorfield | perhaps a with-transaction construct that allowed you to pass a transaction management function? (which could default to the same current implementation) |
| 17:55 | technomancy | seancorfield: have you looked into HStore at all? |
| 17:56 | seancorfield | technomancy: i have not - URL? |
| 17:56 | technomancy | https://postgres.heroku.com/blog/past/2012/3/14/introducing_keyvalue_data_storage_in_heroku_postgres/ |
| 17:56 | jcrossley3 | seancorfield: the only problem i see with that is existing libs built on core.jdbc, e.g. clojureql and korma. |
| 17:56 | technomancy | I'm playing around with it and it's quite nice, but a bit rough around the edges to use with clojure.java.jdbc |
| 17:56 | technomancy | but that may just be because the regular JDBC driver is not very good |
| 17:57 | hiredman | jcrossley3: it is unlikely that korma has seen any large scale use |
| 17:57 | jcrossley3 | hiredman: define "large scale" relative to clojure sql libs. :) |
| 17:59 | oskarth | what's a good way to generate / update images with quil on a web page? |
| 18:00 | hiredman | jcrossley3: 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:01 | hiredman | I could be wrong |
| 18:01 | jcrossley3 | hiredman: do you think there are any heavily used clojure jdbc/sql libs? |
| 18:02 | hiredman | we use java.jdbc at work |
| 18:02 | hiredman | but we don't keep that much data in sql regardless |
| 18:02 | seancorfield | even 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:03 | muhoo | is there a quick hack using proxy to get access to a "protected" method of a java class? |
| 18:03 | muhoo | seems like there might be, but i have no java-fu |
| 18:03 | augustl | is 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:03 | seancorfield | then 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:04 | weavejester | augustl: It's recursive |
| 18:04 | augustl | weavejester: I've never gotten it to work for some reason.. |
| 18:04 | augustl | I add it immediately after my main handler, but it doesn't seem to pick up the changes I make |
| 18:04 | weavejester | augustl: Is your main handler referenced as a var? |
| 18:05 | jcrossley3 | seancorfield: it makes sense, but i would prefer to allow existing apps to "just work" if at all possible. |
| 18:05 | weavejester | augustl: 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:05 | hiredman | jcrossley3: you can always redef transaction* |
| 18:05 | augustl | weavejester: 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:06 | augustl | weavejester: I see |
| 18:06 | jcrossley3 | hiredman: 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:07 | weavejester | augustl: The lein-ring plugin will do wrap-reload for you, by the way. |
| 18:07 | hiredman | jcrossley3: you can redef it to using a binding |
| 18:07 | augustl | weavejester: ah, that's useful |
| 18:07 | jcrossley3 | hiredman: point me to an example? |
| 18:08 | hiredman | uh, 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:09 | hiredman | reach in a monkey patch it |
| 18:09 | hiredman | and |
| 18:10 | jcrossley3 | i'll study on that for a temp solution, hiredman, thanks |
| 18:11 | bbloom | dnolen: any objection to a whitespace cleanup patch? theres a bunch of files with tabs mixed in & it's bothering me ever so slightly :-) |
| 18:11 | jcrossley3 | seancorfield: should i create an issue to track variable tx mgmt somewhere? |
| 18:12 | augustl | weavejester: that's odd, using lein-ring, and it doesn't seem to reload when I change my source files |
| 18:12 | dnolen | bbloom: whitespace cleanup patches are the lowest priority of all. |
| 18:12 | bbloom | dnolen: i figured as much :-) |
| 18:13 | weavejester | augustl: It should do… If you can reproduce the problem in a small project, let me know and I can try and fix it. |
| 18:13 | augustl | weavejester: will do |
| 18:13 | hiredman | jcrossley3: 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:13 | weavejester | augustl: You're using "lein ring server" right? |
| 18:13 | jcrossley3 | hiredman: thanks, man |
| 18:14 | bbloom | dnolen: 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:17 | augustl | weavejester: yeah |
| 18:24 | seancorfield | hiredman: jcrossley3: btw, clojure.java.jdbc.internal is no more - everything's in clojure.java.jdbc now |
| 18:24 | jcrossley3 | seancorfield: yep |
| 18:25 | seancorfield | technomancy: 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:25 | hiredman | seancorfield: yeah, some day I will get around to upgrading |
| 18:25 | dnolen | bbloom: 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:25 | bbloom | dnolen: so my thought is that i'm going to flesh out a proper Keyword type |
| 18:25 | bbloom | dnolen: and then go from there |
| 18:26 | augustl | weavejester: https://github.com/augustl/lein-ring-reload-test here's a reproducible example |
| 18:26 | augustl | perhaps I'm doing it wrong :) |
| 18:28 | jcrossley3 | seancorfield: 'C-h m' should show you. search for barfage |
| 18:28 | technomancy | seancorfield: maybe convolute? |
| 18:29 | dnolen | bbloom: 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:30 | augustl | weavejester: perhaps the way I split my routes into "views" is a bit too unconventional.. |
| 18:30 | bbloom | dnolen: huh? |
| 18:30 | dnolen | bbloom: no foo["keyword"] |
| 18:30 | bbloom | dnolen: why not? |
| 18:30 | dnolen | bbloom: Closure optimizations |
| 18:31 | bbloom | dnolen: oh you mean as a string. oh yeah |
| 18:31 | bbloom | dnolen: i didn't plan to access as a string |
| 18:31 | seancorfield | technomancy: yes, convolute... i hope it does what i want :) |
| 18:31 | bbloom | dnolen: foo.keyword is totaly how i planned on it :-) |
| 18:31 | technomancy | never used it myself |
| 18:32 | seancorfield | maybe it's amalloy who loves it so much then? and, yes, convolute did exactly what i wanted! |
| 18:32 | bbloom | dnolen: 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:33 | amalloy | yeah, i'm the one who advertises convolute |
| 18:33 | dnolen | bbloom: my suggestion would be to do what Clojure does - Symbol & Keyword should have name, mutable hash field, and meta. |
| 18:33 | bbloom | dnolen: I thought keyword didn't have meta? |
| 18:33 | dnolen | bbloom: oops right |
| 18:33 | bbloom | dnolen: i'll look at their implementations for sure. |
| 18:34 | bbloom | dnolen: i'd also like to compare possible HashObj tweaks |
| 18:34 | dnolen | bbloom: HashObj, you mean ObjMap? |
| 18:34 | bbloom | dnolen: dur yeah |
| 18:34 | bbloom | dnolen: brain fart |
| 18:35 | dnolen | bbloom: sure, though I'd rather see optimizations around PersistentHashMap, ObjMaps are very fast except for updates. |
| 18:36 | bbloom | dnolen: 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:37 | dnolen | bbloom: that just involves more copying, so what's the benefit? |
| 18:37 | bbloom | dnolen: rather than allocating the extra garbage for (str \xx \: name) etc each time |
| 18:38 | bbloom | dnolen: 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:39 | dnolen | bbloom: yeah any changes to ObjMap and PHM requires lots of benchmarking. |
| 18:40 | bbloom | dnolen: 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:42 | dnolen | bbloom: 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:43 | dnolen | bbloom: I agree about Symbol, Keyword simplifying a lot of logic around strings - that stuff stinks right now. |
| 18:43 | bbloom | dnolen: 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:43 | bbloom | dnolen: trying to make that not get any slower |
| 18:46 | bbloom | dnolen: although, i guess (keys obj-map) is far less important to optimize than (:key obj-map) :-) |
| 18:46 | dnolen | bbloom: I don't see why you need to coerce, you have name and ObjMap stores its keys. (or (identical? key ...) (identical? (.name key) ...)) |
| 18:47 | dnolen | bbloom: er (.-name key) |
| 18:47 | dnolen | bbloom: (: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:48 | dnolen | bbloom: what I want to see get fast is (map :key ...), that's like 100X slower right now or something. |
| 18:48 | bbloom | dnolen: yeah, i'm gonna eliminate that allocation & replace it with a property access |
| 18:48 | bbloom | dnolen: what's the bottleneck with map? |
| 18:49 | dnolen | bbloom: because that'll result in String.prototype.call |
| 18:49 | bbloom | dnolen: 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:52 | bbloom | dnolen: interestingly, the clojure Keyword implementation stores a symbol, not a string |
| 18:53 | bbloom | dnolen: and Symbol stores ns and name separately, along with a mutable _str memoization |
| 18:54 | seancorfield | technomancy: 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:54 | technomancy | probably, but I don't know the details of how |
| 18:55 | seancorfield | 'k... maybe i'll have a dig around... |
| 18:57 | muhoo | oh java, how i hate thee: https://www.refheap.com/paste/3008 |
| 18:57 | bbloom | dnolen: has anyone experimented with implementing ObjMap's assoc in terms of javascript's prototype? it would be non-copying |
| 18:58 | dnolen | bbloom: bbloom prototype chain lookups are not fast. |
| 18:58 | bbloom | dnolen: ok, makes sense |
| 18:59 | bbloom | dnolen: linked list recursive implementation, generally? |
| 19:00 | oskarth | what's the inverse function of clojure.java.io/file? That is, a java file -> string fn. |
| 19:02 | dnolen | bbloom: 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:02 | amalloy | &(str (java.io.File. "/foo/bar")) |
| 19:02 | lazybot | ⇒ "/foo/bar" |
| 19:03 | seancorfield | technomancy: that was easy - edit .emacs.d/elpa/monokai-theme-0.0.7/monokai-theme.el and reload the theme |
| 19:03 | oskarth | oh. thanks. |
| 19:04 | dnolen | bbloom: I would be very surprised if you can beat PHM for update/access for anything but small maps. |
| 19:05 | bbloom | dnolen: i don't expect to. i'm just exploring. |
| 19:08 | dnolen | bbloom: definitely worth looking into, perhaps there are other persistent data structures which don't require so much array allocation. |
| 19:08 | technomancy | seancorfield: that'll work until you move machines I guess |
| 19:08 | dnolen | bbloom: 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:09 | bbloom | dnolen: that's why i'm wondering about reducing allocations when working with keywords, symbols, etc |
| 19:10 | dnolen | bbloom: 2-3 fields isn't much to allocate - Clojure persistent data structures generally want (make-array 32) |
| 19:16 | nDuff | Blegh. 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:17 | st3ve | hey anyone here work with the "noir" framework much? |
| 19:17 | nDuff | st3ve: played with it briefly, decided I need something more powerful, moved to Compojure |
| 19:18 | ibdknox | nDuff: more powerful? |
| 19:18 | PeregrinePDX | noir uses Compojure doesn't it? And all of Compojure is available in noir.... |
| 19:18 | PeregrinePDX | So I don't see how it's any less powerful it just has certain assumptions baked into it. |
| 19:19 | PeregrinePDX | You might not like those assumptions which is fine. |
| 19:19 | ibdknox | yeah it does. |
| 19:19 | technomancy | the age old framework-vs-library question |
| 19:20 | PeregrinePDX | Definitely. |
| 19:20 | technomancy | it's lightweight for a framework, but it's a framework. |
| 19:20 | nDuff | ibdknox: *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:21 | ibdknox | like? |
| 19:21 | nDuff | Don'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:21 | ibdknox | okidoke, just wondering :) |
| 19:28 | emezeske | ibdknox: I ended up moving away from noir when I needed to start grouping routes together in more complex ways |
| 19:28 | emezeske | ibdknox: It was doable in noir, but there basically wasn't much of an advantage at that point |
| 19:28 | beffbernard | st3ve: what was your question about noir? |
| 19:28 | gfredericks | huh; core.logic's conde is _not_ semantically the same as RS's condi. |
| 19:29 | st3ve | oh, thanks, beffbernard, i was just letting everyone finish up arguing about it ;) |
| 19:29 | emezeske | ibdknox: noir is really nice, but it sounded like you wanted to hear about someone not using it :) |
| 19:29 | emezeske | ibdknox: The driving force behind more complex route groupings was cemerick/friend, btw. |
| 19:30 | beffbernard | st3ve: FYI, ibdknox is the author of noir |
| 19:30 | ibdknox | emezeske: 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:30 | ibdknox | then you can have the best of both worlds |
| 19:30 | emezeske | nice! |
| 19:30 | emezeske | that would indeed be sweet. |
| 19:30 | ibdknox | it would be really easy to do |
| 19:30 | ibdknox | just take a lil time |
| 19:31 | emezeske | I was thinking about putting together some cemerick/friend + noir thing, to make that combo easy |
| 19:31 | emezeske | But I ended up not building that out for lack of time :( |
| 19:32 | ibdknox | I know the feeling :) |
| 19:32 | hiredman | time is the fire |
| 19:32 | emezeske | You more than me! |
| 19:34 | st3ve | well 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:34 | st3ve | but 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:37 | nDuff | ibdknox: ...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:42 | leku | what does Rich Hickey mean by "boxed version" of something? |
| 19:43 | rlb | leku: Integer vs int, for example, I imagine -- if that means anything to you. |
| 19:44 | leku | hm no.. |
| 19:44 | rlb | i.e. whether or not there's a heap allocated object for the particular item. |
| 19:44 | rlb | (at least to some approximation, I believe) |
| 19:44 | gfredericks | jvm has both primitive numbers and proper objects |
| 19:44 | gfredericks | booleans are primitive too I guess |
| 19:45 | gfredericks | all the primitives have "boxed" object analogues |
| 19:45 | rlb | you'd much rather have an int/long/double, but the jvm requires a full-blown object in many circumstances |
| 19:45 | rlb | (where much rather means wrt perf/allocation) |
| 19:45 | leku | k |
| 19:47 | rlb | leku: if that didn't make sense, I'd be happy to try again ;> |
| 19:47 | wmealing | Anyone here use lein2 midje lazytest ? |
| 19:48 | leku | I'm thinking I'm not at the point in my learning of clojure/lisp yet to undersatnd waht you mean possibly |
| 19:48 | rlb | leku: what language are you coming from? |
| 19:48 | leku | i know perl pretty well |
| 19:48 | rlb | (or language(s)) |
| 19:48 | wmealing | No matter what I configure in the project files, or profiles.clj it doesn't seem to find the correct class for lazytest |
| 19:49 | rlb | hmm, can't think of a really good analog there offhand. Familiar with C or C++ at all? |
| 19:49 | gfredericks | leku: it has a lot more to do with java/jvm than with lisp |
| 19:49 | leku | some C yeah |
| 19:50 | gfredericks | e.g., with clojurescript there's not really a relevant analogue |
| 19:50 | technomancy | leku: 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:50 | rlb | OK, 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:50 | leku | gotcha |
| 19:50 | leku | (techno) |
| 19:50 | rlb | except of course, you have initialization, GC, etc. |
| 19:50 | rlb | clojure more or less hides all of that from you |
| 19:51 | rlb | it automatically converts back and forth |
| 19:51 | leku | it turns a primitive into an object? |
| 19:51 | rlb | leku yes, that's the core of boxing/unboxing |
| 19:52 | leku | ok i understand a bit |
| 19:53 | leku | thanks |
| 19:53 | rlb | leku: and in java, int[] is fairly similar to C's int[], etc. |
| 19:54 | rlb | ..which is clojure's (int-array [1 2 3]) |
| 19:55 | rlb | And 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:55 | st3ve | ibdknox: 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:56 | rlb | (since an int[] array isn't immutable) |
| 19:56 | leku | so [1 2 3] and (int-array [1 2 3]) are different? |
| 19:56 | rlb | *very* |
| 19:57 | rlb | leku: feel free to pretend that you don't know about int-array for now. |
| 19:57 | leku | k |
| 19:57 | leku | i feel like i dont know anything for now :) |
| 19:58 | rlb | it'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:58 | leku | i have so many tabs open in chrome of stuff to read they're all blending together |
| 19:58 | leku | rlb: ah ok |
| 19:58 | rlb | a clojure vector like [1 2 3] is immutable, so when you change it, what you really get is a very efficient copy. |
| 19:58 | technomancy | if you're just learning clojure you should probably ignore the primitive stuff if you can get away with it |
| 19:58 | beffbernard | st3ve: check out the comment: http://www.reddit.com/r/Clojure/comments/ablcc/string_interpolation_in_clojure/ |
| 19:58 | rlb | (i.e. copy on write) |
| 19:58 | technomancy | it's much more consistent to pretend the entire world made of objects |
| 19:58 | rlb | ish |
| 19:59 | rlb | right -- what technomancy said... |
| 19:59 | leku | k |
| 19:59 | st3ve | sweet! |
| 19:59 | wmealing | what, the world isnt made of objects ? |
| 19:59 | st3ve | beffbernard: 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:00 | leku | when 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:00 | st3ve | for me, it's always that first bit of how-to that's the toughest. so, thanks. i'm bookmarking that. |
| 20:01 | beffbernard | st3ve: glad I could help |
| 20:01 | gfredericks | leku: the mechanisms for "changing" vectors only work by making copies |
| 20:01 | st3ve | ibdknox: i would encourage you to add a simple example like what beffbernard linked, into the docs on the "html" section of the tutorials. |
| 20:01 | leku | k |
| 20:02 | leku | st3ve: you might want to send him an email? |
| 20:02 | gfredericks | leku: 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:02 | st3ve | sure, i can do that. |
| 20:02 | gfredericks | ,(let [v1 [1 2 3], v2 (assoc v1 1 20)] (list v1 v2)) |
| 20:02 | clojurebot | ([1 2 3] [1 20 3]) |
| 20:03 | rlb | leku: btw, if you haven't seen it yet, I found the cheatsheet helpful - http://clojure.org/cheatsheet |
| 20:03 | leku | cool, thanks |
| 20:04 | gfredericks | I like how leku asks about boxing and it takes us five minutes to get to "don't you worry about that" |
| 20:04 | leku | haha |
| 20:04 | leku | i'm confused about that assoc |
| 20:05 | leku | how come it only added the last element of the v1 vector? |
| 20:05 | rlb | leku: assoc created a new vector with the value you wanted changed. |
| 20:05 | amalloy | leku: (assoc v1 1 20) is a bit like: v1[1] = 20 |
| 20:05 | rlb | (though it creates the new vector efficiently -- it doesn't make a fully copy) |
| 20:05 | leku | what did you say you wanted changed? |
| 20:05 | rlb | s/fully/full/ |
| 20:06 | leku | (assoc v1 1 20) |
| 20:06 | leku | you're changing 1 in v1 to 20? |
| 20:06 | rlb | ,(doc assoc) |
| 20:06 | clojurebot | "([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:06 | leku | wouldn't it be 20 2 3 then? |
| 20:06 | gfredericks | leku: not the 1 value, the 1th position |
| 20:06 | leku | ok |
| 20:06 | leku | got it |
| 20:07 | gfredericks | ,(let [v1 [:a :b :c], v2 (assoc v1 1 20)] (list v1 v2)) |
| 20:07 | clojurebot | ([:a :b :c] [:a 20 :c]) |
| 20:07 | leku | nice |
| 20:07 | leku | good examples, thanks :) |
| 20:07 | gfredericks | np |
| 20:08 | leku | what if you didn't know the position, only the value? |
| 20:09 | gfredericks | well 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:09 | amalloy | then you usually shouldn't be using a vector, but a map |
| 20:09 | rlb | fwiw, 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:09 | gfredericks | I don't think there's a core function for this because it doesn't come up much in practice. as amalloy says. |
| 20:09 | amalloy | &(doc replace) ;; gfredericks |
| 20:09 | lazybot | ⇒ "([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:10 | leku | k |
| 20:10 | rlb | I got a simple clojure version to about 25s, close to java's 18s -- which was good enough for me... |
| 20:11 | gfredericks | amalloy: yeah well I didn't mean "clojure.core", I meant "core" as in "functions I care about" |
| 20:11 | gfredericks | so neener neener |
| 20:11 | amalloy | got it |
| 20:11 | amalloy | replace is kinda lame anyway |
| 20:11 | gfredericks | it's funny I was thinking to myself "a good name for that function would be "replace"" |
| 20:14 | gfredericks | ,(replace #{:b 20} [:a :b :c]) |
| 20:14 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentHashSet cannot be cast to java.util.Map> |
| 20:14 | gfredericks | ,(replace {:b 20} [:a :b :c]) |
| 20:14 | clojurebot | [:a 20 :c] |
| 20:14 | gfredericks | I bet that vector thing is an optimization |
| 20:19 | seancorfield | technomancy: i store .emacs.d on dropbox and symlink it so it's sync'd to all my machines :) |
| 20:19 | seancorfield | (sorry for slow response, was away working on a database - with a clojure repl) |
| 20:21 | technomancy | seancorfield: that's not going to work very well across machines; .elc bytecode is not compatible across different Emacs versions |
| 20:24 | technomancy | I don't understand the appeal of dropbox for source code. |
| 20:25 | brehaut | its like git, but with few of the advantages |
| 20:26 | technomancy | I do crazy experimental things in my code all the time that I don't want propagated. |
| 20:28 | brehaut | oh 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:30 | gtrak` | I do git in dropbox |
| 20:31 | technomancy | git add -f .svn && git commit -m "Just to be extra safe." |
| 20:31 | seancorfield | technomancy: i use the same version of emacs on all my machines - so far the dropbox/symlink thing has worked very well... |
| 20:32 | seancorfield | but good to know about .elc bytecode compatibility |
| 20:32 | technomancy | just sounds a bit too close to checking in jar files for comfort |
| 20:32 | ibdknox | st3ve: use comb or stencil instead, unless you *have* to use string template |
| 20:33 | seancorfield | and 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:33 | technomancy | config is code |
| 20:33 | gtrak` | I also recently put a local svn server dir under git while I messed with it with git-svn |
| 20:34 | seancorfield | once 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:34 | seancorfield | i don't version my emacs config - i don't see the point |
| 20:34 | technomancy | o_O |
| 20:35 | wmealing | i'm addon happy, nice to be able to revert and keep backups of working configs. |
| 20:35 | wmealing | including the config code |
| 20:35 | seancorfield | i 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:36 | brehaut | seancorfield: i just use technomancies config for my emacs; its already in git |
| 20:36 | brehaut | s/ies/y's/ |
| 20:37 | cemerick | technomancy: what do you mean, "rough around the edges" re: hstore + jdbc? |
| 20:38 | technomancy | cemerick: 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:38 | technomancy | also you have to pour all maps into/out of a PGHStore object |
| 20:38 | cemerick | huh |
| 20:38 | technomancy | it fails to inspire confidence |
| 20:38 | cemerick | technomancy: the examples I've seen all make it look like it's just string/varchar data going in and out? |
| 20:39 | technomancy | cemerick: maybe you can use it on a lower-level without this; this is the only thing that works with j.u.Map |
| 20:39 | cemerick | oh, I see |
| 20:40 | cemerick | so presumably you can spit xml into an hstore xml column without a problem. |
| 22:04 | leku | anyone using linode or aws for personal stuff? such as just havinga linux env for development or random things like IRC? |
| 22:05 | amalloy | leku: 4clojure.com lives on my linode |
| 22:06 | hiredman | I just moved clojurebot on to a t1.micro |
| 22:06 | amalloy | oh, and lazybot lives there too |
| 22:06 | hiredman | just yesterday? |
| 22:06 | hiredman | yes, yesterday |
| 22:08 | leku | just wondering if it is worth the expense |
| 22:09 | hiredman | http://aws.amazon.com/free/faqs/ |
| 22:09 | hiredman | there are free usage tiers |
| 22:09 | leku | hmm |
| 22:09 | brehaut | leku: by linode do you mean linode specifically or linux VPSs in general? |
| 22:09 | hiredman | the t1.micro is free, but I am going to be paying whatever for the extra ebs volume I guess |
| 22:10 | hiredman | I have irc messages going through amazon's sqs which costs me around $1.50 a month |
| 22:10 | leku | linux VPSs in general I guess, I see linode is a popular one tho? |
| 22:11 | leku | what do you mean by that hiredman? |
| 22:11 | brehaut | well, slicehost and rimuhosting are both popular |
| 22:11 | bbloom | dnolen: 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:11 | brehaut | ive got a prgmr.com vps because its cheap as and im not doing anything serious with it |
| 22:11 | hiredman | leku: 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:12 | leku | oh fancy |
| 22:13 | leku | are you doing a tail on that log? or do you do it in a batch mode? |
| 22:13 | leku | maybe out of cron? |
| 22:14 | hiredman | https://github.com/hiredman/Howler/blob/master/src/Howler/core.clj |
| 22:15 | hiredman | https://github.com/hiredman/Howler/blob/master/src/Howler/core.clj#L60 is the remote part that feeds the queue |
| 22:15 | leku | cool |
| 22:17 | leku | so whats the gravatar stuff do? |
| 22:18 | leku | allow you to display someones avatar associated with their nickname in a growl popup? |
| 22:20 | leku | also waht is with the locking/acquire/release ? |
| 22:20 | hiredman | limit the number of growl notify processes running |
| 22:20 | hiredman | I had an issue with previous versions of growl where they would not terminate |
| 22:21 | johnmn3 | so I'm taking my first foray into databases/sql |
| 22:21 | johnmn3 | any suggestions? |
| 22:21 | brehaut | johnmn3: from clojure or in general? |
| 22:21 | johnmn3 | clojure |
| 22:21 | johnmn3 | (but it is still my first foray into db) |
| 22:22 | brehaut | so are you wanting suggestions on RDBM systems, clojure librarys or both? |
| 22:22 | johnmn3 | my first thought was "korma and sqlite3" |
| 22:22 | johnmn3 | but there seems to be minimal docs out there on the combo |
| 22:22 | johnmn3 | maybe couchdb..? |
| 22:23 | brehaut | well couchdb is interesting, but its not an SQL db |
| 22:23 | brehaut | its not a relational DB at all |
| 22:23 | brehaut | you need to know that your data model fits that of couch before you select it. |
| 22:23 | johnmn3 | I did use granger's "simpledb" from his noir example site, when I played with that. |
| 22:25 | johnmn3 | I'd like to persist some of my clojure data structures |
| 22:26 | dnolen | bbloom: nearly impossible to find bugs in advanced mode, use simple or whitespace. |
| 22:26 | leku | what was that persistent object database in Symbiotics ? |
| 22:26 | bbloom | dnolen: that's what i figured :-) |
| 22:26 | leku | err symbolics |
| 22:26 | dnolen | bbloom: another reason for source maps. |
| 22:26 | johnmn3 | in fact, the solution that most closely maps to clojures datastructures would be preferrable.. though I know I /should/ learn sql |
| 22:26 | bbloom | dnolen: good point. |
| 22:26 | hiredman | johnmn3: you don't need sql for that |
| 22:26 | bbloom | dnolen: so i have *most* things working again with an explicit symbol and keyword type -- no optimizations yet, but perf isn't *terrible* |
| 22:27 | hiredman | if you just want to persist datastructures you can use prn/read to the filesystem |
| 22:27 | leku | symbolics statice |
| 22:27 | brehaut | which is exactly what ibdknox's simpledb appears to do |
| 22:27 | leku | has that been replicated at all by anyone in modern days? |
| 22:27 | dnolen | bbloom: that kind of patch is no good if it's not actually faster :) |
| 22:28 | leku | http://www.sts.tu-harburg.de/~r.f.moeller/symbolics-info/statice.html |
| 22:28 | hiredman | a notch up from prn/read (because it allows for sharing) is something like https://github.com/hiredman/sunyata |
| 22:28 | johnmn3 | hiredman: 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:29 | bbloom | dnolen: yeah, of course! but i can git commit & then go try various optimizations |
| 22:29 | johnmn3 | hmm, looking at sunyata |
| 22:29 | bbloom | dnolen: i found a few other bugs while i'm poking around. i'll send patches or just file them |
| 22:29 | hiredman | johnmn3: sunyata is really just a toy |
| 22:30 | dnolen | bbloom: 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:30 | hiredman | johnmn3: I would be very surprised if prn/read didn't work find for 10 to 100 users |
| 22:30 | hiredman | fine |
| 22:30 | hiredman | at that scale just about anything would work |
| 22:30 | brehaut | hiredman: except perhaps mysql |
| 22:30 | brehaut | ~rimshot |
| 22:30 | clojurebot | Badum, *tish* |
| 22:31 | hiredman | hiho |
| 22:32 | hiredman | sunyata is actually what I use locally to map irc nicks to email addresses so I can get gravatars for my notifications |
| 22:32 | brehaut | johnmn3: 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:33 | johnmn3 | brehaut: both, but they don't have to necessarily depend on each other. |
| 22:34 | bbloom | dnolen: no brainer: http://dev.clojure.org/jira/browse/CLJS-304 |
| 22:35 | jedmtnman | is there a better way to write this: (filter #(> (get % :score) 1) stuff) |
| 22:35 | johnmn3 | one 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:35 | brehaut | johnmn3: 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:36 | johnmn3 | well, 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:36 | brehaut | , (filter (comp (partial <= 1) :score) [{:score 1} {:score 0} {:score 2}]) ;; johnmn3 |
| 22:36 | clojurebot | ({:score 1} {:score 2}) |
| 22:36 | tomoj | is there a nice way to allow foo(bar, {baz: bing}) from js and (foo bar :baz bing) in cljs? |
| 22:37 | brehaut | err sorry, jedmtnman ^ |
| 22:37 | dnolen | bbloom: cool thx |
| 22:38 | tomoj | thinking 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:38 | jedmtnman | brehaut: thanks, i thought it might be with partial, i just couldn't see it. |
| 22:38 | johnmn3 | hiredman: is sunyata like: https://github.com/ibdknox/simpledb ?? |
| 22:38 | lazybot | johnmn3: Uh, no. Why would you even ask? |
| 22:38 | brehaut | ,(remove (comp (partial > 1) :score) [{:score 1} {:score 0} {:score 2}]) ;; jedmtnman perhaps ;) |
| 22:38 | clojurebot | ({:score 1} {:score 2}) |
| 22:38 | tomoj | well I suppose I can just check whether the first of the rest args is a keyword |
| 22:41 | jedmtnman | brehaut: thanks again |
| 22:42 | johnmn3 | hiredman: in sunyata's readme, what do you mean by "shared"? |
| 22:46 | johnmn3 | infinispan? Isn't that for datacenters or somethign? |
| 22:56 | johnmn3 | is there a place where all of ccw's keybindings can be found? |
| 23:01 | wmealing | johnmn3, its not for desktops, if thats what you mean |
| 23:02 | wmealing | immutant makes infinispan access pretty simple |
| 23:02 | johnmn3 | wmealing: 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:03 | wmealing | https://docs.jboss.org/author/pages/viewpage.action?pageId=3737165 |
| 23:04 | wmealing | johnmn3, you're not mixing up infinispan with infiniband are you ? |
| 23:04 | johnmn3 | oooh, yea |
| 23:05 | johnmn3 | which is a SAN networking thing, right? |
| 23:05 | wmealing | well, you can connect a bunch of devices to it, sans also |
| 23:06 | wmealing | ive seen other infiniband machines, sans, some very high resolution cameras... that kind of stuff |
| 23:06 | wmealing | its for big bandwidth, low latency application, cost a fortune |
| 23:11 | johnmn3_ | wmealing: ah |
| 23:11 | johnmn3_ | I'm liking the simplicity of granger's simpledb |
| 23:12 | wmealing | example anywhere ? |
| 23:12 | wmealing | you mean like amazon simpledb ? |
| 23:12 | johnmn3_ | no, unfortunate choice of name |
| 23:13 | johnmn3_ | https://github.com/ibdknox/simpledb/blob/master/src/simpledb/core.clj |
| 23:13 | wmealing | am i reading that right, it only syncs on clean shutdown ? |
| 23:14 | wmealing | oh it schedules it every now and again |
| 23:14 | johnmn3_ | 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:14 | wmealing | could be, but do you care ? |
| 23:15 | wmealing | unless you have significant amount of data, its probably not going to be a big deal |
| 23:15 | wmealing | (that wasn't being a smart ass, that was a legit question) |
| 23:15 | wmealing | and you're right about one thing, that is likable. |
| 23:16 | johnmn3_ | 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:16 | johnmn3_ | well, yes |
| 23:16 | johnmn3_ | bad example |
| 23:16 | wmealing | yeah, i imagine so |
| 23:16 | wmealing | if you did a map put, i think it would not |
| 23:17 | johnmn3_ | 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:18 | bbloom | dnolen: any reason to maintain the deprecated HashMap? |
| 23:18 | johnmn3_ | even reading the atom may trigger another write |
| 23:19 | wmealing | johnmn3_, i'm pretty new at clojure, but how did you come to the conclusion that reading would write (from the example given ?) |
| 23:20 | johnmn3_ | wmealing: I'm talking about adding an add-watch: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/add-watch |
| 23:20 | johnmn3_ | "Adds a watch function to an agent/atom/var/ref reference. The watch |
| 23:20 | johnmn3_ | fn must be a fn of 4 args: a key, the reference, its old-state, its |
| 23:20 | johnmn3_ | new-state. Whenever the reference's state might have been changed, |
| 23:20 | johnmn3_ | any registered watches will have their functions called." |
| 23:20 | johnmn3_ | ugh, ma'bad |
| 23:21 | johnmn3_ | okay, so that just says "when changed" |
| 23:21 | johnmn3_ | so a read should not trigger the watcher |
| 23:21 | wmealing | yeah |
| 23:21 | amalloy | erc strikes again, johnmn3_? |
| 23:21 | wmealing | another erc user :)! hi |
| 23:21 | johnmn3_ | smuxi |
| 23:21 | wmealing | oh |
| 23:22 | dnolen | bbloom: hanging around as reference for perf benchmarks, it will get dead code eliminated. |
| 23:22 | johnmn3_ | on windows here |
| 23:22 | johnmn3_ | smuxi seems like a decent xchat-alike |
| 23:23 | bbloom | dnolen: thanks |
| 23:23 | bbloom | dnolen: 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:25 | johnmn3_ | so, for (map #(swap! persistent-atom (fn [x] (assoc @persistent-atom :this %))) thousand-items) |
| 23:25 | johnmn3_ | does that trigger a thousand events on the watch or just one? |
| 23:25 | dnolen | bbloom: yeah |
| 23:26 | bbloom | dnolen: 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:33 | johnmn3_ | 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:33 | johnmn3_ | yea |
| 23:34 | johnmn3_ | so maybe using an add-watcher to persist a ref is a little dangerous on io |
| 23:34 | wmealing | yep |
| 23:51 | bbloom | dnolen: why are ObjMaps promoted to persistent versions based on update-count ? i assume that was optimized empirically, but i don't understand why |
| 23:55 | dnolen | bbloom: what do you mean? |
| 23:55 | bbloom | dnolen: (deftype ObjMap [meta keys strobj update-count ^:mutable __hash] |
| 23:56 | bbloom | update-count is checked against cljs.core.ObjMap/HASHMAP_THRESHOLD |
| 23:56 | dnolen | bbloom: updating anything but the smallest ObjMap is crazy slow |
| 23:56 | bbloom | dnolen: yeah, but that's not size, that's number of changes |
| 23:56 | dnolen | bbloom: why shouldn't we promote after N updates? |
| 23:56 | dnolen | bbloom: we do both. |
| 23:56 | bbloom | dnolen: i see you do both. I'm asking why that's faster :-) |
| 23:57 | dnolen | bbloom: because updating anything but the smallest maps is very slow. |
| 23:58 | bbloom | dnolen: dissoc increments update-count. if you alternated assoc & dissoc of the same key, you'd never have (count keys) > 1 |
| 23:58 | bbloom | dnolen: yet it will still be promoted |
| 23:58 | dnolen | bbloom: because it's map that keeps changing frequently - it will become the bottleneck. |
| 23:59 | dnolen | bbloom: look at the benchmarks, most are 1000000 iters, but assoc on ObjMap is 100000 |
| 23:59 | dnolen | bbloom: it's that slow. |