#clojure logs

2012-03-07

00:12arohneris there a better way to do this?
00:12arohner(while (dosync (+ (foo) (bar))) (baz))? foo and bar are pure fns that read refs, baz is a side-effect-y fn
00:14amalloyi kinda assume you've simplified here, because that never terminates
00:14amalloy(and they're not pure if they read refs)
00:15arohneramalloy: yes, I over-simplified. it's (< (+ (foo) (bar)) max-count)
00:15arohnersorry, foo and bar are not pure, but they have no side effects
00:15arohnerthey only read refs
00:16amalloyif baz doesn't care about their refs, i suppose that's as good as anything else
00:17arohnerbaz doesn't care about the refs, but it does have side effects
00:17arohnerthough I guess if my dosync doesn't alter, it won't be retried
00:17arohnerI was more worried about retries
00:18amalloyretries seem irrelevant
00:19arohneramalloy: why?
00:19arohneroh, and (baz) takes ~5 minutes
00:20gorakhargoshWhich is the best place to report a bug with clojurescript?
00:21gorakhargoshthe 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:23gorakhargoshwhen 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:23gorakhargoshmaking*
00:23dnolengorakhargosh: please file a ticket in JIRA, ClojureScript doesn't take GitHub pull requests
00:24dnolenhttp://dev.clojure.org/jira/browse/CLJS
00:24gorakhargoshdnolen: alright. I'll do that
00:32gorakhargoshdnolen: here it is for your reference: http://dev.clojure.org/jira/browse/CLJS-159
00:33dnolengorakhargosh: thx!
00:34gorakhargoshdnolen: you're most welcome. :)
00:42gtuckerkelloggi think i'm not understanding the reduce function
00:43Scriptorgtuckerkellogg: what are you having trouble with?
00:43gtuckerkelloggi have a list of struct-maps, and I want to test if all the values of a certain key are the same length
00:43gtuckerkelloggIf I use (map count (map :lhs test-rules))
00:43gtuckerkelloggI get (2 2 2 2 2 2 2 2 2 2 2 )
00:43gtuckerkelloggetc
00:43Scriptorwhat's :lhs?
00:43Iceland_jackWhere is the `reduce' function?
00:43dnolen,(reduce = [2 2 2 2 2 2])
00:43clojurebotfalse
00:44gtuckerkelloggok, maybe it's not reduce i should be using
00:44Iceland_jackdnolen: true is not equal to 2 (:
00:44gtuckerkelloggvery truthy
00:44dnolenIceland_jack: oops duh
00:44gtuckerkelloggso if I try (map = (map count (map :lhs test-rules)))
00:45gtuckerkelloggi get a list of trues
00:45Iceland_jackgtuckerkellogg: Check out the Wikipedia page on: Fold (higher-order function)
00:45Iceland_jackhttp://en.wikipedia.org/wiki/Fold_%28higher-order_function%29
00:45gtuckerkelloggand my expectation was that (reduce true? (map = (map count (map :lhs test-rules))))
00:45gtuckerkelloggwoudl work
00:45Iceland_jackgtuckerkellogg: every?
00:45Scriptoralright, let's start from the beginning
00:45Iceland_jackI mean you *can* implement that with reduce
00:45Scriptorwhat's (map :lhs test-rules) supposed to do?
00:46Iceland_jack,(every? = [45 45 45 45])
00:46clojurebottrue
00:46Iceland_jack,(every? = [45 4545 45 45])
00:46clojurebottrue
00:46Iceland_jackeek, nvm me
00:46dnolen,(partition 2 1 [2 2 2 2 2])
00:47clojurebot((2 2) (2 2) (2 2) (2 2))
00:47dnolen,(partition 2 1 [2 2 2 2])
00:47clojurebot((2 2) (2 2) (2 2))
00:47Iceland_jack,(apply = [45 45 45 45])
00:47clojurebottrue
00:47gtuckerkellogghey!
00:47gtuckerkelloggthere we go
00:47gtuckerkelloggthat makes sense
00:48gtuckerkellogg,(println "thank you clojurebot")
00:48clojurebotthank you clojurebot
00:48gtuckerkelloggheh
00:48gtuckerkelloggand thank you Iceland_jack
00:48Iceland_jackhaha, no don't take credit from clojurebot
00:48gtuckerkellogg jeez, this room is helpful
00:48seancorfield`is it just me or is clojuredocs.org not working properly?
00:49gtuckerkelloggworks for me
00:49seancorfield`when i type in a function name, nothing happens
00:49Iceland_jackworks for me
00:49amalloy&(reduce (partial list '+) (range 5))
00:49lazybot⇒ (+ (+ (+ (+ 0 1) 2) 3) 4)
00:49Scriptor,(every #(= % 2) [2 2 2 2])
00:49clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: every in this context, compiling:(NO_SOURCE_PATH:0)>
00:49amalloythat's what reduce does internally: it calls + 4 times, once with each arg
00:49seancorfield`the site comes up but typing "read" into the search box doesn't return suggestions
00:49Scriptor,(every? #(= % 2) [2 2 2 2])
00:49clojurebottrue
00:50Iceland_jack,(every? (partial = 4) [4 4 4])
00:50clojurebottrue
00:50seancorfield`and, yes, gtuckerkellogg this room is very helpful :)
00:50amalloy&(every? #{4} [4 4 4])
00:50lazybot⇒ true
00:51amalloyis a nicer way to write that
00:51Scriptorseancorfield: I'm getting status code 500's from it when I use chrome's search on it
00:51gtuckerkelloggperhaps amalloy, but I don't know the length in advance. I just want to check that they do not vary
00:51seancorfield`Scriptor: that matches what i'm seeing then.. static content comes up.. dynamic responses, not so much :)
00:51amalloysure
00:52dnolen,(let [[f & r] [4 4 4 4]] (every? #{f} r))
00:52clojurebottrue
00:52amalloydnolen: meh. just apply =
00:52amalloyif we're solving a particular problem
00:52dnolenamalloy: definitely apply =
00:52amalloyusing #{4} as a predicate is an improvement on Iceland_jack's suggestion, not on the actual problem
00:53Iceland_jackI'm still not used to using keywords and sets as functions
00:53Iceland_jackComing from Common Lisp... sounds insane
00:53dnolenIceland_jack: don't forget maps and vectors too :)
00:53Iceland_jackdnolen: Yes but why aren't numbers mapping functions as well?
00:54Iceland_jack,([1 2 3] 1)
00:54clojurebot2
00:54Iceland_jackbut (1 [1 2 3]) doesn't work
00:54Iceland_jackeven though the converse holds true for (<set> :keyword)
00:54dnolenIceland_jack: less useful, plus it can't really be done, Clojure has Java numbers and literals are now primitive.
00:54ScriptorIceland_jack: because a keyword is very often used as a key in a hash
00:55dnolenIceland_jack: you can do it in CLJS, but modifying languages natives to that is very slow IME.
00:55dnolento do
00:56Iceland_jackRight, probably something like that
01:00amalloyalso i suspect numbers have more "reasonable" meanings when called as functions than vectors do
01:01amalloyso that even if we could do it we wouldn't know how
01:02Iceland_jack(DEFINE 1 CAR) (:
01:02Iceland_jack(I kid)
01:02johnmn3I think regexes should be functions on strings
01:03Iceland_jackjohnmn3: I implemented that once
01:03johnmn3yea?
01:03Iceland_jackwhere I could define a function: c(a|d)*r
01:03Iceland_jackwell +
01:03Iceland_jackwhere you could embed types into the function name
01:03johnmn3oh
01:03Iceland_jackas well as number of occurrences
01:04Iceland_jacklong long time ago
01:04johnmn3I mean (#"thing" "something")
01:04Iceland_jacknot too dissimilar I suppose
01:04johnmn3where, in the functions place, it just calls re-find, or something
01:04Iceland_jackhm, that would be interesting
01:04amalloyjohnmn3: not feasible for the same reaon you can't do it for numbers
01:05Iceland_jackDefine feasible
01:05amalloyit's a brilliant idea that's been had many times
01:05johnmn3amalloy: I know, but it could be builtin at a lower level, I'd imagine
01:06technomancyregexes absolutely should be functions
01:06Iceland_jackThe lexical analyzer or reader could check for patterns for regular expressions or regexps
01:06technomancyyou'd have to create a clojure.lang.Regex subclass rather than using java.util.Pattern
01:06johnmn3ah
01:06technomancybut it would be totally worth it, because regexes have never in the history of Clojure been used for interop
01:07amalloyhaha what
01:07technomancyprobably never going to happen sadly
01:07amalloytechnomancy: i find your claim about interop pretty silly
01:07technomancyamalloy: java bends over backwards to not make you pass around regexes
01:08technomancysee String's .split method
01:08Iceland_jackyou're all about calling others silly amalloy
01:08amalloyand even if it were true clojure has always placed an emphasis on interop
01:08dnolentechnomancy: isn't java.util.regex.Pattern final?
01:08amalloyyes. if it weren't, making regexes functions would be trivial
01:08technomancydnolen: maybe. It wouldn't have to be a subclass.
01:08technomancythe value of regexes as functions is several orders of magnitude higher than their interop value
01:10johnmn3here here
01:10dnolentechnomancy: no way. Then you have to have a custom interface a wrapper class, and something that doesn't work where java Regexes do.
01:10technomancyI've never been in a situation where that would matter.
01:10dnolenthat sounds like a major fail to me anyway.
01:11technomancyI'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:11johnmn3what about Iceland_jack's idea... something in the reader that detects regexes in the functions place?
01:12technomancyjohnmn3: wouldn't work with higher-order functions
01:12Iceland_jackAre they still used? ;)
01:12dnolenjohnmn3: nor will it work w/ regexes stored in vars
01:12johnmn3ah
01:13technomancyIceland_jack: I'll overlook it since I know you come from CL =)
01:13Iceland_jackhaha
01:14johnmn3I'll bet a pretty cool regex library could be built on core.logic...
01:14Iceland_jackAny idea why Clojure didn't go more all-out in implementing ideas from Haskell/OCaml/ML?
01:15Iceland_jackMathematica, etc.
01:15Iceland_jackADT, Pattern Matching,
01:15amalloyi 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:15Iceland_jack...static type system /me ducks
01:16technomancystatic types and pattern matching are both being worked on in libraries
01:16Iceland_jackI know about, what was it, clojure.match?
01:16Iceland_jackthe best part of pattern matching is matching against ADT I've found
01:16Iceland_jackymmv
01:17dnolenIceland_jack: pattern matching has known problems. clojure.match goal is generalize pattern matching.
01:17dnolenhelp wanted :)
01:17dnolenIceland_jack: ADT has plenty o weakness, I like William Cook's analysis
01:19dnolenjohnmn3: you could do something way cooler than regexes, Definite Clause Grammars - but some problems to solve first there too.
01:19technomancyI 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:20Iceland_jackdnolen: haha, that would be awesome
01:20Iceland_jackFirst-class CFG? (8
01:20JorgeBis aleph compatible with clojure 1.3 yet?
01:20ztellmanJorgeB: 0.2.1 is nearing release
01:21johnmn3dnolen: would there be a short-hand syntax, much like current regexes? or would one build grammars/patterns first, and then use those?
01:21ztellmanJorgeB: the alpha snapshots are stable, if you want to take them for a spin
01:21JorgeBztellman: yeah, I think I would. Are they on clojars?
01:22ztellmanJorgeB: yeah, 0.2.1-alpha1 is the latest non-snapshot, 0.2.1-alpha2-SNAPSHOT is the latest
01:22JorgeBztellman: danke
01:24JorgeBztellman: I still get warnings about dynamic bindings not being declared properly. Is that known?
01:25ztellmanJorgeB: if it's only three, that's because prxml hasn't been updated to 1.3 compatibility yet
01:25ztellmanI'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:25ztellmanuntil then, completely harmless
01:25amalloyztellman: actually, data.xml finally has an official release, and it probably has all the prxml features you need
01:25JorgeByeah just 3
01:25Iceland_jackztellman: I have three arms!
01:25ztellmanamalloy: didn't know that, thank you
01:26amalloyif it doesn't, let me know - i can maybe add them
01:26ztellmanI'm sure it does, my needs are pretty simple
01:27amalloy(hint: the functions you'll want are: emit; sexp-as-element and/or sexps-as-fragment)
01:28dnolenjohnmn3: 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:29johnmn3dnolen: rgr
01:31dnolenjohnmn3: what makes them cool (to me) is lexing / parsing are not separate things.
01:33dnolenjohnmn3: this parser for Lisp is awesomely small and clear http://web.student.tuwien.ac.at/~e0225855/lisprolog/lisprolog.pl
01:34Iceland_jackdnolen: Scanning and parsing aren't the same, maybe depending how you look at it
01:35Iceland_jackgenerally they're called lexical and syntactic analysis
01:36Iceland_jackInteresting tidbit, my first compiler's lexical analyzer was called: LEXANA.L
01:39dnolenIceland_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:40Iceland_jackWell Prolog is wonderful
01:40Iceland_jackit seems that logic programming is making a bit of a comeback which is fantastic
02:10TEttinger&(apply + (repeat 10 0.1))
02:10lazybot⇒ 0.9999999999999999
02:10TEttinger&(apply + (repeat 10 1/10))
02:10lazybot⇒ 1N
02:11TEttinger,(apply + (repeat 10 0.1))
02:11clojurebot0.9999999999999999
02:11SirDinosaury3di: 11:18 < rhickey> SirDinosaur: There are no plans to open so
02:11SirDinosaururce Datomic at this time
02:46gtuckerkelloggI have a list like (list '("foo" "bar") '("baz" "booo!"))
02:46gtuckerkelloggi'd like to get the string length of every second level member
02:46gtuckerkellogglike ,(.length "foo")
02:47gtuckerkellogg,(.length "foo")
02:47clojurebot3
02:47gtuckerkelloggso i'd like it to return '(3 3 3 5)
02:49amalloy&(let [lists (list '("foo" "bar") '("baz" "booo!"))] (for [list lists, item list] (.length item)))
02:49lazybot⇒ (3 3 3 5)
02:50gtuckerkelloggwow
02:50gtuckerkelloggjeez, i have a lot to learn
02:50gtuckerkelloggthanks
02:52JetienHi, 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:58raekJetien: clojure.contrib.duck-streams has been superceded by clojure.java.io since Clojure 1.2
03:00raekyou'd need to do something like (with-open [in (io/reader "./somefile..clj")] (doall (take 2 (repeatedly (partial read in)))))
03:02Jetienthanks!
03:08Jetienraek: 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:09Jetienraek: it was the (doall) that was missing
03:11maaclLooks like clojure.contrib.datalog has not been migrated to a new namespace or being maintained, is that correct?
03:20raekJetien: then you need to modify it to (with-open [in (PushbackReader. (io/reader ...))] ...)
03:21raekyou also need (ns ... (:import java.io.PushbackReader))
03:22raekJetien: I don't recomment relying on the "old contrib". you cannot use it in clojure 1.3 and 1.4
03:24maaclraek: Would you know anything about the fate of clojure.contrib.datalog?
03:31raekmaacl: nothing more than what this page says: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
03:32raekwhich is that it is currently looking for a new maintainer, if i understand it correctly
03:43maaclraek: Thanks, kind of weird since it is an integral part of datomic. I suppose that they are maintaining a fork or something?
03:50raekindeed
04:50tsdhAren'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:54taliosI guess people have been a bit busy with datomic to mention it :)
04:56tsdh;-)
04:57tsdhBut at least someone found the time to roll the beta out.
04:59callenincidentally, I refuse to rely on datomic for the reasons I refuse to rely on dynamodb.
04:59talioslucian - 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:59callenparticularly, I find relying on dynamodb a bit fucking bizarre given that there are numerous dyanmo clones out there with various trade-offs...
05:00callenI mean, it's about the farthest thing from 'unique' as it gets with distributed KV stores.
05:00luciantalios: also, vendor lock-in. it's why i don't use app engine, as nice as it is
05:00callenlucian: ditto.
05:00talioscallen - 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:00luciandynamo is nice, i won't deny that
05:00callenthe only things that get mimicked more than Dynamo are SQL databases with b-trees and Unix filesystems.
05:00lucianbut yeah, cassandra and riak are good at replicating the ring design
05:00lucianand a ring FS isn't all that hard to do
05:00talioslucian - true, but isn't couchdb lock in, postgresql is also lockin for some things.
05:01talioscassandra is VERY vendor lockin
05:01luciantalios: no, because you can run them on rackspace just fine
05:01callentalios: they're open source, you aren't forced to pay someone for it.
05:01callentalios: if something goes wrong, you can fix it.
05:01luciancallen: that's not even as important
05:01callentalios: if it's slow for your use-case, you can patch it.
05:01lucianyou can run oracle on both aws and rackspace
05:01callentalios: nobody can hike the price on you and keep you trapped.
05:01luciandynamodb? if amazon hates you you're fucked
05:01callending ding ding ^^
05:02talioscallen - 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:02lucianso if amazon also sold dynamodb, and then kept it also appliance-ised (like mysql), it'd be reasonable to use it
05:03luciantalios: right, but there is also provider lock-in, which is the worst
05:03callentalios: you're still locked in, Cassandra doesn't disappear on you just because some company decides to stop supporting it.
05:03lucianwhat you get with app engine and dynamodb
05:03callentalios: Amazon decides DynamoDB is no longer "strategic" like Google has with GAE, you're all kinds of fucked.
05:03callentalios: have you SEEN GAE languishing?
05:04talioscallen - i wouldn't say languishing, because uptake was dismal to start with :) heh
05:04callenCassandra 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:04luciannot even that, they could just turn it off one day. or you might need servers in a particular area, or w/e
05:05lucianso yeah, if dynamodb was sold like oracle is, it'd be less silly
08:48zamaterian,(+ 1 2 )
08:48clojurebot3
08:51maio,(println "Hello World!")
08:51clojurebotHello World!
08:51juhu_chapaHi!
08:52dan_b,(println (str (char 38) "(println \"hello world\")")
08:52clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
08:52dan_b,(println (str (char 38) "(println \"hello world\")"))
08:52clojurebot&(println "hello world")
08:52lazybot⇒ hello world nil
08:53dan_bseems I need paren matching in irssi
09:04sdpfnhi, i am trying to learn clojure, i'm looking forward to learn about java interops ; any suggestion for good tutorials ?
09:06sdpfnany suggestion for learning java interops
09:07maaclsdpfn: I like these two http://www.infoq.com/presentations/Clojure-Java-Interop http://blog.jayfields.com/2011/12/clojure-java-interop.html
09:08dan_bhttp://clojure.org/java_interop is all I've looked at so far
09:08babilensdpfn: 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:09dan_bthat plus the experimental determination that you shoudl use the :import arg to (ns ...) to import java libs, not :use or :require
09:09RickInGAIf 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:10sdpfnthanks
09:15lucianok, watching Rich's video datomic looks very interesting
09:15lucianstill closed source, still married to dynamodb, unfortunately
09:38loopsNoob 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:48raekloops: twice as long for how many elements?
09:49loops1 million
09:50clgvloops: how about a lazy-seq approach?
09:51fliebelCraziness! I have a -main that does (print (read)), which works on the repl, but just hangs with lein run.
09:51raekfliebel: hangs after printing?
09:51fliebelraek: No, nothing gets printed
09:52loopsclgv, i _think_ it is using lazy-seq, i'm passing in two vectors created with (split-at (but i'm a total noob)
09:52raekhrm, perhaps you need to call shutdown-agents *shrug*
09:52clgvloops: your merge implementation is a recursion.
09:53fliebelraek: uh, ok...
09:53loopsclgv, okay.. i'll figure out how to recode it as a lazy-seq and see how that goes
09:53raekloops: how do you construct the inputs in the python version?
09:53loopsraek, is just two python lists
09:54clgvloops: or easier. you can use a transient as output
09:54loopsraek, in both implementations they're just random #'s
09:54raekloops: you could try something like this: (let [s1 (doall (range 0 1e6)) s2 (doall (range 1e6 2e6))] (time merge s1 s2))
09:54loopsraek, thanks.. will give it a go
09:54raekjust to be sure that you are not measuring the performance of split-at
09:54loopsraek, ah, k
09:55fliebelraek: I'm not using agents, but maybe Leiningen is just weird. I'm using a snapshot after all.
09:55raekfliebel: I vagely recall that clojure uses that thread pool internally or something
09:56fliebelraek: But it hangs before printing, so that should not have anything to do with shutting down, right?
09:56raekhrm
09:56raekwhat about buffering?
09:56raektried calling (flush)?
09:56fliebelgood one.. let me see
09:56raekI think println does that, but not print
09:57loopsraek, blush... you're right.. i was blaming wrong function
09:57clgvloops: but your function can be faster with 'ret as a transient
09:58fliebelraek: nope, not that either. I'll try if stable leiningen makes any difference
09:58loopsclgv, okay.. thanks.. looks like it's not the real problem anyway, but i'll look into how to make ret a transient
09:59jonasenIs there a mailing list for core.logic?
10:00fliebelnothing... Is lein run doing something weird with *in* or *out*?
10:01clgvfliebel: is your version of lein using nrepl already?
10:01fliebelclgv: I have both a 2 snapshot and the latest stable. But I think run should not be using nrepl regardless.
10:01dan_bfliebel: there was something on the mailing list abouit that the other day. lein trampoline run?
10:02clgvfliebel: ahk.
10:02raekloops: 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:02dan_bhttp://groups.google.com/group/clojure/browse_thread/thread/a720fbb471edc040/09521c4b02c86f30?lnk=gst&amp;q=trampoline#09521c4b02c86f30
10:03fliebeldan_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:04raekloops: using transients should be as simple as replacing [] with (transient []) and 'conj' in the recur call with 'conj!'
10:04raekoh, and in the base cases, you need to call (persistent! ...) on the result
10:05raek(persistent! (reduce conj! ret b))
10:05clgvraek: (persistent! (loop ...)) works as well ;)
10:06raekclgv: good point
10:07fliebelNope, 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:08loopsraek,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:09clgvloops: the loop-recur is better if you never call merge from the outside with a 'ret value
10:09loopsclgv, yeah, i can see that. and i don't ever call from outside with 'ret
10:09fliebelstacktrace: http://pastebin.com/Sw7F4SGV
10:10fliebelok, stable lein with trampoline works.
11:13jsabeaudryWhat is the proper way to synchronize access to a peripheral in clojure? Is it to use java semaphores?
11:15Licenserjsabeaudry I think agents would be good but I am not sure what you are talking about
11:15mdeboardlol
11:15LicenserI 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:16gtrak`jsabeaudry, probably polling into an atom, you don't want an STM for side-effects
11:17jsabeaudryLicenser, agents are so powerful I have a hard time seeing all the ways they can be used
11:17gtrak`dhconnelly,
11:17dhconnellyyo
11:17gtrak`shouldn't you be doing homework?
11:17dhconnellyhaha
11:18dhconnellyi'm about to give a presentation actually, brb
11:18Licenserthey 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:19jsabeaudrygtrak, It would seem atoms require functions free of side effects, and my device is all about side effects
11:19jsabeaudryLicenser, from that I could understand, sending multiple functions to an agent the functions might be retried is that right?
11:20gtrak`jsabeaudry, if it's single-threaded, it won't be retried
11:20Licenserjs nope they just will be 'sorted' and porocessed in the order they arrive
11:20Licenserso 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:21jsabeaudrygtrak`, How do I set it to be single-threaded?
11:21gtrak`if there's only a single thread writing to it,i mean
11:22gtrak`you don't set it... you just write to it from one thread
11:22gtrak`the code is very simple: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java
11:22Licenserjsabeaudry the idea is that a atom holds data this data can be modified by functions that you send to it
11:22Licenserthis functions won't ever be executed in a 'wrong' order
11:22Licenserand they are stored in a queue (so to say) untill their time has come
11:24gtrak`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:24Licenserso when I get it right you want to do (write-to-peripheral rs232 "some text") and do that form multiple threads?
11:24gtrak`http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicReference.html#compareAndSet(V, V)
11:26jsabeaudryLicenser, That's pretty much the case except that I also need to wait for an answer
11:26LicenserI see I see so you'd want something like send and then wait for the return right now
11:27Licenserthere is await
11:27jsabeaudrygtrak`, 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:28gtrak`jsabeaudry, then you'd want to use two atoms I suppose? :-)
11:28gtrak`or a queue or something
11:29Licenserhow about (await (send agent write_to_socket "text")) ?
11:29gtrak`I/O should be single-threaded or synchronized, there should be something in between that and your application banging on stuff
11:29Licenserso it is kind of tricky
11:30gtrak`i think this actually calls for standard locks
11:31mdeboardpop and lock
11:31gtrak`jsabeaudry, http://clojuredocs.org/clojure_core/clojure.core/locking
11:32jsabeaudrygtrak`, Ah nice, I wasn't aware that there was standard locking in clojure, so much emphasis is put on the STM
11:33gtrak`values don't care about side-effects :-)
11:33gtrak`there may be a better way, but I can't think of one
11:33Licenseroh locking
11:33jsabeaudryLicenser, So agents are basically a fancy event queue?
11:34Licenserhmm with a save state kind of yes
11:34LicenserI think
11:34Licenseralso if you want to use locking for IO perhaps this is a nice pointer: https://github.com/Licenser/stupiddb
11:34gtrak`agents also use threadpools
11:34clgvshouldn that work? (doseq [[x y] data :when (and x y)] ...)
11:34mdeboardpytorll
11:35Licenseroh wiat no I didn't used locks any more
11:39clgv(doseq [[x y] (map list (range 5) (range 5)) :when (and x y)] (print x y))
11:40clgv&(doseq [[x y] (map list (range 5) (range 5)) :when (and x y)] (print x y))
11:40lazybot⇒ 0 01 12 23 34 4nil
11:40gtrak`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:43jsabeaudrygtrak`, I see
11:43gtrak`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:43gtrak`or just use functions that lock
11:45jsabeaudryI 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:45jsabeaudryBecause there is only one peripheral agent, not two communication will be done at the same time
11:46jsabeaudryNow I just need to figure if functions sent to an agent can be retried and under what circumstances
11:46gtrak`you can add watches to a state change on agents, I would use that to separate the application state from the i/o
11:47llasramjsabeaudry: I'm kind of late to the party, but have you looked at lamina?
11:47gtrak`jsabeaudry, http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/add-watch
11:47jsabeaudryllasram, Yes I took a look at that
11:48jsabeaudryllasram, It is an option but I
11:48jsabeaudry'd love to keep my dependencies low
11:48jsabeaudryespecially in what I consider to be a pretty simple case
11:48llasramBut if what you're trying to do is exactly what lamina provides... eh?
11:49gtrak`i agree this is way too small for an event architecture :-)
11:51luciani've depended on Twisted on occasion just to get decent events in python
11:51gtrak`do the simplest thing that could possibly work?
11:52lucianyeah, that
12:13clgvwhats the predicate related to 'seq - I mean I want to query whether something is seqable
12:15tmciverIs it just 'seq?'? ##(doc seq?)
12:15lazybot⇒ "([x]); Return true if x implements ISeq"
12:15clgvnope
12:15clgvI tend to say it's 'coll?
12:16clgv'coll? tests (instance? clojure.lang.IPersistentCollection x) and IPersistentCollection contains a seq method
12:17RickInGAsequential?
12:17RickInGA&(sequential? [1 2 3])
12:17lazybot⇒ true
12:18clgv(doc sequential?)
12:18clojurebot"([coll]); Returns true if coll implements Sequential"
12:19raekclgv: there isn't any predicate for determining whether calling seq on a thing won't fail
12:19clgvlol but clojure.lang.Sequential does not implement anything
12:19raekcoll? works for clojure stuff
12:19clgvraek: I need it for clojure stuff only ^^
12:20raekclgv: what do you need to do?
12:20raekis this for a macro?
12:20clgvyep
12:21raekseq? detects forms that look like (...), vector? those that look like [...], map? {...}, and coll? all three
12:22clgvI had the problem that I forgot that a macro can expand to a single atomic thing.
12:25clgvso always include an 'and in macro tests ^^
12:40jonasendnolen: Have time for a core.logic question?
12:40dnolenjonasen: shoot
12:41jonasenWhy is core.logic/prep private? Should I never need to use it?
12:42loopsis 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:43jonasenhttps://github.com/jonase/kibit/blob/master/src/jonase/kibit/core.clj#L22
12:43jonasendnolen: ^^ I'm using it here, but maybe there's a better way?
12:44dnolenjonasen: actually I'm not sure why it is private, probably an oversight.
12:45jonasenok, I'll keep using it then.
12:46jsabeaudryof all the lein commands uberjar is by far my favorite, always makes me smile
12:47technomancyjsabeaudry: you're still using uberjar? I switched to "lein überjar"; it's so much better
12:50jsabeaudrytechnomancy, hehe, is ubejar officially deprecated in favor of überjar? ;)
12:50technomancyunofficially deprecated
12:50technomancyüberjar is the more precated of the two
12:51mdeboardprecated
12:53technomancynice; lein-precate is the #2 hit for precate on le goog
12:55jsabeaudrytechnomancy, Oh wow, not even a joke überjar does work! hahah great work
12:56technomancyjsabeaudry: next step is to upgrade to Leiningen to so "lein halp" works
12:57technomancy*upgrade to Leiningen 2
12:59mdeboardHm Weird.
12:59mdeboardWhy does technomancy's umlaut U show up fine but I get an escape character with jsabeaudry
13:00TimMctechnomancy: Clearly, I need to match that with uberjar-otf
13:01raekmdeboard: one of them uses utf-8 and one of them uses latin-1, probably
13:02raekmdeboard: the IRC standard does not define which encoding should be used
13:02mdeboardahh
13:02mdeboardok
13:03raekgood clients accept both and only output utf-8 :-)
13:03mdeboardYeah, emacs sucks :-\
13:03technomancyI didn't expect it to be able to switch encodings on a per-line basis though; that's kinda cool
13:04technomancymdeboard: works for me here
13:04llasramditto
13:04mdeboardobv I don't think emacs sucks.
13:04mdeboard12:55 <jsabeaudry> technomancy, Oh wow, not even a joke überjar does work! hahah great work
13:04mdeboardThe umlaut u shows up at \374
13:04mdeboards/at/as
13:04technomancyare you on a mac?
13:04mdeboardneg
13:05mdeboardubuntu 11.10
13:05technomancyhuh
13:05mdeboardemacs 24-something
13:05mdeboardI'm dumb.
13:05jsabeaudryIt's funny cause I actually copy pasted from technomancy
13:05mdeboardMaybe you have latin-1 clipboard encoding or something.
13:07TimMcYour IRC client may do various curious things with the text on a per-message basis as well.
13:07TimMcirssi has various charset munging options, for instance
13:08mdeboardWell, I'm using rcirc
13:08jsabeaudrymdeboard, Perhaps also Xchat, I'm using the encoding defines as : IRC(Latin&Unicode Hybrid)
13:38dougso i'm getting [{:id 20} ([1,2],[3,4],[5,6])]
13:38dougbut what i want is [{:id 20} [[1,2],[3,4],[5,6]]]
13:38dougwhat's parens mean in that println output, anyways?
13:39fliebeldoug: That it's a list instead of a vector?
13:39fliebel&(map identity [1 2 3 4])
13:39lazybot⇒ (1 2 3 4)
13:41dougtotally
13:42fliebelPushbackReaders are weird. Why does Clojure use them?
13:43AimHereIsn't it a Javaism?
13:43fliebel&(type *in*)
13:43lazybot⇒ clojure.lang.LineNumberingPushbackReader
13:43dougwhat's the best way to turn a list into a vector?
13:43AimHerevec?
13:43fliebelvec or vector, I'm confused
13:44AimHerevector, I think makes a vector of the arguments. vec makes a vector of the collection that's the argument
13:44fliebelAimHere: True, or the other way around, but I think you are right.
13:44AimHere,(vec '(1 2 3))
13:44clojurebot[1 2 3]
13:45tremolowhat's the accepted way to read a properties file in clojure 1.3? I can't seem to find any documentation on this.
13:45fliebelI just tried to unread a character, but it told me Pushback buffer overflow.
13:45johnmn3Is there a way in clj-webdriver to tell if the browser is currently loading or if it is finished loading?
13:46fliebeltremolo: Just a file with properties, or are you referring to a specific format?
13:46joegallo(doto (java.util.Properties.) (.load (input-stream XXX))) should work, yes?
13:46tremolofliebel: the standard 'ole java properties file
13:47tremolothere used to be clojure.contrib.java-utils/read-properties
13:47fliebeltremolo: What joegallo said.
13:47tremolojoegallo: cool, thanks
13:47joegallonp
13:48TimMc~contrib
13:48clojurebotMonolithic 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:48fliebelHow can I tell the size of the pushback buffer?
13:48TimMcHmm, maybe I'll volunteer to maintain that lib.
13:50technomancyTimMc: java-utils got split up into a bunch of other libs
13:56TimMctechnomancy: Ah, in that case I should poke the maintainer of that page. :-)
13:59fliebel$source *in*
13:59lazybotSource not found.
14:00RickInGAI am working through an example using noir, and I keep getting "unable to resulve symbol form-to"
14:01RickInGAI am using hiccup.core…
14:01ibdknoxRickInGA: you need to do (:use [hiccup.form-helpers :only [form-to]])
14:02RickInGAhaha, now I will need to find text-field, but that is progress, thanks
14:02ibdknoxit's in the same namespace
14:02ibdknoxjust add it after form-to
14:03RickInGAibdknox I tried using hiccup.form, has it always been form-helper?
14:03bhenryibdknox: i'm having trouble with a defpartial line https://gist.github.com/35a6605d2b9e5c3fb8ea
14:03ibdknoxRickInGA: yes
14:04bhenryRickInGA: it's changing to just form with the latest version
14:04zamaterianloops, I can recommend criterium for benchmarking functions
14:04RickInGAbhenry ah, that explains the documentation I found
14:05ibdknoxbhenry: not sure I understand the issue?
14:05bhenryibdknox: i don't know what the error means
14:05ibdknoxit's not in noir
14:06ibdknoxit's in whatever you're using for your models
14:06ibdknoxbut
14:06ibdknoxthe issue is likely that id is a string, not an integer
14:06ibdknoxtry doing (Integer. id)
14:06bhenryi've verified that (get-by-id id-string-from-noir) works.
14:07ibdknoxI see
14:07bhenryi added a print statement and it prints the thing just fine. oh i might know!
14:07bhenrybrb
14:07ibdknoxcan you put the full stack up?
14:08bhenryugh. i've been stuck on this way too long, but i got it.
14:08ibdknoxwhat was the issue?
14:09bhenryi missed that get-by-id was returning a list of one thing not the one thing
14:09ibdknoxah
14:09ibdknoxthat'd do it :)
14:09bhenryyep. face palm for sure.
14:09ibdknoxthat stuff happens all the time
14:10ibdknoxusually it's typo'd keywords lol
14:10RickInGAand I have a webpage…. thanks again for help
14:10ibdknoxnp :)
14:10TimMcThere. Fixed.
14:10rafaelIs 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:10ibdknoxsweet
14:11LukeI'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:11ibdknoxTimMc: could just make a map that blows up when you try to get a key that doesn't exist
14:11raekLuke: how did you load the code?
14:12raekdid you load the whole file with C-c C-k or just a single form with C-M-x?
14:12TimMcrafael: You already get the fully exapnded symbols.
14:12raekyou only get line numbers in the first case...
14:13raekTimMc: you do?
14:13TimMcrafael: Why do you need to expand the body of the macro inside the macro?
14:13TimMcraek: Oooh, maybe not...
14:13ibdknoxmacros aren't expanded
14:13raekrafael: you can call resolve on the symbol
14:13TimMcI'm thinking of syntax-quote.
14:13ibdknox~guards
14:13clojurebotSEIZE HIM!
14:13rafaelTimMc, I'm writing a await style macro that rewrites code but it only works on special forms
14:14rafaelI need the code in special forms so I can transform it
14:14Lukeraek: single expression with C-x-e
14:14raekLuke: ok. reload the whole file using C-c C-k or (require '... :reload) in the repl to get line numbers
14:15Lukecool it's throwing an error now - thanks
14:15rafaelraek, but in the caller namespace/context ?
14:16ibdknoxrafael: if you rewrite the code to resolve it, yes
14:17rafaelibdknox, but how can I access the macro invocation context
14:17ibdknoxnot sure I understand the question.
14:17ibdknoxYour macro will replace the current code in the current context
14:18ibdknoxso if your replacement includes resolving the symbols there, they will be resolved in context
14:18ibdknoxNoir unfortunately does this for url-for
14:18ibdknoxthough I intend to remove that
14:19raekrafael: why do you need to namespace qualify the symbols?
14:19rafaelsay 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:19raekwhat do you mean by special forms?
14:19rafaelclojure special forms, let/fn/do, etc. primitives I can analyze and not macros like doseq
14:21raekdo you want to recognize if a symbol means something defined in bar?
14:21rafaelfor 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:22rafaellol I confused my self with that ignore that
14:22ibdknoxthis discussion would benefit from code to look at :)
14:22rafaelanyway I'll look around the code it's to hard to explain with my inglish :)
14:23raekI still don't understand why you need to expand the symbols
14:23rafaelwait a sec till I mock up a snippet :)
14:23raekusually 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:23ibdknoxit takes some pretty hardcore code rewriting to do async
14:24mdeboardfull penetration programming
14:24raekbut 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:25raek(defmacro ... [...] ... (keys &env) ...)
14:26raekand you can use resolve to lookup which var or class a symbols refers to (if it is not a local)
14:26raekthe macro body is evaluated in the namespace where the macro is expanded
14:26rafaelraek, thank you very
14:26rafaelvery much &env is what I've been looking for
14:26raeknow I still have no clue about what you are trying to do... :-)
14:27ibdknoxhe's trying to yield the thread I'm assuming
14:27rafaelibdknox, yeah, similar to C# async/await
14:27ibdknoxtook a lot of work in C# compiler to make that happen :) It *should* be easier in Clojure
14:27ibdknoxit relied very heavily on the iterators stuff that came with LINQ
14:27rafaelibdknox, my thoughts exactly
14:28ibdknoxthe design meetings for that were interesting
14:28ibdknoxsome bad ideas got thrown around for how async should look in code lol
14:30rafaelibdknox, such as ?
14:31raek(defmacro ... [...] ... `(let [f# (fn [ctx#] (let [{:keys ~(vec (keys &env))} ctx&] ...), context# ~(zipmap (map keyword (keys &env)) (keys &env))] (f# context#)) ...)
14:31raekseems like you can use &env to split a piece of code into multiple parts, and still retain the lexical context...
14:33Lukeanyone 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:34ibdknoxrafael: some pretty invasive changes that required walking the stack up to modify all callers, it was worse for VB
14:34ibdknoxin the end it came out really well
14:34gtrak`oo, is someone making async for clojure?
14:35mdeboardwhat
14:35ibdknoxunfortunately it came a bit late for us to do all the debugging stuff we wanted to do
14:36ibdknoxI wonder if you could do such a thing client-side in JS with hackery around timers
14:39rafaelI 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:39rafaelore.clj
14:39rafaelhttps://github.com/rubber-duck/miqpl/blob/master/clj/src/miqpl/observable/core.clj
14:40osa1is there a find function to search in arbitrary data structures with a custom test function?
14:42osa1something to use instead of (first (filter ...))
14:48joegallo(first (filter ...)) is a pretty common idiom
14:48joegallosometimes some is better, but often it's not
14:48ibdknoxyou could potentially use something in clojure.walk
14:49ibdknoxdepending on what you're doing
14:49ibdknoxthat's only useful if there's depth
14:51osa1ibdknox: hmm I think clojure.walk can help. I'm searching some keys in a xml data parsed with clojure.xml
14:51ibdknoxoh
14:51ibdknoxyou should use the xml zipper stuff
14:51ibdknoxdunno where that ended up though
14:53osa1ibdknox: do you mean this https://github.com/clojure/data.zip/blob/master/src/main/clojure/clojure/data/zip/xml.clj ?
14:53ibdknoxyes
14:53ibdknoxxml1-> is what you want
14:55osa1ibdknox: what should I add to my project.clj to use this?
14:55ibdknoxnot sure :)
14:56ibdknoxthere may not be an official release yet
14:56ibdknoxosa1: http://mvnrepository.com/artifact/org.clojure/data.zip/0.1.0
14:57ibdknoxorg.clojure/data.zip 0.1.0
14:57uvtcHi #clojure. For installing Clojure on your system for general use, which makes the most sense:
14:57uvtca. 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:57uvtcb. Use `lein new tinkering`, `cd tinkering`, `lein repl`
14:57jsabeaudryAnyone 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:57uvtcc. or both of the above?
14:57osa1ibdknox: thanks
14:58raekuvtc: b will be easiest once you need libraries. also check out the "lein run" command and the lein-oneoff plugin
14:59zamaterianjsabeaudry, can't you make an alias ?
14:59jsabeaudryzamaterian, yes exactly, except I want the alias to be nameless
14:59uvtcHi 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:00uvtcI thought I'd ask here though, in case I'm missing something.
15:00raekuvtc: you can run "lein repl" outside project too. then you get the version of clojure leiningen happens to use
15:00technomancyuvtc: jark is supposed to address that too, but it's still pretty immature
15:00raekif you need to control the version, or add dependencies, you need a project anyway
15:01TimMctechnomancy: Yeah, last time I tried to use it, it just made "yo momma jokes" and exited.
15:01ibdknoxtechnomancy, TimMc: wish it weren't ocaml.. I'd help then
15:01technomancyibdknox: well if it were C it would keep me from helping
15:01zamaterianjsabeaudry, 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:01technomancyso it's a wash =)
15:01ibdknoxhaha
15:02uvtcOk 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:03uvtcAnd will advise other newcomers to do the same.
15:03jsabeaudryzamaterian, Oh, didn't know that was possible, thanks for the pointer I'll read up on bash scripting!
15:05zamaterianjsabeaudry, http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_08_02.html
15:07uvtcIs 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:08seancorfieldanyone else seeing problems with clojuredocs.org? the search box shows the busy / searching icon but no results are displayed
15:09uvtcI 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:09raekuvtc: yes. you can use "lein search algo.generic" to find out these things
15:09y3dilazybot logs stuff???
15:09lazyboty3di: Yes, 100% for sure.
15:09y3diwoahhh
15:09raekuvtc: no, usually this should be written clearly in the readmme
15:10seancorfielduvtc: this page has all the links http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
15:10eggsbywhy might a piece of code work fine in the lein repl but fail on 4clojure?
15:10eggsby:(
15:10raekbut some documentation for libraries forget to mention it
15:10seancorfieldeggsby: define "fail" - 4clojure has restrictions on many tests
15:10mdeboardeggsby: A whole host of reasons. What is the error message you get
15:11mdeboardeggsby: You are either failing your tests, or using a forbidden function
15:11eggsby'You failed the unit tests.' -- problem 41 -- my "solution" : http://hastebin.com/hofocotepo.clj
15:11Raynes4Clojure 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:11eggsbyhttp://www.4clojure.com/problem/41 works fine in the lein repl for the given examples
15:11RaynesNot much can be done about it though.
15:11RaynesWow, hastebin sure does put that code high up.
15:12eggsbyGuess I'll just try to find a better method, mine felt hackish anyhow :p
15:12uvtcseancorfield, 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:13raekupdating the search index used by lein search takes a looong time
15:13raektook about half an hour last time I did it :(
15:13uvtcraek, hehe ... yes, mine's still running.
15:13raekbut it is super-convenient once it's done
15:13uvtcraek, but I'm happy to use search.maven.org.
15:14jsabeaudryzamaterian, Awfully simple but so convenient for my needs right now: http://pastebin.com/ZJxdkYk7
15:14uvtcWhy are the contrib libs listed at search.maven.org, yet, I'm not finding most of them listed at clojars?
15:14RaynesBecause they aren't on clojars.
15:14raekuvtc: yeah, that one and clojars.org is the two most important places to look at
15:15RaynesContrib libs are put in maven central -- not clojars.
15:15uvtcHm. Somehow I got the idea that clojars was for libs written in Clojure, and search.maven.org for those written in Java...
15:15RaynesBut Leiningen looks in both places for libraries.
15:15uvtcRaynes, ah, right. Thanks.
15:16raekuvtc: in general, that's the case. but the official clojure stuff uses maven and maven central for some reason
15:17uvtcraek, Got it. Thanks.
15:17emezeskeraek: Probably because maven has code-signing, etc, while clojars does not (yet)
15:21TimMcThat's a good reason.
15:23raekcreepy! 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:23raekturned out I had a file called foo.clj with the contents (println "hello") in my home directory...
15:23Licenserraek sneaky ^^
15:23raekthought I was beining hacked for a while there...
15:24callenraek: LOL THIS IS WHY SIDE EFFECTS ARE EVIL LOL
15:24callen</haskell>
15:24Licensercallen doesn't hasel have use?
15:25callen...
15:25callen. . .
15:25uvtcraek, http://xkcd.com/742/
15:26Licenserteehee
15:27Chousukegah wtf
15:27ChousukeI 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:28callenChousuke: they're whining about homakov. I wouldn't worry.
15:28uvtcChousuke, they want you to visit https://github.com/settings/ssh/audit .
15:29callenlol, I have way too many.
15:29RaynesChousuke: ^ Approve those keys and you should be good to go.
15:29Raynesraek: I would have assumed haunted rather than hacked.
15:31Chousukeokay, thanks
15:31zamaterianjsabeaudry, nice :-)
15:36jsabeaudryWhere is a safe place to shutdown-agents, is there a way to specify some kind of destructor on my :main ?
15:39joegallojust right there are the end of your main function
15:40joegallo(hopefully after you've turned off all the things your application was going that are useful)
15:41joegallos/going/doing/
15:41dgrnbrghello clojurians
15:41dgrnbrgI 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:41chouserHello!
15:42jsabeaudryjoegallo, Will that still be executed if I Ctrl-C the application?
15:42dgrnbrghello chouser!
15:43chouserso if the sequence is consumed more slowly than one element per second, the cache will never have more than one item in it?
15:43dgrnbrgI have a watch service on a filesystem
15:43joegallono, 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:43dgrnbrgto know when to reindex files
15:43dgrnbrgbut some editors (like vi) generate 100 FS events when you open a file
15:43dgrnbrgI only want one indexing event to show up
15:44chouserare there timestamps on the events?
15:44dgrnbrgSystem/currentTimeMillis
15:44jsabeaudryjoegallo, Somehow the JVM is not terminated when I Ctrl-C my application
15:44dgrnbrgperhaps 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:44dgrnbrgdoes that seem reasonable?
15:45chouserthat might work, but the distinct cache will grow forever
15:45dgrnbrgThat won't work, then
15:45dgrnbrgso, there are an unbounded number of timestamps
15:46dgrnbrgbut the actual keys that I'm trying to reduce the frequency of are bounded to easily fit in memory
15:46chouserhm
15:46cmiles74I'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:47joegallojsabeaudry: maybe i'm wrong about that, then
15:47dgrnbrgcmiles74: I don't know what that means, but I think that open sourcing when possible is always good
15:47cmiles74dgrnbrg: :P
15:47chouserso 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:47dnolencmiles74: I take it you looked at clotheline at one point?
15:47dnolenclothesline I mean
15:47cmiles74dnolen: I did, but it really looks like it's been abandoned.
15:48dgrnbrgchouser: that gives me an idea
15:48cmiles74dnolen: It also looks... I don't want to sound picky, but maybe a little over-engineered.
15:48dgrnbrgi'll write a rate-limit function
15:48dgrnbrgwhich is like distinct, but it expires keys
15:48dgrnbrgperfect :)
15:48dnolencmiles74: yeah I don't think KirinDave works on it actively.
15:48dnolencmiles74: did you avoid all of the stuff around building protocols and defaults?
15:49cmiles74dnolen: I did, that was one of my goals.
15:49zamaterianjsabeaudry, java has shutdownhooks : http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
15:49dnolencmiles74: cool, does it perform pretty well in comparison to clothesline?
15:49cmiles74I think KirinDave was really invested in working with Clothesline from regular Java code, I'm not so interested in that.
15:49dnolencmiles74: ah yeah, and Scala I think.
15:49cmiles74Right now it works, performance is the next thing I have to tackle.
15:50cmiles74dnolen: 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:51dnolencmiles74: 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:51cmiles74dnolen: That's my hope. :) It really does sound like Clothesline was the only thing out there.
15:51cmiles74Alright, sounds good. I'll finish it up and get it out there. :)
15:52jsabeaudryzamaterian, Thanks, I'll try that right away
15:53cmiles74Webmachine 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:02dgrnbrgchouser--I wrote a nice little fn: https://gist.github.com/1996228
16:04tmcivercmiles74: I've been using
16:04dgrnbrgis there a macro like ->/->> that support sending a seq to 2 different piplelines?
16:04tmciveroop
16:05rplevydgrnbrg: how would it work?
16:05dgrnbrgI have some infinite seqs of events happening in real time
16:05dgrnbrgand I want to route them down a few paths
16:05tmcivercmiles74: 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:05dgrnbrgI'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:07jsabeaudryzamaterian, Unfortunately (.addShutdownHook (Runtime/getRuntime) (Thread. #(shutdown-agents))) does not seem to do the trick
16:10Lukeanyone know how to select a point in incanter?
16:11rplevysay it was called -|> for example, maybe it would be (-|> something [(foo arg) (bar arg)] [baz quux] mary)
16:11chouserdgrnbrg: hm!
16:12rplevyWe had some fun arrow macros we used at Akamai. I'm thinking of making a library with all possible creative arrows
16:12rplevyI call it swiss-arrows
16:13rplevyit's a quadruple subtle pun of some sort
16:13chouserhow about (topic x (foo x) (bar a b x) (qux a x b))
16:15chouserdgrnbrg: I made one too. https://gist.github.com/1996279
16:15aaelonyhi.... 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:15rplevythe diamond arrow is a useful one (-<> x (a <> b) (f2 a b <> c))
16:17rplevychouser: neat
16:27chouserdgrnbrg: using a mutable value inside a lazy seq like that is a bit scary.
16:27chouseryour timestamps aren't assigned until something forces the lazy seq, of course
16:28chouseralso 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:28chouserit's a pity though, since your solution is so much more succinct.
16:30amalloyall those maps and filters with anonymous functions seem like they should be a `for` or two
16:32amalloysomething like https://gist.github.com/1996359 perhaps, dgrnbrg (though chouser is right about the mutable lazy stuff)
16:47hiredmanreconn
17:01dgrnbrgchouser: 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:03chouserchunked seqs could still trip you up
17:06amalloyit's not very likely his input seqs are chunked though, if they're being generated in real time
17:06uvtcWhen someone mentions "array" wrt Clojure, they're probably referring to the fixed-size Java arrays, correct?
17:07TimMcyep
17:07uvtcThanks, TimMc.
17:07Scriptorand clojure representations thereof
17:08TimMcScriptor: ?
17:08uvtcScriptor, can you tell me what you mean by a Clojure representation of a Java array?
17:09Scriptoruvtc: just how java arrays are used in clojure, didn't mean anything more than that
17:09uvtcScriptor, Ah.
17:09TimMcTechnically... they're JVM arrays :-P
17:12nappingwhat did I break that in my project directory even lein help gives a java exception? A malformed project.clj?
17:13technomancynapping: with leiningen 1 sometimes sloppy dev-dependencies can cause that
17:13technomancytry rm -rf lib
17:13nappinglooks like it really doesn't like a defproject with strings where symbols are expected
17:13napping(defproject "my-project" ...) is bad
17:25dgrnbrgis there an idiomatic way to write (->> seqs interleave (partition (count seqs)))?
17:25dgrnbrgi.e. take N seqs and return a seq of vectors of N elts?
17:26dgrnbrgoh… is it (apply map vector seqs)?
17:27nappingtechnomancy: is it time to switch to lein 2?
17:28technomancynapping: yes, but for unrelated reasons
17:28nappingI 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:29technomancyI see you are paying close attention. =)
17:29technomancyit's official now: https://groups.google.com/group/leiningen/browse_thread/thread/8d1451f49969a4d4
17:30amalloydgrnbrg: yes, apply map vector (or list) is the best way to transpose
17:30dgrnbrgtahnks :)
17:32technomancyleiningen 2.0.0-preview1; give it a spin!
17:32ibdknoxtechnomancy: congrats :)
17:33technomancythanks
17:33technomancyI'm excited
17:34RaynesI did most of the work.
17:34technomancyI thought you farmed that out to lazybot
17:34ibdknoxhttp://i1.kym-cdn.com/photos/images/original/000/173/575/25810.jpg
17:35ibdknoxlazybot is doing work for us now???
17:35lazybotibdknox: How could that be wrong?
17:35llasramlein überalles
17:35ibdknoxlol
17:36RaynesI wrote the javac task, the repl task, and the new task. That's like the whole thing!
17:36ibdknoxI wrote some stuff
17:36technomancyoh crap, I forgot to mention javac in the NEWS file
17:38Raynestechnomancy: NOOOOOO!
17:39technomancyI'm going to blame it on your trailing whitespace.
17:39RaynesHaha
17:39LajlaRaynes, my love
17:39Lajlalet us worship His Shadow together
17:39Raynestechnomancy: Sometimes Vim seems to turn off my trailing whitespace stuff.
17:40RaynesI don't know why, but I rarely notice when it does.
17:40lucianthat sucks, it's worked for me for a long time
17:40TimMcibdknox: Yeah, it's great -- I got lazybot to upgrade my leiningen plugin for me.
17:40ibdknoxTimMc: sweet
17:41ibdknoxRaynes: there's something in VIM for that?
17:41nappinglooks like the jack-in plugin now requires a hostname
17:41nappingtask, rather
17:41Raynesibdknox: Yes. janus has listchars set so that it highlights trailing whitespace.
17:41ibdknoxah
17:42duck1123is there a reason lein precate drops the artifactId from my project?
17:42brehauttechnomancy: the new site looks great
17:43duck1123previously I had net.kronkltd/jiksnu and it just outputted net.kronkltd
17:43technomancybrehaut: thanks! it's the first web design I've done since 2008
17:43RaynesArtifactIds are for wimps.
17:43technomancyduck1123: ouch; definitely a bug
17:43technomancyduck1123: can you file an issue?
17:43brehauttechnomancy: you avoided eye searing yellow, or low contrast - the nerds shouldnt get too angry ;)
17:44technomancybrehaut: I tried to make it not-too-obviously-twitter-bootstrapped =)
17:44ibdknoxbrehaut: are you saying people hate colors? ;)
17:44brehautibdknox: some people :P
17:44brehautibdknox: some people like Raynes
17:44ibdknoxdude
17:44RaynesYour blog. It burns me.
17:44ibdknoxscrew Raynes, he smells bad, I hear
17:45Raynestechnomancy: Bootstrap has some cool stuff I've noticed. I'll probably steal some stuff for refheap.
17:45Raynesibdknox: You smelled like San Francisco sewage and earthquakes at the conj.
17:45nappingDo I need to reinstall plugins?
17:45brehauti havent looked at bootstrap yet
17:46ibdknoxRaynes: what's wrong with that? ;) lol
17:46Raynesnapping: You don't install plugins in the same way now.
17:46duck1123I love bootstrap, but you can really tell when a site is using it
17:47Raynesnapping: https://github.com/technomancy/leiningen/wiki/Upgrading
17:47nappinglein2 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:47RaynesYes, that's what you're supposed to do.
17:49Raynesbrehaut: You should obviously be using FW/1
17:49technomancynapping: it's [lein-swank "1.4.3"] rather than swank-clojure
17:50brehautRaynes: JSPs
17:50ibdknoxfuck it. Do it in perl.
17:50brehautCGIs in C++
17:50ibdknoxreal men use assembly to write websites.
17:50amroreal men use netcat to run webservers in realtime
17:51ibdknoxI have a telephone patch board that I use to connect routers to my server
17:51TimMcibdknox: You're going to wear out those guards.
17:51RaynesI process HTTP responses in my mind and render HTML directly into my retinas.
17:52ibdknoxTimMc: They were at lunch, didn't want to disturb them. Man's gotta eat.
17:52brehautwebsites? gopher is the future
17:52TimMcwob...sits?
17:53RaynesIf your project has three hyphens in it and one of them has 'clj' behind it, you need to be more creative.
17:53nappingwhat about the emacs mode?
17:53nappingnow the main error seems to be Wrong number of arguments to jack-in task.\nExpected ()
17:55amalloybrehaut: you're safe, that clj is in front of the hyphens
17:55brehautoh, phew!
17:56Scriptorat least lein no longer throws an exception for staring a name with clo or ending with ure
17:56TimMcaw
17:58nappinglein2 help jack-in has a line Arguments: ([port]), is that reasonable?
17:59technomancynapping: can't repro here; it takes one arg as it always has
17:59technomancystepping out but will be back to help debug in a few
17:59nappingIt's fixed now
18:00duck1123man, I have a bad feeling I'm going to end up forking and patching plugins tonight
18:00nappingI'd left an extra hostname in clojure-swank-command from trying to use the swank-clojure that demanded a hostname
18:01duck1123So is the lein2 profile made available to the application in any way?
18:07nappingI'm wondering why some errors end up as naked java stack traces
18:20technomancyduck1123: the profile name is not exposed, only the values in it
18:20technomancyduck1123: IMO exposing the profile name would be a leaky abstraction
18:21technomancyduck1123: I've already patched 7 or 8 plugins FWIW
18:21technomancypicked the most popular ones according to clojuresphere
18:22emezesketechnomancy: did you run a local copy of clojuresphere so that you could see some recent data on that?
18:23technomancyemezeske: I ran a local copy of clojuresphere for other reasons, but not for that
18:23emezeskeheh
18:23emezeskeI still can't quite bring myself to run a local copy just for up-to-dateness
18:25ibdknoxcould put another version up on heroku and just make it update more often?
18:26emezeskes/often/ever
18:26emezeskeIt's a manual job right now
18:27ibdknoxmanual in what sense?
18:27emezeskeOh, just in that someone needs to run a script I think
18:27emezeskeJust not cronified
18:27ibdknoxmm
18:28technomancynext time you see jkkramer on here, bug him about it
18:28technomancyor get him to collab you into the app
18:28emezeskeI poked him a couple of times, and emailed
18:28ibdknoxand nothing?
18:28emezeskeYeah
18:29emezeskeIt's not a big deal to me, I just like complaining ^_^
18:29technomancy=(
18:29emezeskeIt would be less of a deal if github's search feature didn't suck
18:29the-kennytechnomancy: 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:29technomancyemezeske: once I get a chance to revamp clojars we'll just move clojuresphere features over there anyway
18:29emezesketechnomancy: I think that's gonna be so great
18:30technomancythe-kenny: I don't understand; the :user profile is active unless you select another profile using the with-profiles task
18:30technomancymaybe you found a bug?
18:30emezesketechnomancy: I might be interested in helping with that, depending on timing and other random factors
18:30technomancyemezeske: clojars is next up on my plate now that the lein2 preview is out
18:30technomancyso once the dust settles I'll put a detailed plan out
18:30emezeskegreat!
18:31technomancymy 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:31technomancyibdknox: it's pretty messy, and it's a fair bit of work to get a dev instance up
18:32the-kennytechnomancy: Huh, strange. Works now without me changing anything.
18:32technomancywhich is the #1 priority
18:32emezeske"releases-only" being a repo without all the random org.clojars.emezeske et al?
18:32the-kennySorry for bothering you :)
18:32ibdknoxeww
18:32ibdknoxlol
18:32technomancyemezeske: I haven't decided what the policy will be on forking
18:32technomancybut it'll be less of a mosh pit
18:32emezeskenice
18:33emezeskeBefore I had much of a handle on clojure stuff, the mosh pit was a bit overwhelming
18:33emezeskeWell, it still is
18:34technomancyit's amazing we've gone so long with what we have
18:34technomancyhttps://github.com/ato/clojars-web/graphs/impact
18:35callenemezeske: I'm still waiting for my brain to unfuck itself. I find performing arbitrary transformations on data to be a cognitive overload yet.
18:35technomancydevelopment basically ceased in November of 2010
18:35emezeskecallen: ^_^
18:35callentechnomancy: better than the constant flux and ADHD-churn of the Ruby community.
18:39nappingI 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:39technomancyyou could do it with a watcher function
18:40technomancy(let [block (promise)] (add-watch my-ref (partial deliver block)) @block)
18:40technomancyneed another arg to add-watch, but you get the idea
18:41amalloytechnomancy: that doesn't look reliable
18:41amalloyi guess if you don't mind re-blocking when your watcher goes off but someone else's watcher cancels the state-change
18:41technomancyamalloy: because it'd fire the watcher if a transaction committed the same value back to the ref?
18:41tomojanybody else gotten this lein error on new install? https://gist.github.com/59bee42de1c93f340f50
18:42nappingI'm missing retry and orElse from Haskell's STM
18:42amalloytechnomancy: similar problem, yes
18:42technomancytomoj: what's your profiles.clj look like?
18:42callenI'm missing reassignment :(
18:42tomojtechnomancy: in ~?
18:42technomancytomoj: ~/.lein/profiles.clj
18:43tomojdon't have one
18:43nappingcallen: maybe you haven't tried evilly enough
18:43tomojbrand new machine, just installed java, dropped lein on the path
18:43technomancytomoj: ok, what's project.clj look like?
18:43tomojheh.. don't have one
18:43technomancywat
18:43tomojmaybe this is just what happens when you run `lein`?
18:44napping. o (defn badfun [y] (def acc y) (def acc (+ acc y)) acc)
18:44technomancywell bugger that
18:44tomojyeah, seems to work fine when I actually try to use it
18:45tomoj:)
18:45nappingcallen: expect that to break horribly, but I can't guarantee it actually will
18:45technomancytomoj: looks like a bug when running outside a project dir
18:46nappingtechnomancy: I'd worry about whether calling add-watch from within a transaction works properly
18:46technomancynapping: well don't trust my word on refs; I've basically never used them
18:48nappingit seems to end up calling a synchronized method of ARef that tosses things on a list of watchers
18:49callennapping: I'm intentionally avoiding buttfucking myself with def or var.
18:49callennapping: I'm forcing myself to stay within the constraints more or less outlined by immutability.
18:49nappingvar seems to be surprisingly well behaved, actually
18:50callenthat's true of most aspects of Clojure though.
18:50callenI expected it to be a lot more wild west when I first started using it...eh. No.
18:50nappingI suppose you could abusing bindings or something, but in general vars don't seem to threaten purity
18:50callenmore stable in a few years than nearly two decades of Ruby
18:51callenin terms of language semantics, tooling, community, etc.
18:54technomancytomoj: fixed; thanks for the heads-up
19:45phil_is there a way to somehow autoinclude macros in clojurescript?
19:47phil_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:53ibdknoxphil_: no
19:53ibdknoxat least not currently
19:54aperiodici think i found a bug in await-for's docstring
19:54phil_ibdknox: thx
19:55ibdknox,(doc await-for)
19:55clojurebot"([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:55aperiodicit says it returns nil if it timed out, but it seems to return false in that situation
19:55ibdknox,(source await-for)
19:55clojurebotSource not found
19:57ibdknoxoh god
19:58zakwilsonHehe. 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:58ibdknoxin calls to select?
19:59zakwilsone.g. (select thing (where {:created_at [< (clj-time.core/now)]}))
19:59zakwilsonand then some prepare exists on thing that converts the jodatime object to the right type
20:00ibdknoxit would be nice, but it would require an immense amount of work
20:01ibdknoxthe problem is that those get compiled down to strings of statements
20:01ibdknoxhaha
20:01muhoozakwilson: i'm sure he accepts patches :-)
20:01ibdknoxit seems like in general, a coercion mechanism would be better
20:01zakwilsonmuhoo: but I AM doing important things for the next month!
20:01zakwilsonI thought that's essentially what prepare and transform were intended to be.
20:02ibdknoxbasically, and they wouldn't go away
20:02ibdknoxbut I don't think anyone ever wants sql timestamps
20:02ibdknoxas an example
20:02ibdknoxor how often do you really want big decimals?
20:02zakwilsonI'm not even using SQL time types. I have the time stored in miliseconds as a bigint.
20:03ibdknoxah
20:03ibdknoxsure, but you could write a global coercion in your case from joda to bigint
20:03zakwilsonIn 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:04ibdknoxhaha
20:04ibdknoxyeah
20:04zakwilsonA global coercion? I'm... not sure I know what you mean.
20:04ibdknoxbasically anytime korma sees a jodatime it would transform it into blah
20:05ibdknoxa bigint in your case
20:05ibdknoxand you'd be able to say if you see this type, run this function
20:05zakwilsonWell... yes, that would allow me to extinguish this torch. Where are the docs for that?
20:05ibdknoxI didn't say it existed :p
20:06ibdknoxit wouldn't be too hard to add though
20:06aperiodicso i don't really understand the await-for source, but https://refheap.com/paste/964 is why I think the docstring is mistaken
20:06aperiodici get that behavior under both 1.2 and 1.3
20:06zakwilsonAnd 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:06callenwell that's never comforting. I just installed something in homebrew and saw "geocities.jp" for one of the source tarballs.
20:07ibdknoxzakwilson: yeah, like I said, both would have to exist
20:07ibdknoxso that you can do the right thing selectively
20:07muhoodoes geocities even exist? or is it still 1996?
20:07zakwilsonRight. 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:07ibdknoxseems like a good entry project for someone interested in Noir
20:08ibdknoxzakwilson: convert it in-place
20:08ibdknox(select blah (where {:client-ts [> (->bigint stuff)]))
20:09technomancyheh; homebrew
20:09tmciverThe 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:09amalloy$javadoc java.util.concurrent.CountDownLatch await
20:09lazybothttp://docs.oracle.com/javase/6/docs/api/java/util/concurrent/CountDownLatch.html#await()
20:09technomancyamalloy: did you see my awesome juxt use on the mailing list?
20:09ibdknoxtmciver: probably copied from the old contrib
20:10zakwilsonSo 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:10amalloyheh, i hadn't yet
20:10technomancy,(apply = ((juxt read-string symbol) "symbol name"))
20:10clojurebotfalse
20:11technomancyto determine whether a given string is a round-trippable symbol name
20:11tmciveribdknox: 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:11ibdknoxzakwilson: 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:12technomancy"I don't often reply to Clojure mailing list threads, but when I do it's usually using juxt."
20:12tmciverha!
20:12technomancyoh, I guess the other juxt was on the seajure list
20:12brehautbets on how long until raynes posts the macro on twitter
20:12technomancywhatever
20:13zakwilsonibdknox: 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:13amalloy((juxt read reply-to) thread) - my reply doesn't depend on the content returned by read
20:13ibdknoxhaha
20:13ibdknoxzakwilson: good luck ;)
20:15technomancymy other juxt used mapcat though: (def all-intervals (mapcat (juxt up down) base-intervals))
20:18callenproduction code using juxt?
20:19technomancyno, just a mailing list sample
20:19technomancythough I've used it in production for sure
20:19brehautthese days geni's production code is probably 50% juxt
20:20technomancybrehaut: the parts that aren't fibonacci generation, sure
20:20technomancyonly two juxts in leiningen, and one of them is just separate =\
20:20brehauttechnomancy: did you make up for it with judicious use of comp and partial?
20:21rafaelOK 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:21technomancybrehaut: 14 partials; only 2 comps
20:22brehautrespectable
20:22brehautyou dont want to go wild with the comps
20:22technomancyrafael: yeah; just fixed that; in the mean time do echo "{:user {:profiles []}}" > .lein/profiles.clj
20:24technomancysorry; should be echo "{:user {:plugins []}}" > ~/.lein/profiles.clj
20:24rafaeltechnomancy, yeah I figured out it works tnx :)
20:25ibdknoxtechnomancy: I see you're a contributor to quil?
20:25technomancyibdknox: I had some commits to clj-processing way back in the day
20:25technomancygrandfathered in, I guess
20:25ibdknoxah
20:27ibdknoxI assume sam is doing music + visualization?
20:27ibdknoxor rather, that's the goal
20:28technomancyreasonable to asume
20:28ibdknoxthat could be fun :D
20:28aperiodicamalloy: 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:32amalloyprobably
20:33aperiodicalrighty
20:37aperiodicheh, there's been a JIRA open for this issue since august
20:46stirfooWhy 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:47technomancystirfoo: yeah, line/file metadata
20:47technomancydakrone: is there a trick to getting cheshire to encode persistentqueues?
20:48dakronetechnomancy: I don't think it supports that yet, totally forgot about that, I'll add it (or you can use custom encoding)
20:48technomancyno worries; I'll take a look at the custom encoding
20:48technomancyjust got caught off guard porting this from clj-json
20:50stirfootechnomancy: 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:51stirfooI've been digging into Clojure's source. The reader is highly entertaining to look at.
20:51technomancythat wouldn't be my recommended starting point, but have fun =)
20:52napping,(meta 'x)
20:52clojurebotnil
20:54stirfoo,^"metadata":keyword
20:54clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
20:55nappingis there metadata on symbols?
20:55stirfooand there is why (identical :foo :foo) => true
20:55technomancydakrone: does this look reasonable? (cheshire.custom/add-encoder clojure.lang.PersistentQueue cheshire.custom/encode-seq) (cheshire.core/encode clojure.lang.PersistentQueue/EMPTY)
20:55stirfoonapping: yes
20:55nappingthe interned var has line/number metadata
20:55stirfoobut not keywords
20:55ibdknoxstirfoo: keywords are interned
20:55nappingit is possible to have metadata on symbols
20:55technomancybecause it asplodes =(
20:55nappingbut again, (meta 'x) => nil
20:56napping,(do (def y) (meta #'y))
20:56clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
20:56nappingidentical? tests object identity, so just not interning symbols would be enough
20:57dakronetechnomancy: that *seems* correct
20:57technomancycurious
20:57dakronetechnomancy: I can't look at it at the moment (hackfest), but I will tonight
20:58dakroneunless I pass out
20:58technomancysure; I'll just fall back to clj-json for now
20:58technomancygood luck
21:00dakronetechnomancy: (╯°□°)╯︵ ┻━┻
21:00technomancyhaha; that was not a guilt-trip attempt for the record =)
21:02ibdknoxI need that ascii-art as a system wide abbreviation lol
21:04technomancynecessarily
21:17mdeboardSpeaking of ascii art, I need a good ascii visualization of how zippers work.
21:17mdeboardAs in clojure.zip
21:19duck1123So is lein2 not using the global exclusions list any longer?
21:21seancorfieldclojuredocs.org still seems to be broken (search) for me...
21:29TheBusbydakrone: that's from this http://bit.ly/A7uYAI
21:48RekcuflluksBut does qbg worship His Shadow?
21:48qbgI had to define 4 manual gensyms
21:49qbgThe macro is a factory factory
21:49Rekcuflluksqbg, but do you worship His Divine Shadow?
21:50qbgno comment
21:50duck1123no comment? donate your liver
21:50amalloyqbg: i just put on /ignore anyone who mentions worshipping shadows, on the assumption that it's Lajla with another new nick
21:51RekcuflluksI agree
21:51Rekcuflluksorgan donation should be compulsory
21:51RekcuflluksIt's kind of sad to spend your whole live on some machine because not enough organs are available.
21:51RekcuflluksIf you can force people to pay taxes for the common good, you can force them to surrender their organs after death honestly.
21:52TimMcqbg: I hope you named it UntypedValueFactoryFactoryFactory
21:53qbgTo be precise, a constructor factory
21:54duck1123But how do you get an instance of that? Better make a factory to be safe
21:54qbgIt isn't for Java, so I'm safe
21:55qbgA factory isn't safe enough. You got to use config files
21:55mdeboardC C
21:55qbgxml config files, to be precise
21:56emezeskeBetter create a template for those XML files, to automate their creation
21:56qbg... exposed as a SOAP service
21:56qbgThe wsdl is generated using xslt
21:57duck1123I 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:58qbgduck1123: I was just joking, but that is just wrong.
21:59duck1123to be slightly less (or more) insane, that XForms document was then turned into HTML+JS
22:02zakwilsonLet it be known that I hate Ring stacktraces.
22:03Rekcuflluksduck1123, my page is an RDF/XML document that gets XSLT't to an SVG+JS document?
22:03RekcuflluksDo I count?
22:04TimMcduck1123: I once tried to make an XSLT sheet to display XSLT files...
22:05TimMcqbg: Oh, and this should all conform to... what's that standard that no one knows what it means?
22:05qbgI don't know, but it has to run on IBM WebSphere
22:06duck1123I 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:10technomancyduck1123: there should be global exclusions support, but I'm not sure it extends to plugins
22:11duck1123I 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:12technomancyhm; can you open an issue
22:12technomancy?
22:13duck1123sure. I'm going to see if I can reproduce it on a minimal project. I'm having other issues building
22:13technomancythanks
22:19qbgThanks to my crazy macro, my code is ~100x faster!
22:20qbgThis is why Java needs macros
22:22duck1123figures, the bad dependency comes from the library I use written by the guy I work with. I can bitch him out directly.
22:25qbgMy persistent memory tables for core.logic are actually about twice as fast as the currently existing rels!
22:26qbgActually, about the same
22:27duck1123technomancy, 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:36ztellmanqbg: if you're really trying to benchmark, use https://github.com/hugoduncan/criterium
22:36ztellmanotherwise it's pretty much guesswork
22:38qbgztellman: Will do
22:39qbgRight now I'm just running the target function in a loop a ton of times to get a good average
22:41ztellmanqbg: fwiw, I've found the quick-bench macro is just as accurate for micro-benchmarks and takes about 1/60th the time
22:42qbgThe JVM is actually taking some time to warm up these loops
22:43ztellmanwell, I'm not sure exactly what you're testing
22:46qbgA small logic program
22:48johnmn3anybody have experience with clj-webdriver?
22:49johnmn3trying to find out if there's a way to detect whether the browser is still loading a page or not
22:51johnmn3also, I'm looking for something like (find-it b {:value "some text on the page"}), which returns the xpath of the enclosing attribute.
23:02gtuckerkellogghow can I count the number of truthy elements on the left side of a list
23:03technomancywhat's the left side of a list?
23:04gtuckerkelloggwhat i want to do is something like (map true? '(true true true false false))
23:04gtuckerkelloggexcept I want to get a count of the number of true elements on the left
23:04gtuckerkelloggso if the list is '(true true false true) I'd like to return 2
23:05johnmn3(count (take-while true? '(true true true false false)))
23:05johnmn3I think
23:05gtuckerkellogg,(count (take-while true? '(true true true false false)))
23:05clojurebot3
23:06gtuckerkellogg,(count (take-while true? '(true true true false false true)))
23:06clojurebot3
23:06gtuckerkelloggdang
23:08johnmn3gtuckerkellogg: you just wanted the ones on the left, correct?
23:10gtuckerkelloggyeah, but i'll want to do something analogous on the right
23:10gtuckerkelloggwhat i'm trying to do is "pad" a list on both ends
23:10gtuckerkelloggevery time I ask a question I realized what a noob I am :)
23:11mdeboardIsn't it glorious gtuckerkellogg
23:11gtuckerkelloggit is
23:11mdeboard,(count (drop-while false? '(true true true false false false)))
23:11clojurebot6
23:11gtuckerkelloggevery answer is a bright light on my ignorace. It's fantastic!
23:12mdeboardweird
23:12johnmn3dropwhile true
23:12xeqi,(false? 'false)
23:12clojurebottrue
23:13mdeboardorite
23:13johnmn3,(false? false)
23:13mdeboardsleep
23:13clojurebottrue
23:13mdeboard,(sleep forever)
23:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sleep in this context, compiling:(NO_SOURCE_PATH:0)>
23:13johnmn3,(System/exit 0)
23:13clojurebot#<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)>
23:13johnmn3sorry :/
23:13mdeboardhahaha
23:48tmciverIs there a way to make swank-clojure aware of new libs that have been added to lib/ since it was started?
23:50tmciverhttp://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:51technomancyyou have to restart
23:51Raynestmciver: If you've added libraries, the JVM has to be restarted.
23:52RaynesUnless you do crazy classpath hacks that just aren't worth it.
23:52tmciverOh allright.
23:52tmciverThanks
23:52tmciverIs it true that if you 'lein swank' you don't have to restart?
23:53tmciverI figured 'clojure-jack-in' was starting swank in a similar fashion to 'lein swank'.
23:54technomancyno, you have to restart either way
23:55dreampeppers99hey you guys, I would like some help :)
23:55dreampeppers99I have a given sequence
23:55dreampeppers99'(1 2 51 44 66 77)
23:56theconartistand you want the highest value
23:56dreampeppers99and I would like to sum all the odd index elements
23:56dreampeppers99not, it's the odd index elements
23:57dreampeppers99I 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:58dreampeppers99Do you guys have any idea how to do it? Am I clear in my explanation?
23:58technomancy,(doc keep-indexed)
23:58clojurebot"([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:59dreampeppers99cool, i'm gonna take a look!
23:59dreampeppers99thank you !
23:59technomancy,(apply + (keep-indexed (comp odd? first list) [1 2 3 4]))
23:59clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number>