2012-03-07
| 00:12 | arohner | is there a better way to do this? |
| 00:12 | arohner | (while (dosync (+ (foo) (bar))) (baz))? foo and bar are pure fns that read refs, baz is a side-effect-y fn |
| 00:14 | amalloy | i kinda assume you've simplified here, because that never terminates |
| 00:14 | amalloy | (and they're not pure if they read refs) |
| 00:15 | arohner | amalloy: yes, I over-simplified. it's (< (+ (foo) (bar)) max-count) |
| 00:15 | arohner | sorry, foo and bar are not pure, but they have no side effects |
| 00:15 | arohner | they only read refs |
| 00:16 | amalloy | if baz doesn't care about their refs, i suppose that's as good as anything else |
| 00:17 | arohner | baz doesn't care about the refs, but it does have side effects |
| 00:17 | arohner | though I guess if my dosync doesn't alter, it won't be retried |
| 00:17 | arohner | I was more worried about retries |
| 00:18 | amalloy | retries seem irrelevant |
| 00:19 | arohner | amalloy: why? |
| 00:19 | arohner | oh, and (baz) takes ~5 minutes |
| 00:20 | gorakhargosh | Which is the best place to report a bug with clojurescript? |
| 00:21 | gorakhargosh | the cljsc.bat windows batch file has executable permissions. accidentally executing it in a unix shell environment can trigger undefined behavior. i'd like to suggest removing unix executable permissions from the script. |
| 00:23 | gorakhargosh | when you have a clojurescript home path set up, bash completion suggests this script as one of the executable entries make it even easier to accidentally execute it. |
| 00:23 | gorakhargosh | making* |
| 00:23 | dnolen | gorakhargosh: please file a ticket in JIRA, ClojureScript doesn't take GitHub pull requests |
| 00:24 | dnolen | http://dev.clojure.org/jira/browse/CLJS |
| 00:24 | gorakhargosh | dnolen: alright. I'll do that |
| 00:32 | gorakhargosh | dnolen: here it is for your reference: http://dev.clojure.org/jira/browse/CLJS-159 |
| 00:33 | dnolen | gorakhargosh: thx! |
| 00:34 | gorakhargosh | dnolen: you're most welcome. :) |
| 00:42 | gtuckerkellogg | i think i'm not understanding the reduce function |
| 00:43 | Scriptor | gtuckerkellogg: what are you having trouble with? |
| 00:43 | gtuckerkellogg | i have a list of struct-maps, and I want to test if all the values of a certain key are the same length |
| 00:43 | gtuckerkellogg | If I use (map count (map :lhs test-rules)) |
| 00:43 | gtuckerkellogg | I get (2 2 2 2 2 2 2 2 2 2 2 ) |
| 00:43 | gtuckerkellogg | etc |
| 00:43 | Scriptor | what's :lhs? |
| 00:43 | Iceland_jack | Where is the `reduce' function? |
| 00:43 | dnolen | ,(reduce = [2 2 2 2 2 2]) |
| 00:43 | clojurebot | false |
| 00:44 | gtuckerkellogg | ok, maybe it's not reduce i should be using |
| 00:44 | Iceland_jack | dnolen: true is not equal to 2 (: |
| 00:44 | gtuckerkellogg | very truthy |
| 00:44 | dnolen | Iceland_jack: oops duh |
| 00:44 | gtuckerkellogg | so if I try (map = (map count (map :lhs test-rules))) |
| 00:45 | gtuckerkellogg | i get a list of trues |
| 00:45 | Iceland_jack | gtuckerkellogg: Check out the Wikipedia page on: Fold (higher-order function) |
| 00:45 | Iceland_jack | http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29 |
| 00:45 | gtuckerkellogg | and my expectation was that (reduce true? (map = (map count (map :lhs test-rules)))) |
| 00:45 | gtuckerkellogg | woudl work |
| 00:45 | Iceland_jack | gtuckerkellogg: every? |
| 00:45 | Scriptor | alright, let's start from the beginning |
| 00:45 | Iceland_jack | I mean you *can* implement that with reduce |
| 00:45 | Scriptor | what's (map :lhs test-rules) supposed to do? |
| 00:46 | Iceland_jack | ,(every? = [45 45 45 45]) |
| 00:46 | clojurebot | true |
| 00:46 | Iceland_jack | ,(every? = [45 4545 45 45]) |
| 00:46 | clojurebot | true |
| 00:46 | Iceland_jack | eek, nvm me |
| 00:46 | dnolen | ,(partition 2 1 [2 2 2 2 2]) |
| 00:47 | clojurebot | ((2 2) (2 2) (2 2) (2 2)) |
| 00:47 | dnolen | ,(partition 2 1 [2 2 2 2]) |
| 00:47 | clojurebot | ((2 2) (2 2) (2 2)) |
| 00:47 | Iceland_jack | ,(apply = [45 45 45 45]) |
| 00:47 | clojurebot | true |
| 00:47 | gtuckerkellogg | hey! |
| 00:47 | gtuckerkellogg | there we go |
| 00:47 | gtuckerkellogg | that makes sense |
| 00:48 | gtuckerkellogg | ,(println "thank you clojurebot") |
| 00:48 | clojurebot | thank you clojurebot |
| 00:48 | gtuckerkellogg | heh |
| 00:48 | gtuckerkellogg | and thank you Iceland_jack |
| 00:48 | Iceland_jack | haha, no don't take credit from clojurebot |
| 00:48 | gtuckerkellogg | jeez, this room is helpful |
| 00:48 | seancorfield` | is it just me or is clojuredocs.org not working properly? |
| 00:49 | gtuckerkellogg | works for me |
| 00:49 | seancorfield` | when i type in a function name, nothing happens |
| 00:49 | Iceland_jack | works for me |
| 00:49 | amalloy | &(reduce (partial list '+) (range 5)) |
| 00:49 | lazybot | ⇒ (+ (+ (+ (+ 0 1) 2) 3) 4) |
| 00:49 | Scriptor | ,(every #(= % 2) [2 2 2 2]) |
| 00:49 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: every in this context, compiling:(NO_SOURCE_PATH:0)> |
| 00:49 | amalloy | that's what reduce does internally: it calls + 4 times, once with each arg |
| 00:49 | seancorfield` | the site comes up but typing "read" into the search box doesn't return suggestions |
| 00:49 | Scriptor | ,(every? #(= % 2) [2 2 2 2]) |
| 00:49 | clojurebot | true |
| 00:50 | Iceland_jack | ,(every? (partial = 4) [4 4 4]) |
| 00:50 | clojurebot | true |
| 00:50 | seancorfield` | and, yes, gtuckerkellogg this room is very helpful :) |
| 00:50 | amalloy | &(every? #{4} [4 4 4]) |
| 00:50 | lazybot | ⇒ true |
| 00:51 | amalloy | is a nicer way to write that |
| 00:51 | Scriptor | seancorfield: I'm getting status code 500's from it when I use chrome's search on it |
| 00:51 | gtuckerkellogg | perhaps amalloy, but I don't know the length in advance. I just want to check that they do not vary |
| 00:51 | seancorfield` | Scriptor: that matches what i'm seeing then.. static content comes up.. dynamic responses, not so much :) |
| 00:51 | amalloy | sure |
| 00:52 | dnolen | ,(let [[f & r] [4 4 4 4]] (every? #{f} r)) |
| 00:52 | clojurebot | true |
| 00:52 | amalloy | dnolen: meh. just apply = |
| 00:52 | amalloy | if we're solving a particular problem |
| 00:52 | dnolen | amalloy: definitely apply = |
| 00:52 | amalloy | using #{4} as a predicate is an improvement on Iceland_jack's suggestion, not on the actual problem |
| 00:53 | Iceland_jack | I'm still not used to using keywords and sets as functions |
| 00:53 | Iceland_jack | Coming from Common Lisp... sounds insane |
| 00:53 | dnolen | Iceland_jack: don't forget maps and vectors too :) |
| 00:53 | Iceland_jack | dnolen: Yes but why aren't numbers mapping functions as well? |
| 00:54 | Iceland_jack | ,([1 2 3] 1) |
| 00:54 | clojurebot | 2 |
| 00:54 | Iceland_jack | but (1 [1 2 3]) doesn't work |
| 00:54 | Iceland_jack | even though the converse holds true for (<set> :keyword) |
| 00:54 | dnolen | Iceland_jack: less useful, plus it can't really be done, Clojure has Java numbers and literals are now primitive. |
| 00:54 | Scriptor | Iceland_jack: because a keyword is very often used as a key in a hash |
| 00:55 | dnolen | Iceland_jack: you can do it in CLJS, but modifying languages natives to that is very slow IME. |
| 00:55 | dnolen | to do |
| 00:56 | Iceland_jack | Right, probably something like that |
| 01:00 | amalloy | also i suspect numbers have more "reasonable" meanings when called as functions than vectors do |
| 01:01 | amalloy | so that even if we could do it we wouldn't know how |
| 01:02 | Iceland_jack | (DEFINE 1 CAR) (: |
| 01:02 | Iceland_jack | (I kid) |
| 01:02 | johnmn3 | I think regexes should be functions on strings |
| 01:03 | Iceland_jack | johnmn3: I implemented that once |
| 01:03 | johnmn3 | yea? |
| 01:03 | Iceland_jack | where I could define a function: c(a|d)*r |
| 01:03 | Iceland_jack | well + |
| 01:03 | Iceland_jack | where you could embed types into the function name |
| 01:03 | johnmn3 | oh |
| 01:03 | Iceland_jack | as well as number of occurrences |
| 01:04 | Iceland_jack | long long time ago |
| 01:04 | johnmn3 | I mean (#"thing" "something") |
| 01:04 | Iceland_jack | not too dissimilar I suppose |
| 01:04 | johnmn3 | where, in the functions place, it just calls re-find, or something |
| 01:04 | Iceland_jack | hm, that would be interesting |
| 01:04 | amalloy | johnmn3: not feasible for the same reaon you can't do it for numbers |
| 01:05 | Iceland_jack | Define feasible |
| 01:05 | amalloy | it's a brilliant idea that's been had many times |
| 01:05 | johnmn3 | amalloy: I know, but it could be builtin at a lower level, I'd imagine |
| 01:06 | technomancy | regexes absolutely should be functions |
| 01:06 | Iceland_jack | The lexical analyzer or reader could check for patterns for regular expressions or regexps |
| 01:06 | technomancy | you'd have to create a clojure.lang.Regex subclass rather than using java.util.Pattern |
| 01:06 | johnmn3 | ah |
| 01:06 | technomancy | but it would be totally worth it, because regexes have never in the history of Clojure been used for interop |
| 01:07 | amalloy | haha what |
| 01:07 | technomancy | probably never going to happen sadly |
| 01:07 | amalloy | technomancy: i find your claim about interop pretty silly |
| 01:07 | technomancy | amalloy: java bends over backwards to not make you pass around regexes |
| 01:08 | technomancy | see String's .split method |
| 01:08 | Iceland_jack | you're all about calling others silly amalloy |
| 01:08 | amalloy | and even if it were true clojure has always placed an emphasis on interop |
| 01:08 | dnolen | technomancy: isn't java.util.regex.Pattern final? |
| 01:08 | amalloy | yes. if it weren't, making regexes functions would be trivial |
| 01:08 | technomancy | dnolen: maybe. It wouldn't have to be a subclass. |
| 01:08 | technomancy | the value of regexes as functions is several orders of magnitude higher than their interop value |
| 01:10 | johnmn3 | here here |
| 01:10 | dnolen | technomancy: no way. Then you have to have a custom interface a wrapper class, and something that doesn't work where java Regexes do. |
| 01:10 | technomancy | I've never been in a situation where that would matter. |
| 01:10 | dnolen | that sounds like a major fail to me anyway. |
| 01:11 | technomancy | I've never seen a regex passed to anything but a clojure.core/re-* function, and 90% of the time it's simply used as a predicate |
| 01:11 | johnmn3 | what about Iceland_jack's idea... something in the reader that detects regexes in the functions place? |
| 01:12 | technomancy | johnmn3: wouldn't work with higher-order functions |
| 01:12 | Iceland_jack | Are they still used? ;) |
| 01:12 | dnolen | johnmn3: nor will it work w/ regexes stored in vars |
| 01:12 | johnmn3 | ah |
| 01:13 | technomancy | Iceland_jack: I'll overlook it since I know you come from CL =) |
| 01:13 | Iceland_jack | haha |
| 01:14 | johnmn3 | I'll bet a pretty cool regex library could be built on core.logic... |
| 01:14 | Iceland_jack | Any idea why Clojure didn't go more all-out in implementing ideas from Haskell/OCaml/ML? |
| 01:15 | Iceland_jack | Mathematica, etc. |
| 01:15 | Iceland_jack | ADT, Pattern Matching, |
| 01:15 | amalloy | i think you may actually be right, technomancy, though i quibble on some of the details (like, i don't usually see regexes used as predicates, but instead as split/subgroup finders) |
| 01:15 | Iceland_jack | ...static type system /me ducks |
| 01:16 | technomancy | static types and pattern matching are both being worked on in libraries |
| 01:16 | Iceland_jack | I know about, what was it, clojure.match? |
| 01:16 | Iceland_jack | the best part of pattern matching is matching against ADT I've found |
| 01:16 | Iceland_jack | ymmv |
| 01:17 | dnolen | Iceland_jack: pattern matching has known problems. clojure.match goal is generalize pattern matching. |
| 01:17 | dnolen | help wanted :) |
| 01:17 | dnolen | Iceland_jack: ADT has plenty o weakness, I like William Cook's analysis |
| 01:19 | dnolen | johnmn3: you could do something way cooler than regexes, Definite Clause Grammars - but some problems to solve first there too. |
| 01:19 | technomancy | I have two cond calls in leiningen that are just begging to be replaced with a match call, but I haven't quite pulled the trigger yet |
| 01:20 | Iceland_jack | dnolen: haha, that would be awesome |
| 01:20 | Iceland_jack | First-class CFG? (8 |
| 01:20 | JorgeB | is aleph compatible with clojure 1.3 yet? |
| 01:20 | ztellman | JorgeB: 0.2.1 is nearing release |
| 01:21 | johnmn3 | dnolen: would there be a short-hand syntax, much like current regexes? or would one build grammars/patterns first, and then use those? |
| 01:21 | ztellman | JorgeB: the alpha snapshots are stable, if you want to take them for a spin |
| 01:21 | JorgeB | ztellman: yeah, I think I would. Are they on clojars? |
| 01:22 | ztellman | JorgeB: yeah, 0.2.1-alpha1 is the latest non-snapshot, 0.2.1-alpha2-SNAPSHOT is the latest |
| 01:22 | JorgeB | ztellman: danke |
| 01:24 | JorgeB | ztellman: I still get warnings about dynamic bindings not being declared properly. Is that known? |
| 01:25 | ztellman | JorgeB: if it's only three, that's because prxml hasn't been updated to 1.3 compatibility yet |
| 01:25 | ztellman | I'm waiting to see if there's any movement there; if not I'll just fork it and fix it before the formal release |
| 01:25 | ztellman | until then, completely harmless |
| 01:25 | amalloy | ztellman: actually, data.xml finally has an official release, and it probably has all the prxml features you need |
| 01:25 | JorgeB | yeah just 3 |
| 01:25 | Iceland_jack | ztellman: I have three arms! |
| 01:25 | ztellman | amalloy: didn't know that, thank you |
| 01:26 | amalloy | if it doesn't, let me know - i can maybe add them |
| 01:26 | ztellman | I'm sure it does, my needs are pretty simple |
| 01:27 | amalloy | (hint: the functions you'll want are: emit; sexp-as-element and/or sexps-as-fragment) |
| 01:28 | dnolen | johnmn3: Prolog DCG syntax is pretty terse (though of course not in the same realm as regexes), I haven't so gone so far as to consider something shorter :) |
| 01:29 | johnmn3 | dnolen: rgr |
| 01:31 | dnolen | johnmn3: what makes them cool (to me) is lexing / parsing are not separate things. |
| 01:33 | dnolen | johnmn3: this parser for Lisp is awesomely small and clear http://web.student.tuwien.ac.at/~e0225855/lisprolog/lisprolog.pl |
| 01:34 | Iceland_jack | dnolen: Scanning and parsing aren't the same, maybe depending how you look at it |
| 01:35 | Iceland_jack | generally they're called lexical and syntactic analysis |
| 01:36 | Iceland_jack | Interesting tidbit, my first compiler's lexical analyzer was called: LEXANA.L |
| 01:39 | dnolen | Iceland_jack: yes they are treated separately in a lot of literature because it's tedious in most languages to do otherwise - but I enjoy how the pecularity of Prolog seems to let you deal with them uniformly. |
| 01:40 | Iceland_jack | Well Prolog is wonderful |
| 01:40 | Iceland_jack | it seems that logic programming is making a bit of a comeback which is fantastic |
| 02:10 | TEttinger | &(apply + (repeat 10 0.1)) |
| 02:10 | lazybot | ⇒ 0.9999999999999999 |
| 02:10 | TEttinger | &(apply + (repeat 10 1/10)) |
| 02:10 | lazybot | ⇒ 1N |
| 02:11 | TEttinger | ,(apply + (repeat 10 0.1)) |
| 02:11 | clojurebot | 0.9999999999999999 |
| 02:11 | SirDinosaur | y3di: 11:18 < rhickey> SirDinosaur: There are no plans to open so |
| 02:11 | SirDinosaur | urce Datomic at this time |
| 02:46 | gtuckerkellogg | I have a list like (list '("foo" "bar") '("baz" "booo!")) |
| 02:46 | gtuckerkellogg | i'd like to get the string length of every second level member |
| 02:46 | gtuckerkellogg | like ,(.length "foo") |
| 02:47 | gtuckerkellogg | ,(.length "foo") |
| 02:47 | clojurebot | 3 |
| 02:47 | gtuckerkellogg | so i'd like it to return '(3 3 3 5) |
| 02:49 | amalloy | &(let [lists (list '("foo" "bar") '("baz" "booo!"))] (for [list lists, item list] (.length item))) |
| 02:49 | lazybot | ⇒ (3 3 3 5) |
| 02:50 | gtuckerkellogg | wow |
| 02:50 | gtuckerkellogg | jeez, i have a lot to learn |
| 02:50 | gtuckerkellogg | thanks |
| 02:52 | Jetien | Hi, i'd like to read all the forms of file. If i do (take 2 (repeatedly read)) in a repl, two forms are read from *in* as expected. now, if i wrap this in a (clojure.contrib.duck-streams/with-in-reader "./somefile..clj") however the evaluation will block forever, even though there are multiple forms in "./somefile.clj" - what am i missing? is there a more elegant way to read the forms from a file? |
| 02:58 | raek | Jetien: clojure.contrib.duck-streams has been superceded by clojure.java.io since Clojure 1.2 |
| 03:00 | raek | you'd need to do something like (with-open [in (io/reader "./somefile..clj")] (doall (take 2 (repeatedly (partial read in))))) |
| 03:02 | Jetien | thanks! |
| 03:08 | Jetien | raek: i had to switch io/reader for io/with-in-reader because read likes a pusbackreader. with with-in-reader from io everything works |
| 03:09 | Jetien | raek: it was the (doall) that was missing |
| 03:11 | maacl | Looks like clojure.contrib.datalog has not been migrated to a new namespace or being maintained, is that correct? |
| 03:20 | raek | Jetien: then you need to modify it to (with-open [in (PushbackReader. (io/reader ...))] ...) |
| 03:21 | raek | you also need (ns ... (:import java.io.PushbackReader)) |
| 03:22 | raek | Jetien: I don't recomment relying on the "old contrib". you cannot use it in clojure 1.3 and 1.4 |
| 03:24 | maacl | raek: Would you know anything about the fate of clojure.contrib.datalog? |
| 03:31 | raek | maacl: nothing more than what this page says: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 03:32 | raek | which is that it is currently looking for a new maintainer, if i understand it correctly |
| 03:43 | maacl | raek: Thanks, kind of weird since it is an integral part of datomic. I suppose that they are maintaining a fork or something? |
| 03:50 | raek | indeed |
| 04:50 | tsdh | Aren't beta releases announced anymore? At least for 1.4.0-beta{2,3} I can't find any message on neither the clojure list nor the clojure-dev list... |
| 04:54 | talios | I guess people have been a bit busy with datomic to mention it :) |
| 04:56 | tsdh | ;-) |
| 04:57 | tsdh | But at least someone found the time to roll the beta out. |
| 04:59 | callen | incidentally, I refuse to rely on datomic for the reasons I refuse to rely on dynamodb. |
| 04:59 | talios | lucian - the non-open source I could live with, but being in NZ - being reliant on servers in the US…. latency aside, I know a few government type clients that wouldn't want there data offshore, or normal clients wanting their data in American soil |
| 04:59 | callen | particularly, I find relying on dynamodb a bit fucking bizarre given that there are numerous dyanmo clones out there with various trade-offs... |
| 05:00 | callen | I mean, it's about the farthest thing from 'unique' as it gets with distributed KV stores. |
| 05:00 | lucian | talios: also, vendor lock-in. it's why i don't use app engine, as nice as it is |
| 05:00 | callen | lucian: ditto. |
| 05:00 | talios | callen - given theres the local in-memory testing, and the vmware image store for more testing, I'm sure someone will write a generic store soon enough |
| 05:00 | lucian | dynamo is nice, i won't deny that |
| 05:00 | callen | the only things that get mimicked more than Dynamo are SQL databases with b-trees and Unix filesystems. |
| 05:00 | lucian | but yeah, cassandra and riak are good at replicating the ring design |
| 05:00 | lucian | and a ring FS isn't all that hard to do |
| 05:00 | talios | lucian - true, but isn't couchdb lock in, postgresql is also lockin for some things. |
| 05:01 | talios | cassandra is VERY vendor lockin |
| 05:01 | lucian | talios: no, because you can run them on rackspace just fine |
| 05:01 | callen | talios: they're open source, you aren't forced to pay someone for it. |
| 05:01 | callen | talios: if something goes wrong, you can fix it. |
| 05:01 | lucian | callen: that's not even as important |
| 05:01 | callen | talios: if it's slow for your use-case, you can patch it. |
| 05:01 | lucian | you can run oracle on both aws and rackspace |
| 05:01 | callen | talios: nobody can hike the price on you and keep you trapped. |
| 05:01 | lucian | dynamodb? if amazon hates you you're fucked |
| 05:01 | callen | ding ding ding ^^ |
| 05:02 | talios | callen - true, but thats just PRICE lock-in. the fact that you're saying "we'll patch the server" means your still locked-in to technology-X, I suppose its not vendor lockin, but platform lockin I'm meaning |
| 05:02 | lucian | so if amazon also sold dynamodb, and then kept it also appliance-ised (like mysql), it'd be reasonable to use it |
| 05:03 | lucian | talios: right, but there is also provider lock-in, which is the worst |
| 05:03 | callen | talios: you're still locked in, Cassandra doesn't disappear on you just because some company decides to stop supporting it. |
| 05:03 | lucian | what you get with app engine and dynamodb |
| 05:03 | callen | talios: Amazon decides DynamoDB is no longer "strategic" like Google has with GAE, you're all kinds of fucked. |
| 05:03 | callen | talios: have you SEEN GAE languishing? |
| 05:04 | talios | callen - i wouldn't say languishing, because uptake was dismal to start with :) heh |
| 05:04 | callen | Cassandra is no longer strategic to some vendor, fuck 'em, pay for a contractor to fix whatever you need or hire somebody who likes wide-column stores. Somebody like me. |
| 05:04 | lucian | not even that, they could just turn it off one day. or you might need servers in a particular area, or w/e |
| 05:05 | lucian | so yeah, if dynamodb was sold like oracle is, it'd be less silly |
| 08:48 | zamaterian | ,(+ 1 2 ) |
| 08:48 | clojurebot | 3 |
| 08:51 | maio | ,(println "Hello World!") |
| 08:51 | clojurebot | Hello World! |
| 08:51 | juhu_chapa | Hi! |
| 08:52 | dan_b | ,(println (str (char 38) "(println \"hello world\")") |
| 08:52 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 08:52 | dan_b | ,(println (str (char 38) "(println \"hello world\")")) |
| 08:52 | clojurebot | &(println "hello world") |
| 08:52 | lazybot | ⇒ hello world nil |
| 08:53 | dan_b | seems I need paren matching in irssi |
| 09:04 | sdpfn | hi, i am trying to learn clojure, i'm looking forward to learn about java interops ; any suggestion for good tutorials ? |
| 09:06 | sdpfn | any suggestion for learning java interops |
| 09:07 | maacl | sdpfn: I like these two http://www.infoq.com/presentations/Clojure-Java-Interop http://blog.jayfields.com/2011/12/clojure-java-interop.html |
| 09:08 | dan_b | http://clojure.org/java_interop is all I've looked at so far |
| 09:08 | babilen | sdpfn: http://clojure.org/java_interop is a short summary, but I would recommend buying a good Clojure book and reading it. (Joy of Clojure, Programming Clojure (once the 2nd edition is published), Practical Clojure, Clojure Programming, ... come to mind) |
| 09:09 | dan_b | that plus the experimental determination that you shoudl use the :import arg to (ns ...) to import java libs, not :use or :require |
| 09:09 | RickInGA | If you seach the spefic thing you want, there tend to be a lot of good tutorials you can stumble on that way. Stuart Halloway has a good one on swing |
| 09:10 | sdpfn | thanks |
| 09:15 | lucian | ok, watching Rich's video datomic looks very interesting |
| 09:15 | lucian | still closed source, still married to dynamodb, unfortunately |
| 09:38 | loops | Noob recursive function that merges two sorted vectors, takes twice as long as a python iterative version. Hit me with a clue stick.. http://pastebin.com/dSBjqHwz |
| 09:48 | raek | loops: twice as long for how many elements? |
| 09:49 | loops | 1 million |
| 09:50 | clgv | loops: how about a lazy-seq approach? |
| 09:51 | fliebel | Craziness! I have a -main that does (print (read)), which works on the repl, but just hangs with lein run. |
| 09:51 | raek | fliebel: hangs after printing? |
| 09:51 | fliebel | raek: No, nothing gets printed |
| 09:52 | loops | clgv, i _think_ it is using lazy-seq, i'm passing in two vectors created with (split-at (but i'm a total noob) |
| 09:52 | raek | hrm, perhaps you need to call shutdown-agents *shrug* |
| 09:52 | clgv | loops: your merge implementation is a recursion. |
| 09:53 | fliebel | raek: uh, ok... |
| 09:53 | loops | clgv, okay.. i'll figure out how to recode it as a lazy-seq and see how that goes |
| 09:53 | raek | loops: how do you construct the inputs in the python version? |
| 09:53 | loops | raek, is just two python lists |
| 09:54 | clgv | loops: or easier. you can use a transient as output |
| 09:54 | loops | raek, in both implementations they're just random #'s |
| 09:54 | raek | loops: you could try something like this: (let [s1 (doall (range 0 1e6)) s2 (doall (range 1e6 2e6))] (time merge s1 s2)) |
| 09:54 | loops | raek, thanks.. will give it a go |
| 09:54 | raek | just to be sure that you are not measuring the performance of split-at |
| 09:54 | loops | raek, ah, k |
| 09:55 | fliebel | raek: I'm not using agents, but maybe Leiningen is just weird. I'm using a snapshot after all. |
| 09:55 | raek | fliebel: I vagely recall that clojure uses that thread pool internally or something |
| 09:56 | fliebel | raek: But it hangs before printing, so that should not have anything to do with shutting down, right? |
| 09:56 | raek | hrm |
| 09:56 | raek | what about buffering? |
| 09:56 | raek | tried calling (flush)? |
| 09:56 | fliebel | good one.. let me see |
| 09:56 | raek | I think println does that, but not print |
| 09:57 | loops | raek, blush... you're right.. i was blaming wrong function |
| 09:57 | clgv | loops: but your function can be faster with 'ret as a transient |
| 09:58 | fliebel | raek: nope, not that either. I'll try if stable leiningen makes any difference |
| 09:58 | loops | clgv, okay.. thanks.. looks like it's not the real problem anyway, but i'll look into how to make ret a transient |
| 09:59 | jonasen | Is there a mailing list for core.logic? |
| 10:00 | fliebel | nothing... Is lein run doing something weird with *in* or *out*? |
| 10:01 | clgv | fliebel: is your version of lein using nrepl already? |
| 10:01 | fliebel | clgv: I have both a 2 snapshot and the latest stable. But I think run should not be using nrepl regardless. |
| 10:01 | dan_b | fliebel: there was something on the mailing list abouit that the other day. lein trampoline run? |
| 10:02 | clgv | fliebel: ahk. |
| 10:02 | raek | loops: if you want to hide ret from the outside, you can write your function like (defn merge [a b] (loop [a a, b b, ret []] ...)) |
| 10:02 | dan_b | http://groups.google.com/group/clojure/browse_thread/thread/a720fbb471edc040/09521c4b02c86f30?lnk=gst&q=trampoline#09521c4b02c86f30 |
| 10:03 | fliebel | dan_b: Nice one, that gives a very tall exception. Exception in thread "main" java.lang.ClassCastException: clojure.core$promise$reify__5727 cannot be cast to java.lang.Number But thet might be my code... |
| 10:04 | raek | loops: using transients should be as simple as replacing [] with (transient []) and 'conj' in the recur call with 'conj!' |
| 10:04 | raek | oh, and in the base cases, you need to call (persistent! ...) on the result |
| 10:05 | raek | (persistent! (reduce conj! ret b)) |
| 10:05 | clgv | raek: (persistent! (loop ...)) works as well ;) |
| 10:06 | raek | clgv: good point |
| 10:07 | fliebel | Nope, that's almost certainly not my code, because I have no code, ti does not use reify, and it's not mentioned in the stacktrace. |
| 10:08 | loops | raek,clgv i hadn't included in my pastebin, but i had actually hidden ret from the outside by including a 2 airty version of merge as well that called recalled merge with [] |
| 10:09 | clgv | loops: the loop-recur is better if you never call merge from the outside with a 'ret value |
| 10:09 | loops | clgv, yeah, i can see that. and i don't ever call from outside with 'ret |
| 10:09 | fliebel | stacktrace: http://pastebin.com/Sw7F4SGV |
| 10:10 | fliebel | ok, stable lein with trampoline works. |
| 11:13 | jsabeaudry | What is the proper way to synchronize access to a peripheral in clojure? Is it to use java semaphores? |
| 11:15 | Licenser | jsabeaudry I think agents would be good but I am not sure what you are talking about |
| 11:15 | mdeboard | lol |
| 11:15 | Licenser | I know that ins't a very reassuring sentence but I've been wrong the first time in years right now so I am a bit insecure at the moment |
| 11:16 | gtrak` | jsabeaudry, probably polling into an atom, you don't want an STM for side-effects |
| 11:17 | jsabeaudry | Licenser, agents are so powerful I have a hard time seeing all the ways they can be used |
| 11:17 | gtrak` | dhconnelly, |
| 11:17 | dhconnelly | yo |
| 11:17 | gtrak` | shouldn't you be doing homework? |
| 11:17 | dhconnelly | haha |
| 11:18 | dhconnelly | i'm about to give a presentation actually, brb |
| 11:18 | Licenser | they are pretty much send them messages and they process them in the right order, but as i said I'm not sure if that is really what you want ^^ |
| 11:19 | jsabeaudry | gtrak, It would seem atoms require functions free of side effects, and my device is all about side effects |
| 11:19 | jsabeaudry | Licenser, from that I could understand, sending multiple functions to an agent the functions might be retried is that right? |
| 11:20 | gtrak` | jsabeaudry, if it's single-threaded, it won't be retried |
| 11:20 | Licenser | js nope they just will be 'sorted' and porocessed in the order they arrive |
| 11:20 | Licenser | so if I send long_running_fn and then quick_fn to a agent first long_running_fn would be processed and then once it is done quick_fn |
| 11:21 | jsabeaudry | gtrak`, How do I set it to be single-threaded? |
| 11:21 | gtrak` | if there's only a single thread writing to it,i mean |
| 11:22 | gtrak` | you don't set it... you just write to it from one thread |
| 11:22 | gtrak` | the code is very simple: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java |
| 11:22 | Licenser | jsabeaudry the idea is that a atom holds data this data can be modified by functions that you send to it |
| 11:22 | Licenser | this functions won't ever be executed in a 'wrong' order |
| 11:22 | Licenser | and they are stored in a queue (so to say) untill their time has come |
| 11:24 | gtrak` | jsabeaudry, if you look at the atom code, it spins in an infinite loop if compareAndSet fails... compareAndSet will only fail if the value changes from what's expected, which is if another thread beats you to it |
| 11:24 | Licenser | so when I get it right you want to do (write-to-peripheral rs232 "some text") and do that form multiple threads? |
| 11:24 | gtrak` | http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicReference.html#compareAndSet(V, V) |
| 11:26 | jsabeaudry | Licenser, That's pretty much the case except that I also need to wait for an answer |
| 11:26 | Licenser | I see I see so you'd want something like send and then wait for the return right now |
| 11:27 | Licenser | there is await |
| 11:27 | jsabeaudry | gtrak`, In my case some other thread might beat me to it, so the Atom wouldn't be single threaded, which means the operation might be retried, which is bad because I have side effects, is my reasoning correct? |
| 11:28 | gtrak` | jsabeaudry, then you'd want to use two atoms I suppose? :-) |
| 11:28 | gtrak` | or a queue or something |
| 11:29 | Licenser | how about (await (send agent write_to_socket "text")) ? |
| 11:29 | gtrak` | I/O should be single-threaded or synchronized, there should be something in between that and your application banging on stuff |
| 11:29 | Licenser | so it is kind of tricky |
| 11:30 | gtrak` | i think this actually calls for standard locks |
| 11:31 | mdeboard | pop and lock |
| 11:31 | gtrak` | jsabeaudry, http://clojuredocs.org/clojure_core/clojure.core/locking |
| 11:32 | jsabeaudry | gtrak`, Ah nice, I wasn't aware that there was standard locking in clojure, so much emphasis is put on the STM |
| 11:33 | gtrak` | values don't care about side-effects :-) |
| 11:33 | gtrak` | there may be a better way, but I can't think of one |
| 11:33 | Licenser | oh locking |
| 11:33 | jsabeaudry | Licenser, So agents are basically a fancy event queue? |
| 11:34 | Licenser | hmm with a save state kind of yes |
| 11:34 | Licenser | I think |
| 11:34 | Licenser | also if you want to use locking for IO perhaps this is a nice pointer: https://github.com/Licenser/stupiddb |
| 11:34 | gtrak` | agents also use threadpools |
| 11:34 | clgv | shouldn that work? (doseq [[x y] data :when (and x y)] ...) |
| 11:34 | mdeboard | pytorll |
| 11:35 | Licenser | oh wiat no I didn't used locks any more |
| 11:39 | clgv | (doseq [[x y] (map list (range 5) (range 5)) :when (and x y)] (print x y)) |
| 11:40 | clgv | &(doseq [[x y] (map list (range 5) (range 5)) :when (and x y)] (print x y)) |
| 11:40 | lazybot | ⇒ 0 01 12 23 34 4nil |
| 11:40 | gtrak` | jsabeaudry, yea, STM and functional programming is good for dealing with data and values, but Rich Hickey purposely decoupled values from time. When you do I/O, you have to conflate values and time again anyway. |
| 11:43 | jsabeaudry | gtrak`, I see |
| 11:43 | gtrak` | an atom in front of a device is really just a buffer, perhaps you could extend the peripheral object to implement swap! and deref? |
| 11:43 | gtrak` | or just use functions that lock |
| 11:45 | jsabeaudry | I think Licenser had a potentially good idea with agents, If I send a function (that does the work) to the unique peripheral agent, and that function is a closure on a promise that I wait on |
| 11:45 | jsabeaudry | Because there is only one peripheral agent, not two communication will be done at the same time |
| 11:46 | jsabeaudry | Now I just need to figure if functions sent to an agent can be retried and under what circumstances |
| 11:46 | gtrak` | you can add watches to a state change on agents, I would use that to separate the application state from the i/o |
| 11:47 | llasram | jsabeaudry: I'm kind of late to the party, but have you looked at lamina? |
| 11:47 | gtrak` | jsabeaudry, http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/add-watch |
| 11:47 | jsabeaudry | llasram, Yes I took a look at that |
| 11:48 | jsabeaudry | llasram, It is an option but I |
| 11:48 | jsabeaudry | 'd love to keep my dependencies low |
| 11:48 | jsabeaudry | especially in what I consider to be a pretty simple case |
| 11:48 | llasram | But if what you're trying to do is exactly what lamina provides... eh? |
| 11:49 | gtrak` | i agree this is way too small for an event architecture :-) |
| 11:51 | lucian | i've depended on Twisted on occasion just to get decent events in python |
| 11:51 | gtrak` | do the simplest thing that could possibly work? |
| 11:52 | lucian | yeah, that |
| 12:13 | clgv | whats the predicate related to 'seq - I mean I want to query whether something is seqable |
| 12:15 | tmciver | Is it just 'seq?'? ##(doc seq?) |
| 12:15 | lazybot | ⇒ "([x]); Return true if x implements ISeq" |
| 12:15 | clgv | nope |
| 12:15 | clgv | I tend to say it's 'coll? |
| 12:16 | clgv | 'coll? tests (instance? clojure.lang.IPersistentCollection x) and IPersistentCollection contains a seq method |
| 12:17 | RickInGA | sequential? |
| 12:17 | RickInGA | &(sequential? [1 2 3]) |
| 12:17 | lazybot | ⇒ true |
| 12:18 | clgv | (doc sequential?) |
| 12:18 | clojurebot | "([coll]); Returns true if coll implements Sequential" |
| 12:19 | raek | clgv: there isn't any predicate for determining whether calling seq on a thing won't fail |
| 12:19 | clgv | lol but clojure.lang.Sequential does not implement anything |
| 12:19 | raek | coll? works for clojure stuff |
| 12:19 | clgv | raek: I need it for clojure stuff only ^^ |
| 12:20 | raek | clgv: what do you need to do? |
| 12:20 | raek | is this for a macro? |
| 12:20 | clgv | yep |
| 12:21 | raek | seq? detects forms that look like (...), vector? those that look like [...], map? {...}, and coll? all three |
| 12:22 | clgv | I had the problem that I forgot that a macro can expand to a single atomic thing. |
| 12:25 | clgv | so always include an 'and in macro tests ^^ |
| 12:40 | jonasen | dnolen: Have time for a core.logic question? |
| 12:40 | dnolen | jonasen: shoot |
| 12:41 | jonasen | Why is core.logic/prep private? Should I never need to use it? |
| 12:42 | loops | is there any way to do simple profiling in cl 1.3? the 1.2 contrib package doesn't seem to work any more. having hell of time finding performance problem. |
| 12:43 | jonasen | https://github.com/jonase/kibit/blob/master/src/jonase/kibit/core.clj#L22 |
| 12:43 | jonasen | dnolen: ^^ I'm using it here, but maybe there's a better way? |
| 12:44 | dnolen | jonasen: actually I'm not sure why it is private, probably an oversight. |
| 12:45 | jonasen | ok, I'll keep using it then. |
| 12:46 | jsabeaudry | of all the lein commands uberjar is by far my favorite, always makes me smile |
| 12:47 | technomancy | jsabeaudry: you're still using uberjar? I switched to "lein überjar"; it's so much better |
| 12:50 | jsabeaudry | technomancy, hehe, is ubejar officially deprecated in favor of überjar? ;) |
| 12:50 | technomancy | unofficially deprecated |
| 12:50 | technomancy | überjar is the more precated of the two |
| 12:51 | mdeboard | precated |
| 12:53 | technomancy | nice; lein-precate is the #2 hit for precate on le goog |
| 12:55 | jsabeaudry | technomancy, Oh wow, not even a joke überjar does work! hahah great work |
| 12:56 | technomancy | jsabeaudry: next step is to upgrade to Leiningen to so "lein halp" works |
| 12:57 | technomancy | *upgrade to Leiningen 2 |
| 12:59 | mdeboard | Hm Weird. |
| 12:59 | mdeboard | Why does technomancy's umlaut U show up fine but I get an escape character with jsabeaudry |
| 13:00 | TimMc | technomancy: Clearly, I need to match that with uberjar-otf |
| 13:01 | raek | mdeboard: one of them uses utf-8 and one of them uses latin-1, probably |
| 13:02 | raek | mdeboard: the IRC standard does not define which encoding should be used |
| 13:02 | mdeboard | ahh |
| 13:02 | mdeboard | ok |
| 13:03 | raek | good clients accept both and only output utf-8 :-) |
| 13:03 | mdeboard | Yeah, emacs sucks :-\ |
| 13:03 | technomancy | I didn't expect it to be able to switch encodings on a per-line basis though; that's kinda cool |
| 13:04 | technomancy | mdeboard: works for me here |
| 13:04 | llasram | ditto |
| 13:04 | mdeboard | obv I don't think emacs sucks. |
| 13:04 | mdeboard | 12:55 <jsabeaudry> technomancy, Oh wow, not even a joke überjar does work! hahah great work |
| 13:04 | mdeboard | The umlaut u shows up at \374 |
| 13:04 | mdeboard | s/at/as |
| 13:04 | technomancy | are you on a mac? |
| 13:04 | mdeboard | neg |
| 13:05 | mdeboard | ubuntu 11.10 |
| 13:05 | technomancy | huh |
| 13:05 | mdeboard | emacs 24-something |
| 13:05 | mdeboard | I'm dumb. |
| 13:05 | jsabeaudry | It's funny cause I actually copy pasted from technomancy |
| 13:05 | mdeboard | Maybe you have latin-1 clipboard encoding or something. |
| 13:07 | TimMc | Your IRC client may do various curious things with the text on a per-message basis as well. |
| 13:07 | TimMc | irssi has various charset munging options, for instance |
| 13:08 | mdeboard | Well, I'm using rcirc |
| 13:08 | jsabeaudry | mdeboard, Perhaps also Xchat, I'm using the encoding defines as : IRC(Latin&Unicode Hybrid) |
| 13:38 | doug | so i'm getting [{:id 20} ([1,2],[3,4],[5,6])] |
| 13:38 | doug | but what i want is [{:id 20} [[1,2],[3,4],[5,6]]] |
| 13:38 | doug | what's parens mean in that println output, anyways? |
| 13:39 | fliebel | doug: That it's a list instead of a vector? |
| 13:39 | fliebel | &(map identity [1 2 3 4]) |
| 13:39 | lazybot | ⇒ (1 2 3 4) |
| 13:41 | doug | totally |
| 13:42 | fliebel | PushbackReaders are weird. Why does Clojure use them? |
| 13:43 | AimHere | Isn't it a Javaism? |
| 13:43 | fliebel | &(type *in*) |
| 13:43 | lazybot | ⇒ clojure.lang.LineNumberingPushbackReader |
| 13:43 | doug | what's the best way to turn a list into a vector? |
| 13:43 | AimHere | vec? |
| 13:43 | fliebel | vec or vector, I'm confused |
| 13:44 | AimHere | vector, I think makes a vector of the arguments. vec makes a vector of the collection that's the argument |
| 13:44 | fliebel | AimHere: True, or the other way around, but I think you are right. |
| 13:44 | AimHere | ,(vec '(1 2 3)) |
| 13:44 | clojurebot | [1 2 3] |
| 13:45 | tremolo | what's the accepted way to read a properties file in clojure 1.3? I can't seem to find any documentation on this. |
| 13:45 | fliebel | I just tried to unread a character, but it told me Pushback buffer overflow. |
| 13:45 | johnmn3 | Is there a way in clj-webdriver to tell if the browser is currently loading or if it is finished loading? |
| 13:46 | fliebel | tremolo: Just a file with properties, or are you referring to a specific format? |
| 13:46 | joegallo | (doto (java.util.Properties.) (.load (input-stream XXX))) should work, yes? |
| 13:46 | tremolo | fliebel: the standard 'ole java properties file |
| 13:47 | tremolo | there used to be clojure.contrib.java-utils/read-properties |
| 13:47 | fliebel | tremolo: What joegallo said. |
| 13:47 | tremolo | joegallo: cool, thanks |
| 13:47 | joegallo | np |
| 13:48 | TimMc | ~contrib |
| 13:48 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 13:48 | fliebel | How can I tell the size of the pushback buffer? |
| 13:48 | TimMc | Hmm, maybe I'll volunteer to maintain that lib. |
| 13:50 | technomancy | TimMc: java-utils got split up into a bunch of other libs |
| 13:56 | TimMc | technomancy: Ah, in that case I should poke the maintainer of that page. :-) |
| 13:59 | fliebel | $source *in* |
| 13:59 | lazybot | Source not found. |
| 14:00 | RickInGA | I am working through an example using noir, and I keep getting "unable to resulve symbol form-to" |
| 14:01 | RickInGA | I am using hiccup.core… |
| 14:01 | ibdknox | RickInGA: you need to do (:use [hiccup.form-helpers :only [form-to]]) |
| 14:02 | RickInGA | haha, now I will need to find text-field, but that is progress, thanks |
| 14:02 | ibdknox | it's in the same namespace |
| 14:02 | ibdknox | just add it after form-to |
| 14:03 | RickInGA | ibdknox I tried using hiccup.form, has it always been form-helper? |
| 14:03 | bhenry | ibdknox: i'm having trouble with a defpartial line https://gist.github.com/35a6605d2b9e5c3fb8ea |
| 14:03 | ibdknox | RickInGA: yes |
| 14:04 | bhenry | RickInGA: it's changing to just form with the latest version |
| 14:04 | zamaterian | loops, I can recommend criterium for benchmarking functions |
| 14:04 | RickInGA | bhenry ah, that explains the documentation I found |
| 14:05 | ibdknox | bhenry: not sure I understand the issue? |
| 14:05 | bhenry | ibdknox: i don't know what the error means |
| 14:05 | ibdknox | it's not in noir |
| 14:06 | ibdknox | it's in whatever you're using for your models |
| 14:06 | ibdknox | but |
| 14:06 | ibdknox | the issue is likely that id is a string, not an integer |
| 14:06 | ibdknox | try doing (Integer. id) |
| 14:06 | bhenry | i've verified that (get-by-id id-string-from-noir) works. |
| 14:07 | ibdknox | I see |
| 14:07 | bhenry | i added a print statement and it prints the thing just fine. oh i might know! |
| 14:07 | bhenry | brb |
| 14:07 | ibdknox | can you put the full stack up? |
| 14:08 | bhenry | ugh. i've been stuck on this way too long, but i got it. |
| 14:08 | ibdknox | what was the issue? |
| 14:09 | bhenry | i missed that get-by-id was returning a list of one thing not the one thing |
| 14:09 | ibdknox | ah |
| 14:09 | ibdknox | that'd do it :) |
| 14:09 | bhenry | yep. face palm for sure. |
| 14:09 | ibdknox | that stuff happens all the time |
| 14:10 | ibdknox | usually it's typo'd keywords lol |
| 14:10 | RickInGA | and I have a webpage…. thanks again for help |
| 14:10 | ibdknox | np :) |
| 14:10 | TimMc | There. Fixed. |
| 14:10 | rafael | Is there a way to get fully expanded symbols and macros as an argument to a macro (or expand from within, but using the caller namespace) ? |
| 14:10 | ibdknox | sweet |
| 14:11 | Luke | I'm having an issue where i'm defining a function and then trying to call it on the next line down and it's saying source isn't available. I'm using slime to compile it and confirm it gets bound to a variable. any ideas why it'd bind correctly and then claim the source isn't available on the next line? |
| 14:11 | ibdknox | TimMc: could just make a map that blows up when you try to get a key that doesn't exist |
| 14:11 | raek | Luke: how did you load the code? |
| 14:12 | raek | did you load the whole file with C-c C-k or just a single form with C-M-x? |
| 14:12 | TimMc | rafael: You already get the fully exapnded symbols. |
| 14:12 | raek | you only get line numbers in the first case... |
| 14:13 | raek | TimMc: you do? |
| 14:13 | TimMc | rafael: Why do you need to expand the body of the macro inside the macro? |
| 14:13 | TimMc | raek: Oooh, maybe not... |
| 14:13 | ibdknox | macros aren't expanded |
| 14:13 | raek | rafael: you can call resolve on the symbol |
| 14:13 | TimMc | I'm thinking of syntax-quote. |
| 14:13 | ibdknox | ~guards |
| 14:13 | clojurebot | SEIZE HIM! |
| 14:13 | rafael | TimMc, I'm writing a await style macro that rewrites code but it only works on special forms |
| 14:14 | rafael | I need the code in special forms so I can transform it |
| 14:14 | Luke | raek: single expression with C-x-e |
| 14:14 | raek | Luke: ok. reload the whole file using C-c C-k or (require '... :reload) in the repl to get line numbers |
| 14:15 | Luke | cool it's throwing an error now - thanks |
| 14:15 | rafael | raek, but in the caller namespace/context ? |
| 14:16 | ibdknox | rafael: if you rewrite the code to resolve it, yes |
| 14:17 | rafael | ibdknox, but how can I access the macro invocation context |
| 14:17 | ibdknox | not sure I understand the question. |
| 14:17 | ibdknox | Your macro will replace the current code in the current context |
| 14:18 | ibdknox | so if your replacement includes resolving the symbols there, they will be resolved in context |
| 14:18 | ibdknox | Noir unfortunately does this for url-for |
| 14:18 | ibdknox | though I intend to remove that |
| 14:19 | raek | rafael: why do you need to namespace qualify the symbols? |
| 14:19 | rafael | say I'm in namespace foo and I call macro from bar, when I call the macro it will get the symbols but I want the symbols to be qualified for namespace foo because I need to analyze a few special symbols in bar namespace and I need to know how that namespace is called in foo |
| 14:19 | raek | what do you mean by special forms? |
| 14:19 | rafael | clojure special forms, let/fn/do, etc. primitives I can analyze and not macros like doseq |
| 14:21 | raek | do you want to recognize if a symbol means something defined in bar? |
| 14:21 | rafael | for eg. I have following symbols defined in async namespace and in async I have a variable await-one, and a macro defasync, when I call defasync from namespace user I need to know when the defasync is. I also need to fully expand the macros that are passed to defasync and for that I need user namespace context |
| 14:22 | rafael | lol I confused my self with that ignore that |
| 14:22 | ibdknox | this discussion would benefit from code to look at :) |
| 14:22 | rafael | anyway I'll look around the code it's to hard to explain with my inglish :) |
| 14:23 | raek | I still don't understand why you need to expand the symbols |
| 14:23 | rafael | wait a sec till I mock up a snippet :) |
| 14:23 | raek | usually you do it the other way around: you macro generates code that is injected into an unknown context. therefore your generate code should only contain namespace qualified symbols |
| 14:23 | ibdknox | it takes some pretty hardcore code rewriting to do async |
| 14:24 | mdeboard | full penetration programming |
| 14:24 | raek | but you determine which symbols are in the lexical scope where the macro is expanded by looking at the keys of the map which the "magic" variable &env is bound too |
| 14:25 | raek | (defmacro ... [...] ... (keys &env) ...) |
| 14:26 | raek | and you can use resolve to lookup which var or class a symbols refers to (if it is not a local) |
| 14:26 | raek | the macro body is evaluated in the namespace where the macro is expanded |
| 14:26 | rafael | raek, thank you very |
| 14:26 | rafael | very much &env is what I've been looking for |
| 14:26 | raek | now I still have no clue about what you are trying to do... :-) |
| 14:27 | ibdknox | he's trying to yield the thread I'm assuming |
| 14:27 | rafael | ibdknox, yeah, similar to C# async/await |
| 14:27 | ibdknox | took a lot of work in C# compiler to make that happen :) It *should* be easier in Clojure |
| 14:27 | ibdknox | it relied very heavily on the iterators stuff that came with LINQ |
| 14:27 | rafael | ibdknox, my thoughts exactly |
| 14:28 | ibdknox | the design meetings for that were interesting |
| 14:28 | ibdknox | some bad ideas got thrown around for how async should look in code lol |
| 14:30 | rafael | ibdknox, such as ? |
| 14:31 | raek | (defmacro ... [...] ... `(let [f# (fn [ctx#] (let [{:keys ~(vec (keys &env))} ctx&] ...), context# ~(zipmap (map keyword (keys &env)) (keys &env))] (f# context#)) ...) |
| 14:31 | raek | seems like you can use &env to split a piece of code into multiple parts, and still retain the lexical context... |
| 14:33 | Luke | anyone here use Incanter and know how to put random labels in the legend of a chart? Specifically the R^2 value of a regression? |
| 14:34 | ibdknox | rafael: some pretty invasive changes that required walking the stack up to modify all callers, it was worse for VB |
| 14:34 | ibdknox | in the end it came out really well |
| 14:34 | gtrak` | oo, is someone making async for clojure? |
| 14:35 | mdeboard | what |
| 14:35 | ibdknox | unfortunately it came a bit late for us to do all the debugging stuff we wanted to do |
| 14:36 | ibdknox | I wonder if you could do such a thing client-side in JS with hackery around timers |
| 14:39 | rafael | I think in clojure I can get away by transforming special forms to continuation passing and leverage the closure/shadowing in the language - doesn't seem to require anything fancy - but I only started thinking about this a few days ago and just started writing it, here is a very early version of the event library - I've rewritten it since but it's still conceptually the same https://github.com/rubber-duck/miqpl/blob/master/clj/src/miqpl/observable/c |
| 14:39 | rafael | ore.clj |
| 14:39 | rafael | https://github.com/rubber-duck/miqpl/blob/master/clj/src/miqpl/observable/core.clj |
| 14:40 | osa1 | is there a find function to search in arbitrary data structures with a custom test function? |
| 14:42 | osa1 | something to use instead of (first (filter ...)) |
| 14:48 | joegallo | (first (filter ...)) is a pretty common idiom |
| 14:48 | joegallo | sometimes some is better, but often it's not |
| 14:48 | ibdknox | you could potentially use something in clojure.walk |
| 14:49 | ibdknox | depending on what you're doing |
| 14:49 | ibdknox | that's only useful if there's depth |
| 14:51 | osa1 | ibdknox: hmm I think clojure.walk can help. I'm searching some keys in a xml data parsed with clojure.xml |
| 14:51 | ibdknox | oh |
| 14:51 | ibdknox | you should use the xml zipper stuff |
| 14:51 | ibdknox | dunno where that ended up though |
| 14:53 | osa1 | ibdknox: do you mean this https://github.com/clojure/data.zip/blob/master/src/main/clojure/clojure/data/zip/xml.clj ? |
| 14:53 | ibdknox | yes |
| 14:53 | ibdknox | xml1-> is what you want |
| 14:55 | osa1 | ibdknox: what should I add to my project.clj to use this? |
| 14:55 | ibdknox | not sure :) |
| 14:56 | ibdknox | there may not be an official release yet |
| 14:56 | ibdknox | osa1: http://mvnrepository.com/artifact/org.clojure/data.zip/0.1.0 |
| 14:57 | ibdknox | org.clojure/data.zip 0.1.0 |
| 14:57 | uvtc | Hi #clojure. For installing Clojure on your system for general use, which makes the most sense: |
| 14:57 | uvtc | a. Download and put the clojure.jar file somewhere safe. Create a small script to give you a repl (with nice working command history and working arrow keys). |
| 14:57 | uvtc | b. Use `lein new tinkering`, `cd tinkering`, `lein repl` |
| 14:57 | jsabeaudry | Anyone aware of a tool (in bash or something similar) that will prefix any command I type with something, for example I need to make a lot of "curl foo.bar/baz?cmd=[something]" And I would like to simply type [something][enter] [something][enter] |
| 14:57 | uvtc | c. or both of the above? |
| 14:57 | osa1 | ibdknox: thanks |
| 14:58 | raek | uvtc: b will be easiest once you need libraries. also check out the "lein run" command and the lein-oneoff plugin |
| 14:59 | zamaterian | jsabeaudry, can't you make an alias ? |
| 14:59 | jsabeaudry | zamaterian, yes exactly, except I want the alias to be nameless |
| 14:59 | uvtc | Hi raek. Yes, I see that it certainly *would* be the easiest. When I first encountered Clojure, I went and did choice "a" above. Now that I've learned about choice "b", choice "a" seems not very necessary. |
| 15:00 | uvtc | I thought I'd ask here though, in case I'm missing something. |
| 15:00 | raek | uvtc: you can run "lein repl" outside project too. then you get the version of clojure leiningen happens to use |
| 15:00 | technomancy | uvtc: jark is supposed to address that too, but it's still pretty immature |
| 15:00 | raek | if you need to control the version, or add dependencies, you need a project anyway |
| 15:01 | TimMc | technomancy: Yeah, last time I tried to use it, it just made "yo momma jokes" and exited. |
| 15:01 | ibdknox | technomancy, TimMc: wish it weren't ocaml.. I'd help then |
| 15:01 | technomancy | ibdknox: well if it were C it would keep me from helping |
| 15:01 | zamaterian | jsabeaudry, hmm I would probably make a bash script that takes a input from std-in and uses the value in calling curl and exits on ctrl-d |
| 15:01 | technomancy | so it's a wash =) |
| 15:01 | ibdknox | haha |
| 15:02 | uvtc | Ok then. Thanks. Will stick with just using lein with lein repl instead of going through the rigamarole of creating little scripts in my ~/bin. Thank you. |
| 15:03 | uvtc | And will advise other newcomers to do the same. |
| 15:03 | jsabeaudry | zamaterian, Oh, didn't know that was possible, thanks for the pointer I'll read up on bash scripting! |
| 15:05 | zamaterian | jsabeaudry, http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_08_02.html |
| 15:07 | uvtc | Is this the correct spelling for adding a contrib lib to my project.clj (using algo.generic as an example): `[org.clojure/algo.generic "0.1.0"]`? |
| 15:08 | seancorfield | anyone else seeing problems with clojuredocs.org? the search box shows the busy / searching icon but no results are displayed |
| 15:09 | uvtc | I got the version string by clicking on the "Tags" link at the lib's github page. Is that the customary way of finding out that version string? |
| 15:09 | raek | uvtc: yes. you can use "lein search algo.generic" to find out these things |
| 15:09 | y3di | lazybot logs stuff??? |
| 15:09 | lazybot | y3di: Yes, 100% for sure. |
| 15:09 | y3di | woahhh |
| 15:09 | raek | uvtc: no, usually this should be written clearly in the readmme |
| 15:10 | seancorfield | uvtc: this page has all the links http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 15:10 | eggsby | why might a piece of code work fine in the lein repl but fail on 4clojure? |
| 15:10 | eggsby | :( |
| 15:10 | raek | but some documentation for libraries forget to mention it |
| 15:10 | seancorfield | eggsby: define "fail" - 4clojure has restrictions on many tests |
| 15:10 | mdeboard | eggsby: A whole host of reasons. What is the error message you get |
| 15:11 | mdeboard | eggsby: You are either failing your tests, or using a forbidden function |
| 15:11 | eggsby | 'You failed the unit tests.' -- problem 41 -- my "solution" : http://hastebin.com/hofocotepo.clj |
| 15:11 | Raynes | 4Clojure is pretty heavily sandboxed for one. Sometimes there are things that fail for no good reason in the sandbox while they work in the REPL. |
| 15:11 | eggsby | http://www.4clojure.com/problem/41 works fine in the lein repl for the given examples |
| 15:11 | Raynes | Not much can be done about it though. |
| 15:11 | Raynes | Wow, hastebin sure does put that code high up. |
| 15:12 | eggsby | Guess I'll just try to find a better method, mine felt hackish anyhow :p |
| 15:12 | uvtc | seancorfield, Thanks. I see that I can search for any of the contrib libs at http://search.maven.org and see not only their group id/name, but also their latest version. |
| 15:13 | raek | updating the search index used by lein search takes a looong time |
| 15:13 | raek | took about half an hour last time I did it :( |
| 15:13 | uvtc | raek, hehe ... yes, mine's still running. |
| 15:13 | raek | but it is super-convenient once it's done |
| 15:13 | uvtc | raek, but I'm happy to use search.maven.org. |
| 15:14 | jsabeaudry | zamaterian, Awfully simple but so convenient for my needs right now: http://pastebin.com/ZJxdkYk7 |
| 15:14 | uvtc | Why are the contrib libs listed at search.maven.org, yet, I'm not finding most of them listed at clojars? |
| 15:14 | Raynes | Because they aren't on clojars. |
| 15:14 | raek | uvtc: yeah, that one and clojars.org is the two most important places to look at |
| 15:15 | Raynes | Contrib libs are put in maven central -- not clojars. |
| 15:15 | uvtc | Hm. Somehow I got the idea that clojars was for libs written in Clojure, and search.maven.org for those written in Java... |
| 15:15 | Raynes | But Leiningen looks in both places for libraries. |
| 15:15 | uvtc | Raynes, ah, right. Thanks. |
| 15:16 | raek | uvtc: in general, that's the case. but the official clojure stuff uses maven and maven central for some reason |
| 15:17 | uvtc | raek, Got it. Thanks. |
| 15:17 | emezeske | raek: Probably because maven has code-signing, etc, while clojars does not (yet) |
| 15:21 | TimMc | That's a good reason. |
| 15:23 | raek | creepy! I used "lein repl" outside a project and when i did (ns foo) ... (ns bar (:use foo)) a line with the text "hello" appeared in the repl... |
| 15:23 | raek | turned out I had a file called foo.clj with the contents (println "hello") in my home directory... |
| 15:23 | Licenser | raek sneaky ^^ |
| 15:23 | raek | thought I was beining hacked for a while there... |
| 15:24 | callen | raek: LOL THIS IS WHY SIDE EFFECTS ARE EVIL LOL |
| 15:24 | callen | </haskell> |
| 15:24 | Licenser | callen doesn't hasel have use? |
| 15:25 | callen | ... |
| 15:25 | callen | . . . |
| 15:25 | uvtc | raek, http://xkcd.com/742/ |
| 15:26 | Licenser | teehee |
| 15:27 | Chousuke | gah wtf |
| 15:27 | Chousuke | I got a message from github notifying me of an ssh key vulnerability and then managed to knock my keyboard down so that the message disappeared and is nowhere to be found |
| 15:28 | callen | Chousuke: they're whining about homakov. I wouldn't worry. |
| 15:28 | uvtc | Chousuke, they want you to visit https://github.com/settings/ssh/audit . |
| 15:29 | callen | lol, I have way too many. |
| 15:29 | Raynes | Chousuke: ^ Approve those keys and you should be good to go. |
| 15:29 | Raynes | raek: I would have assumed haunted rather than hacked. |
| 15:31 | Chousuke | okay, thanks |
| 15:31 | zamaterian | jsabeaudry, nice :-) |
| 15:36 | jsabeaudry | Where is a safe place to shutdown-agents, is there a way to specify some kind of destructor on my :main ? |
| 15:39 | joegallo | just right there are the end of your main function |
| 15:40 | joegallo | (hopefully after you've turned off all the things your application was going that are useful) |
| 15:41 | joegallo | s/going/doing/ |
| 15:41 | dgrnbrg | hello clojurians |
| 15:41 | dgrnbrg | I was wondering what the best way is to take an infinitive sequence and remove duplicates, but to have the duplicate cache only extend for 1 second |
| 15:41 | chouser | Hello! |
| 15:42 | jsabeaudry | joegallo, Will that still be executed if I Ctrl-C the application? |
| 15:42 | dgrnbrg | hello chouser! |
| 15:43 | chouser | so if the sequence is consumed more slowly than one element per second, the cache will never have more than one item in it? |
| 15:43 | dgrnbrg | I have a watch service on a filesystem |
| 15:43 | joegallo | no, it won't. but in that case you're terminating the jvm anyway, so what difference does it make if the agents are shutdown or not? |
| 15:43 | dgrnbrg | to know when to reindex files |
| 15:43 | dgrnbrg | but some editors (like vi) generate 100 FS events when you open a file |
| 15:43 | dgrnbrg | I only want one indexing event to show up |
| 15:44 | chouser | are there timestamps on the events? |
| 15:44 | dgrnbrg | System/currentTimeMillis |
| 15:44 | jsabeaudry | joegallo, Somehow the JVM is not terminated when I Ctrl-C my application |
| 15:44 | dgrnbrg | perhaps I could use a pair where one element is the timestamp, and then round that timestamp to the nearest unit, and just use distinct? |
| 15:44 | dgrnbrg | does that seem reasonable? |
| 15:45 | chouser | that might work, but the distinct cache will grow forever |
| 15:45 | dgrnbrg | That won't work, then |
| 15:45 | dgrnbrg | so, there are an unbounded number of timestamps |
| 15:46 | dgrnbrg | but the actual keys that I'm trying to reduce the frequency of are bounded to easily fit in memory |
| 15:46 | chouser | hm |
| 15:46 | cmiles74 | I'm working on a webmachine-like framework for building REST APIs. Does anyone find that interesting? I'm wondering if it's worth talking to my employer about throwing it out on Github. |
| 15:47 | joegallo | jsabeaudry: maybe i'm wrong about that, then |
| 15:47 | dgrnbrg | cmiles74: I don't know what that means, but I think that open sourcing when possible is always good |
| 15:47 | cmiles74 | dgrnbrg: :P |
| 15:47 | chouser | so if you have a map of keys to timestamps, you could easily tell if a new event for a key came enough later than what was in your map to let it through as a new event. |
| 15:47 | dnolen | cmiles74: I take it you looked at clotheline at one point? |
| 15:47 | dnolen | clothesline I mean |
| 15:47 | cmiles74 | dnolen: I did, but it really looks like it's been abandoned. |
| 15:48 | dgrnbrg | chouser: that gives me an idea |
| 15:48 | cmiles74 | dnolen: It also looks... I don't want to sound picky, but maybe a little over-engineered. |
| 15:48 | dgrnbrg | i'll write a rate-limit function |
| 15:48 | dgrnbrg | which is like distinct, but it expires keys |
| 15:48 | dgrnbrg | perfect :) |
| 15:48 | dnolen | cmiles74: yeah I don't think KirinDave works on it actively. |
| 15:48 | dnolen | cmiles74: did you avoid all of the stuff around building protocols and defaults? |
| 15:49 | cmiles74 | dnolen: I did, that was one of my goals. |
| 15:49 | zamaterian | jsabeaudry, java has shutdownhooks : http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread) |
| 15:49 | dnolen | cmiles74: cool, does it perform pretty well in comparison to clothesline? |
| 15:49 | cmiles74 | I think KirinDave was really invested in working with Clothesline from regular Java code, I'm not so interested in that. |
| 15:49 | dnolen | cmiles74: ah yeah, and Scala I think. |
| 15:49 | cmiles74 | Right now it works, performance is the next thing I have to tackle. |
| 15:50 | cmiles74 | dnolen: I need to do some load testing and get some numbers together. I pretty much just have a working state machine and enough code around it to work with Ring. |
| 15:51 | dnolen | cmiles74: sounds cool, I haven't messed around with Webmachine or Clothesline enough to have much of opinion, but I'm sure there are people that will find it useful. |
| 15:51 | cmiles74 | dnolen: That's my hope. :) It really does sound like Clothesline was the only thing out there. |
| 15:51 | cmiles74 | Alright, sounds good. I'll finish it up and get it out there. :) |
| 15:52 | jsabeaudry | zamaterian, Thanks, I'll try that right away |
| 15:53 | cmiles74 | Webmachine handles a lot of HTTP semantics that are easy to ignore when you just need to get a REST service out the door. I think it also makes it easier to do things in a relatively non-hacky way, like properly handle "accept" headers. |
| 16:02 | dgrnbrg | chouser--I wrote a nice little fn: https://gist.github.com/1996228 |
| 16:04 | tmciver | cmiles74: I've been using |
| 16:04 | dgrnbrg | is there a macro like ->/->> that support sending a seq to 2 different piplelines? |
| 16:04 | tmciver | oop |
| 16:05 | rplevy | dgrnbrg: how would it work? |
| 16:05 | dgrnbrg | I have some infinite seqs of events happening in real time |
| 16:05 | dgrnbrg | and I want to route them down a few paths |
| 16:05 | tmciver | cmiles74: I've been using Clothesline in a project that I haven't been working on in a while, partly because Clothesline is tough to get my head around. I'd definitely be interested in what you've got. |
| 16:05 | dgrnbrg | I'm not sure what it'd look like, which is why I want to know if there's already a solution before I come up w/ my own |
| 16:07 | jsabeaudry | zamaterian, Unfortunately (.addShutdownHook (Runtime/getRuntime) (Thread. #(shutdown-agents))) does not seem to do the trick |
| 16:10 | Luke | anyone know how to select a point in incanter? |
| 16:11 | rplevy | say it was called -|> for example, maybe it would be (-|> something [(foo arg) (bar arg)] [baz quux] mary) |
| 16:11 | chouser | dgrnbrg: hm! |
| 16:12 | rplevy | We had some fun arrow macros we used at Akamai. I'm thinking of making a library with all possible creative arrows |
| 16:12 | rplevy | I call it swiss-arrows |
| 16:13 | rplevy | it's a quadruple subtle pun of some sort |
| 16:13 | chouser | how about (topic x (foo x) (bar a b x) (qux a x b)) |
| 16:15 | chouser | dgrnbrg: I made one too. https://gist.github.com/1996279 |
| 16:15 | aaelony | hi.... I'm using Incanter to read an excel file which normally works fine. A particular excel file however causes the read-xls function to throw a RuntimeException and stops. My attempts so far at try/catch-ing this exception, allowing it to continue don't seem to stick. https://refheap.com/paste/960 Any ideas welcome ... |
| 16:15 | rplevy | the diamond arrow is a useful one (-<> x (a <> b) (f2 a b <> c)) |
| 16:17 | rplevy | chouser: neat |
| 16:27 | chouser | dgrnbrg: using a mutable value inside a lazy seq like that is a bit scary. |
| 16:27 | chouser | your timestamps aren't assigned until something forces the lazy seq, of course |
| 16:28 | chouser | also if your input seq is chunked you might get dup keys close together in time from one chunk before the cache gets updated, therefore giving you incorrect results |
| 16:28 | chouser | it's a pity though, since your solution is so much more succinct. |
| 16:30 | amalloy | all those maps and filters with anonymous functions seem like they should be a `for` or two |
| 16:32 | amalloy | something like https://gist.github.com/1996359 perhaps, dgrnbrg (though chouser is right about the mutable lazy stuff) |
| 16:47 | hiredman | reconn |
| 17:01 | dgrnbrg | chouser: sorry, I had a meeting…I am using this for filtering realtime seqs that are forced with a dorun at the end, so it works well :) |
| 17:03 | chouser | chunked seqs could still trip you up |
| 17:06 | amalloy | it's not very likely his input seqs are chunked though, if they're being generated in real time |
| 17:06 | uvtc | When someone mentions "array" wrt Clojure, they're probably referring to the fixed-size Java arrays, correct? |
| 17:07 | TimMc | yep |
| 17:07 | uvtc | Thanks, TimMc. |
| 17:07 | Scriptor | and clojure representations thereof |
| 17:08 | TimMc | Scriptor: ? |
| 17:08 | uvtc | Scriptor, can you tell me what you mean by a Clojure representation of a Java array? |
| 17:09 | Scriptor | uvtc: just how java arrays are used in clojure, didn't mean anything more than that |
| 17:09 | uvtc | Scriptor, Ah. |
| 17:09 | TimMc | Technically... they're JVM arrays :-P |
| 17:12 | napping | what did I break that in my project directory even lein help gives a java exception? A malformed project.clj? |
| 17:13 | technomancy | napping: with leiningen 1 sometimes sloppy dev-dependencies can cause that |
| 17:13 | technomancy | try rm -rf lib |
| 17:13 | napping | looks like it really doesn't like a defproject with strings where symbols are expected |
| 17:13 | napping | (defproject "my-project" ...) is bad |
| 17:25 | dgrnbrg | is there an idiomatic way to write (->> seqs interleave (partition (count seqs)))? |
| 17:25 | dgrnbrg | i.e. take N seqs and return a seq of vectors of N elts? |
| 17:26 | dgrnbrg | oh… is it (apply map vector seqs)? |
| 17:27 | napping | technomancy: is it time to switch to lein 2? |
| 17:28 | technomancy | napping: yes, but for unrelated reasons |
| 17:28 | napping | I noticed it was in the works a while ago, but it seemed to be marked experimental, and today I see 2.0.0-preview1 |
| 17:29 | technomancy | I see you are paying close attention. =) |
| 17:29 | technomancy | it's official now: https://groups.google.com/group/leiningen/browse_thread/thread/8d1451f49969a4d4 |
| 17:30 | amalloy | dgrnbrg: yes, apply map vector (or list) is the best way to transpose |
| 17:30 | dgrnbrg | tahnks :) |
| 17:32 | technomancy | leiningen 2.0.0-preview1; give it a spin! |
| 17:32 | ibdknox | technomancy: congrats :) |
| 17:33 | technomancy | thanks |
| 17:33 | technomancy | I'm excited |
| 17:34 | Raynes | I did most of the work. |
| 17:34 | technomancy | I thought you farmed that out to lazybot |
| 17:34 | ibdknox | http://i1.kym-cdn.com/photos/images/original/000/173/575/25810.jpg |
| 17:35 | ibdknox | lazybot is doing work for us now??? |
| 17:35 | lazybot | ibdknox: How could that be wrong? |
| 17:35 | llasram | lein überalles |
| 17:35 | ibdknox | lol |
| 17:36 | Raynes | I wrote the javac task, the repl task, and the new task. That's like the whole thing! |
| 17:36 | ibdknox | I wrote some stuff |
| 17:36 | technomancy | oh crap, I forgot to mention javac in the NEWS file |
| 17:38 | Raynes | technomancy: NOOOOOO! |
| 17:39 | technomancy | I'm going to blame it on your trailing whitespace. |
| 17:39 | Raynes | Haha |
| 17:39 | Lajla | Raynes, my love |
| 17:39 | Lajla | let us worship His Shadow together |
| 17:39 | Raynes | technomancy: Sometimes Vim seems to turn off my trailing whitespace stuff. |
| 17:40 | Raynes | I don't know why, but I rarely notice when it does. |
| 17:40 | lucian | that sucks, it's worked for me for a long time |
| 17:40 | TimMc | ibdknox: Yeah, it's great -- I got lazybot to upgrade my leiningen plugin for me. |
| 17:40 | ibdknox | TimMc: sweet |
| 17:41 | ibdknox | Raynes: there's something in VIM for that? |
| 17:41 | napping | looks like the jack-in plugin now requires a hostname |
| 17:41 | napping | task, rather |
| 17:41 | Raynes | ibdknox: Yes. janus has listchars set so that it highlights trailing whitespace. |
| 17:41 | ibdknox | ah |
| 17:42 | duck1123 | is there a reason lein precate drops the artifactId from my project? |
| 17:42 | brehaut | technomancy: the new site looks great |
| 17:43 | duck1123 | previously I had net.kronkltd/jiksnu and it just outputted net.kronkltd |
| 17:43 | technomancy | brehaut: thanks! it's the first web design I've done since 2008 |
| 17:43 | Raynes | ArtifactIds are for wimps. |
| 17:43 | technomancy | duck1123: ouch; definitely a bug |
| 17:43 | technomancy | duck1123: can you file an issue? |
| 17:43 | brehaut | technomancy: you avoided eye searing yellow, or low contrast - the nerds shouldnt get too angry ;) |
| 17:44 | technomancy | brehaut: I tried to make it not-too-obviously-twitter-bootstrapped =) |
| 17:44 | ibdknox | brehaut: are you saying people hate colors? ;) |
| 17:44 | brehaut | ibdknox: some people :P |
| 17:44 | brehaut | ibdknox: some people like Raynes |
| 17:44 | ibdknox | dude |
| 17:44 | Raynes | Your blog. It burns me. |
| 17:44 | ibdknox | screw Raynes, he smells bad, I hear |
| 17:45 | Raynes | technomancy: Bootstrap has some cool stuff I've noticed. I'll probably steal some stuff for refheap. |
| 17:45 | Raynes | ibdknox: You smelled like San Francisco sewage and earthquakes at the conj. |
| 17:45 | napping | Do I need to reinstall plugins? |
| 17:45 | brehaut | i havent looked at bootstrap yet |
| 17:46 | ibdknox | Raynes: what's wrong with that? ;) lol |
| 17:46 | Raynes | napping: You don't install plugins in the same way now. |
| 17:46 | duck1123 | I love bootstrap, but you can really tell when a site is using it |
| 17:47 | Raynes | napping: https://github.com/technomancy/leiningen/wiki/Upgrading |
| 17:47 | napping | lein2 doesn't have a plugin task, so I'm not sure what to do besides having {:user {:plugins [[swank-clojure "1.4.0"]]}} as .lein/profiles.clj |
| 17:47 | Raynes | Yes, that's what you're supposed to do. |
| 17:49 | Raynes | brehaut: You should obviously be using FW/1 |
| 17:49 | technomancy | napping: it's [lein-swank "1.4.3"] rather than swank-clojure |
| 17:50 | brehaut | Raynes: JSPs |
| 17:50 | ibdknox | fuck it. Do it in perl. |
| 17:50 | brehaut | CGIs in C++ |
| 17:50 | ibdknox | real men use assembly to write websites. |
| 17:50 | amro | real men use netcat to run webservers in realtime |
| 17:51 | ibdknox | I have a telephone patch board that I use to connect routers to my server |
| 17:51 | TimMc | ibdknox: You're going to wear out those guards. |
| 17:51 | Raynes | I process HTTP responses in my mind and render HTML directly into my retinas. |
| 17:52 | ibdknox | TimMc: They were at lunch, didn't want to disturb them. Man's gotta eat. |
| 17:52 | brehaut | websites? gopher is the future |
| 17:52 | TimMc | wob...sits? |
| 17:53 | Raynes | If your project has three hyphens in it and one of them has 'clj' behind it, you need to be more creative. |
| 17:53 | napping | what about the emacs mode? |
| 17:53 | napping | now the main error seems to be Wrong number of arguments to jack-in task.\nExpected () |
| 17:55 | amalloy | brehaut: you're safe, that clj is in front of the hyphens |
| 17:55 | brehaut | oh, phew! |
| 17:56 | Scriptor | at least lein no longer throws an exception for staring a name with clo or ending with ure |
| 17:56 | TimMc | aw |
| 17:58 | napping | lein2 help jack-in has a line Arguments: ([port]), is that reasonable? |
| 17:59 | technomancy | napping: can't repro here; it takes one arg as it always has |
| 17:59 | technomancy | stepping out but will be back to help debug in a few |
| 17:59 | napping | It's fixed now |
| 18:00 | duck1123 | man, I have a bad feeling I'm going to end up forking and patching plugins tonight |
| 18:00 | napping | I'd left an extra hostname in clojure-swank-command from trying to use the swank-clojure that demanded a hostname |
| 18:01 | duck1123 | So is the lein2 profile made available to the application in any way? |
| 18:07 | napping | I'm wondering why some errors end up as naked java stack traces |
| 18:20 | technomancy | duck1123: the profile name is not exposed, only the values in it |
| 18:20 | technomancy | duck1123: IMO exposing the profile name would be a leaky abstraction |
| 18:21 | technomancy | duck1123: I've already patched 7 or 8 plugins FWIW |
| 18:21 | technomancy | picked the most popular ones according to clojuresphere |
| 18:22 | emezeske | technomancy: did you run a local copy of clojuresphere so that you could see some recent data on that? |
| 18:23 | technomancy | emezeske: I ran a local copy of clojuresphere for other reasons, but not for that |
| 18:23 | emezeske | heh |
| 18:23 | emezeske | I still can't quite bring myself to run a local copy just for up-to-dateness |
| 18:25 | ibdknox | could put another version up on heroku and just make it update more often? |
| 18:26 | emezeske | s/often/ever |
| 18:26 | emezeske | It's a manual job right now |
| 18:27 | ibdknox | manual in what sense? |
| 18:27 | emezeske | Oh, just in that someone needs to run a script I think |
| 18:27 | emezeske | Just not cronified |
| 18:27 | ibdknox | mm |
| 18:28 | technomancy | next time you see jkkramer on here, bug him about it |
| 18:28 | technomancy | or get him to collab you into the app |
| 18:28 | emezeske | I poked him a couple of times, and emailed |
| 18:28 | ibdknox | and nothing? |
| 18:28 | emezeske | Yeah |
| 18:29 | emezeske | It's not a big deal to me, I just like complaining ^_^ |
| 18:29 | technomancy | =( |
| 18:29 | emezeske | It would be less of a deal if github's search feature didn't suck |
| 18:29 | the-kenny | technomancy: Let's say I have lein-swank in profiles.clj. Is there a nice way of making clojure-jack-in work? It doesn't select the :user profile by default. |
| 18:29 | technomancy | emezeske: once I get a chance to revamp clojars we'll just move clojuresphere features over there anyway |
| 18:29 | emezeske | technomancy: I think that's gonna be so great |
| 18:30 | technomancy | the-kenny: I don't understand; the :user profile is active unless you select another profile using the with-profiles task |
| 18:30 | technomancy | maybe you found a bug? |
| 18:30 | emezeske | technomancy: I might be interested in helping with that, depending on timing and other random factors |
| 18:30 | technomancy | emezeske: clojars is next up on my plate now that the lein2 preview is out |
| 18:30 | technomancy | so once the dust settles I'll put a detailed plan out |
| 18:30 | emezeske | great! |
| 18:31 | technomancy | my focus is going to be 0) make it easier for others to run their own clojars instances for hacking 1) add a releases-only repository and 2) adding other features in order of priority |
| 18:31 | technomancy | ibdknox: it's pretty messy, and it's a fair bit of work to get a dev instance up |
| 18:32 | the-kenny | technomancy: Huh, strange. Works now without me changing anything. |
| 18:32 | technomancy | which is the #1 priority |
| 18:32 | emezeske | "releases-only" being a repo without all the random org.clojars.emezeske et al? |
| 18:32 | the-kenny | Sorry for bothering you :) |
| 18:32 | ibdknox | eww |
| 18:32 | ibdknox | lol |
| 18:32 | technomancy | emezeske: I haven't decided what the policy will be on forking |
| 18:32 | technomancy | but it'll be less of a mosh pit |
| 18:32 | emezeske | nice |
| 18:33 | emezeske | Before I had much of a handle on clojure stuff, the mosh pit was a bit overwhelming |
| 18:33 | emezeske | Well, it still is |
| 18:34 | technomancy | it's amazing we've gone so long with what we have |
| 18:34 | technomancy | https://github.com/ato/clojars-web/graphs/impact |
| 18:35 | callen | emezeske: I'm still waiting for my brain to unfuck itself. I find performing arbitrary transformations on data to be a cognitive overload yet. |
| 18:35 | technomancy | development basically ceased in November of 2010 |
| 18:35 | emezeske | callen: ^_^ |
| 18:35 | callen | technomancy: better than the constant flux and ADHD-churn of the Ruby community. |
| 18:39 | napping | I think I've asked this before, but there's no easy way to decide you don't like the state of some refs and block until they change, is there? |
| 18:39 | technomancy | you could do it with a watcher function |
| 18:40 | technomancy | (let [block (promise)] (add-watch my-ref (partial deliver block)) @block) |
| 18:40 | technomancy | need another arg to add-watch, but you get the idea |
| 18:41 | amalloy | technomancy: that doesn't look reliable |
| 18:41 | amalloy | i guess if you don't mind re-blocking when your watcher goes off but someone else's watcher cancels the state-change |
| 18:41 | technomancy | amalloy: because it'd fire the watcher if a transaction committed the same value back to the ref? |
| 18:41 | tomoj | anybody else gotten this lein error on new install? https://gist.github.com/59bee42de1c93f340f50 |
| 18:42 | napping | I'm missing retry and orElse from Haskell's STM |
| 18:42 | amalloy | technomancy: similar problem, yes |
| 18:42 | technomancy | tomoj: what's your profiles.clj look like? |
| 18:42 | callen | I'm missing reassignment :( |
| 18:42 | tomoj | technomancy: in ~? |
| 18:42 | technomancy | tomoj: ~/.lein/profiles.clj |
| 18:43 | tomoj | don't have one |
| 18:43 | napping | callen: maybe you haven't tried evilly enough |
| 18:43 | tomoj | brand new machine, just installed java, dropped lein on the path |
| 18:43 | technomancy | tomoj: ok, what's project.clj look like? |
| 18:43 | tomoj | heh.. don't have one |
| 18:43 | technomancy | wat |
| 18:43 | tomoj | maybe this is just what happens when you run `lein`? |
| 18:44 | napping | . o (defn badfun [y] (def acc y) (def acc (+ acc y)) acc) |
| 18:44 | technomancy | well bugger that |
| 18:44 | tomoj | yeah, seems to work fine when I actually try to use it |
| 18:45 | tomoj | :) |
| 18:45 | napping | callen: expect that to break horribly, but I can't guarantee it actually will |
| 18:45 | technomancy | tomoj: looks like a bug when running outside a project dir |
| 18:46 | napping | technomancy: I'd worry about whether calling add-watch from within a transaction works properly |
| 18:46 | technomancy | napping: well don't trust my word on refs; I've basically never used them |
| 18:48 | napping | it seems to end up calling a synchronized method of ARef that tosses things on a list of watchers |
| 18:49 | callen | napping: I'm intentionally avoiding buttfucking myself with def or var. |
| 18:49 | callen | napping: I'm forcing myself to stay within the constraints more or less outlined by immutability. |
| 18:49 | napping | var seems to be surprisingly well behaved, actually |
| 18:50 | callen | that's true of most aspects of Clojure though. |
| 18:50 | callen | I expected it to be a lot more wild west when I first started using it...eh. No. |
| 18:50 | napping | I suppose you could abusing bindings or something, but in general vars don't seem to threaten purity |
| 18:50 | callen | more stable in a few years than nearly two decades of Ruby |
| 18:51 | callen | in terms of language semantics, tooling, community, etc. |
| 18:54 | technomancy | tomoj: fixed; thanks for the heads-up |
| 19:45 | phil_ | is there a way to somehow autoinclude macros in clojurescript? |
| 19:47 | phil_ | i.e. say i have a namespace xxx and macros in xxx-macros, can i somehow require xxx-macros whenever i require just xxx? |
| 19:53 | ibdknox | phil_: no |
| 19:53 | ibdknox | at least not currently |
| 19:54 | aperiodic | i think i found a bug in await-for's docstring |
| 19:54 | phil_ | ibdknox: thx |
| 19:55 | ibdknox | ,(doc await-for) |
| 19:55 | clojurebot | "([timeout-ms & agents]); Blocks the current thread until all actions dispatched thus far (from this thread or agent) to the agents have occurred, or the timeout (in milliseconds) has elapsed. Returns nil if returning due to timeout, non-nil otherwise." |
| 19:55 | aperiodic | it says it returns nil if it timed out, but it seems to return false in that situation |
| 19:55 | ibdknox | ,(source await-for) |
| 19:55 | clojurebot | Source not found |
| 19:57 | ibdknox | oh god |
| 19:58 | zakwilson | Hehe. It looks like Korma doesn't use prepare in calls to select and probably other stuff. It seems like that might be a good idea. |
| 19:58 | ibdknox | in calls to select? |
| 19:59 | zakwilson | e.g. (select thing (where {:created_at [< (clj-time.core/now)]})) |
| 19:59 | zakwilson | and then some prepare exists on thing that converts the jodatime object to the right type |
| 20:00 | ibdknox | it would be nice, but it would require an immense amount of work |
| 20:01 | ibdknox | the problem is that those get compiled down to strings of statements |
| 20:01 | ibdknox | haha |
| 20:01 | muhoo | zakwilson: i'm sure he accepts patches :-) |
| 20:01 | ibdknox | it seems like in general, a coercion mechanism would be better |
| 20:01 | zakwilson | muhoo: but I AM doing important things for the next month! |
| 20:01 | zakwilson | I thought that's essentially what prepare and transform were intended to be. |
| 20:02 | ibdknox | basically, and they wouldn't go away |
| 20:02 | ibdknox | but I don't think anyone ever wants sql timestamps |
| 20:02 | ibdknox | as an example |
| 20:02 | ibdknox | or how often do you really want big decimals? |
| 20:02 | zakwilson | I'm not even using SQL time types. I have the time stored in miliseconds as a bigint. |
| 20:03 | ibdknox | ah |
| 20:03 | ibdknox | sure, but you could write a global coercion in your case from joda to bigint |
| 20:03 | zakwilson | In one project because I needed dates farther in the past than Postgres could handle, and in another because I had these nice prepare and transform functions from the other project. |
| 20:04 | ibdknox | haha |
| 20:04 | ibdknox | yeah |
| 20:04 | zakwilson | A global coercion? I'm... not sure I know what you mean. |
| 20:04 | ibdknox | basically anytime korma sees a jodatime it would transform it into blah |
| 20:05 | ibdknox | a bigint in your case |
| 20:05 | ibdknox | and you'd be able to say if you see this type, run this function |
| 20:05 | zakwilson | Well... yes, that would allow me to extinguish this torch. Where are the docs for that? |
| 20:05 | ibdknox | I didn't say it existed :p |
| 20:06 | ibdknox | it wouldn't be too hard to add though |
| 20:06 | aperiodic | so i don't really understand the await-for source, but https://refheap.com/paste/964 is why I think the docstring is mistaken |
| 20:06 | aperiodic | i get that behavior under both 1.2 and 1.3 |
| 20:06 | zakwilson | And select *does* call my transform, so the other side is taken care of (I don't necessarily want every bigint to become a DateTime) |
| 20:06 | callen | well that's never comforting. I just installed something in homebrew and saw "geocities.jp" for one of the source tarballs. |
| 20:07 | ibdknox | zakwilson: yeah, like I said, both would have to exist |
| 20:07 | ibdknox | so that you can do the right thing selectively |
| 20:07 | muhoo | does geocities even exist? or is it still 1996? |
| 20:07 | zakwilson | Right. I understand. So, if I want to deliver code to my client in an hour (did I mention I'm using Korma in production?)... what would be the best approach? |
| 20:07 | ibdknox | seems like a good entry project for someone interested in Noir |
| 20:08 | ibdknox | zakwilson: convert it in-place |
| 20:08 | ibdknox | (select blah (where {:client-ts [> (->bigint stuff)])) |
| 20:09 | technomancy | heh; homebrew |
| 20:09 | tmciver | The bottom of the docstring for xml-> (https://github.com/clojure/data.zip/blob/master/src/main/clojure/clojure/data/zip/xml.clj#L56) mentions zip-query.clj. This file does not appear to be a part of data.xml. Anyone know what this is referring to? |
| 20:09 | amalloy | $javadoc java.util.concurrent.CountDownLatch await |
| 20:09 | lazybot | http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/CountDownLatch.html#await() |
| 20:09 | technomancy | amalloy: did you see my awesome juxt use on the mailing list? |
| 20:09 | ibdknox | tmciver: probably copied from the old contrib |
| 20:10 | zakwilson | So if I were to have a beer or five and write a contribution to Korma that does the global coercion you talked about, what do I need to know to get started? |
| 20:10 | amalloy | heh, i hadn't yet |
| 20:10 | technomancy | ,(apply = ((juxt read-string symbol) "symbol name")) |
| 20:10 | clojurebot | false |
| 20:11 | technomancy | to determine whether a given string is a round-trippable symbol name |
| 20:11 | tmciver | ibdknox: hmm, there is a zip.clj in data.xml but it doesn't appear to have any example code as the docstring suggests. I'll look at the original contrib lib. Thanks. |
| 20:11 | ibdknox | zakwilson: most of the work would revolve around exec, you'd need to walk the return for things to swap and walk the params of the query to swap |
| 20:12 | technomancy | "I don't often reply to Clojure mailing list threads, but when I do it's usually using juxt." |
| 20:12 | tmciver | ha! |
| 20:12 | technomancy | oh, I guess the other juxt was on the seajure list |
| 20:12 | brehaut | bets on how long until raynes posts the macro on twitter |
| 20:12 | technomancy | whatever |
| 20:13 | zakwilson | ibdknox: alright, that gives me a place to start looking. I'm going to finish up the client work, drink a bit and then attempt to contribute to your project. If it doesn't work out, I'm going to drink more and try again. |
| 20:13 | amalloy | ((juxt read reply-to) thread) - my reply doesn't depend on the content returned by read |
| 20:13 | ibdknox | haha |
| 20:13 | ibdknox | zakwilson: good luck ;) |
| 20:15 | technomancy | my other juxt used mapcat though: (def all-intervals (mapcat (juxt up down) base-intervals)) |
| 20:18 | callen | production code using juxt? |
| 20:19 | technomancy | no, just a mailing list sample |
| 20:19 | technomancy | though I've used it in production for sure |
| 20:19 | brehaut | these days geni's production code is probably 50% juxt |
| 20:20 | technomancy | brehaut: the parts that aren't fibonacci generation, sure |
| 20:20 | technomancy | only two juxts in leiningen, and one of them is just separate =\ |
| 20:20 | brehaut | technomancy: did you make up for it with judicious use of comp and partial? |
| 20:21 | rafael | OK so right after I did lein self-install with v2 preview (rm ~/.lein -rf and ~/bin/lein, download lein 2 to bin/lein do lein self-install that finishes OK) I get this exception : https://refheap.com/paste/965 |
| 20:21 | technomancy | brehaut: 14 partials; only 2 comps |
| 20:22 | brehaut | respectable |
| 20:22 | brehaut | you dont want to go wild with the comps |
| 20:22 | technomancy | rafael: yeah; just fixed that; in the mean time do echo "{:user {:profiles []}}" > .lein/profiles.clj |
| 20:24 | technomancy | sorry; should be echo "{:user {:plugins []}}" > ~/.lein/profiles.clj |
| 20:24 | rafael | technomancy, yeah I figured out it works tnx :) |
| 20:25 | ibdknox | technomancy: I see you're a contributor to quil? |
| 20:25 | technomancy | ibdknox: I had some commits to clj-processing way back in the day |
| 20:25 | technomancy | grandfathered in, I guess |
| 20:25 | ibdknox | ah |
| 20:27 | ibdknox | I assume sam is doing music + visualization? |
| 20:27 | ibdknox | or rather, that's the goal |
| 20:28 | technomancy | reasonable to asume |
| 20:28 | ibdknox | that could be fun :D |
| 20:28 | aperiodic | amalloy: seems to me from that javadoc that await-for returns true if the actions succeeded, and false if it timed out. if so, what's the process for getting that fixed? file a JIRA? |
| 20:32 | amalloy | probably |
| 20:33 | aperiodic | alrighty |
| 20:37 | aperiodic | heh, there's been a JIRA open for this issue since august |
| 20:46 | stirfoo | Why does (identical? 'x 'x) return false? More to the point, why do symbols with the same name *have* to be unique instances? Is it because of attached meta data? |
| 20:47 | technomancy | stirfoo: yeah, line/file metadata |
| 20:47 | technomancy | dakrone: is there a trick to getting cheshire to encode persistentqueues? |
| 20:48 | dakrone | technomancy: I don't think it supports that yet, totally forgot about that, I'll add it (or you can use custom encoding) |
| 20:48 | technomancy | no worries; I'll take a look at the custom encoding |
| 20:48 | technomancy | just got caught off guard porting this from clj-json |
| 20:50 | stirfoo | technomancy: Ok. Actually I've been trying to figure this out for 15 minutes, and meta data just occurred while I was typing that question. |
| 20:51 | stirfoo | I've been digging into Clojure's source. The reader is highly entertaining to look at. |
| 20:51 | technomancy | that wouldn't be my recommended starting point, but have fun =) |
| 20:52 | napping | ,(meta 'x) |
| 20:52 | clojurebot | nil |
| 20:54 | stirfoo | ,^"metadata":keyword |
| 20:54 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Metadata can only be applied to IMetas> |
| 20:55 | napping | is there metadata on symbols? |
| 20:55 | stirfoo | and there is why (identical :foo :foo) => true |
| 20:55 | technomancy | dakrone: does this look reasonable? (cheshire.custom/add-encoder clojure.lang.PersistentQueue cheshire.custom/encode-seq) (cheshire.core/encode clojure.lang.PersistentQueue/EMPTY) |
| 20:55 | stirfoo | napping: yes |
| 20:55 | napping | the interned var has line/number metadata |
| 20:55 | stirfoo | but not keywords |
| 20:55 | ibdknox | stirfoo: keywords are interned |
| 20:55 | napping | it is possible to have metadata on symbols |
| 20:55 | technomancy | because it asplodes =( |
| 20:55 | napping | but again, (meta 'x) => nil |
| 20:56 | napping | ,(do (def y) (meta #'y)) |
| 20:56 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 20:56 | napping | identical? tests object identity, so just not interning symbols would be enough |
| 20:57 | dakrone | technomancy: that *seems* correct |
| 20:57 | technomancy | curious |
| 20:57 | dakrone | technomancy: I can't look at it at the moment (hackfest), but I will tonight |
| 20:58 | dakrone | unless I pass out |
| 20:58 | technomancy | sure; I'll just fall back to clj-json for now |
| 20:58 | technomancy | good luck |
| 21:00 | dakrone | technomancy: (╯°□°)╯︵ ┻━┻ |
| 21:00 | technomancy | haha; that was not a guilt-trip attempt for the record =) |
| 21:02 | ibdknox | I need that ascii-art as a system wide abbreviation lol |
| 21:04 | technomancy | necessarily |
| 21:17 | mdeboard | Speaking of ascii art, I need a good ascii visualization of how zippers work. |
| 21:17 | mdeboard | As in clojure.zip |
| 21:19 | duck1123 | So is lein2 not using the global exclusions list any longer? |
| 21:21 | seancorfield | clojuredocs.org still seems to be broken (search) for me... |
| 21:29 | TheBusby | dakrone: that's from this http://bit.ly/A7uYAI |
| 21:48 | Rekcuflluks | But does qbg worship His Shadow? |
| 21:48 | qbg | I had to define 4 manual gensyms |
| 21:49 | qbg | The macro is a factory factory |
| 21:49 | Rekcuflluks | qbg, but do you worship His Divine Shadow? |
| 21:50 | qbg | no comment |
| 21:50 | duck1123 | no comment? donate your liver |
| 21:50 | amalloy | qbg: i just put on /ignore anyone who mentions worshipping shadows, on the assumption that it's Lajla with another new nick |
| 21:51 | Rekcuflluks | I agree |
| 21:51 | Rekcuflluks | organ donation should be compulsory |
| 21:51 | Rekcuflluks | It's kind of sad to spend your whole live on some machine because not enough organs are available. |
| 21:51 | Rekcuflluks | If you can force people to pay taxes for the common good, you can force them to surrender their organs after death honestly. |
| 21:52 | TimMc | qbg: I hope you named it UntypedValueFactoryFactoryFactory |
| 21:53 | qbg | To be precise, a constructor factory |
| 21:54 | duck1123 | But how do you get an instance of that? Better make a factory to be safe |
| 21:54 | qbg | It isn't for Java, so I'm safe |
| 21:55 | qbg | A factory isn't safe enough. You got to use config files |
| 21:55 | mdeboard | C C |
| 21:55 | qbg | xml config files, to be precise |
| 21:56 | emezeske | Better create a template for those XML files, to automate their creation |
| 21:56 | qbg | ... exposed as a SOAP service |
| 21:56 | qbg | The wsdl is generated using xslt |
| 21:57 | duck1123 | I feel ashamed that I once wrote XQuery scripts to produce a XSLT document that would transform more XML into a XForms document that served as my page |
| 21:58 | qbg | duck1123: I was just joking, but that is just wrong. |
| 21:59 | duck1123 | to be slightly less (or more) insane, that XForms document was then turned into HTML+JS |
| 22:02 | zakwilson | Let it be known that I hate Ring stacktraces. |
| 22:03 | Rekcuflluks | duck1123, my page is an RDF/XML document that gets XSLT't to an SVG+JS document? |
| 22:03 | Rekcuflluks | Do I count? |
| 22:04 | TimMc | duck1123: I once tried to make an XSLT sheet to display XSLT files... |
| 22:05 | TimMc | qbg: Oh, and this should all conform to... what's that standard that no one knows what it means? |
| 22:05 | qbg | I don't know, but it has to run on IBM WebSphere |
| 22:06 | duck1123 | I had all of the HTML, RDFa, XForms, XSLT, etc all XSD validated and properly autocompleting with Oxygen. These days I'd just use emacs. |
| 22:10 | technomancy | duck1123: there should be global exclusions support, but I'm not sure it extends to plugins |
| 22:11 | duck1123 | I have a dependency that uses slf4j-nop that I normally have excluded, but when I try to run with lein2 I get slf4j conflicts |
| 22:12 | technomancy | hm; can you open an issue |
| 22:12 | technomancy | ? |
| 22:13 | duck1123 | sure. I'm going to see if I can reproduce it on a minimal project. I'm having other issues building |
| 22:13 | technomancy | thanks |
| 22:19 | qbg | Thanks to my crazy macro, my code is ~100x faster! |
| 22:20 | qbg | This is why Java needs macros |
| 22:22 | duck1123 | figures, the bad dependency comes from the library I use written by the guy I work with. I can bitch him out directly. |
| 22:25 | qbg | My persistent memory tables for core.logic are actually about twice as fast as the currently existing rels! |
| 22:26 | qbg | Actually, about the same |
| 22:27 | duck1123 | technomancy, I can't seem to get it to reproduce, so I'll keep an eye on it and see if I can get it to happen in a simpler project |
| 22:36 | ztellman | qbg: if you're really trying to benchmark, use https://github.com/hugoduncan/criterium |
| 22:36 | ztellman | otherwise it's pretty much guesswork |
| 22:38 | qbg | ztellman: Will do |
| 22:39 | qbg | Right now I'm just running the target function in a loop a ton of times to get a good average |
| 22:41 | ztellman | qbg: fwiw, I've found the quick-bench macro is just as accurate for micro-benchmarks and takes about 1/60th the time |
| 22:42 | qbg | The JVM is actually taking some time to warm up these loops |
| 22:43 | ztellman | well, I'm not sure exactly what you're testing |
| 22:46 | qbg | A small logic program |
| 22:48 | johnmn3 | anybody have experience with clj-webdriver? |
| 22:49 | johnmn3 | trying to find out if there's a way to detect whether the browser is still loading a page or not |
| 22:51 | johnmn3 | also, I'm looking for something like (find-it b {:value "some text on the page"}), which returns the xpath of the enclosing attribute. |
| 23:02 | gtuckerkellogg | how can I count the number of truthy elements on the left side of a list |
| 23:03 | technomancy | what's the left side of a list? |
| 23:04 | gtuckerkellogg | what i want to do is something like (map true? '(true true true false false)) |
| 23:04 | gtuckerkellogg | except I want to get a count of the number of true elements on the left |
| 23:04 | gtuckerkellogg | so if the list is '(true true false true) I'd like to return 2 |
| 23:05 | johnmn3 | (count (take-while true? '(true true true false false))) |
| 23:05 | johnmn3 | I think |
| 23:05 | gtuckerkellogg | ,(count (take-while true? '(true true true false false))) |
| 23:05 | clojurebot | 3 |
| 23:06 | gtuckerkellogg | ,(count (take-while true? '(true true true false false true))) |
| 23:06 | clojurebot | 3 |
| 23:06 | gtuckerkellogg | dang |
| 23:08 | johnmn3 | gtuckerkellogg: you just wanted the ones on the left, correct? |
| 23:10 | gtuckerkellogg | yeah, but i'll want to do something analogous on the right |
| 23:10 | gtuckerkellogg | what i'm trying to do is "pad" a list on both ends |
| 23:10 | gtuckerkellogg | every time I ask a question I realized what a noob I am :) |
| 23:11 | mdeboard | Isn't it glorious gtuckerkellogg |
| 23:11 | gtuckerkellogg | it is |
| 23:11 | mdeboard | ,(count (drop-while false? '(true true true false false false))) |
| 23:11 | clojurebot | 6 |
| 23:11 | gtuckerkellogg | every answer is a bright light on my ignorace. It's fantastic! |
| 23:12 | mdeboard | weird |
| 23:12 | johnmn3 | dropwhile true |
| 23:12 | xeqi | ,(false? 'false) |
| 23:12 | clojurebot | true |
| 23:13 | mdeboard | orite |
| 23:13 | johnmn3 | ,(false? false) |
| 23:13 | mdeboard | sleep |
| 23:13 | clojurebot | true |
| 23:13 | mdeboard | ,(sleep forever) |
| 23:13 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sleep in this context, compiling:(NO_SOURCE_PATH:0)> |
| 23:13 | johnmn3 | ,(System/exit 0) |
| 23:13 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)> |
| 23:13 | johnmn3 | sorry :/ |
| 23:13 | mdeboard | hahaha |
| 23:48 | tmciver | Is there a way to make swank-clojure aware of new libs that have been added to lib/ since it was started? |
| 23:50 | tmciver | http://stackoverflow.com/questions/3383729/how-to-add-classpath-with-emacs-slime-conjure seems to say that if you started swank with 'lein swank' then you simply drop the new jars in lib. I 'clojure-jack-in' and this does not work for me. |
| 23:51 | technomancy | you have to restart |
| 23:51 | Raynes | tmciver: If you've added libraries, the JVM has to be restarted. |
| 23:52 | Raynes | Unless you do crazy classpath hacks that just aren't worth it. |
| 23:52 | tmciver | Oh allright. |
| 23:52 | tmciver | Thanks |
| 23:52 | tmciver | Is it true that if you 'lein swank' you don't have to restart? |
| 23:53 | tmciver | I figured 'clojure-jack-in' was starting swank in a similar fashion to 'lein swank'. |
| 23:54 | technomancy | no, you have to restart either way |
| 23:55 | dreampeppers99 | hey you guys, I would like some help :) |
| 23:55 | dreampeppers99 | I have a given sequence |
| 23:55 | dreampeppers99 | '(1 2 51 44 66 77) |
| 23:56 | theconartist | and you want the highest value |
| 23:56 | dreampeppers99 | and I would like to sum all the odd index elements |
| 23:56 | dreampeppers99 | not, it's the odd index elements |
| 23:57 | dreampeppers99 | I know i can filter a seq based on its elements using a predicate but to filter based on index i don't idea of the best way. |
| 23:58 | dreampeppers99 | Do you guys have any idea how to do it? Am I clear in my explanation? |
| 23:58 | technomancy | ,(doc keep-indexed) |
| 23:58 | clojurebot | "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects." |
| 23:59 | dreampeppers99 | cool, i'm gonna take a look! |
| 23:59 | dreampeppers99 | thank you ! |
| 23:59 | technomancy | ,(apply + (keep-indexed (comp odd? first list) [1 2 3 4])) |
| 23:59 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number> |