#clojure logs

2012-05-15

00:43muhooi have to punt on this one: how would i transform a tree of maps into a [:ul [:li structure in hiccup?
00:43muhooi started using zippers, and got.... confused.
00:44brehautmuhoo: what are the keys and values in the map?
00:48brehautmuhoo: https://www.refheap.com/paste/4fb1dfb7e4b07e354afa355d ?
00:48muhoobrehaut: it's like [{:name "foo" :val 2} [[{:name "child" :val 5} [{:name "subchild" :val 666} ]]]]
00:48muhooit's more like a nested vector than a nested map
00:49muhooi stupidly didn't set it up right
00:49brehautso whats the output you would want for that?
00:49muhooyour refheap is helpful though
00:50muhooi'd need to change it a bit. vector? would tell me if i have a child node.
00:50brehautyup
00:51brehautand you'll want to modify the destructuring
00:51brehaut(ie, you probably dont want to destructure)
00:51muhoonot in this case, i'd want to do other things, like format the stuff in that map.
00:51muhoohmm.. this looks promising.
00:51muhoothanks!
00:51brehautright, but you'll probably want to create a seperate function for that and call it in the else of the map's fn
00:52brehautno worries
00:52brehautalso some of the 4clojure tree problems are good practise for this sort of shenanigans
00:54muhooi really need to do those. i feel like if i can understand trees, the world is mine.
00:54muhooor, at least, lisps are.
00:56brehautyou'll think so, right up till you need to understand graphs :P
00:57kaoDI find tress a bit awkward
00:57kaoDeven more that graphs
00:57kaoD(I mean, trees done right)
02:15michaelr525hello
02:15LuminousMonkeyG'day
02:28ambrosebsShould I think of the null pointer as being related to Java or to the JVM?
02:32kovasbambrosebs: interesting question. what are the pros and cons?
02:40ambrosebskovasb: I just wanted to get my terminology right. Did Java invent the null pointer, or is it part of the JVM?
02:41ambrosebsWhere can I find the answers to these kinds of things?
02:41LuminousMonkeyIsn't it part of the JVM? http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.4 Or am I missing something?
02:42kovasbI'm pretty sure the null pointer predates both of them
02:42ambrosebsLuminousMonkey: ah, thanks!
02:42ambrosebskovasb: I meant in the context of the JVM
02:42kovasbyeah, seems like a jvm feature
02:42kovasb"feature"
02:42ambrosebs:)
02:43ambrosebsthanks!
02:44LuminousMonkeyambrosebs: I'm just surprised you're not doing this sort of thing at 2am, unless you're starting early today. :P
02:44ambrosebsLuminousMonkey: I just woke up...
02:44ambrosebshahaha
02:45ambrosebsI basically was doing this at 2am
02:45LuminousMonkeyambrosebs: Good day for staying in bed anyway.
02:49robertstuttafordis it possible to conditionally bind in a value in a let form if an arg in the containing function has a value of nil, otherwise use that value?
02:50ambrosebsare you talking about fnil?
02:50Iceland_jackif-let?
02:50Iceland_jack,(doc if-let)
02:50clojurebot"([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
02:50Raynes&(doc fnil)
02:50lazybot⇒ "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can... https://www.refheap.com/paste/2724
02:50robertstuttafordgah of course
02:51Rayneslazybot is better for docstrings because it pastes long output.
02:51LuminousMonkeyLike x ||= "other" in Ruby?
02:51robertstuttafordyes LuminousMonkey. i'll check both if-let and fnil out
02:51robertstuttafordthanks!
02:54amalloyrobertstuttaford: it sounds like you just want ##(doc or)
02:54lazybot⇒ "Macro ([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns a logical true value, or returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expression. (or) returns nil."
02:56LuminousMonkeyHooray for prefix notation.
03:04robertstuttafordamalloy: or is perfect, thank you
03:09patchworkHuh, suddenly when trying to run any lein command, I get an http timeout?
03:09patchworkIs there any way to run a lein command without making an http request?
03:14patchworkWhy would lein clean be timing out?
03:21robertstuttafordit's probably trying to update deps?
03:43robertstuttafordhow do i list all the loaded namespaces?
03:43robertstuttafordie, all the valid targets for (in-ns)
03:44LuminousMonkey&(doc all-ns)
03:44lazybot⇒ "([]); Returns a sequence of all namespaces."
03:50cljnewb_2345alright, has anyone here successfully run lein-beanstalk?
03:50cljnewb_2345i'm getting all types of errors
03:50cljnewb_2345https://github.com/weavejester/lein-beanstalk is a bit light on documentation
03:50cljnewb_2345all all I really want is a function project.lcj + src/main.clj
03:51cljnewb_2345then, I can start modifying it
04:07robertstuttaforddoes 'lein ring server' notify via STDOUT when it detects file modifications?
04:08LuminousMonkeyI've never noticed if it does.
04:08robertstuttafordi don't think it's actually reloading files for me
04:29robertstuttafordargh. how do i get a java.util.Date from the string "yyyy-mm-dd hh:mm:ss"?
04:33xeqi&(.parse (java.text.SimpleDateFormat. "yyyy-mm-dd hh:mm:ss") "2012-04-15 03:32:13")
04:33lazybot⇒ #inst "2012-01-15T11:32:13.000-00:00"
04:35robertstuttafordthank you xeqi
04:36xeqiwell, something like that since it seems to have given me a different time
04:39amalloyxeqi: m can't be both minute and month
04:41xeqi&(.parse (java.text.SimpleDateFormat. "yyyy-MM-dd HH:mm:ss") "2012-04-15 03:32:13")
04:41lazybot⇒ #inst "2012-04-15T10:32:13.000-00:00"
04:43xeqicloser
04:43amalloytimezone issues now. i wouldn't worry about that; it probably prints back out correctly
04:46michaelr525'(when-let [[i] []] (println i))
04:46michaelr525,(when-let [[i] []] (println i))
04:47clojurebotnil
04:47michaelr525,(when-let [[i] []] (println "hello"))
04:47clojurebothello
04:47michaelr525why this binding evaluates to true?
04:48michaelr525it says get me the first element of the seq, right?
04:49kovasbso, what is the current way to convert a clojurescript hash map to a plain old javascript object?
04:49michaelr525the seq is empty, the binded value is nil but the binding expression evaluates to true and executes the body.
04:49kovasbwe used to have .strobj, but I'm guessing that doesn't work for the new persistent collections
04:52xeqi&(macroexpand-1 '(when-let [[i] []] (println "hello")))
04:52lazybot⇒ (clojure.core/let [temp__3974__auto__ []] (clojure.core/when temp__3974__auto__ (clojure.core/let [[i] temp__3974__auto__] (println "hello"))))
04:53michaelr525kovasb: everybody are drinking coffee :)
04:53kovasbyup
04:53michaelr525xeqi: let me parse that..
04:53xeqiheh
04:53xeqiwhen checks the []
04:54xeqiand sees thats not falsy
04:54xeqiand then proceeds to do a let binding [i]
04:54michaelr525oh, i see
04:55michaelr525i just rewrote it as (let [[i]...] (when i))
04:55michaelr525i wonder whether there is another solution which is more elegant
04:55clojurebotAck. Ack.
04:58michaelr525 &(macroexpand '(when-let [[i] []] (println "hello")))
05:10robertstuttafordwhen i connect to an nrepl server from lein2, it works great. when i connect from ccw, it doesn't give me any errors, but i don't get any responses to my commands, either
05:11robertstuttaforddamn frustrating because i can't leverage the evaluation tools in eclipse
05:14ogrimHello, I
05:14ogrimhave a question :P
05:15ogrimwhen updating deps for a forked project, I want to put it on clojars - so I add my group id, BUT whould I update the original version? I updated a project from 1.3 to 1.4. Not sure if idiomatic to do so.
06:27ejacksonRaynes: why is clojure-py awesome ?
06:30ejacksonI don't really know the python platform, does it give you something that the JVM doesn't ?
06:32clgvejackson: a global interpreter lock ;)
06:33ejacksonhehehe
06:34clgvejackson: they started an erlang like concurrency implementation afair
06:35ejacksonhmmm. My only opinion on this is what I read from Rich :)
06:35clgvwhat did he write about clojure-py?
06:36ejacksonno, he wrote about Erlang concurrency a while back
06:37ejacksonand why he did it differently in Clojure
06:37clgvah ok
06:38ejacksonclgv: you EuroClojuring ?
06:39clgvejackson: no. have been to european lisp symposium already ;)
06:39ejacksonhow was it ?
06:39clgvgood. also very nice city.
06:40ejacksonwell, compared to London....
06:40clgvLondon can be nice too. I have been there in a sunny warm summer week^^
06:42ejacksonyeah its alright, provided you don't actually have to live there
06:42ejacksona live in LSD-flashback
06:43clgvhaha
06:48clgvwhat is the name of this rule engine with a leiningen plugin that can check clojure code for non--idiomatic code or common pitfalls?
06:52foxdonutclgv: just guessing, is it this? https://github.com/jonase/eastwood
06:52Borkdudeclgv: https://github.com/jonase/kibit
06:53clgvoh I think I saw both - must be one of them I was thinking of
06:53foxdonutI just got the "eastwood" part -- clojure lint = clint :D
06:53clgvhehe
06:54foxdonutboth look interesting.. glad you asked clgv
06:55clgvoh kibit is spitting out a lot of infos
06:56clgvI should try a smaller project
06:56ejacksonclgv: yeah, eastwood, been using it, kinda fun
06:56ejacksonturns out I'm fond of swapping [arglist] and "docstring",,,, doh !
06:59foxdonutejackson: (defn foo [bar] "docstring" ...) has always seemed more natural to me.
07:00clgvfoxdonut: but it does not make clear if you want to return the string or whether it is doc ;)
07:06foxdonutclgv: you're right, for sure. But as I am typing, it just seems to flow more naturally to type the fn name + args, then the docstring.
07:06foxdonutclgv: also it would not make much sense for functions that have multiple arities..
07:07clgvyep
07:10muhoois there any kind of threading macro where, if at any point in the thread i get nil, don't continue to the rest of the thread?
07:11muhooi.e., (-> loc z/down z/down z/branch?) ===> BOOM!! NPE because you can't do z/branch? on nil
07:11ejacksonmuhoo, yep -?>
07:11muhooit'd be nice if i could do (-> loc z/down z/down z/down z/branch?) or z/node or whatever, and if there's a nil at any point, the thread would return nil
07:11muhooejackson: awesome, thanks
07:12ejacksonits in core.incubator
07:12ejacksonso you'll need to include that
07:50augustllooking for tools to generate static HTML pages with clojure, for my own blog
07:51augustlother than just building a website and wget-ing the HTML :)
07:53michaelr525why generate static HTML pages?
07:54dan_bmeans you don't have to install clojure on your web host, is one consideration
07:54michaelr525ah
07:55michaelr525ok, then why write a static site in clojure?
07:55dan_bperhaps you really really like hiccup
07:56ejacksonaugustl: ultimately hiccup/enlive all output html strings, so just figure a way to capture and save those ?
07:56dan_bsimilar things exist in other languages -> https://github.com/mojombo/jekyll/
07:56augustlmichaelr525: mostly just because I want to use clojure
07:56augustlejackson: yeah I guess
07:57ejacksondo it well and release as a library for generating static html pages from clojure:)
07:57augustlmakes sense to have a separate tool for dynamic html page => static html anyways
07:57augustlso that it's reusable
07:57augustlI think wget can only partially do it
07:57augustluh, yeah, what ejackson said :)
07:57michaelr525then why don't you just install clojure at your webhost and run a dynamic site?
07:57ejacksonthere might exist such a thing, i dunno.
07:58augustlmichaelr525: it's no dynamic content (user input etc) so it's easier to host it as HTML
07:58augustlalso, it scales ;)
07:58michaelr525much easier to just throw a dynamic site imho
07:59ejacksonaugustl: Lau Jensen did something like this for his blog a while back, I think he posted about what he did. Might help
07:59dan_bcan't push clojure to a cdn though
07:59augustlsemi related, if I build such a scraping tool with clojure, how would it be distributed? A .jar?
07:59augustlejackson: ah, cool
08:00augustlejackson: http://www.bestinclass.dk/ ? Seems to be a tumblr for the blog
08:01ejacksonhe's subsequently changed it back :)
08:01ejacksonhahaha
08:01augustlheh
08:01augustlthanks for the help, though, I know what to do now
08:01mittchel((fn [x] (clojure.string/join "Hello, " (clojure.string/join x "!"))) "Dave")
08:01michaelr525dan_b: is it a real use case? to host html on a cdn?
08:02mittchelwhy does this give me "!" and not Hello, Dave!
08:02augustl(build my webpage with clojure and optionally find or write a tool to turn any web page to static HTML)
08:08michaelr525mittchel: you can just write (str "Hello, " x "Dave")
08:08mittchel.(str "Hello, " x "Dave")
08:08mittchel,(str "Hello, " x "Dave")
08:08clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0)>
08:09michaelr525&(let [x "something"](str "Hello, " x "Dave"))
08:09lazybot⇒ "Hello, somethingDave"
08:09mittchelbut I actually need a "!" after the "dave" without placing it in the name
08:09mittchelso, Hello, Dave!
08:09foxdonut&(let [x "Dave"] (str "Hello, " x "!"))
08:09lazybot⇒ "Hello, Dave!"
08:11mittchelhm I understand what it does
08:11foxdonut&(require 'clojure.string)
08:11lazybotjava.lang.ClassNotFoundException: clojure.string
08:11foxdonut,(require 'clojure.string)
08:11clojurebotnil
08:11foxdonut,(clojure.string/join "|" ["one" "two" "three"])
08:11clojurebot"one|two|three"
08:12foxdonutmittchel: so join is more for putting a separator in between a bunch of strings
08:12mittchelahh cool :D
08:12mittchelcause I',m trying out this one: http://www.4clojure.com/problem/16
08:13bderooms_is there a way to let clojure use more memory?
08:13foxdonutmittchel: yeah, str is your friend for that one.
08:13mittcheldo I need to use let too for the !
08:14foxdonutmittchel: no, you can just use (fn [x] (str "Hello, " x "!"))
08:14mittchelYea I actually filled that in haha
08:14mittchelworked:P cool
08:17ejacksonbderooms_: you have to pass in a param to the jvm
08:18ejackson-Xmms and friends
08:19ejacksonbderooms_: http://www.devdaily.com/blog/post/java/java-xmx-xms-memory-heap-size-control
08:20ejacksonyou can pass these in via leiningen
08:20bderooms_I passed them to java when calling the jar
08:20bderooms_but it 'seems' to still cap on memory
08:20kaoDbderooms_: it shouldn't
08:20bderooms_my cpu's go at 90 percent, then the memory curve flattens out and the cpu's drop
08:21bderooms_if I give less load, the cpu's work at 99 percent continiously
08:21bderooms_maybe it's not the memory but I'm puzzled..
08:21ejacksondoes sound like memory
08:22kaoDbut maybe you're still hitting memory limits even raising them
08:22bderooms_I gave java -Xincgc -Xmx1024m -Xms1024m -cp clojure.jar:clojure-contrib.jar clojure.main file.clj as argument
08:22kaoDthat should be raising the limits
08:22kaoDso probably you're still hitting them
08:23bderooms_kaoD: if I use thos e settings I don't see a difference. It goes from 959 ram to 1.3 gb ram when I run
08:23bderooms_but 1.3 seems to be the limit
08:23kaoDno wonder: 1024m is about 1.3gb ram
08:23bderooms_shouldn't it go +1gb
08:23bderooms_ah I was assuming the 956 mb is from my OS
08:23kaoD-Xmx2048m -Xms2048m
08:23kaoDthat's 2GB ram
08:23bderooms_that does not work
08:24bderooms_could not reserve enough heap space
08:24kaoDdo you have enough ram to fit it?
08:25bderooms_4 gb
08:25bderooms_32 bit system though
08:25bderooms_well, I actually have 8 gig, but due to the 32 bit I only have 3.2 to allocate
08:26kaoDhmm...
08:26kaoD32bit should be enough for 2gb allocation
08:26bderooms_my friends just suggested I try on our university's server
08:26bderooms_I guess I'll try that
08:26bderooms_64 bit system
08:27kaoDoh, wait a sec
08:28kaoDtry -Xmx2048m -Xms1024m
08:29kaoDalso: incremental GC will lead to poor garbage collection
08:29kaoD(although it will avoid pauses for GC)
08:31kaoDalso: try just -Xmx1850M
08:31mittchelIs anyone able to explain me this one: http://www.4clojure.com/problem/71 ?
08:31kaoDmittchel: sure, although you might wanna go to #4clojure
08:32kaoDmittchel: (__ (sort (rest (reverse [2 5 4 1 3 6])))) is obviously == (-> [2 5 4 1 3 6] reverse rest sort __)
08:32kaoDso you just need some way to get 5 out of those expressions
08:32bderooms_kaoD: same results
08:32kaoD&(reverse [2 5 4 1 3 6])
08:32lazybot⇒ (6 3 1 4 5 2)
08:33bderooms_1450 works
08:33bderooms_!
08:33bderooms_:)
08:33kaoD&(rest (reverse [2 5 4 1 3 6]))
08:33lazybot⇒ (3 1 4 5 2)
08:33kaoD&(sort (rest (reverse [2 5 4 1 3 6])))
08:33lazybot⇒ (1 2 3 4 5)
08:33bderooms_and yey.. we get more memory
08:33kaoDnow it should be easy enough
08:33bderooms_so I guess the defautl was already 1024
08:33mittchelWell it's abracadabra for me what happens there lol
08:34mittchelI know the reverse stuff
08:34kaoDwhat do you mean abracadabra?
08:34mittchelbut I don't know how to solve the problem, cause I don't know what it wants as exceed output
08:34kaoDyou want 5 as output
08:34mittchellike single number 5 or [1 2 3 4 5]
08:34kaoDbderooms_: probably you're hitting your OS limit, although 1450 seems like an odd number to be your limit :S
08:34kaoDmittchel: as I said, the first and second expressions are equivalent
08:34kaoDthat problem is meant to show you that
08:35kaoD-> acts like a simplification there
08:35kaoD(__ (sort (rest (reverse [2 5 4 1 3 6])))) is obviously == (-> [2 5 4 1 3 6] reverse rest sort __)
08:35mittchelah ok
08:35kaoD&(sort (rest (reverse [2 5 4 1 3 6])))
08:35lazybot⇒ (1 2 3 4 5)
08:35mittchelIt's just shorter
08:35kaoD&(-> [2 5 4 1 3 6] reverse rest sort)
08:35lazybot⇒ (1 2 3 4 5)
08:35bderooms_kaoD: was not done testing yet, 1600 also still works
08:35kaoDwhatever you fill in the __
08:36kaoDboth expressions will result the same
08:36kaoDe.g.
08:36kaoD&(first (sort (rest (reverse [2 5 4 1 3 6]))))
08:36lazybot⇒ 1
08:36mittchelwell whatever I fill in there it still gives me errors haha
08:36kaoD&(-> [2 5 4 1 3 6] reverse rest sort first)
08:36lazybot⇒ 1
08:36kaoDhow?
08:36clojurebotwith style and grace
08:36kaoDlol
08:36kaoDwhat kind of errors?
08:36mittchelI should fill in [1 2 3 4 5] rigjt
08:36kaoDnope
08:36kaoDwhy would you?
08:37mittchelargh
08:37mittchelI dont know
08:37mittchellol
08:37kaoDlets go through this again
08:37mittchelI know 2 expressions are the same
08:37kaoDread closely
08:37mittcheland I understand -> is just neater way to right the first expression
08:37kaoDyep
08:37mittchelI just don't understand what to fill on the __ to make it compile
08:37kaoDwell... any function
08:37kaoD(__ (sort (rest (reverse [2 5 4 1 3 6]))))
08:38kaoD__ is the first element of a form
08:38kaoDso it should be a function
08:38kaoDright?
08:38clojurebottechnomancy: you're right I should explain the reason. The reason is I would like to be able to call aether with an extra parameter for introducing my own :transfer-listener.
08:38mittchelI think so haha
08:38kaoDit makes no sense to put a vector there
08:38kaoDso you have this:
08:38kaoD&(sort (rest (reverse [2 5 4 1 3 6])))
08:38lazybot⇒ (1 2 3 4 5)
08:39kaoDthat's your partial result
08:39kaoDBEFORE applying __
08:39kaoDsame goes for the -> form
08:39kaoD&(-> [2 5 4 1 3 6] reverse rest sort)
08:39lazybot⇒ (1 2 3 4 5)
08:39kaoDand since these two forms are ALWAYS the same
08:39mittchelit can be anything
08:39kaoDyour goal is to get them equal to the THIRD part of the if
08:39mittchelah
08:39kaoD(which is 5)
08:40ambrosebsis IFn the correct interface to extend for invocable types?
08:40kaoDand how would you get 5 out of (1 2 3 4 5)?
08:40kaoDambrosebs: IIRC it is
08:40kaoDyou mean invocable like a set, vector, map, right?
08:40ambrosebsyes
08:40kaoDthen it is
08:41ambrosebsdoes it support rest args?
08:41mittchelahh
08:41mittchellol
08:41mittchelSomething with find maybe
08:41kaoDambrosebs: not sure TBH
08:41mittchellet me check clojure cheat sheet:P
08:41kaoDmittchel: find? what the hell?
08:42kaoDokay let's do this again
08:42mittchelfilter?:Pp
08:42kaoDthis is what you have
08:42kaoD&(-> [2 5 4 1 3 6] reverse rest sort)
08:42lazybot⇒ (1 2 3 4 5)
08:42kaoD&(-> [2 5 4 1 3 6] reverse rest sort second)
08:42lazybot⇒ 2
08:42kaoD&(-> [2 5 4 1 3 6] reverse rest sort first)
08:42lazybot⇒ 1
08:42clgv&(ancestors map)
08:42lazybot⇒ nil
08:43clgv&(ancestors (type map))
08:43lazybot⇒ #{clojure.lang.Fn java.lang.Runnable java.io.Serializable java.util.Comparator clojure.lang.IMeta clojure.lang.AFn java.util.concurrent.Callable clojure.lang.IObj clojure.lang.IFn clojure.lang.AFunction clojure.lang.RestFn java.lang.Object}
08:43mittchelahw
08:43mittchelisn't it just last
08:43mittchelsince [1 2 3 4 5] <- last one is 5
08:43kaoDyup
08:43kaoDit is
08:44kaoD&(-> [2 5 4 1 3 6] reverse rest sort last)
08:44lazybot⇒ 5
08:44clgvmittchel: there is also 'nth
08:44mittchellol I actually understand it now
08:45kaoD&(-> [2 5 4 1 3 6] reverse rest sort (nth 4))
08:45lazybot⇒ 5
08:45mittchelthanks a lot kaod
08:45mittchelIt's really easy wants you get it
08:47mittchelbasically what it does is (res(reverse 2 5 4 1 3 6)) so reverse makes it 6 3 1 4 5 2. rest says the first one should be 'skipped' so you keep 3 1 4 5 2. Sort just sorts it to [1 2 3 4 5]. Int he last if it wants to be 5, so if you call last you'll get 5 back.
08:47kaoDyeah, that's itr
08:48kaoDbderooms_: it seems that JVM requires a contiguous memory block
08:48kaoDso you might be running into memory fragmentation
08:50mittchelWhats the difference between -> and ->>
08:52kaoD-> insert as second
08:52kaoD->> as last
08:53gfredericks-<> insert wherever you want
08:53ejacksongfredericks: is that in core ?
08:53kaoDgfredericks: what?
08:53clgvgfredericks: where is that defined?
08:53kaoDlol you all came alive
08:53ejacksonsettle, settle !
08:53gfredericksswiss arrows
08:54clgvthe swiss, again!
08:54gfredericks$google github swiss-arrows
08:54lazybot[rplevy/swiss-arrows · GitHub] https://github.com/rplevy/swiss-arrows
08:55gfredericksha -- I like using the clojars link for "installation"
08:55kaoDmittchel: see this:
08:55kaoD&( -> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9) )
08:55lazybot⇒ ([1 2 3 4 5] 6 7 8 9) nil
08:55gfredericksno keeping versions uptodate in the readme
08:55kaoD&( ->> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9) )
08:55lazybot⇒ (6 7 8 9 [1 2 3 4 5]) nil
08:55clgvclojure 1.4 has no :use anymore?
08:55mittchelso it switches forms basicly?
08:56kaoDmittchel: nope
08:56mittcheldel other forms
08:56mittchelwell*
08:56kaoDmittchel: inserts as second
08:56kaoDor last
08:56mittchelYes and the -> inserts as first right?
08:56bderooms_kaoD: thx for the info
08:56kaoDsecond if you cound the function
08:57kaoD*count
08:57kaoDgfredericks: The Trystero Furcula <- what a name
08:57mittchelWell if you say both inserts as second
08:57mittchelw
08:57mittchelwhat the hell is the difference then
08:58kaoDwhat?
08:58clojurebotWhat is short for ,(doc ...)
08:58kaoD-> second (or first if you don't count the function)
08:58kaoD->> last
08:58jweissi'm a little confused about "lein run" - seems like sometimes it compiles the main namespace for you, other times it expects you to have done it.
08:58kaoDsee the examples again
08:58kaoD&( -> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9) )
08:58lazybot⇒ ([1 2 3 4 5] 6 7 8 9) nil
08:58clgv&(clojure-version)
08:58lazybot⇒ "1.4.0"
08:59kaoD&( ->> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9) )
08:59lazybot⇒ (6 7 8 9 [1 2 3 4 5]) nil
08:59kaoD6 7 8 9 are SEVERAL forms
08:59kaoDit's not a vector
08:59clgv&(->> (ns-publics 'clojure.core) keys (into #{}) 'use)
08:59lazybotjava.lang.ClassNotFoundException: clojure.core
09:00clgv&(->> (ns-publics clojure.core) keys (into #{}) 'use)
09:00lazybotjava.lang.ClassNotFoundException: clojure.core
09:00clgv&(->> (ns-publics (the-ns 'clojure.core)) keys (into #{}) 'use)
09:00lazybotjava.lang.ClassNotFoundException: clojure.core
09:00kaoD&(ns-publics "clojure.core")
09:00lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
09:01clgvhaha lol k
09:01clgvthat changed as well
09:03mdeboard&*ns*
09:03lazybot⇒ #<Namespace sandbox3826>
09:03mdeboard:o
09:03clgv&*ns*
09:03lazybot⇒ #<Namespace sandbox3826>
09:04clgvdamn, we have the same sandbox - dont steal my cake!
09:05hyPiRion&(ns foo) ?
09:05lazybotjava.lang.ClassNotFoundException: clojure.core
09:06duck1123&(in-ns 'foo)
09:06lazybotjava.lang.SecurityException: You tripped the alarm! in-ns is bad!
09:07clgv"The Diamond Fishing Rod" :D
09:08kaoD,(ns-publics 'clojure.core)
09:08clojurebot{sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, unchecked-inc-int #'clojure.core/unchecked-inc-int, ...}
09:08clgv,(clojure-version)
09:08clojurebot"1.4.0-master-SNAPSHOT"
09:08kaoDthere you go
09:08kaoDthey didn't change it
09:08kaoDit worked with the string because... it didn't work
09:08kaoD(oh, the irony)
09:09kaoD,(->> (ns-publics 'clojure.core) keys (into #{}) 'use)
09:09clojurebotuse
09:09kaoD,(->> (ns-publics 'clojure.core) keys (into #{}))
09:09clojurebot#{sorted-map read-line re-pattern keyword? unchecked-inc-int ...}
09:10robertstuttafordargh my eclipse/ccw/leiningen setup is broken. no longer getting leiningen deps appearing in the project. now deleted all of eclipse and its metadata and trying from scratch
09:10robertstuttafordi really should spend some time learning emacs :-/
09:11hyPiRionrobertstuttaford: I have the same issue. With emacs, that is.
09:12robertstuttafordi'm sure emacs is awesome. so many folks can't be wrong. but getting it all set up and comfy seems daunting. fonts, colours, getting the damn thing to properly fullscreen on osx, etc.
09:13kaoDrobertstuttaford: it looks harder than it is
09:13robertstuttafordhaha oh dear
09:13kaoDyou just have to rub the lamp
09:13kaoDand the genie comes out
09:13kaoDand you learn all emacs hotkeys
09:13kaoDeasy-peasy
09:13Fossii'm not gonna rub stallman's lamp
09:14uvtcrobertstuttaford, hyPiRion : this might help: http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html
09:14kaoDFossi: I'm sure he's disappointed :(
09:14hyPiRionbtw, http://mrozekma.com/editor-learning-curve.png
09:14robertstuttafordwoo, thanks uvtc
09:14Fossigotta love the guy, but too much is too much :>
09:14hyPiRionuvtc: thanks
09:14kaoDbtw, he's been in spain recently for a conference
09:14uvtcyw. Hope it's useful to you.
09:15kaoDand he had to leave the conference and go to the hospital
09:15clgvrobertstuttaford: you are using the leiningen plugin already?
09:15kaoDan ambulance came
09:15mdeboardrobertstuttaford: Yes setting up emacs to be the flexible, powerful editor that you can feel comfortable in is indeed a time investment, but very worth it.
09:15robertstuttafordclgv: i followed cemerick's screencast
09:15Fossiread that on /.
09:15clgvrobertstuttaford: I am still waiting for a release before I use it in production
09:15robertstuttafordit said, install this plugin, so i did :)
09:16robertstuttafordi guess i'm paying the price, now
09:16hyPiRionclgv: leiningen plugin for eclipse?
09:16clgvhyPiRion: yes
09:17hyPiRionclgv: Huh, didn't knew it existed. But then again, I'm still stuck in 1.2.
09:18duck1123Emacs is a lot easier now that it was in years past, package-install makes all the difference
09:18hyPiRionI suppose I'll just go straight to emacs though - no need to slow productivity even more.
09:18clgvrobertstuttaford: you should report that issue. it's still alpha/beta at this stage.
09:19michaelr`the general emacs experience is terrible, i've tried using it a couple of times but i just can't make it
09:19robertstuttafordmudphone was kind enough to share this https://github.com/mudphone/clojure_basics/blob/master/emacs_clojure_setup_notes.txt
09:19michaelr`currently using Sublime Text to edit clojure
09:20robertstuttafordis there an emacs rainbow-parens addon?
09:20robertstuttafordi love this about ccw
09:20kaoDmichaelr`: did you try the emacs tutorial?
09:21kaoDrobertstuttaford: yes, there are rainbow parens
09:21duck1123even better, there's paredit
09:21kaoDI had a harder time getting emacs 24 than using it tbh
09:21kaoDI only had 23 in the repos
09:22robertstuttafordparedit in ccw is also awesome
09:22kaoDrobertstuttaford: so you use CCW? how the hell do I start app's -main?
09:22kaoDI seem to only be able to run the REPL
09:22kaoD(which is actually why I left CCW)
09:23kaoD(besides zero Lein support)
09:23clgvkaoD: start the repl in its namespace and type (-main) ;)
09:23uvtcduck1123, I haven't yet used any sort of Emacs package-install. Just apt-get install emacs emacs-goodies-el, and then manual set-up of my config file. Maybe the pkg installer is more useful outside of GNU/Linux?
09:23duck1123My experience with CCW has been "This would be great if I weren't already using emacs"
09:24robertstuttafordkaoD: use yes. until it broke an hour ago
09:24duck1123uvtc: I think it's built into 24 or 23 if you have the starter kit. (also known as ELPA)
09:24robertstuttafordgot to taste the editor <> repl koolaid.
09:24kaoDclgv: seems too complicated for a fucking IDE
09:24kaoDI just want my program to run
09:24uvtcrobertstuttaford, maybe this: http://www.emacswiki.org/emacs/RainbowDelimiters ?
09:24kaoDif you can't give me that, then, what the hell, I'll switch to Emacs
09:25robertstuttafordawesome uvtc!
09:25duck1123kaoD: Can't you set up something with lein run and eclipse's launchers?
09:25clgvkaoD: dont know if emacs explicitel suports running some -main function
09:25uvtcrobertstuttaford, emacswiki.org is pretty much galactic central for all Emacs info. :)
09:25robertstuttafordi guess emacs and lein play nicely?
09:25clgvduck1123: good point
09:25kaoDclgv: but it's got a good lein plugin, which supports "lein run"
09:25robertstuttafordfor instance, i'm now using lein ring server-headless
09:26kaoDduck1123: yep, you can hack it but it feels very unnatural
09:26duck1123robertstuttaford: There's the elein package, but I never use it
09:27kaoDand, what the hell, it was the perfect excuse to try emacs
09:27clgvkaoD: honestly, I only use the -main function when I have a jar. otherwise I'll be using concrete functions I am developing almost all the time
09:27uvtcduck1123, thanks. Will read up on ELPA.
09:27clgvkaoD: choose the environment that suits you ^^
09:27robertstuttafordthe main thing is being able to start a ring server and be able to interact with it via repl, and have that repl be nicely integrated with my editor so i can evaluate forms and so forth
09:27robertstuttafordif i can do all of that within emacs, i'm happy
09:27kaoDclgv: yeah, I usually do incremental development too
09:28kaoDbut it just gets annoying when the IDE gets in the way
09:28duck1123I would highly suggest getting emacs starter kit (even if you're not a starter) it has much better defaults and makes it a better experience
09:28kaoDit should be making my life easier, right?
09:28kaoDrobertstuttaford: you can do that using SLIME
09:28kaoDLein starts a REPL (nREPL, IIRC) and then you jack into it using SLIME
09:28kaoDet voila, full REPL in your running project
09:28robertstuttafordawesome
09:29uvtcduck1123, you mean this <https://github.com/technomancy/emacs-starter-kit/&gt;?
09:29duck1123What I do is run a terminal and run 'lein swank' and then in emacs: M-x slime-connect
09:30duck1123uvtc: yes, but be careful, there's two versions if you have 24 or earlier
09:30robertstuttafordduck1123: do i need lein plugins for that?
09:30duck1123robertstuttaford: to do that, all you need is the swank repl package
09:30kaoDduck1123: isn't M-x slime-jack-in the same?
09:31kaoDand shorter
09:31kaoDand requires no shell
09:31robertstuttafordso i'm going to install emacs 24, emacs-starter-kit, and swank-clojure
09:31kaoD(which speeds up my workflow)
09:31robertstuttafordhttps://github.com/technomancy/swank-clojure
09:31kaoDrobertstuttaford: for some reason I had trouble using ESK
09:31duck1123slime-jack-in also starts the slime, In my workflow I have a server running that I connect to, so jack-in isn't useful to me
09:31robertstuttafordand https://github.com/technomancy/clojure-mode
09:31echo-areaIs there a non-reflective way of getting length of an array in Clojure?
09:32kaoDduck1123: oh, I see
09:32kaoDecho-area: .length?
09:32robertstuttaforduvtc: the keyboard shortcut list on that link you sent is great
09:33echo-area,(let [v (make-array Integer/TYPE 3)] (.length v))
09:33clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: length for class [I>
09:33echo-areakaoD: This won't work
09:33echo-areaI find that only (count array) works, but it's using reflection
09:34clgvecho-area: it is?
09:34echo-areaclgv: It is for array, isn't it?
09:35uvtcrobertstuttaford, thanks. I put in what I thought was most useful. Also, M-n and M-p are my own doing (maybe I missed something, but I don't understand why Emacs doesn't come stock with key bindings for scrolling the window up and down).
09:35echo-areaclgv: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L522
09:36uvtcrobertstuttaford, Also, note that that page doesn't cover the setup described by duck1123 (regarding swank). I haven't tried that myself yet. :)
09:36clgv,(let [v (make-array Integer/TYPE 3)] (Array/getLength v))
09:36clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: Array, compiling:(NO_SOURCE_PATH:0)>
09:36kaoDuvtc: what do you mean? C-v and M-v let you scroll down and up
09:36uvtckaoD, No, I mean up-by-line and down-by-line, not -by-page.
09:37clgv,(let [v (make-array Integer/TYPE 3)] (java.util.Array/getLength v))
09:37clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: java.util.Array>
09:37kaoD there is too
09:37echo-area,(let [v (make-array Integer/TYPE 3)] (java.lang.reflect.Array/getLength v))
09:37clojurebot3
09:37clgvah right
09:37kaoDC-n and C-p if
09:37kaoDIIRC
09:37uvtckaoD, if?
09:37kaoDtypo
09:37uvtcC-n and C-p move the cursor. I mean scrolling the window.
09:37kaoDC-n and C-p, period :P
09:37echo-areaclgv: I guess that's really the only way
09:38kaoDoooh, I see
09:38ldopauvtc: i somehow got into the habbit of navigating via C-s or C-r <string> and then C-l to center the window on the cursor
09:38ldopaand don't miss single-line scrolling at all
09:39uvtcldopa, Yes, I do that all the time as well. (Guess I'm just picky about where the window is scrolled to.)
09:39ldopaheh ok
09:40kaoDuvtc: did you try M-<num lines> C-v?
09:40clgvecho-area: those arrays seem like objects in java but do not seem like real objects on jvm level
09:40kaoDM-1 C-v for instance
09:41kaoDyup, it works
09:41kaoDM-1 C-v scrolls one line down
09:41uvtckaoD, yes (well, actually C-u 1 C-v) ... that's what I bind M-n to. :)
09:41kaoDit's bound by default right?
09:41robertstuttafordnerds, the lot of you
09:41robertstuttaford:)
09:41foxdonutand proud of it!
09:42robertstuttafordi say this from behind the safety of my 3 monitors
09:42uvtckaoD, easier to just tap M-n and M-p than to type those prefixes though. Not sure what you mean, "it's bound by default". I added those bindings to my ~/.emacs. It's noted in http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html .
09:43echo-areaclgv: I see that java.lang.reflect.Array.getLength() is a native method. Is array.length in Java also compiled to that?
09:43echo-areaI don't know how to disassemble Java bytecode.
09:43foxdonutwe're nerds, what are we going to do, whack you with a virtual terminal?
09:43echo-area(yet)
09:44clgvecho-area: try jd-gui
09:44echo-areaOh.
09:45echo-areaThanks!
09:45duck1123I'm sure Rich made counting arrays as fast as he could possibly make it
09:46clgvduck1123: probably. but the shortcut for clojure.lang.Counted wasnt there in 1.2.1 ;)
09:46clgvduck1123: args. maybe confused it with indexed
09:47kaoDuvtc: are you sure? M-<number> is mentioned as a shortcut for C-u <number> in the emacs tutorial
09:47kaoDoh nevermind
09:47kaoDI got you wrong
09:47duck1123of course, if you know that you're getting an array, you could probably go straight for the Array/getLength
09:47kaoDyou meant the shortcut for one-line not for C-u
09:59bhenry1what do i need in my project.clj so i can (import '[org.bson.types ObjectId])
10:00duck1123[org.mongodb/bson "2.7.3"]
10:00bhenrythanks
10:01duck1123Although you'll probably want the full mongo driver and/or a good clojure library for it
10:03robertstuttafordis it bad if emacs 24 crashes when i clojure-jack-in the first time? :-(
10:03bhenryduck1123: just grabbed karras
10:09duck1123bhenry: I like karras because it gives me back all my entities as records. I can then do neat things with them from there. There are a couple of other good ones as well. (congomongo and another one)
10:11bhenryduck1123: karras is the shiz
10:11pandeiroduck1123: what can you do with those records, if u dont mind my curiosity.. i dont tend to use them
10:12acherobertstuttaford: what OS are you on?
10:12ejacksonpandeiro: its a typed map
10:13acherobertstuttaford: and does it crash on only the first time?
10:13pandeiroejackson: i get the concept but i don't think to use them, maybe b/c of limited background using strongly typed langs?
10:13robertstuttafordache: osx. i rebooted emacs and tried again, and it worked this time
10:13robertstuttafordit went nuts compiling something
10:13achedo you think it's fine now?
10:13ejacksonpandeiro: it allows you to have a map participate in Protocols, so you get function dispatch on its type
10:13robertstuttafordseems that way. repl starts up
10:13duck1123pandeiro: mostly, I use them in multi-methods where I dispatch on type
10:14duck1123When I started writing this part, Protocols weren't out yet, and I'm dispatching on more than just the type
10:15achewelcome to emacs. :) i map the most common keystrokes to the f1 f2 etc buttons to avoid key combinations
10:16pandeiroi see, that's the main draw then, dispatching on type
10:17pandeirocoming from a more js background i dont think to use multimethods as much as multiple arity fns
10:17duck1123I think I hit a point where I started using multimethods too much, but it works well for me
10:23robertstuttafordgot emacs 24 up with starter-kit, starter-kit-lisp, clojure-mode and clojure-swank
10:23robertstuttafordlet the learning begin
10:25acherobertstuttaford: make sure you have paredit :)
10:25ejacksonand ibuprofen
10:25robertstuttafordhow do i confirm that i do?
10:25duck1123M-x package-list-packages
10:25robertstuttafordoh i see it on the line
10:25robertstuttaford(Clojure Paredit Slime Fill)
10:25robertstuttafordejackson: -grin-
10:26acherobertstuttaford: also you can run erc and then be on #clojure in the same emacs window
10:27robertstuttafordi have 3 monitors. you guys are off on the left. emacs fills the middle one
10:28duck1123robertstuttaford: C-x 5 2 -- emacs on all the monitors
10:28rhcwhile we're talking about emacs, how the hell do a permanently turn off hl-line-mode or change the color? i tried adding (hl-line-mode -1) to my .emacs.d/init.el and still loads up on startup
10:28acherobertstuttaford: ah. you guys are off to the right because my employer blocks irc and i'm ssh-ing for this
10:30jweissi notice that the difference in compile time of my main namespace is huge, depending on if i do clojure-jack-in in emacs, and then compile the main class in emacs. versus 'lein compile' (which says it is only compiling that one namespace) - lein takes 10x longer.
10:33duck1123jweiss: even though it only says the one, it still compiles all the required namespaces. How are you compiling that main class in emacs?
10:34jweissduck1123: C-c C-k
10:34jweisswhich must also compile all the req'd ns's
10:34jweissor does it?
10:34jweissi would have thought so
10:35jweissi don't see how you can compile any ns without first compiling the deps.
10:36jweissthe jack-in process is slow, which makes me wonder if it's compiling. although it doesn't seem to complain if there are compile problems.
10:36jweissso that made me think it wasn't.
10:37achejweiss: I think in emacs the first compile does do all the dependencies
10:37achejweiss: and thereafter it only has to re-def the things in the current buffer
10:37acheor not "has to" but "only does"
10:38jweissache: yeah, but even the first compile in emacs is way faster than "lein compile". lein takes about 30 seconds. emacs takes about 2.
10:38acheso i think if you changed other buffers and saved them, but ran the compile from one buffer, compile only does that one buffer... that's my guess
10:38achejweiss: interesting. my first compile in emacs is slower than the later ones
10:38duck1123emacs is loading / requiring that namespace, but it's not doing a full AOT compile
10:38jweissache: that's true for me too, the 2nd compile in emacs is a fraction of a second
10:39rhc30 seconds? usually my M-x clojure-jack-in takes about 2-3 seconds
10:39jweissduck1123: ok, can i get leiningen to run my main namespace without AOT'ing it? it doesn't seem to want to do that.
10:40duck1123jweiss: you don't need to AOT to use lein run
10:40duck1123but you do if you want an executable jar
10:40jweissduck1123: yes i do. it will error out with classnotfound (on my main namespace)
10:40jweissif i don't run lein compile first.
10:40jweissmaybe i'm doing something wrong
10:41jweissbut if i do lein clean, run it will not work
10:41jweissif i do lein clean, compile, run it works.
10:41jweisslet me test that again to make sure
10:41duck1123I was having that problem for a while.
10:43jweissok i'm lying, i had that error but lein clean, run does run it (albeit after 30+ seconds of doing something that appears to be compiling )
10:44jweissand in fact my classes dir does have all the class files compiled
10:45jweisseverything has to be compiled one way or another. what is the difference with AOT?
10:46clgvjweiss: no it does not
10:46clgvjweiss: "running" only compiles to files if you bind/set *compile-files* to true
10:46clgvjweiss: you can try that in a repl
10:46jweissclgv: ok so it's all normally done in-memory, which is what i want when i do "lein run". but that is not what i get. i get a classes/ dir full of compiled classes for my whole codebase.
10:47ejacksonjweiss: you don't have a stray :aot :all in your project.clj maybe ?
10:47clgvjweiss: thats probably because you specified a namespace containing a -main method
10:47jweissclgv: yup, how else can i do lein run?
10:48clgvjweiss: the problem is that everything that is used or required in the namespace of main will get compiled even transitively
10:48jweisswill it behave differently in terms of compiling, if i leave it off in project.clj and do lein run -m ...?
10:48jweissclgv: yeah, that appears to be what is happening.
10:48technomancyjweiss: you can do :main ^:skip-aot whatever.ns
10:49technomancyor -m
10:49clgvjweiss: you can try to make a minimal -main method which just does (require 'real-main) (eval `(real-main/-main ~@args))
10:50jweissclgv: that's kinda ugly :)
10:50clgvyeah it is
10:50jweissi'll try technomancy's suggestion first
10:50clgv:skip-aot works in leiningen 1.7.1?
10:53jweissclgv: technomancy: -m does not help, still AOT's everything
10:54michaelr`btw, i think i have the same problem with a noir website and it compiles for 5-7 minutes every time i 'lein run'
10:54clgvyou can also use lein repl^^
10:54michaelr`i tried -m and skip-aot and it didn't help
10:54duck1123I think my record was 15+ minutes for a clean, compile
10:54clgvduck1123: with pre 1.7?
10:55jweiss:main ^:skip-aot my.ns does not work either.
10:55clgv jweiss: I guess thats for lein2
10:55kaoDmaybe you're using something that requires AOT?
10:55jweissclgv: the sample for v1 shows it in the doc
10:55clgvoh
10:55jweisshttps://github.com/technomancy/leiningen/blob/master/sample.project.clj#L90
10:56jweisskaoD: like what? it doesn't get aot'd when i use slime.
10:56clgvjweiss: but clojure 1.2 didnt support ^:kw to ^{:kw true} I thought?
10:57jweissclgv: i'm not sure what lein uses?
10:57jweissis it 1.2?
10:57clgvlein 1.7.1 should be using 1.2.1
10:57jweissi'll try the old style
10:58jweiss(inc clgv)
10:58lazybot⇒ 2
10:58jweissthanks! that did it :)
10:58michaelr`jweiss: what did you do?
10:59jweiss:main ^{:skip-aot true} my.main.ns
10:59jweissthen lein run
10:59jweissdid not write 1000 classfiles, just ran it :)
10:59michaelr`oh
10:59michaelr`doesn't work here
10:59technomancyjweiss: that's sample.project.clj on the master branch, not the 1.x branch
10:59technomancyby "use -m" I mean do that instead of putting :main in project.clj
11:00jweisstechnomancy: i see, i didn't realize master was now 2.0
11:00jweisslast i looked, it wasn't
11:01clgvmaster usually is the snapshot/development version of clojure projects on github
11:01jweissor maybe i thought it wasn't because the readme still referenced 2.0 as beta
11:01clgvafair^^
11:01jweissbut i guess that was a bad assumption on my part.
11:02jweissthe readme on master, i mean
11:04DvyjonesAny idea why line 6 in test.clj fails? https://gist.github.com/e6d3fd431b7699971900
11:04duck1123ok, a clean compile of my project took 6minutes (included updating deps)
11:04DvyjonesThis is the error I get: Caused by: java.lang.ClassNotFoundException: context-io.api.ApiContext
11:06solussdwith korma I'm getting cyclic load errors because my model namespaces are co-dependent- seems like this would be a problem in just about any database driven app using korma with relationships between entities housed in different namespaces. Are we suppose to keep our entire model in one namespace?
11:07TimMcDvyjones: What folder is api.clj in?
11:07TimMc(it should have an underscore)
11:07TimMcDvyjones: Oh... and that should be :import, not import
11:07DvyjonesTimMc: :import gives the same error.
11:08DvyjonesTimMc: Also, the api.clj file is in src/context_io/api.clj. The test.clj file is actually in test/context_io/test/api.clj and the ns is actually context-io.test.api. I can call functions from context-io.api with no problems, if I remove the import.
11:09kaoDit's clojure namespace
11:09kaoDshouldn't it be require then?
11:09kaoDimport is for java classes amirite?
11:09TimMckaoD: defrecords produce classes, not namespaces
11:10duck1123solussd: It sometimes takes careful planning to avoid that, but it is possible
11:10kaoDTimMc: I should've opened the code
11:10TimMcThat would help. :-P
11:11DvyjonesTimMc: All of the code is here: https://github.com/dvyjones/context-io-clj, but without the :import stuff, since that's what I'm adding now.
11:11solussdduck1123: my problem is i have twqo models entities, call them 'a' and 'b' in there own namespaces that refer to each other in a defentity form. is there a solution other than having them share a namespace?
11:12duck1123solussd: I ended up putting all my entities in 1 ns, then I have model namespaces that refer to them, and then a higher level namespace that refers to those
11:12duck1123it can sometimes be a pain
11:13solussdduck1123: interesting, thanks
11:13duck1123solussd: ref https://github.com/duck1123/jiksnu/blob/master/src/jiksnu/model.clj
11:27TimMcDvyjones: Well, I can certainly reproduce that.
11:33TimMcDvyjones: Oh, ugh -- it's the underscores.
11:33TimMcOr lack thereof.
11:33TimMcDvyjones: (:import context_io.api.ApiContext)
11:35djue2012Hi, I'm having trouble with lein install plugin on windows (7 x64)
11:36TimMcWHat version of lein?
11:36djue20121.7.1
11:36djue2012java 1.6.0_21
11:37djue2012i'm running as admin, but the stack trace is showing Caused by: java.io.IOException: Couldn't delete C:\Users\djue\AppData\Local\Temp\lein-14755f9c-f50e-451f-af04-0c3561761258\lib\cdt-1.2.6.2.jar
11:37djue2012it's like it doesn't have permissions to delete the files or something
11:37TimMcThe file is probably in use. Windows won't let you delete those.
11:37djue2012hmmmm
11:38djue2012maybe my virus scanner is holding onto it and lein is too fast :)
11:38TimMcWhy run it as admin? It'll work fine in non-privileged mode.
11:39djue2012i tried in non priv and it wasn't working
11:39djue2012i thought using runas on the cmd line might help
11:39djue2012no difference, same error
11:40djue2012lemme try disabling any rt virus scanner stuff
11:43djue2012ah i see
11:43djue2012it's saying the file is open in java.exe
11:43djue2012the cdt-1.2.6.2.jar
11:47djue2012hehe
11:47nDuff(although IIRC, NTFS added support for unlinked inodes, so it's just a backwards-compatibility piece of silliness that the API functions don't allow it still)
11:53djue2012oh well. I updated an existing open ticket. https://github.com/technomancy/leiningen/issues/252
11:53DvyjonesTimMc: That worked. Thanks!
11:54clgvis there a midje checker to check a value to be in a given domain?
11:54djue2012thanks tim and nDuff
11:55clgve.g. => (just [...G... (in-domain #{'e1 'e2 'e3})])
11:56duck1123clgv: checking against the raw set doesn't do it?
11:56clgvduck1123: how would you write that? I tried several versions
11:57duck1123=> #{'e1 'e2 'e3} or => #(#{'e1 'e2 'e3} %)
11:58clgvdont forget the vector^^
11:58clgvwith the vector the first does not work
11:59clgvthe second works but is not that readable..
12:00duck1123is the left-hand side a single value?
12:01clgva single function call, yes
12:01clgvor do you mean ...G... ?
12:01duck1123I mean, is it returning a single symbol in this case? I don't get what you mean about the vector
12:02clgvthe function returns a vector like [...G... ...e...] but ...e... has to be from a given set of values
12:03duck1123(partial every #{'e1 'e2 'e3}) perhaps?
12:03clgvprobably not: ##((partial every #{'e1 'e2 'e3}) 'e1)
12:03lazybotjava.lang.RuntimeException: Unable to resolve symbol: every in this context
12:03clgv&((partial every? #{'e1 'e2 'e3}) 'e1)
12:03lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
12:05duck1123&((partial every? #{'e1 'e2 'e3}) ['e1 'e3])
12:05lazybot⇒ true
12:05clgvwell [...G... #(#{'e1 'e2 'e3} %)] works. but I thought there would be something readable built in
12:08duck1123if you're using the latest midje, you could probably build something straightforward using every-checker
12:10clgvduck1123: not really. ...G... in the first position is no sequence and something different from the second position where the domain is limited
12:10devnJust got my copy of Let Over Lambda
12:10devncolor me excited
12:11clgvgotta go. see ya
12:12espeedI'm in the process of learning macros, and I'm getting a NullPointerException when trying to use macroexpand-1 (https://gist.github.com/2702934)
12:17uvtcIs standard procedure for getting Emacs 24 on Ubuntu/other-buntus pretty much to add-apt-repository ppa:cassou/emacs?
12:19hdevalenceHow do I add a local git repository as a lein dependency?
12:21kaoDuvtc: that's how I did it
12:22kaoDadd-apt-repository ppa:cassou/emacs -> apt-get install emacs-snapshot emacs-snapshot-gtk
12:23uvtckaoD, Thanks. I'm looking at technomancy's emacs-starter-git and thinking maybe it's time. :)
12:23kaoDit's cool once you get it
12:23kaoDjust make sure you follow the basic emacs tutorial
12:23kaoDeven before messing with clj
12:25uvtckaoD, I know basic Emacs. Just haven't ever used swank (nor the new Emacs package management)
12:26uvtckaoD, There's a fair number of moving parts. :)
12:27technomancythe starter kit is just fixing some bad defaults in Emacs
12:27technomancyif you already know how to customize Emacs you can get all the benefit just from taking a look at what it does and trying out some of the features it enables for yourself
12:30espeedI'm in the process of learning macros, and I'm getting a NullPointerException when trying to use macroexpand-1 (see http://stackoverflow.com/questions/10604875/why-am-i-getting-a-nullpointerexception-when-executing-macroexpand-1-on-this-clo)
12:36uvtctechnomancy, I don't know much elisp. It would be helpful if there were a wiki page at the emacs-starter-kit github page that simply listed what you get when you `M-x package-install starter-kit`.
12:37technomancyuvtc: yeah, that's a good idea. the starter kit is kind of in hibernation right now though.
12:37uvtctechnomancy, hm. Why is it currently in hibernation mode?
12:38technomancyuvtc: because it's more or less done
12:39technomancyin a perfect world, the starter kit wouldn't exist; Emacs would just work better out of the box
12:44dnolenespeed: config is not a map at that point in the macro - it's just a symbol.
12:47espeeddnolen: thanks. What should I be doing instead?
12:48dnolenespeed: untested, did you try `((ns-resolve (:ns config) 'create-vertex) config data) ?
12:51jappy123does ^ints serve as a type hint for single and multi-dimension int arrays? or are they differenciated? perhaps it doesn't care about the inner arrays?
12:51clojure-newcomerHi guys, newcomer to Clojure here, looking for a bit of help with a very basic task
12:52TimMcespeed: As someone else answered on SO... maybe you just need a function, not a macro?
12:53uvtcHi clojure-newcomer. You can just ask. :)
12:53clojure-newcomeruvtc: Hi, will do
12:53clojure-newcomerI am trying to loop over return from file-seq and print every file name, sample at : http://pastebin.com/t6Fe575J
12:54espeedI was trying to avoid repeated calls to (ns-resolve) -- should I not be concerned with that?
12:54clojure-newcomerwhile the commented out line prints the entire collection happily… the line above it does not seem to do what I am trying to do
12:56OwenOuhi guys, what's the state of the art of building db backed web app in clojure? noir and korma?
12:58dakroneclojure-newcomer: (for ...) is lazy, so that may be your problem, what are you wanting to do that it's not doing?
12:58uvtcclojure-newcomer, `for` is for creating new lists. Maybe you want do-seq?
12:58babilenclojure-newcomer: You want doseq in lieu of for there (you want to force side-effects) -- for is lazy.
12:59clojure-newcomerthanks guys, appreciate it, I'll give it a go
12:59technomancyOwenOu: more or less
13:00technomancyassuming you want a relational DB
13:00OwenOutechnomancy: if you are building a web app, what would be your tech stack? any suggestion would be appreciated
13:01espeedTimMc: Thanks -- I see now.
13:01technomancyOwenOu: there's no one-size-fits-all solution
13:01technomancyfor databases especially
13:02technomancyalthough postgres comes pretty close if you know you'll never outgrow a single node now that you can have schemaless tables
13:04technomancybeen meaning to take a closer look at postgres with hstore
13:04duck1123as far as db access goes, korma is a big load of awesome
13:05technomancyI am not the right person to comment on web apps though
13:06jappy123is the best I can do for a type hint at multidimensional int arrays ^ints? will this result in reflection still being done on a java method call that accepts a two dimensional int array
13:06hiredmanjappy123: ^ints is an array of ints, but arrays on the jvm are one dimensional, so your "multidimensional" array is really an array of arrays
13:07dnolenjappy123: if you call class on your multidimensional primitive array it'll give you a class string you can use for type hinting.
13:08TimMc&(class (into-array [(into-array Integer/TYPE [])])) ;; jappy123
13:08lazybot⇒ [[I
13:08dnolenso ^"[[I" will work
13:08jappy123perfect TY!
13:08TimMc&(.getCanonicalName (into-array [(into-array Integer/TYPE [])]))
13:08lazybotjava.lang.IllegalArgumentException: No matching field found: getCanonicalName for class [[I
13:08TimMc&(.getCanonicalName (class (into-array [(into-array Integer/TYPE [])])))
13:08lazybot⇒ "int[][]"
13:09TimMc^ the "human-readable" version
13:09duck1123but you can't type hint with that, can you?
13:10TimMcNah.
13:11dgrnbrgIs there a way to get a lazy seq of a string split on a character?
13:13hyPiRionwhat do you mean by split on a character?
13:13hyPiRion##(re-seq #"c" "acdcb")
13:13lazybot⇒ ("c" "c")
13:13hyPiRioner.
13:14hyPiRion&(re-seq #"[^c]*" "acdcb") should work
13:14lazybot⇒ ("a" "" "d" "" "b" "")
13:14hyPiRion+ then. I hate regex.
13:15hyPiRion&(re-seq #"[^c]+" "acdcb")
13:15lazybot⇒ ("a" "d" "b")
13:16dgrnbrghyPiRion: I see, thanks--I was using clojure.string/split, which is eager
13:32hyPiRionIs it possible to destructure a hash set? e.g. (let [[a b] #{:c :d}] do-stuff)
13:39progoyou could seq it first... But sets have no order so you don't know what you're getting
13:46mmarczykdnolen: ping
13:51TimMcdgrnbrg: Do you want empty substrings? e.g. split "accb" on \c
13:52dnolenmmarczyk: pong
13:52mmarczykdnolen: hi
13:52mmarczykdnolen: I've posted a patch for cljs-255 and will post one for 256 in a moment
13:53mmarczykdnolen: if only nil were not counted -- but alas, in Clojure (nth nil whatever) => nil, which looks like a bug, but...
13:54dnolenmmarczyk: I'm skeptical about some of the extend-type's around nil
13:54mmarczykdnolen: my gut feeling is that IIndexed should be removed
13:54dnolenmmarczyk: I'm not against moving the nil handling into the relevant fns.
13:54mmarczykdnolen: then the linear traversal helper would be used and throw -- correctly, IMO
13:54mmarczykdnolen: but that's not how it is in Clojure
13:55mmarczykdnolen: alternative solution -- handle nil explicitly in nth with a (when (coercive-not= nil ...) ...)
13:55dnolenmmarczyk: that's what I'm suggesting.
13:55mmarczykdnolen: oh right
13:55mmarczykdnolen: ok, so I'll do that and 256 will magically go away
13:55dnolenmmarczyk: a lot of the extend-types are there for the world prior to a fast satisfies and coercive-not=
13:56mmarczykdnolen: ...and in the present brave new world should retire peacefully :-)
13:56dnolenmmarczyk: I think so, it also speeds up nil handling.
13:56mmarczykdnolen: I've been thinking about proto method inlining, btw -- regrettably I'm seriously overloaded this week
13:57dnolenmmarczyk: having to go through protocols to handle nil stinks.
13:57dnolenmmarczyk: np
13:57mmarczykdnolen: I've been thinking though
13:57mmarczykdnolen: about possibly trasmitting info from satisfies? "upwards" / "outwards"
13:57mmarczykdnolen: or onwards, I guess
13:57dnolenmmarczyk: well it doesn't stink, it keeps the code cleaner - but you get stuff which doesn't make sense to me - (indexed? nil) => true, (counted? nil ) => true
13:57mmarczykdnolen: so that if we say (satisfies? IFoo bar) in if's test, then the branches know what we found out
13:58mmarczykdnolen: precisely
13:59mmarczykdnolen: I can live with counted semantically -- the current linear helper for count actually assumes that, though I guess that should change maybe? -- but indexed makes no sense to me
13:59mmarczykdnolen: in fact, why is (nth nil 5) nil rather than an error?
13:59mmarczykdnolen: (but that's what happens in Clojure too)
14:00dnolenmmarczyk: yeah we shouldn't stray from Clojure behavior.
14:01dnolenmmarczyk: re: transmitting satisfies? information. If we're going to handle that I think it should be more deeply integrated in the compiler.
14:01mmarczykdnolen: oh, definitely
14:01dnolenmmarczyk: but before we do that we should see if inlining results in any perf win at all.
14:02dnolenmmarczyk: but yes basically with in the true branch we can tag the symbol with whatever protocol it satisfies, and call the protocol method directly.
14:03mmarczykdnolen: would be nice if that information got propagated as far as possible
14:03rmacHi guys, is there a library for handling the security implications of using Clojure as a configuration format, or guides to help out if I want to go down that route ?
14:04dnolenmmarczyk: that information could flow in the usual way across binding forms.
14:04TimMcrmac: I think just binding *read-eval* to false is sufficient.
14:05TimMcrmac: Or are you looking to have scripting available?
14:05mmarczykdnolen: right
14:05dnolenmmarczyk: so 255 ready to go?
14:05mmarczykdnolen: yes
14:05rmacTimMc: no, I don't need scripting… to start just read only config
14:05mmarczykdnolen: btw, I don't suppose you'll be going to EuroClojure?
14:06rmacTimMc: are there any good examples you would point to ?
14:06dnolenmmarczyk: don't think so
14:06TimMcrmac: Leiningen's project.clj, sort of.
14:07mmarczykdnolen: ah, that's a shame
14:07TimMcdefproject is a macro, but you could just allow a map of stuff.
14:07mmarczykdnolen: some other time.
14:08rmacTimMc: I saw a presentation recently, about Clojure being used in a bank, they ended up using RDF for config instead due to security worries about the eval possibilities with Clojure config
14:08eggsbylol
14:09hyPiRionHarr. Is there a lazy equivalent of group-by in Clojure?
14:09TimMcrmac: Did they have concerns other than *read-eval*?
14:09hyPiRionTurns out that creating two lazy seqs out from a single one is not only messy, but rather hard without looping through the sequence twice.
14:10hyPiRion;(
14:10rmacTimMc: unsure of the specifics… just a fear generally of 'Turing-complete' protocols and file formats being used for config
14:10TimMc,```````````foo will error out, but that's all I can think of
14:10dnolenmmarczyk: sounds like a lot of fun!
14:10dnolenmmarczyk: 255 fixed
14:10clojurebotExecution Timed Out
14:10mmarczykdnolen: yes, I'm really looking forward to it :-)
14:11mmarczykdnolen: writing commit message for 256 now
14:12TimMchyPiRion: The outer data structure is a map, so you'd have to use a lazy map...
14:14amalloyhyperboreean: it's not really possible to do lazily in an eager, immutable language
14:15mmarczykdnolen: patch posted on 256
14:19dnolenmmarczyk: applied
14:20mmarczykdnolen: cool
14:29neotykhello everyone!
14:29hyPiRionHello
14:32neotykdnolen: could you look at https://github.com/happyhacking-nl/clojurescript/commit/77521c6a431c1857fc1882b897858b7e48e5ac49 in context of CLJS-204 ?
14:34dnolenneotyk: -compareTo -> -compare
14:34dnolenneotyk: also don't use list comprehension
14:34dnolenneotyk: comparison is performance sensitive
14:35dnolenneotyk: if you do that feel free to attach a patch to 204
14:35neotykdnolen: what should I use there then?
14:35dnolenneotyk: loop/recur probably
14:35neotykdnolen: ack
14:35dnolenneotyk: lazy sequences are insanely slow in CLJS - even when get to chunked seqs they aren't going to beat loop/recur
14:35neotykdnolen: also, should I add all collections to participate in IComparable?
14:36dnolenneotyk: I don't know, I haven't look closely at 204, what does Clojure do?
14:36neotykdnolen: it relies on Comparable of Java
14:37dnolenneotyk: but for which collections? all of them?
14:37amalloyneotyk: i don't think you should; ISeqs aren't comparable in clojure
14:37mmarczykIComparable, great :-)
14:37amalloy&(compare (range 3) (range 3))
14:37lazybotjava.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.Comparable
14:38mmarczykneotyk: maps and sets are not comparable in Clojure
14:38neotyk&(compare [1 2] [1 1])
14:38lazybot⇒ 1
14:38dnolen&(compare (int-array [1 2]) (int-array [1 1]))
14:38lazybotjava.lang.ClassCastException: [I cannot be cast to java.lang.Comparable
14:38neotykmmarczyk: so it is vectors only?
14:39neotykmmarczyk: well, PersistentVectors :-)
14:39mmarczykneotyk: well, symbols and keywords seem to have impls
14:40amalloyneotyk: the clojure classes which implement Comparable are: vector, keyword, ref (really?), ratio, and symbol
14:40mmarczykneotyk: so you might want to have a look at those and maybe do sth special for them in the string impl
14:40mmarczykneotyk: ref
14:40amalloymmarczyk: nah, string compare will just work in js, won't it?
14:41neotykstring is part of IComparable now
14:41mmarczykamalloy: well, not necessarily
14:41mmarczykamalloy: neotyk: syms/keys might deal with the namespace part and the name part separately
14:41dnolenmmarczyk: we already do garray/defaultCompare
14:41dnolenmmarczyk: so I think all we need is the (satisfies? IComparable ...) test to come before that.
14:42neotykdnolen: it is implemented exactly like that
14:43mmarczykdnolen: sure
14:43amalloymmarczyk: i suppose it could, but (a) the natural string compare is going to do what you probably want anyway, and (b) i think all you really need is any consistent ordering; it doesn't matter much what that ordering is
14:43dnolenneotyk: so does garray/defaultCompare do the wrong thing with bool, string, etc?
14:43mmarczykneotyk: looking at your patch now -- did you teach cljs.core/compare to use -compare when possible? I might be missing it
14:43neotykdnolen: not sure, didn't test
14:44dnolenneotyk: you should test and possibly remove - garrya/defaultCompare probably has a lot less indirection.
14:44neotykmmarczyk: yes: https://github.com/happyhacking-nl/clojurescript/commit/77521c6a431c1857fc1882b897858b7e48e5ac49#L0R917
14:44mmarczyk&(compare 'foo/quux 'foobar/quux)
14:44lazybot⇒ -3
14:45mmarczyk-1 in cljs currently
14:45mmarczykneotyk: ok, thx!
14:46mmarczykamalloy: yeah, I guess so
14:46amalloyneotyk: have you thought about the possibility of asymmetric comparisons across types? like (compare true 0) returning 1 and (compare 0 true) also returning something positive?
14:46neotykamalloy: not at all
14:46mmarczykamalloy: unless there's any need for compare to be consistent across platforms, but that's probably impossible anyway (would clash with native compare some places probably?)
14:46dnolenamalloy: that's not allowed in CLJS anyway
14:46dnolenamalloy: types must match
14:46amalloydnolen: great
14:47amalloydnolen: do you happen to know where the code that enforces that is? i'd be interested to take a peek
14:48dnolenamalloy: http://github.com/happyhacking-nl/clojurescript/commit/77521c6a431c1857fc1882b897858b7e48e5ac49#L0R919
14:48goodieboywhat is the cleanest way to turn a map into a list?
14:48amalloy&(seq {1 2 3 4})
14:48lazybot⇒ ([1 2] [3 4])
14:48goodieboyamalloy: ahh ok, sorry i meant, flattened?
14:49amalloy&(apply concat {1 2 3 4})
14:49lazybot⇒ (1 2 3 4)
14:49neotykwhy in cljs there are cljs and clojure ns?
14:49goodieboyamalloy: damn, that's pretty clean. thanks!
14:49dnolenneotyk: probably because of namespace masking problem.
14:49dnolenneotyk: top level ns segments can be shadowed by locals.
14:50dnolenmmarczyk: speaking of which, I like my latest idea for a solution to that.
14:51neotykdnolen: I don't quite understand it, is there a gist that exposes this problem?
14:51amalloyneotyk: the cond in (defn compare ...) should probably be an if now that you've added that first clause, to avoid calling type twice on each arg
14:52dnolenneotyk: it's simple. (ns foo.bar) (defn baz [foo] ... everything in foo now shadowed ...)
14:52mmarczykdnolen: indeed, very clean solution for locals
14:53mmarczykdnolen: there's still the issue of top-level names clashing with ns names though
14:53neotykamalloy: (if (types ..) (if (satisfies? ..) .. ()) (cond ..))
14:53neotykamalloy: ?
14:54amalloyyeah, that's what i was aiming for
14:54dnolenmmarczyk: ?
14:54goodieboywhat's the cleanest way to check if something is either true or false?
14:54mmarczykdnolen: that's cljs-180, right?
14:55jtoyis this the recommended way to do opts for functions?
14:55jtoy(defn foo
14:55jtoy ([] (foo "bar"))
14:55jtoy ([s] (........)))
14:55dnolenmmarczyk: the locals issue yes.
14:55dnolenmmarczyk: not sure I follow about the top-level names clashing with ns names.
14:55hyPiRiongoodieboy: I think (or (true? a) (false? b)) is okay?
14:55mmarczykdnolen: so yeah, I like the locals solution
14:56mmarczykdnolen: I'd also like to prevent foo.bar/quux from clashing with foo.bar.quux
14:56mmarczykdnolen: ideally
14:56hyPiRionYou could eventually do some sort of hackish way, like (some? #(% a) [true? false?])
14:56hyPiRion*some
14:57mmarczykdnolen: but that is a totally different problem (in particular because it has interop implications)
14:57goodieboyhyPiRion: ahh yeah, some works
14:57dnolenmmarczyk: not sure I follow, what is foo.bar.quux?
14:57mmarczykdnolen: a namespace
14:57neotykgoodieboy: something is always true? or false?
14:57dnolenmmarczyk: ah right.
14:58goodieboyneotyk: yes, and well, sometimes nil
14:58goodieboybut i only care about true or false
14:58neotyk$(if nil :a :b)
14:58neotyk#(if nil :a :b)
14:58amalloy&(if nil :a :b)
14:58lazybot⇒ :b
14:59neotykgoodieboy: like booleans?
14:59goodieboyneotyk: exactly
14:59goodieboyi guess i was hoping to find bool? or something in core
15:00neotyk&(map boolean [nil 1 '() true false])
15:00lazybot⇒ (false true true true false)
15:00neotyknah
15:02hyPiRiongoodieboy: Actually, more idiomatic would be ##(#{true false} 'foo)
15:02lazybot⇒ nil
15:02amalloyhyPiRion: cute, but broken
15:02hyPiRioner, nevermind, it will return true or false ;(
15:04goodieboyhyPiRion: exactly! using a set was my first thought too
15:05gfredericks&(contains? #{true false} 'foo)
15:05lazybot⇒ false
15:05gfredericks&(contains? #{true false} false)
15:05lazybot⇒ true
15:05hyPiRiongfredericks: good one.
15:05gfredericks(def bool? (partial contains? #{true false}))
15:06goodieboygfredericks: contains? thanks!
15:07mmarczykdnolen: do we know top-level names coming from the JS side? "goog", say?
15:12gfredericksalse (def bool? (some-fn true? false?))
15:16dnolenmmarczyk: we don't, solving real JS problems is a non-goal I think.
15:18dwierengais there a a way to tell lein to load the mysql jdbc driver too? it loads clojure.java.jdbc fine but not the mysql driver
15:19duck1123dwierenga: add it to your dependencies
15:19mmarczykdnolen: actually why not just gensym all params? let-bound locals are all gensym'd now and (let [cljs :foo] cljs.core/reduce) works fine
15:20dnolenmmarczyk: yucky
15:20mmarczykdnolen: how come?
15:20dnolenmmarczyk: I'm only interested in solving inter CLJS clashes
15:20dnolenmmarczyk: we don't care about external libs - users can figure that out for themselves.
15:21mmarczykdnolen: well, caring about them won't make things more complicated here
15:21mmarczykdnolen: anyway, fn params are the only type of locals with no gensymming currently
15:21dwierengaduck1123: thanks but i'm not sure how. i only got clojure.java.jdbc loaded because of the instructions on the github page
15:21mmarczykdnolen: only munge
15:22dnolenmmarczyk: only partly true
15:22dnolenmmarczyk: let doesn't gensym unless you reuse a binding.
15:23dnolenmmarczyk: if we get some robust source mapping support this may be worth pursuing - but not until then.
15:23mmarczykdnolen: actually I just said #(let [asdfasdf :foo] 123) in Rhino
15:23zakwilsonSo from what I'm seeing in this clojure.core blog post, reducers.map is supposed to be parallel. That doesn't seem to be the behavior I observe when I use it on a vector.
15:23mmarczykdnolen: asdfasdf is gensym'd
15:24xeqidwierenga: [mysql/mysql-connector-java "5.1.6"] should work
15:24amalloyzakwilson: you need to use a large vector and make sure to call fold
15:24amalloyeg, (fold + (reducers/map inc (vec (range 1e6)))) should start up a bunch of threads
15:25dwierengaxeqi: just what i needed, thanks!
15:26zakwilsonOh, it only works if you call fold on it? I must admit to some lack of understanding.
15:27dnolenmmarczyk: oh yeah, you are right about let.
15:29zakwilsonHow large a collection do I need to see this?
15:29dnolenmmarczyk: still I think it wasn't done for a reason - to support existing JS tooling
15:30amalloyzakwilson: by default fold splits up into chunks of 512
15:30amalloy(ish)
15:30amalloyso a couple thousand elements would be enough to start a few threads
15:30zakwilsonI just tried it with 5000 elements and saw only one CPU busy and no speedup over reduce/map
15:30mmarczykdnolen: ?
15:30dnolenmmarczyk: if someone decides to use CLJS as a regular old JS lib - they get cljs.core.first(coll_4857) as the signature which is gross.
15:31mmarczykdnolen: well, that someone should use mori :-)
15:31dnolenmmarczyk: they'll still get that signature.
15:31zakwilsonAnd I do see both cores busy and a speedup using useful/pcollect.
15:31mmarczykdnolen: ah, yeah, I guess
15:32dnolenmmarczyk: also any other target will suffer from this problem as well.
15:32amalloyzakwilson: i haven't seen any code yet, so i can't really help with "something doesn't work and i don't know why"
15:33mmarczykdnolen: it does work though, it only looks weird
15:33mmarczykdnolen: but then
15:33dnolenmmarczyk: in Scheme, I'm not sure anyone will want to see (nth coll-4867 i-187 not-found-101)
15:34mmarczykdnolen: I guess the simple answer to my question re: our knowing about goog etc.
15:34mmarczykdnolen: is that if someone intends to use a JS lib, they still need a :require
15:34mmarczykdnolen: so no reason at all to be worried
15:35mmarczykdnolen: or make things ugly
15:35dnolenmmarczyk: oh yes that too.
15:36mmarczykdnolen: which means your approach is absolutely the one to take
15:36mmarczykdnolen: since we don't even have to gather new info
15:37zakwilsonamalloy: http://pastebin.com/bw4VgE1t
15:37amalloywell uh...repeat and take produce lazy sequences, not reducibles
15:37amalloyseriously, try it on a vector
15:38zakwilsonOh. Yes, that's a little better.
15:38amalloy(repeat and take *can* produce reducibles, but that's not implemented yet)
15:39hiredman"could"
15:39amalloya better word choice, indeed
15:41amalloy(although, reducers/take does exist, and there's already a patch adding repeat)
15:42mebaran151hey #clojure, how do I add tool.jar to the classpath in lein2?
15:42mebaran151something that I can add to my profile.clj?
15:44BAWKINGLuyt mabes fmeyer_ duck1123 Lajla mebaran151 inmist mrSpec jimduey tmciver halgari jcromartie wilkes ordnungswidrig1 Wild_Cat mye_ zx80 zxcxzc hanDerPeder daviddpark jwpalmer ystael cafesofie mbriggs dajac elliottw jcrossley3 Licenser h0bbit BeLucid_ jtoy meisterluk bradfordw hiredman aaelony arohner neotyk mprentice zane ilteris_ ambroff devth zamaterian bryancp OlegYch|h sytch thearthur chewbranca phi
15:44BAWKINGrsch_ iwillig Eldariof-ru rmac rodrigovieira
15:44BAWKING* Users on #clojure: jasonbray mishok13 c0rn S11001001 gridaphobe tensorpudding tibbe dreish carllerche perezd Borkdude gtrak` gozala juhu_chapa OwenOu scriptor AimHere jappy123 kumarshantanu brandonz aperiodic dryman cataska_ lazybot lstoll etherdev metajack rmarianski Speed` nrichards mritz jsabeaudry_ ieure ernst strmpnk_ jweiss_ Bronsa rlb cacodaemon zodiak mengu dan`b prip lopex jlf christi
15:44BAWKINGanberg silven lobotomy rodnaph ggreg ppppaul rhc worrelsik1 cesario__ jodaro
15:44BAWKING* Users on #clojure: JorgeB thorwil tbatchelli djue2012 tuubow_ dnolen sorenmacbeth uvtc zuzkins mefesto gsav wkmanire ejackson xeqi jimt artefon DuoSRX jbomo goodieboy achin kovasb kschrader pcavs apwalk gtrak ssedano octagon jayunit100 ConstantineXVI Tristam pandeiro olauzon hhutch dgrnbrg ldopa pelleb nighty- ChiralSym kcin jonaskoelker enebo _KY_ luigy tscheibl jmolet dakrone gary_poster Chi
15:45BAWKINGron beffbernard bruges mmarczyk technomancy jhulten cola_zero Sigma Zolrath
15:45BAWKING* Users on #clojure: fliebel wookiehangover PeregrinePDX xmux baoist seancorfield hoeck1 timonv konr yacin jamiei puchacz rippy thickey septomin philr vsayer ejlo saint_cypher helgikrs jmatt joegallo bhenry krunaldo Ash WuTangTan ktsuji Killeroid jappinen_ ssideris clojurebot apoc alvis midrangio arnihermann__ creidiki_ dotemacs trescenzi srid_ SeanTAllen tfnico_ si14 Scorchin Crowb4r reiddraper
15:45zodiakthat's one annoying bot
15:45BAWKING voodootikigod beawesomeinstead xrl jltrim_ fukushima FDFlock mikem kingtim
15:45BAWKING* Users on #clojure: ipostelnik tncardoso mel0on Blazeix bderooms_ ache Madsy edw wwitb kaoD terom hyPiRion gravity oskarth matessim JoshAshby
15:45gtrakBAWKING: what are you doing...
15:45jtoya shitty bot
15:45eneboI bawk at bawking!
15:45zodiakcan you verb his name like that ?
15:45Bronsacool, i'm on #clojure
15:45BAWKING* Users on #clojure: ipostelnik tncardoso mel0on Blazeix bderooms_ ache Madsy edw wwitb kaoD terom hyPiRion gravity oskarth matessim JoshAshby calvados EzeQL broquaint nsxt nighty^ ahihi2 TDJACR jetlag dan64 LeNsTR reprisal TakeV cbad jave hyko fooc bobry TimMc jdp_ amro al-ol_ scottj karnowski gfredericks sattvik pushp0p hcastro pipeline ryland winkywooster locojay zaphar_ps LoganLK acagle augu
15:45BAWKINGstl alek_b algernon rafl scgilardi dnm bweaver EToS wyan anekos xian zaargy
15:45BAWKING* Users on #clojure: _ulises muhoo almaisan-away metellus rbranson wink srcerer spjt _janne frankvilhelmsen Gonzih lucian espeed rcj_ serpent213 shajith jeremyheiler bradwright LauJensen brainproxy cmbntr aniero danlarkin mrb_bk mccraig raph_amiard TristamWrk kraft_ tos9 blakesmith joshbohde sramsay ericthorsen henrygarner eno dsantiago yonkeltron pbuckley Yamazaki-kun chouser TheDudeKnows joste
15:45TimMcGriefer or n00b, just .ignore it.
15:45BAWKINGink altivec drewr progo tvaalen_ katratxo pyykkis Iceland_jack Chousuke
15:45BAWKING* Users on #clojure: grim_radical omni5cience austinh hugod groundnuty marmae_ Guest35406 DerGuteMoritz jedi magnars Munksgaard dwierenga ninjudd lancepantz krig ozzloy rcs robink adamspgh @ChanServ geoffeg Raynes brixen djahandarie nlogax maio sjl loomcore_ tcrawley mjhan_ nuba rossabaker nDuff the-kenny boyscared TheBusby webben groot seanm tauntaun gf3 rkz helino zyfo_ nuclearsandwich chipdud
15:45dreishGive it a rest, bawking!
15:45matessimWat
15:45BAWKINGe yason erewhon leathekd beepboop devn mrowe thheller- tlockney zerokarmaleft
15:45BAWKING* Users on #clojure: ibdknox Derander_ aravind_ kral|off cfa ivan` _ato amalloy zakwilson Dyresen brweber2_ johnkpaul aking_ replaca_ rdd anthracite wdouglas hive-mind tmarble nickmbailey sirn gmcabrita vandemar hyperboreean ivan\ pyrtsa SHODAN eggsby rmunn dleja bioc tolja kanru pjstadig TheMoonMaster rowth twem2 marchdown jeffrubic raek leafw derrida _tca andrewclegg flashingpumpkin rotty_ noi
15:45matessimWho dares ping me
15:45BAWKINGdi_ ajsharp_zz mtd_ ernestas jeekl Anusko jimi_hendrix wtetzner Miko2 fhd
15:45oskarthwhats up
15:45BAWKING* Users on #clojure: geoffeg_c rahcola ivan fmu Cr8 arkx JStoker dougs87 Harbinger jszakmeister AWizzArd rmrfchik Le
15:45enebozodiak: I believe I have license to verb all names! :)
15:45oskarthdamn it
15:46oskarth:p
15:46matessimyou just pinged 1,000 angry ronin.
15:46TheMoonMasterThe fuck is this shit?
15:46gf3That was exciting
15:46Cr8=/
15:46uvtcwhat's the command to ignore that?
15:46BAWKINGmatessim, 477.
15:46gf3/quit
15:46Bronsa/ignore BAWKING
15:46matessimwhat the fuck was that shit.
15:46Luytuvtc: Depends on your IRC client.
15:46eneboEveryone stop typing he may list all users again :)
15:46oskarthhe should prolly get a ban unless he has a really good reason for doing that
15:46TheMoonMasterI totally couldn't tell who was in this channel
15:46uvtcBronsa. Thanks. Luyt: xchat
15:46gf3I think we should give him ops, he clearly knows what he's doing
15:46amalloyoskarth: if we had any ops, we could do that
15:47oskarthah, there are no ops at all?
15:47oskarthor just not just available right now
15:47TimMcWell, any ops in the channel have now been pinged.
15:47oskarthidd
15:47amalloybut i think it's basically chouser and rich, who are both not often here and not very active as ops
15:47oskarthso, what's the usual routine to deal with annoying people?
15:48TimMcoskarth: /ignore, don't talk about them, get ops
15:48hiredman/ignore
15:48hiredman/ignore is great
15:48oskarthfair enough
15:49TimMcmebaran151: Not sure... in Maven, I've seen scope=provided, indicating that it ends up on the classpath somehow...
15:49oskarthyeah, but not very efficient for 477 people
15:49omni5ciencelol, I like how angry that made people
15:49omni5cienceI just came to see what was up and there was a lot of ranting
15:49Blazeixsounds like omni5cience is the creator of the bot :)
15:49oskarthomni5cience: a lot of people have ping alerts
15:49pandeiroanyone tried to rip the ring handler that compiles cljs to js out of himera and use it?
15:50omni5cienceoskarth: as do I, I just got all sorts of notifications
15:50JorgeBwhenever someone pings me I kick a puppy. Don't ping me.
15:50omni5cienceis it a cute puppy?
15:50JorgeBno, ugly puppuy
15:50JorgeBpuppy*
15:50RaynesAny puppy is a cute puppy.
15:50fliebelI'm surprised noone is getting pings by SMS
15:50TimMcJorgeB: That's an interesting approach, JorgeB.
15:50the-kennyI really thought someone wanted to talk to me :-(
15:51fliebelsqs?
15:51Raynesthe-kenny: http://i3.kym-cdn.com/entries/icons/original/000/003/619/Untitled-1.jpg
15:51mebaran151I'm just thinking of setting up swank-cdt
15:51omni5cienceshort query service
15:51oskarthI have it hooked up to a huge car horn which wakes me up in case of an emergency
15:51hiredmansimple queue service
15:51TimMchiredman: Do you also get a few lines of context?
15:51hiredmanyes
15:51the-kennyRaynes: haha :D
15:51hiredmanI mean, I have the irc log piped in to sqs
15:52hiredmanand then a little clojure app that pulls and growls them
15:52dnolensource maps are available in Chrome today
15:52TimMcdnolen: :-D
15:52fliebelhiredman: ... my client just growls them directly. Why the detour?
15:52the-kennydnolen: For Clojurescript? Awesome
15:52dnolenTimMc: I don't mean for CLJS :)
15:52dnolenthe-kenny: sorry to confuse
15:52TimMcD-:
15:52hiredmanfliebel: I don't run irc locally
15:52oskarthhiredman: that's a neat solution, assuming you are sshing into IRC?
15:52Rayneshalgari: Ohai
15:52dnolenI mean we need to get on the ball
15:52dnolenChrome has source map support now
15:52hiredmanoskarth: yes
15:53oskarththat's a good idea, should try that
15:53Rayneshalgari: Excellent work on clojure-py. I was playing with it last night. It's super straightforward to get going and use. I'm not very familiar with Python, but I managed to call out to a Python library in just under 30 seconds.
15:53oskarthcould build in delay and send mail if the message hasn't been received/sent for 24h
15:53geoffeg_chas anyone looked into using Web Workers with ClojureScript? I've started playing around with the idea.
15:53fliebelLots of people online now, suddenly.
15:54omni5ciencefliebel: it happens when you ping everybody in the channel
15:54fliebelyea
15:54hyPiRionheh.
15:54the-kennyWe should do that more often
15:54fliebelHow do you un-ignore a bot? :P
15:54pandeirothis happened in #Node.js few months ago, same thing happened
15:56oskarthha
15:56fliebelMaybe it should be smarter, so that it ping selectively, based on some NLP baysian blabla.
15:56oskarthsome channels have a not-talking-for-x-period-of-time filter, then you get kicked out
15:57pandeirofliebel: i think that would be over-optimization
15:57oskarthI imagine a lot of people in here have a irssi client running on some server somewhere
15:57the-kennydnolen: I like this approach for notifications. Is the little Clojure application open source?
15:57the-kennydnolen: ew sorry.
15:57the-kennyhiredman: I like this approach for notifications. Is the little Clojure application open source?
15:58notNicolasAny recommended style guides? I'm not used to lisp style syntax
15:59amalloy$google scheme mumble style guide
15:59lazybot[lisp style guide - It works!] http://mumble.net/~campbell/scheme/style.txt
15:59notNicolashmm kind of long but alright. Thanks!
15:59omni5cienceoskarth: I have ZNC running on a server and irssi running locally :P
16:00oskarth:p
16:04RaynesnotNicolas: Not all of it is entirely relevant, but it is generally sound. You could also get by with looking at popular well written code.
16:05nDuffHmm; I'm doing something wrong with destructuring. ((fn [{:keys [foo bar]} & args] [foo bar]) :foo 1 :bar 2) is returning [nil nil], where I'd expect [1 2]
16:06RaynesYou're destructuring the first argument to the function.
16:06RaynesNot the whole input.
16:06RaynesYou want to destructure & args or pass an actual map.
16:07nDuffAhh.
16:07nDuffgraci
16:07Raynes&((fn [& {:keys [foo bar]}] [foo bar]) :foo 1 :bar 2)
16:07lazybot⇒ [1 2]
16:08pandeirois there a simple way i could see a diff between cljs-1211 cljs-1011?
16:10hiredmangit diff?
16:10michaelr`hey
16:11dnolenpandeiro: http://github.com/clojure/clojurescript/compare/r1011...r1211
16:11dnolenpandeiro: pretty massive set of changes.
16:11pandeirodnolen: himera breaks between the two, trying to debug
16:12dnolenpandeiro: any specific error you're seeing?
16:12pandeirocljs.compiler/emits isn't emitting anything
16:13dnolenpandeiro: oh Himera probably does some custom emission - the old what doesn't work anymore
16:14pandeirohas a custom expander, that could be it?
16:14dnolenpandeiro: you need to use emit-str now
16:14dnolencljs.compiler/emit-str
16:15dnolenpandeiro: it takes an analyzed expression
16:15pandeirocool i will swap them out and see, thanks
16:23michaelr`is there a way to make clojure more verbose about what it's doing right now? I removed (:class-gen) and the :main reference in project.clj and now I use (use :reload-all 'paz.server) from the repl and it's still taking minutes to load (5-7), it seems just wrong
16:24amalloy,(apropos "verbose")
16:24clojurebot(*verbose-defrecords*)
16:24hiredman^- heh
16:24amalloyi thought there was a verbose-loading flag or something. is that private to clojure.core, maybe?
16:24hiredmanthere is :verbose flag you can pass to require and use
16:25hiredmanamalloy: it is not, just not documented
16:25hiredmanmichaelr`: but I imagine the problem is sloppiness on your part
16:28michaelr`hiredman: probably it's on my side i'm just looking for the right path to debug it
16:30pandeirohow does the cljs repl eval more than one form at a time?
16:30pandeiroi notice that read-string does not work with a string of more than one form
16:33dnolenpandeiro: cljs repl uses Clojure reader not the CLJS one
16:41mccraigwhat's the canonical way of ensuring that a (atom | vector) is/becomes a vector ?
16:42rlbmccraig: you mean you have something that might be an atom or a vector?
16:42ivannDuff: you can open a file with a share mode that includes FILE_SHARE_DELETE and you'll be able to delete it; too bad most things don't support it/do it
16:43ivanI don't think you can reach it through the POSIX open() that everyone likes to use
16:44mccraigrlb: yeah, and if it's an atom, i want to make it into a vector
16:45rlb(if (vector? x) x (atom x))
16:45pandeiroi would do (or (and (atom? atom-or-vec) @atom-or-vec) atom-or-vec)
16:45rlbof if you need to test for atom (may be a better way): (instance? java.lang.Atom x)
16:45rlbpandeiro: didn't see atom?
16:46pandeiroi'm assuming there's an atom? function :)
16:46pandeirothere's not?
16:46rlbpandeiro: not by default, at least not here.
16:46pandeiroyeah, not here either
16:47pandeirobut it can't be too hard to create a predicate like that, right?
16:47rlbmccraig: ignore what I said first -- by "make it a vector", make what a vector?
16:47rlbmccraig: the atom, or the content of the atom?
16:47yoklovlike (if (vector? x) (vector x) x) ?
16:48rlbi.e. if the latter -- (if (vector? x) x [@x])
16:48yoklovoh right
16:48michaelr`haha
16:48mccraigagh. i don't mean atom. more brainfail :)
16:48yoklovthat was totally backwards
16:48michaelr`problem solved!
16:48michaelr`i just upgraded noir to the latest version
16:48michaelr`was beta 3 not beta 7
16:49michaelr`it got lost somewhere while loading my views
16:49michaelr`s/not/now
16:50mccraigrlb: i was meaning atom in the cl sense, i.e. not a sequential?
16:50mccraigwhat i want is the equivalent of the ruby: [*scalar_or_vector]
16:52rlbwould (if (coll? x) x [x]) do something suitable?
16:52rlbi.e. does it have to result in a vector?
16:52mccraigyeah, that would work.. i was looking for something more elegant :)
16:52rlbthat will put anything that's not a collection into a vector...
16:52rlb(which might or might not be OK)
16:53rlbmccraig: just curious -- what's the use case (wondering what that's normally used for in ruby, for example)?
16:54mccraigin this case, incanter gives me a scalar when i select a single column from a row of a matrix, but a vector when i select a range of columns… what i actually want is a vector in both cases
16:54S11001001mccraig: and having special language-level syntax just for that operation is particularly elegant?
16:56mccraigS11001001: that same syntax is used for apply in ruby, which is pretty general-purpose, so yeah it is quite elegant
16:57mccraigS11001001: tho ruby has many counter-examples of ugliness
16:58S11001001the division between scalar and non-scalar is not clear enough in either language to fix one definition at the language level
16:58S11001001it just happens that ruby did it anyway
16:59muhoohappy :-) https://www.refheap.com/paste/2739
16:59yoklovit's a fairly common lisp idiom afaik, i'm actually surprised clojure doesn't give you something like that
16:59S11001001among your choices are seq?, coll?, sequential?, and seqable? from core.incubator
17:00ordnungswidrig1muhoo: nice
17:00S11001001and if ruby's apply just interprets a scalar as a list of one element, for some arbitrary meaning of scalar among the several that make sense in ruby, that's not good design
17:01yoklovsomething like (defn ensure-seq [x] (if (seq? x) x (list x))) has been somewhat common in my scheme code, and I've heard of lispers using it
17:02S11001001aye
17:04pandeirodoes lein cljsbuild know by default to look for cljs libs in lib/ if a specific :source-path is defined, or would lib/ have to be included there too?
17:05srid``avout seems quite buggy. sometimes the refs/atoms get reset to nil. tried with the mongo adapter, made no difference.
17:05dnolenpandeiro: cljsbuild looks for files on the classpath
17:08pandeirosurprised that the himera repl.cljs 75-line file is taking 65 seconds to compile with lein cljsbuild
17:13muhooordnungswidrig1: thanks. that little function took me 8+ hours to write. clojure makes me work very, very hard, but i strangely enjoy it.
17:13wkmaniremuhoo: one function 8 hours?
17:13wkmanireWHat am I getting myself into.
17:15dnolenpandeiro: sounds suspect
17:15Rayneswkmanire: You can do in 8 hours in one function in Clojure what you can do in 8 hours and 47 classes, 50 files, and 1800 compile -> run cycles in Java.
17:16muhoowkmanire: what Raynes said :-)
17:16wkmanireI'm assuming that functon ended up terse as well right?
17:16wkmanireFrom the little bit of clojure I've written I'm just shocked by how terse it is.
17:16wkmanireSo much implied functionality.
17:17muhooi'm addicted to the damn thing. i suspect it may ruin me, but i don't care.
17:18TimMcmuhoo: It won't ruin you so much as it will ruin other languages for you.
17:19muhoowkmanire: actually, here is what i'm coming to realize. i'm getting old. i have carpal tunnel issues and vision issues. i simply CANNOT sit here typing 47 classes 50 files and 1800 compiles. i have to be able to do more with less typing, and more thinking. it's almost a health imperative.
17:19TimMcMight be the same thing, employability-wise.
17:21muhooTimMc: so far, i've been pretty lucky. just completed a nice sized web app job in clojure for a customer, he didn't care what it was written in. and, looks like there are plenty of clojure jobs for those interested in FT work too.
17:27zoldarmuhoo: can you tell the url of that web app? :)
17:28TimMcmuhoo: "FT" == full-time?
17:29muhoozoldar: it's an intranet thing, nothing to see without login
17:29muhooTimMc: ya.
17:29tmcivermuhoo: FT work?
17:30muhootmciver: FT => full time, PT => part time, etc
17:30wkmaniremuhoo: I know what you mean about having to deal with mountains of seperate class files.
17:30wkmanireAfter spending a while working in Python I find the one file one class paradigm to be laughable.
17:31muhooactually that was raynes's witticism about the explosion of class files in oop languages. and it's true :-)
17:31tmcivermuhoo: ha! I was thinking Functional something.
17:31muhooFT FP
17:32TimMcthe dream
17:33muhoodream? i dunno, i saw quite a few booths at clojurewest that said "we're hiring".
17:33TimMcDreams can be achievable. :-P
17:42alex_baranoskyFT FP :)
17:42alex_baranoskythe reality :)
17:43muhooalex_baranosky: runa was one of those, yes.
17:52jimtvirsh uri
18:04yoklovhas anybody ported propagators network to clojure? the amount of state that seems necessary is… daunting.
18:04yoklov(http://groups.csail.mit.edu/mac/users/gjs/propagators/)
18:07dnolenyoklov: I messed around with it in Scheme a bit, their approach seemed very slow.
18:08dnolenyoklov: at the least constraint portion is better done via cKanren approach as far as I can tell.
18:08yoklovdnolen: yeah, i part of the speed issues come from using lists for sets/associations
18:09yoklov*i think
18:09dnolenyoklov: I know cemerick tried something with atoms - also was not particularly fast - but not sure what the bottleneck was there.
18:09yoklovHm, that's interesting
18:09dnolenyoklov: maybe, it creates a network of propagators - there's a lot of overhead pushing changes around.
18:10yoklovyeah, maybe it's just not a particularly fast model of computation.
18:10dnolenyoklov: cKanren is lazier in it's approach to updating constraints
18:10yoklovnot until it's extremely parallel
18:10yoklovuntil/unless
18:10dnolenyoklov: yeah probably.
18:11dnolenyoklov: in any case The Art of Propagator rocks - nice approachable intro to this stuff.
18:11dnolenkind of like a SICP Chapter 4.5
18:13yoklovRight, I've read through that and Alexey's dissertation on the subject, and started trying to port some of the code to clojure when I became a bit overwhelmed with it
18:13yoklovany object having an arbitrary number of stateful fields determined at runtime is… daunting
18:14yoklovIt's fascinating stuff though, not sure if it's strictly useful but it's really neat.
18:17yoklovHadn't ever thought of it like sicp chapter 4.5, but it does sort of read like that now that you mention it.
18:17dnolenyoklov: again I recommend reading the William Byrd Dissertation + cKanren paper for very, very functional approach to constraint programming.
18:18dnolensimilar results - not stateful.
18:18yoklovInteresting, will do.
18:28gtrakis there a way I can get lein to ignore the ~/.m2/settings.xml?
18:30amalloyrm ~/.m2/settings.xml
18:34jaenHey, could you please kindly tell me what shall I do if I wanted to expose a defrecorded record for Java to use?
18:36brehautjaen: i'm guessing here, but i think you need to do AOT export if you want it accessible from a jar without calling clojure at all
18:36brehauts/export/compile/
18:36technomancygtrak: upgrade to lein2 =)
18:36brehautjaen: you can probably also call in via the clojure runtime and require the namespace that defines the record
18:37gtraktechnomancy: can i use two versions of lein concurrently?
18:38technomancygtrak: definitely
18:38technomancyclojurebot: leiningen upgrade guide
18:38clojurebotleiningen is always the easiest way
18:38technomancywell yes, but
18:38technomancyclojurebot: google: leiningen upgrade guide
18:38clojurebotupgrading to leiningen 2 is easy with this handy upgrade guide: https://github.com/technomancy/leiningen/wiki/Upgrading
18:38jaenbrehaut: mhmm
18:38gtrakwould I just use 2 different lein scripts?
18:39gtraki have some projects that require an older version
18:39technomancygtrak: sure; lein and lein2 if you like
18:39gtrakawesome
18:40testcljgtrak
18:40testcljis testing irc from clojure
19:03srid``why would anyone use `atom` in clojurescript?
19:05nDuffAhh! Someone was asking the other day about a non-JNI-based mechanism for getting notifications about external files changing? That's a JDK 7 thing, java.nio.file.WatchService
19:06technomancynDuff: cool
19:06pipelineso the inevitable question
19:06pipelinehow is that service implemented on your target platform
19:07pipelineis it gonna sit and spin if you don't have inotify on linux or what
19:07nDuffpipeline: hasn't been a Linux without inotify or dnotify or FAM for ages
19:07pipelinewell that is a perfect example
19:07pipelinea lot of shit you would use inotify for would be poison with dnotify or fam
19:07pipelineand what happens e.g. on windows, sosx
19:08nDuffboth of those have equivalents
19:08pipelinehaving a non-jni solution makes it easier but it is not the end of the line
19:08nDuffit'd only be older *nix systems where I'd expect having an efficient API to be in question at all.
19:12nDuffpipeline: ...that said, the API allows a FileSystem to simply assert that it doesn't have the interface available by throwing an UnsupportedOperationException, so it doesn't look like it'll fall back to polling under any circumstances.
19:13pipelinenDuff: that is an awesome api
19:28pipelinenDuff: I was not being sarcastic
19:28pipelinenDuff: it is way better to barf an exception than to have performance vary by 3 orders of magnitude and just not work right
19:32technomancystill you should be able to fall back to polling if you explicitly want it
19:34frozenlockIs there ways to use clojure Noir with ssl? (Sandbar perhaps?)
19:44startlinghi, does clojure have something like haskell's "init"? I want everything but the last element of a list; basically the opposite of "last"
19:44hyPiRionbutlast?
19:45hyPiRion,(butlast [1 2 3])
19:45clojurebot(1 2)
19:45startlingthat's it. thanks!
19:45hyPiRionyou're welcome :)
19:46nDuffstartling: ...that said, efficiency on that depends on what type you're using it with
19:46startlingnDuff, yep. it's bad for linked lists, good for vectors
19:47startlingnDuff, just looking for a nice way to write `reverse` in the clojure koans
19:47hyPiRionbutlast works for lists, pop works for vectors.
19:47brehauti suspect its basically identical for vectors and lists
19:47nDuffpop also works for lists or queues
19:48nDuff...but returns an object of the same type, as opposed to a sequence
19:48brehautpop works for anything that implements IPersistentStack
19:48hyPiRionWell, pop != butlast in a sense, as popping a list removes the first element, while popping a vector removes the last.
19:49kaoDhyPiRion: is right
19:49kaoD I had quite a headache with that :P
19:49nDuff...right; pop being more of an inverse to conj
19:50brehauthttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L626-630
19:51startlinghm, you can't recur modulo cons?
19:51hyPiRionstartling: What do you mean?
19:51brehautnDuff: pop isnt necessarily the inverser of conj. on a queue for instances they work at opposite ends
19:53brehautnDuff: identical? != equal
19:53nDuffbrehaut: *nod*, but being persistent structures...
19:53brehautnDuff: identical? tests if two references are to the same _object_. ie its areference test, not a value test
19:53nDuffbrehaut: yes, I know that. I expected structural sharing to result in it being actually the same object in that case.
19:53startlinghyPiRion: in some languages, there's a thing called "tail call modulo cons", which lets you what would be (defn x [seq] (cons (1) (recur (rest seq)))) in clojure
19:54startling(efficiently)
19:54brehautnDuff: it doesnt go back and look at the historical, discarded structures and pull it back, it builds a new one preserving as much as it can of the old
19:55startlingbut clojure tells me "Can only recur from tail position"
19:55hyPiRionstartling: Ah. I just wrap a loop around such cases.
19:55frozenlockibdknox: I'm sure you are already over your head with light-table, but do you have any ssl example for Noir you could point me to?
19:55brehautnDuff: removing and reattaching the same object from an (internally) tree shaped collection can result in a different internal shape with the same value
19:56nDuffbrehaut: Didn't expect it to look at historical structures. Was thinking of something more akin to a list implementation wherein the prior version would be included in the new one. On thinking it about it a bit more, I should have known that vectors didn't work that way.
19:56nDuff*nod*.
19:56startlinghyPiRion, sure.
19:56hyPiRionIt's not pretty, but it gets the job done.
19:56startlingI'm doing the clojure koans, though, and it wants me to write a recursive reverse. :/
19:57hyPiRionrecursive != tail-call optimized ;)
19:57brehautnDuff: if doesnt work for lists either
19:57brehaut,(let [s (list 1 2 3)] (identical? (cons 1 (rest s)) s))
19:57clojurebotfalse
19:57startlinghyPiRion, I get a stack overflow if i do it naively. :S
19:58hyPiRionhm.
19:58brehautoh, wrong expression
19:58nDuff,(let [start '(1 2 3)] (identical? start (pop (conj start 4))))
19:58clojurebottrue
19:58brehaut,(let [s (list 1 2 3)] (identical? (conj (rest s) 1) s)) ; pedantic clarification
19:58clojurebotfalse
19:58startlingis there a thing like haskell's "flip"? takes a function and returns a function that takes the arguments in the opposite order
19:59kaoDnDuff: I was going to point that out
19:59brehautobviously the tail remains identical, but thats not the same thing as getting an identical list when you conj the same value onto the front of it
20:00kaoDstartling: probably you can do it with #(reverse %&)
20:00kaoD&( #(reverse %&) 1 2 3 4 )
20:00lazybot⇒ (4 3 2 1)
20:00startlingkaoD: heh, the point is to write a recursive reverse function, though
20:00startlingah well, i'll just ignore it
20:00kaoDstartling: if you're talking about 4clojure... it has no point
20:01startlingkaoD: clojure koans, actually
20:01kaoDstill, I like abusing the rules :P
20:01startlingkaoD, yeah, there are quite a few (= "Hello world" "Hello world")s in my solutions
20:02hyPiRionstartling: (defn rev [c] (if (nil? c) nil (concat (rev (next c)) [(first c)])))
20:02brehautmy favorite recursive reverse is (partial reduce conj ())
20:02startlingooh, that works
20:02startlingI was going to do (reduce (flip (partial cons)) '()) but clojure doesn't have flip. :(
20:02PeregrinePDXThat is I believe the implementation of reverse in clojure.core
20:03brehauthah it is too
20:03kaoDbrehaut: how is that recursive?
20:03brehautkaoD: reduce is the primative recursive operation
20:03kaoDah
20:03hyPiRionkaoD: reduce is recursive?
20:03brehautkaoD: its not _explicitly recursive_
20:03kaoDI thought it wasn't recursive
20:03kaoDI thought reduce used loop under the hood
20:03brehautit doesnt matter how its implemented, its mathematically a recursive operation
20:03startlingkaoD, doesn't clojure use a stack machine under the hood?
20:04startlingkaoD, if so, *nothing* in clojure would be recursive
20:04kaoDbrehaut: oh, mathematically
20:04kaoDstartling: stack machine = has recursion
20:04kaoDI mean
20:05kaoDok, I get your point
20:05kaoDbtw, my personal favorite is
20:05kaoD&(into () '(1 2 3 4 5 6))
20:05lazybot⇒ (6 5 4 3 2 1)
20:05brehautthats quite a nice variant
20:05startlingwhat does into do?
20:06kaoDI think it basically does (partial reduce conj ())
20:06brehautit calls conj on the initial argument for all the values in the seq
20:06kaoDunder the hood
20:06startlingah
20:06brehautkaoD: yes. the only detail is that it uses transients for performance
20:06startlingconj is cons flipped?
20:06brehaut(when it can)
20:07kaoDstartling: nope, conj is... conj
20:07brehautconj is polymorphic cons with the arguments flipped
20:07startlingbrehaut: got it, thanks
20:07brehautits also a varargs cons
20:07startlinghuh, how does that work?
20:07brehaut,(conj [] 1 2 3)
20:07clojurebot[1 2 3]
20:08startlingoh, neat
20:08brehaut,((partial apply conj ()) [1 2 3 4])
20:08clojurebot(4 3 2 1)
20:08startlingheh
20:09brehaut(its short for 'conjoin' incidentally)
20:09startlingis (reduce (partial +) ...) the best way to do that?
20:09kaoDstartling: bear in mind this
20:09brehaut(apply + …)
20:09kaoD,(conj () 1 2 3)
20:09clojurebot(3 2 1)
20:09startlingkaoD, yeah?
20:09startlingbrehaut: oooh
20:09brehautstartling: where functions provide a vararg form that would do what a reduce with the binary form would do (eg, +) its better to use the vararg version
20:10kaoD,(= (conj [] 1 2 3) (conj () 1 2 3))
20:10clojurebotfalse
20:10startlingbrehaut: yeah, i'm used to haskell
20:10kaoDstartling: you don't need partial +
20:10hyPiRionI like to think of conj as the fastest way of adding an element to a collection. For a vector, that is naturally at the end, and for a (linked) list, that is naturally at the beginning.
20:10startlingbrehaut: so varargs in functional languages are weird for me
20:10hyPiRioncons is just at the front, no matter what.
20:10brehautstartling: there are varargs in haskell (sort of)
20:10kaoDyou only need partial if you're partially applying it
20:10startlingbrehaut: yeah, sort of. but not for (+)
20:11brehautno, not for plus
20:11kaoDit's not about plus
20:11kaoDit's about partially applying
20:11brehautstartling: + is also convenient here because it has a nice identity
20:11brehaut,(+)
20:11clojurebot0
20:11kaoD,(map (partial + 2) [1 2 3 4])
20:11clojurebot(3 4 5 6)
20:11startlingkaoD, okay?
20:11kaoD,(map + [1 2 3 4])
20:11clojurebot(1 2 3 4)
20:11kaoDsee what I mean?
20:11kaoDbrehaut: my god, didn't know about + identity
20:12startlingyeah, that's pretty cool
20:12brehaut* has it too, but not - or /
20:12kaoDfor / makes sense
20:12kaoDbut for - ?
20:12kaoD,(-)
20:12clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$->
20:13brehauti saw the argument for why somewhere on the internet the other day, but i cant recall where
20:13brehautperhaps rhickey's reducers blog post?
20:13brehautyes http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
20:14brehauthmm or maybe not
20:14kaoDbtw, I had some trouble implementing chain of responsibility while trying not to reinvent the wheel
20:14kaoDit ended up looking a lot like monads
20:14kaoDam I doing it wrong or should I just use monads?
20:14startlinghm, clojure has pattern-matching for variable arguments but not for values?
20:14kaoDchain of responsibility with event consuming
20:15kaoDstartling: it has no pattern matching
20:15brehautclojure doesnt have pattern matching in core, it only has destructuring
20:15brehautpattern matching is in core.match and last i heard (a while ago) not quite ready for prime time
20:15kaoDwhich makes me sad :(
20:16startlingkaoD, (defn length ([] 0) ([a] 1)) is what i meant by "pattern matching for variable arguments", i guess
20:16brehaut,(destructure ['[a b] [1 2 3]])
20:16clojurebot[vec__237 [1 2 3] a (clojure.core/nth vec__237 0 nil) b ...]
20:16kaoDstartling: then it's overloading by arity
20:16kaoDnot pattern matching
20:16brehautdestructuring doesnt take the value into account at all, its just convenient access
20:16startlingkaoD: ah
20:17brehaut(destructure ['[a b] 1])
20:17brehaut,(destructure ['[a b] 1])
20:17clojurebot[vec__264 1 a (clojure.core/nth vec__264 0 nil) b ...]
20:17brehautyou can see that that is going to fail, but it will generate the code for you anyway
20:17kaoDthat's quite an ugly representation
20:17brehautthats just internals with gensym for use in macros
20:18xeqikaoD: chain of responsability sounds alot like ring middleware
20:18xeqiwhen I read it on wikipedia
20:18brehautif you want to see what pattern matching currently looks like in clojure: https://github.com/clojure/core.match/
20:19kaoDxeqi: yup, it's pretty much it
20:19kaoDin fact I want it for a middleware-like thing
20:21kaoDxeqi: in fact I want something like that but I also want stop conditions
20:21kaoDi.e. consuming events
20:21kaoD(which IIRC ring's middleware cant)
20:22kaoDthat's where complexity begins and my conde starts looking like ugly-monads
20:22kaoD*code
20:22brehautkaoD: what do you mean by stop conditions?
20:22brehautyou want to be able to block the next handler in the chain?
20:23kaoDand therefore, blocking all the rest
20:23kaoDconsuming the event, that is
20:24xeqiyou can block the next handler by just not passing it down
20:25xeqiwhich is basically what the last handler, usually the app does
20:25kaoDxeqi: it's probably done using reduce
20:25kaoDor equivalent
20:25kaoDwhich I shouldn't use because I might want to consume it BEFORE the end
20:25kaoDso I ended up using loop-recur + stop condition
20:26kaoDbut it's not very extensible without heavy tweaking of code and added complexity
20:26kaoDwhich made my code look very similar to monads
20:26brehautwell then, go use monads :P
20:26kaoDI heard clojure.monads is very inefficent
20:27brehautyes and no
20:27brehautit does a lot of static compilation to minimise the function call overhead
20:27brehautits definately not going to be as efficient as hand optimised code (eg core.logic vs a logic monad)
20:28brehautbut its the same amount of overhead as a monad in haskell that doesnt have the advantage of fusion or other rewriting rules
20:28kaoDI see
20:28kaoDI should give it a try then, thanks
20:28brehautits also clojure.algo.monads btw
20:29kaoDyup
20:31brehautkaoD: its worth having a look at the imp of algo.monads and tools.macro to see how symbol-macros are used to eliminate some of the indirection and dynamic lookups you might expect to be there
20:32kaoDI'm afraid I'm just another victim of premature optimization
20:32brehauthaha probably
20:32kaoDI'd better leave it like it is until I really need to tweak :P
20:33hyPiRionWhile talking about monads, does anyone have a good clojure-introduction to monads for complete beginners on the topic?
20:34brehauthyPiRion: clojure.net
20:34brehautall of it
20:34kaoDhyPiRion: I learn them in clojure.algo.monads git repo
20:35kaoDit has several links
20:35kaoD(one to onclojure IIRC)
20:36kaoDit can get very technical but I found it amusing
20:36kaoDand the technical chitty-chat is actually justified
20:38hyPiRionkaoD: Ah, thank you.
20:44kaoDgfredericks: what do you mean password creation?
20:44gfrederickschoosing a password when creating an account on a site
20:44kaoDand what are you battling with?
20:44gfredericksthe validation rules
20:45kaoDjust warn, no matter how long or convoluted the password is
20:45gfrederickskaoD: no this is not my site
20:45gfredericksI'm trying to create an account and it doesn't like my password
20:45kaoDoh
20:45kaoDI see
20:45kaoDthen they applied the method I described
20:46kaoDit's pretty common
20:46gfredericksjust warning?
20:46kaoDit depends
20:46kaoDif they really want to annoy you
20:46kaoDit's like sites which need usernames length >5
20:46kaoDI'm fucking kaoD
20:46mittchelHm guys
20:46kaoD4 characters
20:46kaoDwhy would you make me be something else!?!?
20:46mittchel,((fn [x y] (nil?(get y x nil))){:a nil :b 2} :c)
20:46clojurebottrue
20:47mittchelWhy does that give true? It shouldn't find C so give back nil
20:47mittchelNevermind
20:47mittcheldumbest question ever.
20:47kaoD,(get :c {:a nil :b 2} nil)
20:47clojurebotnil
20:47mittchelI know what happends
20:47kaoD,(nil? nil)
20:47clojurebottrue
20:47kaoD:P
20:47mittchelit doesn't find C so it replaces it with nil. and (nil? nil) returns true
20:47mittchellol:D
20:48gfredericks,(-> nil nil? true? false? false?)
20:48clojurebottrue
20:48PeregrinePDXThis is why I save those kind of questions for a pm
20:48PeregrinePDXthen only 1 person knows I'm an idiot
20:48mittchelhaha
20:49technomancyhas anyone tried JDK7 and had to stick with JDK6 for whatever reason?
20:49kaoDtechnomancy: yes I did
20:49technomancykaoD: oh? what happened?
20:49kaoDwell, actually hacked my way around JDK7
20:49kaoDAndroid -> key generation went wrong
20:49kaoDapparently the algorithm changed so my keys were rejected when installing
20:49kaoDalso Google AppEngine + GWT
20:49technomancyhuh.
20:50kaoDrefused to work
20:50kaoDbecause...
20:50kaoDsomething
20:50kaoD:P
20:50technomancywhat about in a deployed production environment?
20:50kaoDno idea there
20:51gfredericksusernames can have curly braces but passwords have to be alphanumeric??
20:51lazybotgfredericks: What are you, crazy? Of course not!
20:51gfredericksand tildes
20:51kaoDhahaha
20:51kaoDlazybot: is always right no matter what
20:51kaoDright, lazybot ???
20:51lazybotkaoD: Yes, 100% for sure.
20:56mittchelGuys
20:56mittchelrem takes 2 numbers and returns the difference between them right
20:56mittchelso lets say
20:56mittchel10 9 = 1
20:57tmcivermittchel: nope, remainder
20:57tmciverafter division
20:57mittchelah
20:57kaoDnot to be confused with modulo
20:57startling,(rem 20 9(
20:57startling,(rem 20 9)
20:57clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
20:57clojurebot2
20:57kaoD &(mod -10 3)
20:57mittchelaAlright:D
20:58kaoD &(rem -10 3)
20:58kaoDokay, lazybot is having a nap
20:58kaoD,(mod -10 3)
20:58clojurebot2
20:58kaoD,(rem -10 3)
20:58clojurebot-1
21:00mittchelHm
21:00mittchelbut could you explain 1 thing for me
21:00mittchel(for [x (range 40)
21:00mittchel :when (= 1 (rem x 4))]
21:00mittchel x))
21:00mittchelthis result sin: 1 5 9 13 17 etc.
21:00mittchelbut when x = 1, it does: (rem 1 4)
21:00mittchelwhich is 1
21:00mittchelso thats ok, but when x = 2 you have
21:00mittchel2
21:01mittchelso why isn't 2 displayed?
21:01kaoDlol nope
21:01gfredericksbecause 2 is not 1
21:01kaoD:when
21:01kaoD:when = 1
21:01kaoDwhen remainder is 1
21:01mittcheloh my god
21:01kaoD,(rem 1 4)
21:01clojurebot1
21:01kaoD,(rem 5 4)
21:01clojurebot1
21:01gfredericks&(for [x (range 40)] (rem x 4))
21:01lazybot⇒ (0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3)
21:01kaoD,(rem 9 4)
21:01clojurebot1
21:01mittcheloh my gosh
21:01mittchelI got it lol
21:02mittchel,(rem 37 4)
21:02clojurebot1
21:02mittchelSo every remainder that is 1 for x, x will be shown
21:02mittchellol
21:02mittchelIt's late for me so excuse me haha
21:03gfredericks&(-> 50000 range count)
21:03lazybot⇒ 50000
21:04hyPiRionThat's mean.
21:04gfredericks&(->> 50000 range reverse count range (reduce +))
21:04lazybot⇒ 1249975000
21:04hyPiRion&(-> 1e7 range count)
21:04mittchelhaha
21:04lazybot⇒ 10000000
21:04mittchel,(if 0 1 0)
21:04clojurebot1
21:04mittchelwhy does that give me 1
21:05gfredericks0 is truthy
21:05mittchelcause if 0 is always true?
21:05metellusonly alse and nil are true
21:05gfredericksfalse
21:05mittcheloh ok:D
21:05metellusyeah, that
21:05metellusboth times I wanted to say "false" I messed up
21:05gfredericksdouble meaning. I was correcting your typo and contradicting you
21:06septominfalse: false is false
21:06mittchelhaha
21:06gfredericksonly alse and fil are trouble
21:07hyPiRionseptomin: Well, that's confusing. ##(-> false false? false?)
21:07lazybot⇒ false
21:07septominmalkovich
21:08gfredericks(-> false false? (= (false? false)))
21:08gfredericks&(-> false false? (= (false? false)))
21:08lazybot⇒ true
21:14amalloykaoD: lazybot would pay more attention to you if you stopped putting spaces before his &s
21:15alex_baranoskyjust have to say that clojure.string/split behaves weirdly when splitting ""
21:16alex_baranoskyI'd expect an empty seq to be returned, not [""]
21:17kaoDamalloy: lol, I copypasted and didn't even notice
21:19alex_baranoskyanyone else see that behavior in clojure.string/split, and think it was odd?
21:23amalloythat behavior is never gonna change, since split is just a wrapper around String/split
21:34brehaut /away
21:34kaoD /near
21:36brehautbah /me fails at irc
21:41brehauthi talios
21:41taliosso much for being away!
21:41brehauti was trying to be unaway
21:41talios:)
21:42brehautsee: i fail bad
21:48muhooalex_baranosky: ##(seq (.split "" "."))
21:48lazybot⇒ ("")
21:49muhooseems to be a java thang
21:49alex_baranoskystill sucks ;)
21:49alex_baranoskyit is very JAva-ey in that way I guess :D
21:49alex_baranoskyI kiiddd I kidddd
21:50brehaut,(re-seq #"^[,]" "") ;; nothing says overkill like a regexp
21:50clojurebotnil
22:01devnalex_baranosky: why would you expect empty seq? I mean, I know why, but I'm forcing self-reflection on you. Why do you think empty seq?
22:02devnalex_baranosky: I find it pretty easy to imagine splitting an empty string on that which it does not contain would produce the original empty string.
22:02alex_baranoskydev: dammit you're making me reflect
22:02devnI guess I am more surprised it is a sequence and not an empty string.
22:02alex_baranoskyand it makes sense
22:03devnbut even still, sort of normal depending on your version of normal
22:03gfredericksthe return value in any other case is a sequence of strings
22:03devn*nod*
22:03alex_baranoskywell if you split "abc" on "," you get back "abc"
22:03alex_baranoskywhich makes total sense
22:03devnin a sequence, right?
22:03devn["abc"]
22:03alex_baranoskyyeah
22:03devnerr coll
22:03alex_baranoskysorry
22:03gfredericks&(.split "abc" ",")
22:03lazybot⇒ #<String[] [Ljava.lang.String;@17d4a14>
22:03gfredericks&(seq (.split "abc" ","))
22:03lazybot⇒ ("abc")
22:05devnat least it's NaN
22:05devnit's *not NaN
22:05gfredericksso it _is_ a number?
22:06muhooheh, NaN, watman.
22:07devnwat?
22:07clojurebotFor Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888
22:08devnwho knows their noir here?
22:08devnim failing on some forms stuff
22:08devnhttps://gist.github.com/2706731
22:09devnhow do I get the path to look like /search-by-input/myquery
22:10devnibdknox: i bet you know the answer 3:)
22:12devni want to type something into the form field as a string, and for it to be the query ive made against a fn. what i have currently returns ":query" examples
22:12devni want :query to be "myquery"
22:13xeqidevn: don't think you can post to a dynamic url like that without javascript
22:14devnxeqi: that's what i thought :(
22:14xeqiusually its just get/post to /search-by-input and then grab the value out of the query
22:14xeqicould make that page do a redirect if you really wanted to
22:14devnthat's too bad
22:14devnmeh, might as well involve JS at this point I suppose
22:14xeqi*grab the query value out of the params
22:15devnsomeone told me that and I was willing to fight because it seemed like i might be able to do it
22:20arohnerhiredman: https://github.com/arohner/clj-wallhack
22:24devnarohner: heh
22:24devnhmmm.... clojure.pprint/code-dispatch
22:24devnim not sure im using it right still
22:27jweiss_is there some trick to getting stdout in the either the repl or the console in CCW? most of my stdout seems to not be *anywhere*. this works fine in emacs/slime.
22:27jweiss_seems like println is all that works.
22:29devnjweiss_: that's vague. specific case where you want to capture out?
22:30devn&(with-out-str (println "foo"))
22:30lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
22:30devn,(with-out-str (println "foo"))
22:30clojurebot"foo\n"
22:31devnjweiss_: like that?
22:32jweiss_devn: i'm not quite sure what's going on, that is what i was hoping the stdout might tell me. i thought it might be a known CCW thing, i'll dig deeper and see if i can determine where it's going. there are definitely cases where the same code prints stdout in emacs, but not in CCW
22:32jweiss_not a 1-liner though, unfortunately
22:33devnjweiss_: godspeed
22:36jweiss_devn, another q for you - (assuming you're a ccw user). i notice that highlighting a defn form in an unsaved file and hitting ctrl-enter, doesn't seem to update the function. works different than slime? am i missing something?
22:36devnim not a ccw user
22:37devnbut maybe i can help
22:37jweiss_i usually use emacs but i want to demo using eclipse for my co-workers
22:37devn:)
22:37devnthat makes me feel fuzzy inside
22:38devnjweiss_: this is slightly off the beaten path
22:38devnbut perhaps you shouldnt be demoing in terms of editors
22:38devnif you can avoid it
22:38kaoDdevn: I'm sure he's trying not to scare off his co-workers
22:38kaoDwhich emacs is very good at
22:38jweiss_devn: they are actually going to be using eclipse.
22:38kaoD(at scaring, I mean)
22:39devnkaoD: it is, but for some it is a nice challenge
22:39jweiss_i'm lucky they're using clojure at all, making them learn emacs was asking too much :)
22:39devnchallenges inspire some people
22:39devnand discourage others
22:40jweiss_devn, yup that is true
22:40fil512why does this give me an error:
22:40fil512(defn records-by-host [records]
22:40fil512 (index records [:host]))
22:40jweissif i coulda forced them into emacs, i would have :)
22:40devnjweiss: i guess what im suggesting (only as a suggestion, a thought) is that maybe the people you're showing clojure to should find their own editor
22:40devnand you should try to be as agnostic as possible
22:41devnlet that happen naturally maybe?
22:41jweissdevn: yeah some of them might want to use vim, but i can't help them with that. none of them already know emacs.
22:41devnjweiss: vimclojure-easy makes it...easy
22:41jweissso i want to start with something where they're not totally on their own.
22:41devni was vimclojuring with the best of them in about 4 hours
22:41jweissdevn: will you come work for us :)
22:41devnjweiss: sure!
22:42devn:)
22:42devnerr
22:42devn"with"
22:42devnmaybe not "for" :)
22:42fil512hello
22:42jweissyeah that is what i meant
22:42jweiss"us" being the company (red hat)
22:42devnoh, cool!
22:42fil512could someone help a clojure noob?
22:42fil512I'm getting an error I dont understand.
22:42devnfil512: that's what we're here for :)
22:42fil512(defn records-by-host [records]
22:42fil512 (index records [:host]))
22:42fil512Unable to resolve symbol: index in this context
22:43devnfil512: that means index is not defined in the context you're trying to use it
22:43devnwhere is "index" in your project?
22:43fil512I figured that. :-)
22:44fil512http://clojuredocs.org/clojure_core/clojure.set/index
22:44devnjweiss: no foolin', I'd be happy to come hang out for a week at some point if that works with your team
22:44fil512I want to use this
22:44fil512isn't it built-in?
22:44devnfil512: no, it needs requiring or using
22:44fil512oh...
22:44fil512so I need clojure.set?
22:44devn(ns mynamespace.foo (:require [clojure.set :as set]))
22:44jweissdevn: are you in the raleigh area? i know we met at last year's conj but don't remember where you're from
22:44devn*nod*
22:44fil512sweet
22:44fil512thanks
22:45xeqiwith that require use (set/index ..)
22:45devnfil512: (set/index #{'fun 'stuff} [:host])
22:45devnjweiss: why not talk to relevance? their training is fantastic
22:46fil512when should i use "use" vs. "require"?
22:46xeqifil512: what version of clojure are you using?
22:46jweissdevn, yeah, they're doing a 4-day thing in durham next month, $1800 a pop though
22:46fil5121.4
22:46devnfil512: when you're eating a big enchilada, err on the side of (:require foo :as bar)]
22:46jweissdon't think my manager is ready for that
22:47devnfil512: when you're using :use, think: (:use foo :only (x y))
22:47fil512what about when I'm bringing in my stuff vs. external stuff?
22:47devnfil512: the goal is to always limit your exposure to other namespaces
22:47brehautdo you mean (:use [foo :only [x y]]) ?
22:47jweissi am happy to train my co-workers, up to a point. i mean, i got pretty far on my own without any training. just some help from the friendly folks in this channel.
22:48devnbrehaut: yeah
22:48devnjweiss: it's hard.
22:48devnjweiss: i know this sounds nutty, but i think 1800/person is worth it.
22:49devnjweiss: granted you need to have smart enough people to absorb it
22:49devns/smart/dedicated
22:49fil512anyone here use eclipse?
22:49jweissdevn: yeah, i think they are still at the stage where they are pretty skeptical that the effort is worth it.
22:49devnjweiss: so you gotta prove it, eh?
22:50devnjweiss: find someone awesome in your crew and inspire them to rewrite an ugly project you have internally in clojure
22:50jweissdevn, yup. it's been pretty exhausting fighting off the haters
22:51devnshow people side-by-side clojure vs X
22:51devnthat changes minds *fast*
22:51devndont be arrogant, just show them
22:51fil512what if they say the code is unmaintainable
22:52devnfil512: Ask them what they mean.
22:52fil512if an intermediate developer walks up to a big pile of java code, they can understand what's going on pretty quickly. can the same be said for a big clojure program?
22:52devn"This code is unmaintainable!" -- Person looking for an argument
22:52devnfil512: moreso
22:52jweissdevn - i think we're heading in the right direction, people are interested. i think i showed off the speed of interactive development that other languages struggle to match
22:53devnfil512: if someone can handle a big java program they should run 100 circles around clojure
22:53devnthe codepaths are simple, less deep, obvious
22:53devnthe only thing it might hurt is their ego if they're known for being mr. smarty pants
22:53fil512how do i get the type of a var? e.g. set vs. map
22:54fil512i'd like my test to assert on type
22:54devn,(type {:a 1 :b 2})
22:54clojurebotclojure.lang.PersistentArrayMap
22:54devn,(type #{:a :b :c})
22:54clojurebotclojure.lang.PersistentHashSet
22:55tmciverfil512: or use set?, map?
22:55devnor those ;)
22:55fil512i like set? better!
22:55fil512thanks!
22:55devndamned tmciver skipping the pain of learning
22:55devn:D
22:55fil512any1 know if eclipse plug-in does auto-indent--unindented code is driving me crazy!
22:56kaoDfil512: it does
22:56fil512ctrl-shift-F doesn't work
22:56devnccw re-implemented paredit
22:57fil512which is the usual binding
22:57fil512how do i do it?
22:57devnlpetit is a crazy sonofabitch
22:57devni find it hard to believe he missed things
22:57kaoDfil512: not sure, but IIRC there's a "autoindent code" button somewhere
22:57fil512iirc?
22:58metellusif I remember correctly
22:58kaoDif I recall correctly
22:58kaoDor remember, I'm never sure of the meaning of remember/recall
22:58kaoDfil512: try right clicking on the file.clj
22:58metellus...I was in the middle of typing "or recall"
22:58fil512there is something called "indent-line" but it does nothing
22:58kaoDlol
22:58clojurebotNo entiendo
22:58kaoDyo tampoco entiendo, clojurebot
22:59fil512i find it so hard to code without auto-indenting! yarrg!
23:01fil512found it. it's the tab key! :-/
23:06fil512is there a version of clojure.set.index that doesn't lose my ordering?
23:07fil512right now it's giving me back a set which loses the ordering
23:07fil512(I started with a vector of ordered records)
23:09tmciverfil512: I'm not sure what you're trying to do but have you looked at group-by?
23:09tmciver,(doc group-by)
23:09clojurebot"([f coll]); Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."
23:10xeqifil512: clojure's sets don't have an order
23:10xeqiyou might look at https://github.com/flatland/ordered if you really need them
23:10fil512you are a clojure god. group-by is exactly what i need
23:10fil512if it's clojure.core do i need a require?
23:11tmciverha! he doesn't know me very well. :/
23:11gfredericksno
23:11gfredericksevery morning the newbs got up early and gathered parens for the afternoon sacrifice to the clojure gods
23:12fil512lol
23:16fil512I need a function that does something like this: [["a" 1] ["b" 5] ["c" 7]] => [["a" "b"] 4] [["b" "c"] 2]
23:16fil512i.e. report on successive deltas
23:17gfrederickspartition will be a good start
23:18gfredericks&((fn [coll] (->> coll (partition 2 1) (map (fn [[[a x] [b y]]] [[a b] (- y x)])))) [["a" 1] ["b" 5] ["c" 7]])
23:18lazybot⇒ ([["a" "b"] 4] [["b" "c"] 2])
23:19tmciver(inc gfredericks)
23:19lazybot⇒ 5
23:19fil512is there a REPL listening in on this conversation?
23:20achetwo bots
23:20achewhich can evaluate
23:20fil512so damn cool
23:21gfredericks,(println "I am clojurebot, and this is lazybot. Say ##(println \"hi, lazybot\")")
23:21clojurebotI am clojurebot, and this is lazybot. Say ##(println "hi, lazybot")
23:21lazybot⇒ hi, lazybot nil
23:21gfrederickseh. you can only animate them so much.
23:21fil512lol
23:22creeseI need to profile my code. Can someone point me to a page or doc that describes current best practices?
23:22fil512thanks folks you were a big help to a noob.
23:31chouserenlive is failing me
23:31chouserit held such promise. I had such hope!
23:31Rayneschouser: I've been where you are. We should form a support group.
23:32brehautlol
23:32brehautare you still bitter raynes?
23:32RaynesAt least he fixed my bug.
23:32Raynes>_>
23:33chouserI'm trying to insert unparsed html and I can't get it to do what I want.
23:33brehaut(html-content …) not working?
23:36chouserno it's not, although it may be tagsoup's fault
23:36brehautare you using html5 elements by chance?
23:37chouserThe html I'm providing appears to be well-formed, but by the time enlive emits it, it's been rearranged incorrectly.
23:37chousernope. ul, li
23:38brehautif you do (emit* (html-snippet html-str)) does it garble it?
23:38chouserjust did that.
23:38chouseryes it does
23:39chouser(apply str (#'enlive/emit (first (enlive/html-snippet "<div><ul><li>a</li><ul><li>b</li></ul></ul></div>")) nil))
23:39chouser"<div><ul><li>a</li></ul><ul><li>b</li></ul></div>"
23:39chouserthat is, b is meant to be indented more deeply than a, but they come out siblings in two separate ul's
23:40chouserSo I guess I'll try to either get it to emit the raw text directly, or find a better parser
23:40brehauttry <div><ul><li>a</li><li><ul><li>b</li></ul></li></ul></div>
23:40chouserI wonder if tagsoup has options I can control here.
23:40brehaut(wrapping the inner ul in an li)
23:40brehaut(and im just guessing there)
23:41chouserleaving out the </li> closers seems to help, but that's not an acceptable option for this
23:41chouserI've got a lot of content flowing in this way and shouldn't be tweaking it
23:41xeqiI don't think <ul><ul> is valid
23:42brehauti think the validity or not of the ul without a wrapping li is very doctype dependant
23:42devnenlive...
23:42xeqitrue, I was jumping to html5
23:44devnchouser: look into nekohtml
23:45chousermeh. I didn't really want to be parsing this html.
23:45chouserI wonder if I can convince enlive to just emit the string without parsing it or escaping it.
23:45devndont use enlive
23:45brehautyeah it would. ive wanted that more than once
23:45devnsquare peg, round hole
23:46devnit's a clojure 1.1.0 project turned quasi-idiomatic
23:46gfrederickschouser: come on man, just use a regex. what could go wrong?
23:46devnit scared the living daylights out of me
23:46devnscares*
23:47chouserok, all I really want is way to use plain html as a template
23:47devnchouser: can you post the document and the intended result?
23:47brehautchouser: i havent used it myself, but dsantiago's tinsel might work?
23:48brehautalthough its possible also tagsoup based
23:48devnchouser: are you tied to plain html?
23:48devnso many questions...
23:49chouserplain html so that the template can be viewed correctly in a browser
23:50chouserthen I have content I'd like to place into that template -- the content is coming from an atom feed, so there are some plain strings but several chunks of html as cdata
23:50devnmust you always have complicated questions? ;)
23:51devnso unfortunately, or fortunately, enlive as a tool seems to fit that bill
23:51devnand yet, i've never had anything but headaches with enlive
23:51devnmaybe (likely) im dense
23:52chouserI wish I hadn't screwed up data.zip for rewriting, or I could use that throughout
23:52devnbut i just dont enjoy using it
23:52chouserhm, actually ...
23:53brehautjust use enlive to suck in the template, and do al lthe transformations with data.zip ?
23:54chouserI'm parsing the atom feed find with data.zip, and parsing the template fine with enlive. But plopping unparsed html from the feed into the template is apparently outside enlives capabilities.
23:54muhooi've had a pleasant experience with mustache for templatting
23:55muhoospecifically, stencil: http://www.google.com/url?q=https://github.com/davidsantiago/stencil&amp;sa=U&amp;ei=xySzT4yhHIiJiALZybT4AQ&amp;ved=0CBEQFjAA&amp;usg=AFQjCNGveEdvH3zgetwhvsTnrssteX3S7g
23:55muhoogah
23:55muhoohttps://github.com/davidsantiago/stencil
23:55brehautchouser: the format that enlive uses for html is compatible with the data.zip xml format though right?
23:56wkmanire1:( I ran out of internet for a few minutes.
23:56muhoowkmanire1: you got to keep putting quarters into it, man.
23:58chouserbrehaut: I'm not sure that matters. I'm getting html that was cdata in the feed, so an unparsed string of html.
23:58chouserbrehaut: if I use html-content to insert it in the template, tagsoup misinterprets it
23:59brehautchouser: right sorry, i mean just use enlive to suck in your template html, and then use data.zip to stick the text into place ?
23:59brehaut(without processing that text)