#clojure logs

2011-11-10

00:11mindbender1$findfn :stu
00:11lazybot[]
00:14mindbender1$(defrecord Person [fname lname address])
00:15mindbender1,(defrecord Person [fname lname address])
00:15clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
00:19mindbender1what's the equivalent of java interface in clojure?
00:29terommindbender1: protocol (IIRC, haven't used them yet)
01:01brehautmindbender1, terom: multimethods, protocols and interfaces all exist in clojure and perform related but different things
02:27tsdhDoes anyone have an example on how to use `name-with-attributes' from the tools.macro contrib lib?
03:07tsdhI figured it out and added an example to clojuredocs: http://clojuredocs.org/clojure_contrib/clojure.contrib.def/name-with-attributes
04:31Fossisomebody know why appengine-magic uses jetty directly and not ring.adapter.jetty?
04:31Fossifeels wrong to reimplement ssl connector handling
06:12Blkt(a late) good morning everyone
07:24drguildocan somebody help me solve problem 28 on 4clojure? i don't want the solution, just some pointers as i'm not making any progress.
07:24drguildo"write a function that flattens a sequence"
07:25drguildoapparently it's "easy"
07:30drguildoi've tried using cons but that requires cons'ing with something which produces a new sequence so i still end up with sub-sequence
07:30drguildoi tried using map but that just produces a sequence
07:38drguildoi guess not so easy that anyone can offer some advice
07:39fronxdrguildo: mapcat and recursion may be useful to you.
07:39fliebelAre any of the Clojure books available in mobi?
07:39fliebeldrguildo: I missed the question?
07:40clgvdrguildo: humm there is an elegant way that uses a certain function - but that would be at least 66% of the solution
07:40drguildoall my solutions so far have used recursion and i took a quick look at mapcat but dismissed it quite quickly so i'll look at it some more
07:40drguildoclgv: :-/
07:41clgvdrguildo: you have to decide whether I should tell you the function name
07:42drguildoprobably not at this point, thanks. i really want to solve this properly. the only reason i asked now is because i hit a point where i'm making literally no progress.
07:43drguildoi guess part of the problem is my knowledge of the various functions is very poor (i'm a total beginner) and so i've been trying to hammer a nail with only a saw.
07:44clgvdrguildo: than you should have a look at e.g. http://clojure.github.com/clojure/branch-1.2.x/index.html
07:44drguildoi should but i'm desperate to solve this problem before i move on to doing something else as it's bothering me now
07:47clgvdrguildo: a little hint: if tail-recursion becomes too complicated, you might as well try the lazy way
07:48drguildois this problem really "easy" if it requires the use of tail-recursion and laziness?
07:48drguildoi mean i've had no real problem with previous ones up to this point
07:48drguildobut this one has stumped me
07:50clgvI dont remember all of the previous one but their is a light increase in diffculty from fibonacci to palindrom to this flatten
07:51drguildoi solved those previous ones without much difficulty
07:52drguildomaybe i'm weird or there is some huge gap in my knowledge
07:52clgvwhy does your recursion approach fail?
07:53drguildobecause i've been trying to use cons and map and both of them produce sequences
07:53drguildoso i still end up with nested sequences
07:54drguildoi need to somehow make it produce nested cons calls but with a []/'() when it reaches the final element of the top-most sequence but i have no idea how
07:55drguildoi guess a distinct initial call to the function before doing recursive ones... maybe
07:55drguildoi'm at the point where i've tried lots of different things with varying degrees of success (failure?) and now my head is a bit of a mess
07:57clgvmaybe you should tak a break and continue later on
07:57drguildowell i went to sleep and woke up not long ago
08:00luciandrguildo: i think i used concat for mine
08:04drguildoi need to find a way of dealing with the recursive call that passes in (rest xs) where it's an empty seq. hrmmmmm...
08:05luciani do an if sequential?
08:06drguildoi still get a stackoverflowerror
08:07clgvdrguildo: the stackoverflow is due to not using loop-recur aka tailrecursion
08:08drguildoi don't see how because there would have to be a lot of nested sequences for that to happen and right now i'm just testing on an already flat one
08:08clgvoh, then your recursion stop criterion is wrong
08:08drguildoexactly
08:09drguildo(rest xs) is, at the end of a list, going to be a []
08:09drguildoso it'll just go into an infinite loop
08:09drguildoso i need to figure out how to avoid that
08:10drguildothis code seems far too verbose but i guess something that just works is a good start
08:11lucianmy solution is also pretty verbose
08:12clgvSO NOW YOU GOT ME TO OPTIMIZE MY GOLFSCORE ON THAT PROBLEM ;)
08:12clgvups. damn key^^
08:12drguildohow much did you reduce it by?
08:12clgv19
08:12clgvto 43
08:12drguildoexcellent
08:13clgvcould be a few more if there was a shortcut for recursive usage in a #() statement
08:16lucianhow can you see this "golfscore"? and what is it?
08:16clgvlucian: it's the number of characters you used and you have to enable it in the options
08:16lucianah, ok
08:16drguildois there a way to do a conditional bind? like if (rest xs) is empty then bind a variable to [], otherwise bind it to the result
08:16lucianso pointless, and wisely hidden by default :)
08:17luciandrguildo: if-let might do what you want
08:17lucianacutally, it doesn't bind conditionally, it just binds the condition
08:17clgvlucian: ah well it's interesting to see how short your solution is in comparison
08:18lucianclgv: what's your handle on 4clj? so i can follow you
08:18clgvlucian: I didnt do much there. only 37 of the easier problems so far ;)
08:18luciani haven't done much either, 71
08:19clgvits the same as here
08:19lucianclgv: really? search must be broken or something
08:20lucianyeah, yours is way shorter :)
08:21clgvbut not minimal it seems form the chart - I wonder whats the last trick
08:21lucianmine's from the time i was reading "the little schemer"
08:30drguildourgh
08:30drguildostill no further forward
08:31drguildoi have two options: unflattened list or stack overflow
08:32drguildoam i right in thinking it's impossible to get an unflattened list while using cons?
08:32drguildoerm
08:32drguildoam i right in thinking it's impossible to get an flattened list while using cons?
08:32luciandrguildo: try conj
08:32luciani use concat if it's a sequence and conj if it's not
08:33drguildobecause of the cons problem?
08:35luciandrguildo: sure. and it's more general
08:47kzarIs there a Clojure / Java library that splits up a URL into it's component parts? I was hoping to get a map back ideally
08:48drguildois it just me or are clojure error messages practically useless?
08:51drguildoclgv: can you tell me the name of that function?
08:52tsdhkzar: Doesn't the standard Java URL class have getters for the individual components?
08:53clgvdrguildo: you can do it via tree-seq. that was my first one. but now I changed it to reduce size and its using basic lazy primitives only
08:53kzartsdh: Oh yea, you're right
08:53kzar,(.getHost (java.net.URL. "http://google.com&quot;))
08:53clojurebot"google.com"
08:53drguildoclgv: which ones?
08:54clgvdrguildo: lazy-seq coll? mapcat
08:54fliebeldrguildo: What are you trying to do? I've seen you ask seq related question all morning :)
08:54clgvthough coll? works on the examples but maybe not in general for all flatten cases
08:54drguildowrite a function that flattens a sequence
08:55fliebeldrguildo: 4clojure? Because there is just a flatten function in core.
08:55drguildoyeah
08:55babilenkzar: (bean (URL. "http://www.clojure.org&quot;))
08:58fliebeldrguildo: If you want to do fancy, you could as well use http://clojure.github.com/clojure/clojure.zip-api.html#clojure.zip/next
09:03drguildoi want to do "something i can actually get to work" ;-)
09:09clgvdrguildo: the read about tree-seq and try that approach
09:10TimMcdrguildo: Which problem?
09:11fliebelTimMc: flatten a seq
09:11drguildo28
09:14TimMcOh, huh -- chouser's solution is mine, but inside out.
09:15TimMcI think it is a little better in efficiency that way, maybe.
09:19cemerickkzar: that's what the url fn in com.ashafa.clutch.utils does, actually :-)
09:19cemerickobviously built for clutch's purposes, but it might help you
09:20kzarcemerick: I switched back to 0.2.5 because I couldn't get the watch for changes feature working with 0.3.0. Again I posted on the group but my reply didn't show up
09:20TimMcdrguildo: So you tried a recursive solution, but it didn't work?
09:20kzarcemerick: Right I ended up writing my own, using clj-url.core/parse and then just renaming :path to :name pretty much (and stripping the "/" )
09:21cemerickkzar: google caught your emails as spam :-( I whitelisted you.
09:21kzarcemerick: Hey that's weird, I use google apps for my email too! cheers
09:22cemerickyeah, groups' spam detection isn't so great
09:22cemerickkzar: I'll have to reply later, but maybe you could send (another) email with your watch-changes call(s), or a gist to the same?
09:24kzarcemerick: Sure, that's totally fine. I reduced it down to simply adding a hook like (clutch/watch-changes db :test println :include_docs true) and I still found it to not work, then when I switched back it was working again. Might be me but I suspect the feature's buggered in the new version
09:25drguildoTimMc: yeah
09:26cemerickkzar: the tests pass, but, well, stranger things have happened than tests passing while a bug is floating about
09:26cemerickI'll definitely look at it some time this week
09:26kzarcemerick: Hey I meant to ask, what's your talk going to be about? Or is it secret?
09:26abedracemerick: I believe somebody said something about tests passing and bugs
09:26abedracemerick: can't quite place it though ;)
09:26kzarabedra: That _does_ ring a bell, heh
09:27cemerickabedra: I heard something like that somewhere.
09:27cemerick;-)
09:27cemerickkzar: http://clojure-conj.org/schedule#emerick
09:28technomancyso is clojure.test.generative quickcheck ported to clojure?
09:28abedracemerick: that's a good thing
09:28technomancywithout type inference? =)
09:28abedratechnomancy: not quite
09:28abedratechnomancy: it doesn't have narrowing
09:28redingercemerick: you have time for Q&A?
09:28kephalecemerick: i do a fair amount of machine learning so your talk looks pretty cool. any chance you'll post your slide somewhere?
09:28abedratechnomancy: but it is done in the spirit of qcheck
09:29TimMcdrguildo: Can you gist your (broken) solution?
09:29cemerickibdknox: all bark, no bite ;-)
09:29technomancyhttp://ruby.sadi.st/Heckle.html
09:29ibdknoxcemerick: probably. :D
09:29abedratechnomancy: that would be interesting
09:29abedratechnomancy: and actually really easy
09:29cemerickredinger: fair point. we'll see
09:29kephalecemerick: given that i'm still in MA instead of conj
09:30technomancyabedra: easier with CinC though
09:30cemerickkephale: slides, code, etc.
09:30abedratechnomancy: yes
09:30technomancywell, maybe not; hmm
09:30cemerickkephale: where in MA?
09:30kephaleyay
09:30abedratechnomancy: didn't Ryan convert ruby into sexps to make Heckle?
09:30technomancyabedra: pretty much
09:30abedratechnomancy: well we are already there :)
09:30kephalecemerick: waltham at the moment, but often in amherst hanging out with Lee
09:31kzartechnomancy: Oh, I meant to say; I couldn't get that buildpack working it said it wasn't found. I ended up doing this: `heroku config:add LEIN_NO_DEV=1` which just set the environment variable manually and that worked fine
09:31cemerickkephale: right, right; couldn't place your handle at first :-)
09:31abedratechnomancy: the cool thing would be to have a repl that replaced the reader with the reader + a heckler
09:31kephalecemerick: Brandeis to be precise. good luck on your talk though
09:32cemerickThanks!
09:33technomancykzar: ah, bummer. I'll see if I can get it working after the conj
09:33technomancyabedra: yeah, going upstream of the compiler would sidestep the cinc issue
09:34abedratechnomancy: yeah, the reader is the place for now where this would have to happen
09:37lnostdal_is it possible to extend deref and @ so it can work with other non built-in things?
09:37ibdknoxlnostdal_: yes
09:38TimMcIDeref, right?
09:38ibdknoxyep
09:38lnostdal_yeah, i need to do some java interop?
09:38ibdknoxno
09:38ibdknoxyou can just do deftype
09:39ibdknoxand implement IDeref
09:39TimMcthat is sort of interop
09:39lnostdal_ok, cool
09:39ibdknoxfair enough
09:39ibdknoxit doesn't really *look* like interop :)
09:39ibdknoxlnostdal_: http://stackoverflow.com/questions/2944108/implementing-custom-data-structures-using-clojure-protocols
09:39mjwhittare clojure conj slides online anywhere?
09:40abedralnostdal: Make sure to look at how deref works in the current set around blocking when being printed
09:40abedramjwhitt: they will be
09:40abedraand the videos should be as well
09:41redingermjwhitt: They'll be here when we get them: https://github.com/relevance/clojure-conj/tree/master/2011-slides
09:41ibdknoxlnostdal_: so you'd do that with clojure.lang.IDeref
09:41mjwhittthanks
09:41redingerWe'll announce them and the videos later
09:43lnostdal_ibdknox, awesome; thank you
09:56kzartechnomancy: Should futures work OK on Heroku?
09:56technomancyabsolutely
09:56technomancyyou can do "heroku run lein repl" to experiment
09:57kzaroh, good point I'll use that
09:57kzarthanks
10:00meliponeI have a question about Java interop. I'm using lein repl and I am putting a jar file into the lib directory so it's in my classpath. I do (import '(net htmlparser jericho)) to access the jar file but I get a class not found exception. I can access the jar fine through a Java program that I import, so WTF?
10:01technomancy(import 'net.htmlparser.Jericho) maybe?
10:01drguildoTimMc: i don't even have a solution right now because i've had about 2^2809423 varies attempts none of which have failed so i just deleted it all with the aim of starting over
10:01sriddo we have an IRC channel specific to clojure/conj?
10:01danlarkinwow @fakerichhickey is really tweeting up a storm
10:02TimMcsrid: Like, a backchannel?
10:02drguildohttps://gist.github.com/1355036
10:02drguildothat's the last one i tried
10:03drguildoi don't actually even understand why it doesn't work heh
10:03TimMcdrguildo: You'll probably have better luck using map.
10:03drguildoi've tried using map
10:03redingersrid: I debated that, I am in #clojure/conj, but didn't think everybody in here would mind if we just hung out here :)
10:03drguildosame problem: i get back the exact same sequence
10:03drguildowell, apart from the outer one being a list
10:04TimMcdrguildo: ##(seq [1 2 3])
10:04lazybot⇒ (1 2 3)
10:04TimMc,(seq? [1 2 3]) rather
10:04drguildomy problem is i can't use map or cons/conj without getting back another list
10:04clojurebotfalse
10:05drguildoso any recursive call to them is going to result in another list leading to nested lists
10:05drguildoby lists i mean sequences but whatever
10:05lucianheroku have nice graphics
10:05TimMcdrguildo: so you want to concatenate them
10:06drguildoso wait
10:06drguildowhat do i use instead of seq? i thought vectors were sequences
10:06gtrak /join #clojure/conj
10:06TimMcdrguildo: If you have '[[1 2 3] [a b c]] how do you turn that into '[1 2 3 a b c]?
10:06TimMcdrguildo: coll?
10:06drguildoTimMc: if i could answer that i'd be able to solve this problem
10:06TimMcvectors, lists, maps, sets, and sequences are all colls
10:06TimMcand are all seqable
10:07clgvdrguildo: I suggest structuring your code so that if you know your argument is a collection than you apply your function on every element and concatenate the result
10:07redingerAlright, let's take the clojure/conj talk over to #clojure/conj
10:07drguildoi think i solved it
10:07drguildohttps://gist.github.com/1355050
10:07clgvcoll? works on the 3 examples but not necessarily on all flatten use cases
10:07drguildoTimMc: why does seq? return false on a vector?
10:08clgvdrguildo: since it doesnt implement ISequential ##(doc seq?)
10:08lazybot⇒ "([x]); Return true if x implements ISeq"
10:08TimMcdrguildo: Because a vector is a collection, but not a sequence. (seq some-vector) is a sequence.
10:08clgvIseq rather
10:08drguildohrmm, ok
10:08drguildoi thought they were all sequences by default
10:08TimMcIt is seq-able -- you can get a seq of it -- but it itself is just a collection.
10:08TimMcdrguildo: It's the other way around -- sequences are themselves collections.
10:09TimMcbut it is very easy to work with any collection as a sequence.
10:09drguildoi think i need to sit down and read an actual book sequentially (pun intended) because i get the impression there are basic things i should know that i don't
10:09raekdrguildo: the functions in clojure that expect a sequence as an argument will call (seq ...) on the argument first before using it
10:09TimMcseq vs. coll is a bit complicated.
10:09abedra,(= '(1 2 3) [1 2 3] #{1 2 3})
10:09clojurebotfalse
10:10drguildowhat should i do to understand it? is there something i should read? is it important to know?
10:10TimMc,(= '(1 2 3) [1 2 3])
10:10clojurebottrue
10:10raekIMHO, it would have been more intuitive (but more verbose) if the core function would not have called 'seq' automatically
10:10abedraTimMc: yes, sorry, I got carried away
10:11TimMc,(vec (seq #{1 2 3}))
10:11clojurebot[1 2 3]
10:11TimMc,(vec (seq #{3 2 1}))
10:11clojurebot[1 2 3]
10:11pjstadig,(= '(1 2 3) [1 2 3] (seq #{1 2 3}))
10:11clojurebottrue
10:11raekdrguildo: most of the time, you just use sequences and use vectors as sequence literals
10:11TimMc,(ancestors (class #{2 1 3}))
10:12drguildoyeah but right now trying to use a vector as a sequence literal bit me in the ass so i need to have a more precise understanding than that
10:12TimMcoh, clojurebot
10:12TimMc&(ancestors (class #{2 1 3}))
10:12lazybot⇒ #{java.util.Set clojure.lang.IMeta clojure.lang.IObj clojure.lang.IFn java.util.concurrent.Callable clojure.lang.IEditableCollection java.lang.Runnable clojure.lang.IPersistentCollection clojure.lang.Seqable java.lang.Object java.lang.Iterable java.util.Collection ... https://gist.github.com/1355062
10:12drguildoi wasted hours because i was using seq? on a vector
10:12raekdrguildo: how did it bite you?
10:12drguildoand it was returning false
10:12drguildoread the last 2 gits i pasted
10:12raekalso, to remove one level of nesting of sequences, use (apply concat ...)
10:13drguildothe first fails and the second works
10:13raek,(apply concat [[1 2 3] [4 5 6]])
10:13TimMcclojurebot is down
10:13TimMcsuddenly
10:13raek&(apply concat [[1 2 3] [4 5 6]])
10:13lazybot⇒ (1 2 3 4 5 6)
10:13abedraTimMc: you killed it
10:13TimMcmaybe pj did
10:13TimMche was the last to poke it
10:14abedratrue
10:14TimMcdrguildo: ##(if (seq [1 2 3]) "It's seqable" "It's not seqable")
10:14lazybot⇒ "It's seqable"
10:14pjstadigwho me?
10:14pjstadignah
10:14clojurebot#{clojure.lang.IPersistentSet clojure.lang.AFn java.util.concurrent.Callable clojure.lang.IObj clojure.lang.IMeta ...}
10:14clojurebot(1 2 3 4 5 ...)
10:14drguildoright, but it isn't a seq
10:14TimMchaha
10:14TimMcOh, clojurebot
10:15TimMc,(seqable? [1 2 3])
10:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seqable? in this context, compiling:(NO_SOURCE_PATH:0)>
10:15TimMc&(seqable [1 2 3])
10:15lazybotjava.lang.RuntimeException: Unable to resolve symbol: seqable in this context
10:15TimMc&(seqable? [1 2 3])
10:15lazybotjava.lang.RuntimeException: Unable to resolve symbol: seqable? in this context
10:15TimMcWhat am I missing?
10:15pjstadigseqable? doesn't exist?
10:15raekseqable? is in contrib (and does not always work)
10:15TimMcOh! It's a contrib thing?
10:16ibdknoxyes
10:16drguildosequential?
10:16hiredmanno
10:16TimMcNot quite.
10:16abedra&(apropos 'seq)
10:16lazybotjava.lang.RuntimeException: Unable to resolve symbol: apropos in this context
10:16TimMcapropos is a repl util
10:16raekthe clojure collections are seqable, so you can use 'coll?'
10:16abedrathought it might be available here
10:16ibdknox&(require 'clojure.repl)
10:16lazybot⇒ nil
10:16TimMc,(coll? "foo")
10:16clojurebotfalse
10:16ibdknox&(apropos 'seq)
10:16lazybotjava.lang.RuntimeException: Unable to resolve symbol: apropos in this context
10:17ibdknox&(clojure.repl/apropos 'seq)
10:17lazybot⇒ (seq-test if-seq-error seqable? chunked-seq? sequential? doseq sequence rseq seq? xml-seq seque rsubseq seq re-seq resultset-seq file-seq tree-seq enumeration-seq iterator-seq lazy-seq line-seq subseq seq-zip parsed-seq parsed-smile-seq)
10:17TimMcdrguildo: Basically, colls and seqs and so forth are best represented with a Venn diagram that no one was drawn yet.
10:17TimMc*has
10:17drguildoso a string is sequable even though it isn't a coll?
10:17raekyes
10:17TimMcyeah, it's a special case of sorts
10:17raekdoesn't support conj, for instance
10:17TimMc&(seq "hello")
10:17lazybot⇒ (\h \e \l \l \o)
10:18pjstadigwhich means you can't...
10:18drguildoso seqs are the union of collections and some other stuff?
10:18abedraand other behavior you might not expect
10:18abedra&(reverse "hello")
10:18lazybot⇒ (\o \l \l \e \h)
10:19melipone(import 'net.htmlparser.jericho) does not work either ...
10:19raekanyway, flatten is a bit weird function to have since the line between collection and "atom" is a bit fuzzy in clojure
10:19raek(I have never used it)
10:19pjstadig,(into "hello " (seq "world"))
10:19clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentCollection>
10:19pjstadig^ a sad fact
10:20tsdhraek: Why is it fuzzy? No collection is an atom, isn't it?
10:20raekmelipone: the part after the last dot must be a class (you cannot import every class in a package)
10:20technomancypjstadig: I wonder if that's just waiting for more seq stuff to get moved to protocols
10:20TimMcdrguildo: Point of clarification: "atom" is an overloaded word here.
10:20abedraoh wow, did both bots die?
10:20pjstadigtechnomancy: maybe
10:20TimMcthere are only so many good names
10:20TimMc&(+ 1 1)
10:20lazybot⇒ 2
10:21TimMc&(println "still alive")
10:21lazybot⇒ still alive nil
10:21clgv,(println "still alive")
10:21clojurebotstill alive
10:21hiredman /win 22
10:22hiredmanwhoops
10:23raekmelipone: (import 'net.htmlparser.jericho.Attribute) or (import '(net.htmlparser.jericho Attribute Config))
10:24raekbut use (:import net.htmlparser.jericho.Attribute) or (:import (net.htmlparser.jericho Attribute Config)) in a 'ns' form
10:28TimMcdrguildo: Makin' a spreadsheet of this stuff.
10:30fliebelHuh... How can I access the TO field? http://download.oracle.com/javaee/5/api/javax/mail/Message.RecipientType.html
10:31fliebeld'oh javax.mail.Message$RecipientType/TO
10:32ibdknoxin case anyone finds this useful: https://github.com/ibdknox/watchtower
10:32duck1123fliebel: did you look at the postal library?
10:32fliebelduck1123: Not yet. I first wont to familiarize myself with the Java way.
10:32drguildoTimMc: ok, thanks
10:34duck1123fliebel: I just started using it myself yesterday, but so far, it seems pretty easy. I had to do crazy things like attach a file to the email, and postal made that way easier than using the java lib directly
10:34fliebelduck1123: Huh, I remember someone showing me some project wrapping javamail, but I seem to remember it was way less mature
10:36duck1123fliebel: https://github.com/drewr/postal
10:36fliebelduck1123: yeayea, did you show that to me before? Or was that someone else with a different library?
10:37duck1123fliebel: I don't think it was me. I just found it yesterday
10:38alexbaranoskyI've gotten by with: (:import [org.apache.commons.mail SimpleEmail])
10:38fliebelduck1123: It was the same probable, or at least it also does not include receiving mail.
10:39drewrfliebel: yes, postal is currently send-only
10:40drewror just Message contruction if you want to take care of sending yourself
10:41fliebeldrewr: So it can map to and from maps to javax.mail.Message?
10:43drewrfliebel: yes
10:43drewror at least it should!
10:44drewropen a ticket if there's a deficiency and I'll fix quickly
10:44fliebeldrewr: So I "only" need to find a nice api for mailboxes and such.
10:45drewrfliebel: for imap et al?
10:46fliebeldrewr: yea
10:48drewrI'll add those eventually
10:48drewrthe main thing I constantly needed was a one-liner for sending out a message (for monitoring, etc.)
10:54TimMc$findarg (map % [true 5 "" nil false]) [true true true false false]
10:54lazybot[]
10:55bhenryseq
10:56bhenry(boolean (seq %))
10:56bhenryoh that's wrong too
10:56bhenry,(boolean nil)
10:56clojurebotfalse
10:56bhenryjust boolean i guess.
10:57duck1123,(boolean 5)
10:57clojurebottrue
10:57TimMc&(= (map boolean [true 5 "" nil false]) [true true true false false])
10:57lazybot⇒ true
10:58TimMclazybot, you fail
10:58duck1123,(map identity [true 5 "" nil false])
10:58clojurebot(true 5 "" nil false)
10:58meteorfox, (print "Hello")
10:58clojurebotHello
10:59meteorfoxhi, can anyone explain the bots? what's the difference between the clojurebot and the lazybot?
10:59pyrhi
10:59pyris there a way for leiningen to use repos with credentials ?
10:59pyri.e if a maven repo is protected by a htaccess
11:00duck1123pyr: have you tried setting up whatever you have to do in ~/.m2/settings.xml for the same thing in maven?
11:01pyrduck1123: yep, this works
11:01pyrduck1123: i just want to know if there's a way to keep the config in project.clj
11:01pyrduck1123: it doesn't seem to accept the http://user@password:... scheme
11:02pyri meant http://user:password@host/path
11:03duck1123https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L136
11:03duck1123:username and :password flags
11:04pyrthank!
11:04pyrthanks, rather :)
11:07TimMc$findfn "<" "&lt;"
11:07lazybot[]
11:07TimMcah well
11:10pjstadig&(System/exit 0)
11:10lazybotjava.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
11:10ibdknoxlol
11:10ibdknox:p
11:16TimMctechnomancy: Hey, isn't "[1.3.0,1.4.0)" not supposed to pick up 1.4?
11:17technomancyTimMc: not sure exactly. it may allow everything up to but not including the release, and the snapshots are considered prior to the release.
11:18TimMcI didn't understand that/ :-(
11:18technomancy(< 1.3.0 1.4.0-SNAPSHOT 1.4.0) ; basically
11:19TimMcew ew ew
11:19duck1123[1.3.0, 1.3.∞-1]
11:19technomancy1.4.0 is not included in that range, but the snapshot is "under" the release.
11:19TimMcAny way to say "1.3.*" then?
11:19technomancynot sure off the top of my head
11:20TimMcI see this as one of the things holding back large-project robustness (not just in Clojure.)
11:20technomancywell generally applications should never use version ranges, just libraries
11:21TimMcThat's what I mean.
11:21TimMcWhen libraries depend on libraries...
11:22duck1123TimMc: but you can just lock down the transitive dependencies in your project, that way you're sure
11:23technomancymore details here: http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges
11:28TimMcOK, so [1.3.0,1.3.999] for now.
11:36seancorfieldamalloy: Raynes comment about juxt made me check the WS codebase... 13 occurrences of juxt in ~3kloc :)
11:44pjstadig&(deref (future))
11:44lazybotjava.lang.SecurityException: You tripped the alarm! future-call is bad!
11:51lnostdal_couldn't ref-set, reset! and others be replaced by a generic setter facility now? .. with all the new stuff added to clj recently
11:53vijaykiranHi .. I'm experimenting with enlive templating with compojure webapp - when I change the html file - the application doesn't reload it unless I stop and start it again ..
11:53vijaykiranis there anyway I can make it dynamically loaded whenver there's file change?
11:54lnostdal_vijaykiran, re-load the resourc (xml-resource, html-resource) on every call to your templating code
11:54lnostdal_resource*
11:55lnostdal_at least that's what i do; on production i have (let [resource ...] (defn my-handler [] ...)) while developing i have (defn my-handler [] (let [resource ...] ...))
11:55raekvijaykiran: if you have a repl you can reload the namespace that contains the deftemplate with (require ... :reload)
11:56raekthere is middleware for reloading .clj files automatically, but that wouldn't trigger if you change a .html file
11:57seancorfieldi had to solve that problem in fw/1 so i have a dev mode (that reloads the namespaces and resets the html node cache on every request) and a url param (configurable) that lets you force a reload
12:09fremI'm lazy. Is there a version of Clojure Box updated for 1.3?
12:29rplevyRaynes: OAKFOREST / CJ4MMF
12:36Raynesrplevy: Gotcha. Thanks.
12:36wawaii
12:41scottjcemerick: when are you releasing your bayes lib? during/after your talk?
12:42cemerickscottj: sometime after
12:42scottjcemerick: best estimate?
12:42scottj"when it's ready" :)
12:42cemerickon review, someone pointed out a relatively significant flaw in my treatment of continuous variables, so I want to fix that before letting people trip up on it
12:42cemerickNext week, I'm hoping.
12:42scottjcool
12:43cemerickgd integrals
12:43nuclearsandwichcemerick: I am taking those math classes. Even we trip up on stuff like that all the time. ;)
12:44ibdknoxewwww math.
12:44scottjpeople at conj: are they recording this year? (have they announced it/do you see a camera?)
12:44ibdknoxyes
12:44cemerickyeah, it's all being recorded
12:44scottjcool
12:44nuclearsandwichscottj: yeah they have I think confreaks doing it. High quality in my past experiences
13:28TimMc$findfn name [:a :b] {:a "a" :b "b"}
13:28lazybot[]
13:29Bronsa,(into {} (map (juxt identity str) [:a :b]))
13:29clojurebot{:a ":a", :b ":b"}
13:32mabesAccording to the docs on extend (clojure 1.2) I should be able to provide interfaces (not just protocols), however this fails: (extend Foo clojure.lang.IFn {:invoke (fn [foo n] (if (= n 0) (.a foo) (.b foo)))})
13:32mabesit says "interface clojure.lang.IFn is not a protocol"
13:33mabesthe same happens with the extend-type macro since it just expands to use extend
13:33mabeshowever, if I inline the interface functions in the deftype it does work
13:33mabesany suggestions on what I'm doing wrong?
13:44semperosI'm new to logic programming, and obviously to core.logic; I'm converting some "regular" functions into ones that return goals
13:44semperostake this code for example: https://gist.github.com/1354083
13:45semperosI have a function that relies on some Java interop under the hood and returns a boolean
13:45semperosbut I've not seen any example of unifying a function's return value with `true`, as I've done in that gist
13:45semperosis this the "right" way in this situation?
13:48fliebelsemperos: iirc, you need to use project to mix up regular and goal functions.
13:49fliebelImagine what would happen is foo was unbound.
13:50fliebelSo project walks the var, and binds the ground value, so you can use it in normal functions.
13:50semperosok
13:52semperosfliebel: thanks, I'll try to get my head around project more, I had seen it used in a simple arithmetic example
13:57callendo you guys think the community needs a blog that documents common foibles and confusions that noobies run into when learning Clojure?
13:57klauernYES!
13:57ibdknoxthe community needs a starting point in general
13:58klauernI'm just learning Clojure now and I have had lots and lots of problems that amounted to simple things like (quote) and REPL behavior
13:59semperosone of the challenges in documenting such a starting point is the diversity of "skills" required to get started
13:59klauernI've even got this link bookmarked because I keep tripping up with it: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
13:59semperosJVM experience, Lisp development, functional programming...
14:00ibdknoxsemperos: yeah, I think part of what would be helpful is starting from no framepoint
14:00ibdknoxsemperos: because then you're forced to explain yourself in plain english in a way that could be universally understood
14:00semperosibdknox: possibly, but then you're reading 100+ pages of material before you're really started :)
14:01ibdknoxsemperos: not if it's written right ;)
14:01semperosagreed
14:01ibdknoxI've been thinking about taking that up as a project soon
14:01cemerickibdknox: how many projects do you need? ;-)
14:02ibdknoxcemerick: 27 at least ;)
14:02cemericksounds about right
14:02cemerickas if I should talk :-P
14:02semperosanother possible approach is what Rich did with the videos, in terms of detailed introductions for folks coming from Java, Lisp, etc. backgrounds
14:02ibdknoxabsolutely, I think both are extremely useful
14:03ibdknoxand necessary!
14:03technomancythere's this site, but it kinda sputtered out: http://learn-clojure.com/
14:03semperosI know for myself that I "got" Clojure in multiple phases, spending large swaths of time focusing on those individual skills until one day a critical "grok mass" was reached
14:04ibdknoxtechnomancy: yeah, it needs work... lots of work.
14:08callensooooo
14:08callenis it something I should do?
14:08callenI have a clojure project I am working on already
14:08callenit would simply be a matter of documenting as I go.
14:09callenI've been writing Clojure for 1-1.5 years but still feel stoopid. :|
14:09technomancymaybe you could contact the site's maintainer and see if he wants help
14:09callenheh, I've gone down that route before
14:09callentrying to pick up on poorly maintained stuff
14:10callenit turns into a shit-show.
14:10callenunless they're prepared to hand over the site and the domain, I'm not going to do that.
14:10technomancymaybe. there are a lot of independent efforts for things like this and not much coordination.
14:10callenthat's not in the slightest my fault that people are too lazy to work with me.
14:10ibdknoxhm
14:10callenHN Office Hours is derelict because I couldn't get the guys I worked with to stop sitting on it and let me code.
14:10technomancywell there's always the wiki
14:11callenI worked with the original weekend hackathon crew to get it deployed.
14:11technomancyno bottlenecks there
14:11callenI'm sharing anecdote
14:11puredangerklauern: I have argued for a while now that the content on Colin's blog you reference should be on one of the prominent pages on clojure.org instead of what is currently on http://clojure.org/libs but I never got a blessing to do it. I catalogued a bunch of similar ideas here: http://dev.clojure.org/display/doc/clojure.org+TODO+list
14:11callennot authoritative wiki content.
14:11technomancypuredanger: that absolutely should happen
14:12puredangertechnomancy: well I have edit rights on the wiki. :) But I am typically delicate in changes on those pages unless blessed by Stu or Rich.
14:12callenthat's the thing
14:13callenI'm not in the mood to debate, or argue, or try to make an encyclopedia of Clojure
14:13callenI just want to share anecdotes that will be relevant to noobies.
14:13callen"here's why my classpath was fucked"
14:13callen"here's what I misunderstood about namespaces"
14:13technomancypuredanger: I can see if I can corner one of them
14:13ibdknoxthat's a very different kind of content
14:13callenthat's not wiki content.
14:13ibdknoxand a very good kind of content
14:13callenthat's my point.
14:13callenit's not wiki relevant at all
14:13ibdknoxgo for it
14:14puredangerclojure-docs is a good place for stuff like that example stuff but it is function-focused
14:14callenthat's not a good place for what I'm talking about.
14:14puredangeryeah
14:14callenthis is why I just do what's in my head normally.
14:14callenokay, so we're back to where I started
14:14callenmaking a blog.
14:14callengot it.
14:14puredangerthings like "contains? doesn't do what you think it does. try some."
14:14ibdknoxpuredanger: cleaning up clojure.org would definitely make a huge difference. Just making it less like a PhD candidate's website is a good start.
14:15technomancyI don't necessarily think a "Pitfalls" page would be out of place on the wiki
14:15ibdknoxtechnomancy: that's fair
14:15puredangeribdknox: my best thoughts after collecting and distilling ideas on the web site a year ago are on that referenced to do list.
14:16callentechnomancy: I don't want my content to be subject to the whims of the community.
14:16callentechnomancy: I'm just making a blog.
14:16puredangeribdknox: they are mostly not radical changes though, just cleaning and improving organization. I'm not a web site designer
14:16klauernWell, one thing that still trips me up is when walking through a tutorial and they have me type (ns foo) or something equivalent, I then try using (doc) (find-doc) or whatnot and realize that it doesn't work anymore
14:16klauernThis is in the REPL
14:16ibdknoxpuredanger: yeah, I would want to do something a little more radical :)
14:17puredangeribdknox: if someone wanted to take over and do whatever to learn-clojure, I'm sure Kyle would be happy to let people hack on it
14:17klauernPart of the problem I have is that I don't feel like when I'm in the REPL as a n00b I know enough about anything to be effective or useful. There's not (help) command, for instance, or (help ns) (help import), etc., that would be different from (doc ns)
14:17semperoswhat would folks consider to be the "most successful" non-clojure.org Clojure reference website? (informal poll)
14:17ibdknoxpuredanger: interesting...
14:17mdeboardklauern: What language are you coming from?
14:17klauernJava primarily
14:17callensemperos: github.com
14:17klauernRuby on the side
14:17TimMcsemperos: clojuredocs.org
14:18puredangerklauern: there is an api to get examples from clojuredocs at the repl
14:18TimMcIt's the only one I know of.
14:18puredangeri find the core docs to be both wonderfully (and painfully) concise - clojuredocs plugs a hole there in providing examples
14:18ibdknoxyeah, I have a sample size of one :/
14:18ibdknoxexamples are the key to language acqusition
14:18klauernpuredanger: what is that? I usually flit between clojuredocs and my REPL to figure things out
14:19technomancythe docstrings that just say "please see clojure.org" are always fun to hit when you're on a plane
14:19TimMchaha
14:19ibdknox:(
14:19puredangertechnomancy: :) special forms ...
14:19TimMcgood times with bad docs
14:19semperosmy thought was clojuredocs.org as well, and even though an API/examples reference site, distilling what makes that so successful would be a first-step in standing up a proper and comprehensive "learning Clojure" site, from a usability and reliability-of-information standpoint, imho
14:20puredangerif anyone out there uses DuckDuckGo as their search engine (try it!) you can do "!clojure" in searches to search clojuredocs
14:20lambdanaut(reduce * (range 1 101) ) gives me an int overflow. What do?
14:20TimMc(inc DuckDuckGo)
14:20puredangerklauern: the lib to access clojuredocs from the repl is at https://github.com/dakrone/cd-client
14:21semperoslambdanaut: (reduce *' (range 1 101))
14:21semperosis one way
14:21TimMcIs this a 1.2 vs. 1.3 thing?
14:21klauernpuredanger: excellent!
14:21semperosyep
14:21TimMc,(doc *')
14:21ibdknox,(doc *')
14:21semperoslambdanaut: the return value of that is a clojure.lang.BigInt
14:21lambdanautOh thanks! What does that apostraphe do?
14:21ibdknoxlol
14:21clojurebot"([] [x] [x y] [x y & more]); Returns the product of nums. (*) returns 1. Supports arbitrary precision. See also: *"
14:21clojurebot"([] [x] [x y] [x y & more]); Returns the product of nums. (*) returns 1. Supports arbitrary precision. See also: *"
14:21TimMclambdanaut: It's part of the name.
14:22semperoslambdanaut: gives you 1.2-style auto-promoting arithmetic
14:22TimMc,(name '*')
14:22clojurebot"*'"
14:22lambdanautOh ok
14:22TimMc&(type (+' 1 2))
14:22lazybot⇒ java.lang.Long
14:23TimMc&(+ Integer/MAX_VALUE 1)
14:23lazybot⇒ 2147483648
14:23TimMc&(+ Long/MAX_VALUE 1)
14:23lazybotjava.lang.ArithmeticException: integer overflow
14:23TimMc&(+' Long/MAX_VALUE 1)
14:23lazybot⇒ 9223372036854775808N
14:25puredangerre the previous discussion on better pages on clojure.org... IF you have a concrete page you would like to improve, then please write alternative text and file a jira. /core can bless and I'd be happy to do the work to change the page but I am lacking in time to do the writing itself.
14:27puredangerand if someone wants to take the initiative to hack on learn-clojure, I'd be happy to talk to Kyle (he's here in St. Louis) and I'm sure he'd be happy to have that happen.
14:27puredangerhis original intention was to have it be that kind of resource but he is also busy running a company and other boring things like that :)
14:28ibdknoxpuredanger: I think I'd like to do that, but I'll need a bit of time before I'll be ready to really do the work
14:28puredangeribdknox: I'll connect you
14:28ibdknoxpuredanger: great, thanks :)
14:28puredangeribdknox: or did you mean clojure.org or learn-clojure ?
14:29ibdknoxpuredanger: learn-clojure
14:30TimMcIs there a way I can get '(1 2 3) to print as '(1 2 3) instead of (quote (1 2 3))?
14:31TimMcor (1 2 3)
14:31ibdknoxpr
14:31mdeboard,("'(1 2 3)")
14:31clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
14:31mdeboarddarn :(
14:31ibdknox,(pr '(1 2 3))
14:31clojurebot(1 2 3)
14:32mdeboard,(prn "'(1 2 3)")
14:32clojurebot"'(1 2 3)"
14:32mdeboard:o
14:32gfredericksTimMc: printing source code?
14:33ibdknox,(pr-str '(1 2 3))
14:33clojurebot"(1 2 3)"
14:33gfredericksTimMc: you want a reader-macro-writer? :)
14:33TimMcgfredericks: Sort of. I am making an HTML page that shows the results of evaluating various functions on various bits of data.
14:33gfredericksI bet you want (fn [%] (foo %)) to be printed as #(foo %) too, don't you?
14:33gfredericks:)
14:33TimMcheh
14:33TimMcjust the data, ma'am
14:34kephale,(pr (clojure.string/replace (clojure.string/replace `'(1 2 3) "(quote " "'") "))" ")"))
14:34clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>
14:34gfredericksTimMc: the repl prints lists without quotes...
14:34TimMcyeah
14:34kephale: P
14:34TimMchttps://github.com/timmc/seqs/blob/master/src/seqs/core.clj
14:35licenseribdknox: I was told by swanky people you are clojurescript smrt?
14:35TimMcMy data examples are at the top.
14:35kephale,(use 'clojure.string)
14:35clojurebotWARNING: replace already refers to: #'clojure.core/replace in namespace: sandbox, being replaced by: #'clojure.string/replace
14:35clojurebotWARNING: reverse already refers to: #'clojure.core/reverse in namespace: sandbox, being replaced by: #'clojure.string/reverse
14:35ibdknoxlicenser: lol potentially
14:35clojurebotnil
14:35kephale,(pr (clojure.string/replace (clojure.string/replace `'(1 2 3) "(quote " "'") "))" ")"))
14:35clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox>
14:35meliponehow do I find a character in a string?
14:35kephaleerr
14:35ibdknoxuh oh
14:35kephaleeep
14:35abedra,(require '[clojure.string :as str])
14:35ibdknoxhiredman: clojurebot is toast
14:35clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox>
14:36technomancyibdknox: he should restart himself every 10m iirc
14:36dakronemelipone: (.indexOf "aoeu" "e")
14:36ibdknoxhaha that's an awesome failsafe
14:36gfredericksTimMc: my thought is that if you're displaying data, lists should be printed with bare parens, just like the repl does.
14:36licenserheh :) ibdknox I was just bothering technomancy about lein handling clojurescript deps he told me you're the go to gut - then he might just wanted to get rid of me :P
14:37TimMcgfredericks: I'd like to hide the implementation detail of seqs as lists. Maybe I should just use strings and eval. -.-
14:37ibdknoxlicenser: ah, well it actually handles cljs as jars just fine already
14:37ibdknoxlicenser: the only "tough" part is making sure that when you run the compiler, they're on your classpath
14:37gfredericksTimMc: that sounds like a separate issue...
14:37gfrederickswhy is '(1 2 3) any less of a list that (1 2 3)?
14:37ibdknoxlicenser: if you use cljs-watch it should just work
14:38kephale&(do (require '[clojure.string :as s]) (pr (s/replace (s/replace `'(1 2 3) "(quote " "'") "))" ")")))
14:38lazybot⇒ "'(1 2 3)"nil
14:38gfrederickss/that/than
14:38licenseribdknox: that means we can just toss clojurescript libs in clojars and all is fine and fluffy?
14:38TimMcgfredericks: Because (1 2 3) does not evaluate to itself whereas [1 2 3] does.
14:38ibdknoxlicenser: yessir
14:38gfredericksTimMc: I thought it was data -- why would you be evaluating it?
14:39licenseribdknox: technomancy did not promise too much when recommending you :P
14:39TimMcgfredericks: I want to show that (coll? (seq [1 2 3])) gives true -- and that involves being able to print "(seq [1 2 3])".
14:40ibdknoxlicenser: that's because I can't do much ;)
14:40licenserlol
14:40gfredericksTimMc: ah, okay, so it's not just data
14:41TimMcright
14:41gfredericksI'm not sure where I got that idea, I may have made it up.
14:41TimMcI may have said it.
14:41gfredericksif the problem is hard, invent something that simplifies it.
14:47seancorfieldtechnomancy: why is the swank-clojure switch repl to namespace command bound to C-c M-p? that seems hard to type and C-c C-n seems more intuitive ('n' for namespace) and didn't seem bound to anything else (at least for me)
14:49danlarkinp is for package
14:49danlarkinfrom common lisp
14:49technomancyyep
14:49callenI prefer the Count, rather than learning the alphabet.
14:50callenTHREE! AH AH AHHH
14:50hiredmanlooking for tests for syntax quote
14:50hiredmanhttps://github.com/hiredman/syntax-quote/blob/master/test/syntax_quote/core_test.clj
14:50callenhiredman: for what?
14:50hiredmanthats what I got, but I am sure there are cases that I have missed
14:51callenhiredman: what...is this?
14:51callenhiredman: what's with the backticks?
14:56TimMc"clojure's syntax quote as a macro"
14:56TimMchiredman: Nested quoting.
14:58TimMchiredman: You might also consider checking that gensym for the same symbol is different in different quotes.
14:59seancorfielddanlarkin: thanx, that makes sense now
15:00seancorfieldi've rebound it to C-c C-n which makes more sense for me with clojure (and is way easier to type / press!)
15:01scottjwhat % of the time do you go to the repl after doing C-c M-p?
15:02seancorfieldyou're going to tell me there's an easier way? (he asks, hopefully!)
15:02scottjwell I have C-c C-S-z do C-c M-p and C-c C-z
15:03jlfseancorfield: C-c C-<letter> bindings are reserved for major modes, so that may get you into trouble later -- C-c <letter> bindings are reserved for users
15:03jlfsee http://www.gnu.org/software/emacs/elisp/html_node/Key-Binding-Conventions.html
15:07hiredmanseancorfield: https://gist.github.com/1355999
15:08seancorfieldjlf: good to know... but i find C-c <letter> harder to type than C-c C-<letter> - i already bound something else to other-window because C-x o was too awkward (i kept pressing C-x C-o by accident)
15:10seancorfieldvery nice hiredman thanx!
15:12wwmorganhow would you download an image from a URL to a file? The first 2 or 3 things I've tried either give me an empty file, or only download half the image.
15:14hiredman(clojure.java.io/copy (URL. ...) (clojure.java.io/file ...))
15:14hiredman(that may or may not work)
15:16drewr(URL. ...) => (io/file "http://...&quot;)
15:16drewrin case that's easier
15:17puredangerRe the earlier discussion on improving Clojure docs, I blogged some ideas and links here: http://tech.puredanger.com/2011/11/10/improving-clojures-docs/
15:17wwmorganaha. You're using io/file for the destination, I was using io/output-stream. That might explain it
15:19wwmorganOK I think I'm in business with (with-open [is (.openstream (java.net.URL. url))] (io/copy is (io/file dest))). Thanks hiredman, drewr, technomancy!
15:20danlarkinyou can io/copy an url itself
15:21drewrdanlarkin: you're right... io/copy promotes its args doesn't it
15:22wwmorgandarlarkin: can you? I tried a string URL and a java.net.URL. The first one just gave me the contents of the string itself and the second gave me a no multimethod error
15:22danlarkinyeah it's implemented as a bunch of multimethods so it munges its args until it's in a form that it can actually copy bytes
15:22danlarkinoh really?
15:23danlarkinwell I know that the String defmethod copies the bytes of the string, but I thought there was a java.net.URL version
15:23danlarkinmaybe there isn't
15:23hiredmanthere may not be one for http urls
15:24wwmorganno dice on (io/copy (java.net.URL. "http://clojure.org/file/view/clojure-icon.gif&quot;) (io/file "/tmp/logo.gif"))
15:24hiredmanmight only work with file http urls
15:24hiredmaner
15:24hiredmanfile urls
15:25wwmorganbut I can wrap the URL in io/input-stream and everything works again
15:25hiredmanyeah, well
15:26drewrwwmorgan: don't bother with the URL constructor
15:27drewrtry (io/file "http://...&quot;)
15:27drewror io/reader
15:27danlarkinno no don't use io/reader if you don't want it sucked into a String
15:28danlarkinwhich ballses binary data
15:28raekuse io/url if you want a url...
15:28raekand as danlarkin says, reader is for text, input-stream is for binary data
15:29wwmorganI've got (io/copy (io/input-stream url) (io/file dest)), which works
15:29drewrdanlarkin: that's right he's dealing with an image isn't he
15:29drewrwwmorgan: nice
15:30wwmorganthe final solution was entirely too simple for me to struggle for so long. Thanks again!
15:30danlarkinthat will leak an inputstream, won't it?
15:31wwmorgandanlarkin: It would appear so. I'll use with-open
15:31drewrah, io/file is only for File (derp)
15:35seancorfieldemacs/lein workflow question: if you update project dependencies in project.clj, how do you go about running lein deps and refreshing your repl?
15:36seancorfieldright now i'm using an eshell to run lein deps, then running clojure-jack-in (and killing the previous process)
15:36technomancyseancorfield: you should be able to use pomegranate for that, but for some reason it doesn't work with swank
15:36technomancyopen issue, for now just re-jack-in
15:36technomancyif you set :checksum-deps true in project.clj you don't need to run deps manually
15:37seancorfieldah, right, i remember reading about that the other day
15:37seancorfieldis there a page that documents all of the stuff that can appear in project.clj?
15:37technomancylein help sample
15:39seancorfieldah good point technomancy thanx
15:40technomancysure
15:40seancorfieldholy %$@& that's a lot of options!
15:41duck1123seancorfield: it might be easier to read on the github page
15:42technomancylein help sample > #<buffer sample.clj> # C-x b sample, M-x clojure-mode
15:42technomancyif you're in eshell
15:42technomancyand you want highlighting
15:50_ulisesI suppose nobody here knows how to reset ones clojars password?
15:52melipone,(.indexOf "aeoa" "e")
15:52clojurebot1
15:53melipone,(.indexOf "aeoa" "a")
15:53clojurebot0
15:53_ulisessod it
15:56technomancy_ulises: I think you need to contact alex osborne
15:56_ulisestechnomancy: thanks. I've registered again. I'll let him know anyway to avoid username pollution
16:00TimMc$mail drguildo I'm writing up an explanation of seqs and colls, starting here: https://github.com/timmc/seqs (just playing around so far)
16:00lazybotMessage saved.
16:17_uliseseep
16:18gfredericks_ulises: you went to the profile page and it wouldn't work?
16:18_ulisesgfredericks: I couldn't log in as I didn't remember my password
16:18gfredericksoh. haha. of course.
16:18duck1123keepass
16:19_ulises:)
16:27gfredericksduck1123: beanbag?
16:28gfredericksduck1123: also don't want the name to imply that it has anything to do with EJBs and spring and all that :/
16:28duck1123that could work. Took me a second to figure out wft you were talking about though
16:29gfredericksI know :)
16:29gfredericksmaybe a name centered around class generation
16:30gfrederickssettlers.
16:30brehautgfredericks: ##(apply str "lib-" (repeatedly 4 #(rand-int 10))) have you forgotten your own rules already‽
16:30lazybot⇒ "lib-2367"
16:30gfrederickslib-2367 it is.
16:31gfredericks"The 2367 is for the future!"
16:33gfredericksbrehaut: do you have a keyboard shortcut for the interrobang or something?
16:33brehautgfredericks: os x text replacement
16:33gfredericksslick.
16:44klauernin leiningen, if you've defined a project as 'foo', how are the .clj files and (ns) definitions parsed under the src/ directory?
16:45klauerncan I have a (ns bar) inside of the src/ directory even if the project is 'foo' ?
16:45klauerncan I have a src/bar/thing.clj file or do I have to keep everything under src/foo ?
16:45brehautklauern: im pretty sure the namespaces provided by the project are completely seperate to the project (and thus package) name
16:45klauernok
16:46klauernI keep tripping up with the REPL because I use one leiningen project for alot of scratch files and they don't follow the same structure as the project
16:46klauernI'm still learning, so I'll have a foo.clj file in the src/ directory and not know why I can't (require 'foo) properly
16:47brehautdoes it have (ns foo) in it?
16:47klauernthat's what I'm still experimenting with
16:47technomancyclojurebot: single-segment namespaces?
16:47clojurebotsingle-segment namespaces is unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them.
16:48hiredmanis?!
16:48brehautenglish must be clojurebot's second language
16:49hiredman~english
16:49clojurebotEnglish is the official language of the universe
16:50brehauti expect us in color and the correct spelling of aluminium from now on
16:51technomancybring it on
16:51gfredericksduck1123: https://github.com/fredericksgary/lib-2367
16:51brehauttechnomancy: no apropos comic?
16:52brehautgfredericks: lol :)
16:52technomancyoh snap
16:52brehauttechnomancy: is the queens english your kryptonite?
16:52technomancybrehaut: nah I'm all about lifts and carparks and so forth
16:53technomancyjust none of my comic authors appear to be
16:53brehautstalemate then
16:54brehauttechnomancy: what would you call a carpark if you didnt call it a carpark?
16:54technomancybrehaut: "parking lot" ಠ_ಠ
16:54technomancyit's pretty lame
16:54brehautyeah
16:56seancorfieldtechnomancy: just saw that eshell trick of redirecting output to a buffer! awesome! i seem to learn something new about emacs every day that makes it even more powerful and cool :)
16:56gfredericksI once talked to an Argentine who thought it was completely ridiculous that we didn't have a word for "traffic light".
16:57technomancyyou can pipe to elisp functions too
16:58seancorfieldtechnomancy: oh boy... my brain will explode :)
16:58seancorfieldjust learned how to hide join / part messages in erc too (thanx google)
16:58technomancys'okay, clojurebot can usually clean up the mess
16:59brehauthow many of you are at the conj at the moment?
17:00gfredericksI doubt anyone will be bothered by my taking the group name 'lib-2367' on clojars.
17:00callenI'm at work.
17:00callenya bums.
17:01technomancybrehaut: M-| wc on /names in #clojure/conj says 21
17:01seancorfieldat the conj, listening to stuart halloway on "power"
17:01brehauttechnomancy: are you trying to expand my mind with emacs tricks again?
17:01technomancycouldn't hurt
17:02brehauttechnomancy: very soon im going to have more emacs tricks pinned to my wall than wall
17:03seancorfieldbrehaut: i'd rather have them "pinned" to my brain... but there may not be enough room :(
17:04brehautseancorfield: likewise. they keep falling out of my mind
17:04seancorfieldmaybe i just need more pins...
17:21callenseancorfield: get a voodoo doll.
17:21callenseancorfield: someone, somewhere, will start learning Clojure. Painfully.
17:21callenseancorfield: "BWAHAHAHA, HOW YOU LIKE MY NAMESPACE NOW?!"
17:24callendamn, tough crowd.
17:24calleny'all some haters.
17:25technomancyeverybody's busy watching the conj talk
17:25callentechnomancy: rink?
17:25mjwhittand it's a good talk
17:25callenRINK
17:26technomancyhttp://clojure-conj.org/schedule#halloway
17:26callenthat is *not* a video.
17:26callen :(
17:26brehautwhere did this assumption that there would be live streams come from?
17:26callenI assumed a lack of communism.
17:26callenclearly I should've quit my job and shown up.
17:27aperiodicare they being filmed for later uploading?
17:27michael_campbellyes
17:27aperiodic*all* of them?
17:27callenwell then.
17:27callenI will asynchronously process the talks.
17:28michael_campbellCamera's been going since the first talk, near as I can see.
17:28aperiodicawesome
17:28callen<3
17:28duck1123it's a minor consolation
17:28aperiodicthanks to whomever's in charge of that
17:28aperiodicbetter than nothing!
17:29callenBY FAR
17:29duck1123oh yes, thank you to whoever is filming, I still really wish I was there
17:30michael_campbelltalks are over for the day; time to go drink.
17:31erldaveI have a basic question on function arguments:
17:31erldave(defn another-fn [& {:keys [id] }] {:ty :link :id id })
17:31erldave(defn add-link [& args] (println "Answer of another fn" (another-fn args)))
17:31erldave(add-link :a-ns "ns1" :id "testlink" :from-obj rq :to-obj qs)
17:31erldavewhy doesn't the above work?
17:32erldaveI assume is because the variable args in add-link is not of type map any more
17:32erldavehow should I solve this?
17:32brehauterldave: add-link collects its arguments as a seq
17:32aperiodicargs is a sequence contianing all the arguments passed to add-link
17:32brehauterldave: but another-fn wants a map
17:32erldaveyes, so how would I forward the call on?
17:32brehautapply
17:33erldavehow do I "gather" the map into a variable so I can call another-fn ?
17:33brehautbut you might want to reconsider you API design
17:33duck1123(apply another-fn args)
17:33erldavethanks
17:34erldaveapply - perfect, thanks
17:40nickmbaileyanyone around use leiningen and also build debian packages of their projects?
17:41nickmbaileyi'm not extremely well versed in either debian packaging or maven but the two refuse to play nice
17:41nickmbaileybasically 'fakeroot lein deps' refuses to work
17:42jodaroisn't there a lein-deb plugin?
17:42duck1123I was just thinking the same thing
17:43jodarohttps://github.com/travis/lein-deb
17:43nickmbaileyhmm interesting
17:43jodaronever used it, but you might take a look
17:43nickmbaileyi doubt i'll be able to use it but it certainly might help me figure out whats going on
17:43nickmbaileythanks
17:43duck1123In my experience, using lein with anything other than the way it says in the readme is destined to fail
17:44jodaroi haven't built debian packages before but our ops guys require rpms for everything
17:44jodaroand i've been able to get most wacky build tools to deal with it since all you really need is to be able to run a shell command
17:45nickmbaileyyeah i have no trouble building rpms
17:45nickmbaileydebian packages have so much fancy tooling around them though
17:45duck1123huzzah! My last test passes. I have now officially replaced clj-record with Korma in my work project
17:45jodaronice
17:45brehautduck1123: awesome :)
17:46jodaroibdknox will be proud of you
17:46duck1123although I'm really starting to think there might still be room for a level of abstraction on top of korma
17:50brehautduck1123: there probably is
17:51brehautduck1123: something like django's admin + south on top of korma would satisfy a particular niche quite nicely
17:51duck1123brehaut: doubtful there's much yet
17:52duck1123I'd like to see something where the queries return the maps back as records, that way I could extend protocols and dispatch on types. I'm sure I can do it with the :transform flag, just haven't gotten there yet
17:53brehautduck1123: ive been quite happy with multimethods and plain maps from couchdb for my site
17:54brehauti can see the value in protocols, but i think id want a much more involved datamodel than most the sorts of websites i buld
17:55duck1123how do you determine the type of the map? I had a fork of clj-record a couple of years back (that old) that attached metadata to the records, and I use karras for my mongodb work because it gives me a record to use
17:55brehautduck1123: a combination of a :type member and keys
17:56TimMc$mail drguildo I moved it to https://github.com/timmc/seqs-and-colls
17:56lazybotMessage saved.
18:01duck1123I wrote this big extensive macro system that would allow me to dispatch a record based on the combination of it's type, the response format used, and the transport protocol and then stopped using it
18:01brehautoh
18:01brehaut:/
18:02brehautduck1123: one other option that might be useful is core.match
18:02duck1123https://github.com/duck1123/ciste look at "sections"
18:03brehautgive me a minute, i dont want to miss the next book depository deail
18:04duck1123There was one place I tried to use core.match, then I learned it didn't work that way. It's staying on my classpath though. Just looking for a good place to use it
18:07brehautback in a bit; lunch
18:13callenbrehaut: hawaii?
18:24brehautcallen: new zealand
18:39duck1123are there any good examples of libraries that use macros to define functions and also change the metadata? (in my case, arglist)
18:39duck1123I seem to be missing something
19:22TimMchttp://www.brainonfire.net/files/seqs-and-colls/seqs-and-colls.html
19:25TimMc(sorry, not a response to you, duck1123)
19:25TimMc$mail drguildo http://www.brainonfire.net/files/seqs-and-colls/main.html
19:26lazybotMessage saved.
19:53gtrakis there a way to seek into java code from slime/swank and emacs?
19:53nappingI don't think there is
19:54nappingI was looking at things a bit and there are possibly appropriate slime/swank messages which the clojure mode doesn't implement
19:57nappingActually, it's the disassemble message which isn't implemented, but could perhaps return bytecode for anything
19:59nappingFor writing some small Swing code it seems inner defs is convenient for naming subexpressions: http://pastebin.com/NFJ8RM6H I'd like to avoid using def, but it seems I'd need to hardcode a lot of the allowed forms to get similar results with a macro.
20:00nappingActually, it may only be the add method that other widgets can be nested inside
20:46tensorpuddinghmm, running massive programs in swank which use up 1 gb of memory is a bad idea
20:46tensorpuddingbecause java won't free that memory until you kill swank, it seems
20:49brehautjava never frees memory that its acquired from the OS
20:49tensorpuddingis it possible to tune the jvm to not take so much memory
20:49brehautyes
20:50brehautlein has a project property
20:50brehaut:jvm-opts
20:51brehautyou can use that to pass a max heap size to use which will cause the collector to kick more readily and limit the total growth
20:51tensorpuddingi didn't use lein that i know of, i just used clojure-mode to compile a piece of source code, which suddenly started running the program
20:51brehautif you are using swank you are likely using either lein or cake
20:53tensorpuddingi don't think i had to install lein to install clojure mode
20:54brehautyou dont need to use clojure mod
20:54brehaute
20:54brehautbut clojure mode does not evaluator your code for you
20:54brehautperhaps you are using inferior lisp mode?
20:55tensorpuddingno
20:55tensorpuddinga moment
20:55tensorpuddingoh wait, it is swank-clojure
20:56tensorpuddingi was running a slime command to compile it
20:56tensorpuddingof course...
20:57brehautif you use -Xmx256m as a :jvm-opt then the heap size will be limited to 256 mb, causing the collector to be more aggressive
20:59tensorpuddingi don't know how to configure the options sent to java, to be honest
20:59brehautbrb. rubbernecking
21:00tensorpuddingwell, it uses lein jack-in
21:00tensorpuddingso it's probably configurable through lein
21:03tensorpuddingthough i don't see how
21:04tensorpuddingoh, the LEIN_JVM_OPTS variable maybe
21:04brehauttensorpudding: as i said earlier, you can set the java options though your lein project file with the :jvm-opts key. it takes a vector of strings.
21:04tensorpuddingthis particular instance didn't involve a project
21:04tensorpuddingthere was no project.clj file here
21:04tensorpuddingi just compiled a .clj file
21:04tensorpuddingand sent it to swank
21:05tensorpuddingwell, i mean, there was the project that i used to jack-in, but that wasn't where the code that i compiled was
21:05brehautthe project that you used to jack in is the important part
21:06tensorpuddingmeh
21:06tensorpuddingi suppose so
21:09leo2007does the reference on clojure.org provide any more info than the doc-strings src?
21:11brehautleo2007: it varies; often it has more conceptual or rational type docs, if not concrete examples
21:11brehautleo2007: clojuredocs.org is pretty solid for examples though
21:11brehaut(where they exist)
21:11ajsharpso i'm a complete clojure newb -- am i heading down a sadomasochistic path by trying to program clojure in vim?
21:12gfredericksajsharp: there's an embarrassed but significant minority of us.
21:12ajsharpgfredericks: good to know :)
21:12gfredericksI mostly try to get by by not thinking about what I'm missing.
21:12ajsharpsounds like emacs and SLIME is how the hardcore dudes work in clojure
21:12tensorpuddingit's a good excuse to try emacs out
21:13tensorpuddingif you haven't yet
21:13ajsharptensorpudding: also good to know
21:13tensorpuddingthough getting started through swank/slime is drinking from a big firehose
21:13gfredericksajsharp: I also reassure myself by noting that nearly half of the issues brought up in #clojure are people having trouble with their swanks and their swines and their thing-modes.
21:13tensorpuddingslime
21:13tensorpuddingnot swine
21:13ajsharpthe thing that always threw me about emacs was constantly keeping my pinky on the ctrl key, but i don't want to get into a vim / emacs discussion...
21:14tensorpuddingi totally would find emacs unusable if i didn't bind caps lock as control a while ago
21:14tensorpuddingit helps in general
21:15ajsharptensorpudding: yea, i do the same already
21:15ajsharpactually, i bind it as escape, but i use it exclusively for vim
21:15ajsharpanyway
21:15ajsharpi also have very limited experience with the jvm, so that said, what is nailgun?
21:16brehautajsharp: totally use vim if you know it
21:17ajsharpbrehaut: yea, i'm definitely going to start with vim, and maybe i'll give emacs a try at some point before i get too deep
21:17brehautajsharp: i have heard good things about evil-mode for vim expats in emacs land
21:17brehaut(which is apparently better than vyper?)
21:18ajsharphaha
21:18ajsharpthat's awesome -- evil-mode
21:18ajsharpvim for emacs
21:18ajsharpso nailgun is a clojure development server?
21:25gfredericksnailgun is a generic jvm server
21:25gfredericksexists to circumvent the jvm startup time
21:31ajsharpgfredericks: oh ok, cool, thanks
21:34leo2007brehaut: thanks for that.
21:35leo2007why (seq? [1 2 3]) is false?
21:36brehautleo2007: many collections that are sequential are not seqs
21:36brehaut,(map (juxt seq? sequential) [[] () {} #{}])
21:36clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sequential in this context, compiling:(NO_SOURCE_PATH:0)>
21:37brehaut,(map (juxt seq? sequential?) [[] () {} #{}])
21:37clojurebot([false true] [true true] [false false] [false false])
21:37leo2007brehaut: thanks again.
21:38brehautleo2007: a seq is a particular abstraction; you hardly ever use seq? in real code, but you might use coll?
21:38leo2007brehaut: I see.
21:39brehautleo2007: and to complete this pile of noise, vectors while sequential are implemented use trees (well, tries) internally
21:41TimMcbrehaut: I'm trying to throw together a page explaining colls and seqs in clojure: http://www.brainonfire.net/files/seqs-and-colls/main.html
21:42brehautTimMc: excellent
21:42TimMcNeeds a lot more text and organization.
21:44brehautand perhaps discussion of equality partitions?
21:44TimMcGood point!
21:50aperiodicwait, so vectors have lg(n) access time?
21:50TimMcbase 32, I think
21:51gfredericksaperiodic: that means yes
21:51aperiodicwell, that's not too bad
21:51klauernAre there any tips or strategies for making Clojure wrappers around Java libs?
21:52klauernIn particular, how to do you wrap a method that returns an instance of a type or List<T> of something?
21:56aperiodicwait, is a vector just a map with integer keys?
21:56brehautaperiodic: roughly
21:56brehautit is different
21:56aperiodichow so?
21:57brehaut,(assoc {} 3 1)
21:57gfredericks{1 :foo, 10000000 :bar} would not go well as a vector
21:57clojurebot{3 1}
21:57brehaut,(assoc [] 3 1)
21:57clojurebot#<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>
21:58brehautvectors are required to have contigous keys
21:58aperiodicokay
21:58brehautand you conj onto a vector with a single item, but you conj onto a map with a pair
21:58gfredericksaperiodic: I think most people associate them more closely with lists than with maps.
21:59aperiodicso it's a map with tight restrictions on the keys, and presumably some performance benefits resulting from that?
21:59brehautyes
21:59aperiodicgfredericks: i always thought maps were more or less arrays (constant-access)
22:00brehautklauern: timmc is right about type erasure; List<T> is a java langauge ficton that doesnt really exist in the JVM
22:00gfredericksin terms of performance you could maybe say that, but certainly having arbitrary objects for keys distinguishes maps from arrays rather drastically
22:00nappingklauern: can you seq it?
22:00aperiodics/maps/vecs/
22:01aperiodicbrain fart
22:01klauernI would think so, but I'm new to Clojure, so I don't know how well clojure understands lists in Java
22:01nappingIt seems to work
22:01gfredericksaperiodic: and of course in any case the persistent-immutable thing is definitely not very array-like
22:01gfrederickspardon me if you're well familiar with that and I'm just nit-picking
22:02klauernI would think that returning whatever the Java call created is bad form as far as Clojure is concerned, and it'd be better to weave in a more Clojuresque return type
22:03nappingklauern: Call seq on the result
22:03nappingmaybe
22:03brehautklauern: java interop is first class in clojure; dealing with java objects is not dirty
22:04klauernah
22:04nappingIf it's just a collection like a list or something, converting it might be nice, but if it's more useful than that, you might as well expose it
22:04aperiodicgfredericks: i mean, i know they're not arrays in some very important respects, but my rough mental categorization was seq -> linked list, vec -> array, map -> hashtable
22:05brehaut,(seq (doto (java.util.ArrayList.) (.add :a) (.add :b)))
22:05clojurebot(:a :b)
22:05nappingunless you are going to a lot of trouble to rewrite a nicer interface. I guess you could say that's what clojure collections are already
22:05brehaut,(map inc (doto (java.util.ArrayList.) (.add 2) (.add 1)))
22:05clojurebot(3 2)
22:05klauernRight now I'm hoping to learn Clojure idioms and just get a better feel for the language
22:06klauernif the library I create ends up being useful at the end, all the better I suppose
22:06gfredericksaperiodic: that's a decent rough mental categorization.
22:06aperiodicgfredericks: so it was just a bit weird to hear that vecs are actually tries
22:07aperiodici might wanna look at the implementation to make sure i'm not doing anything too stupid with them
22:08brehaut,(map #(java.util.Collections/frequency % 1) [[] [1] [2 1 0 1 0 3]])
22:08clojurebot(0 1 2)
22:08brehautklauern: ^ as you can see, clojures operations know about java objects and clojrues collections fullfil the appropriate interfaces for java operations
22:09klauernThat's good to know
22:09gfredericksaperiodic: that's because of the persistent-immutable part
22:10brehautaperiodic: it means they are more naturally paralizable
22:10gfrederickselse it'd be hard to have good performance for "changing" vectors
22:10brehautaperiodic: and are cheaper for internal updates
22:10aperiodicyeah, that makes sense, because otherwise the entire vector would have to be copied whenever a single location was updated
22:11aperiodicwhich would be less than ideal
22:11TimMcbrehaut: I got a start on equality partitions. Anything beyond the 4 coll types to cover?
22:11brehautTimMc: interop ;) ?
22:11TimMcurgh
22:12brehauti wouldnt worry about that
22:12TimMcI could mention the interfaces.
22:12TimMcThere's more basic stuff to cover first.
22:12brehautTimMc: i think theres only three equality partitions though, so just those 4 should be fine
22:12brehaut(sequentials, maps, sets right?)
22:12TimMcyeah
22:13brehautyou might want to note that sorted or not isnt relevate to identity ?
22:13brehautbut meta data is?
22:14brehauterr isnt
22:14duck1123metadata does not impact equality
22:15brehautthats what i was trying to say, but failed at completely
22:16TimMc,(= (sorted-set) (hash-set))
22:16clojurebottrue
22:16gfredericks,(= [] #{})
22:16clojurebotfalse
22:17TimMcgfredericks: This is the article I am working on: http://www.brainonfire.net/files/seqs-and-colls/main.html
22:17gfredericks,(= () (new java.util.ArrayList))
22:17clojurebottrue
22:17aperiodicso, let's say that i wanted a thread-local mutable array in clojure, for doing something like image processing (so the array's size would make the log_32 factor non-trivial)
22:17aperiodicwhat would i use?
22:17brehautgfredericks: new? thats old school right?
22:17gfredericksaperiodic: a transient vector?
22:18brehautaperiodic: for image processing? use an array
22:18gfredericksaperiodic: or just an array, if you want
22:18gfredericksbrehaut: what's old school about it?
22:18brehautgfredericks: its from before the (Constructor.) notation?
22:19gfredericksI like new. Constructor. looks like a typo.
22:19gfredericksit's just hiding there.
22:19aperiodiclikewise
22:19gfredericksverbs go up front!
22:19aperiodicso easy to miss if you're not careful
22:20aperiodicand "new " is only 4 more chars
22:20gfredericksI don't want my eye to have to wander to the end of a long qualified classname just to figure out what we're doing with it
22:20gfredericksaperiodic: 3, since you save the "."
22:21gfredericksdang whippersnappers.
22:21brehauti find the the lumbering CapitalCamelNames usually is sufficient to spot a constructor ;P
22:21gfredericksbrehaut: vs static field access?
22:21brehautbut that always has a /fieldName
22:21gfredericksyeah but I can't tell that till I've gotten to the end of the thing
22:21brehauti suspect this is my python roots showing through
22:23brehautaperiodic: http://dosync.posterous.com/lispers-know-the-value-of-everything-and-the
22:23leo2007Is -main special? I have seen something like (def -main start-repl) in a few projects?
22:23brehautleo2007: - is the default prefix for genclass methods
22:24brehaut-main the is compiled to a public static main method of the genclass class
22:25aperiodicbrehaut: handy, thanks!
22:25brehaut(which if you are unfamilar with the jvm, is the entry point for a startup class)
22:25brehautaperiodic: dnolen's posterous is choc full of interesting stuff
22:26aperiodicbrehaut: bookmarked
22:26aperiodic(inc brehaut)
22:26gfredericks(dec lazybot)
22:26lazybotYou want me to leave karma the same? Fine, I will.
22:27aperiodicwhat a bum
22:27gfrederickslazybot: get a job.
22:27brehautraynes really needs to fix that
22:28aperiodic&(inc 3)
22:28lazybot⇒ 4
22:28TimMc,(inc brehaut)
22:28clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: brehaut in this context, compiling:(NO_SOURCE_PATH:0)>
22:28brehautlol
22:28gfredericks&(let [brehaut (rand-int 10)] (inc brehaut))
22:28lazybot⇒ 9
22:28aperiodicis it a problem with karma in particular?
22:28RaynesYeah, somewhere along the line the karma plugin got broken. Don't know why, don't know how.
22:28brehautyeah, karma doesnt run through the evaluator
22:29aperiodicright
22:29RaynesBut if somebody bitches about it after the conj, I'll definitely fix it.
22:29brehautRaynes: i read through your slides; looked good
22:29brehautgreat cats
22:29RaynesHeh
22:29aperiodici had a problem trying to setup lazybot the other week where it would only respond to evaluation commands
22:29aperiodiceverything else it would ignore
22:30Raynesaperiodic: I bet you were mistaking your evaluation prefix with your command prefix.
22:30Raynesaperiodic: Can I see your ~/.lazybot/config.clj file? Minus passwords and such.
22:31aperiodicRaynes: sure, one sec
22:32brehautkarma raynes
22:33brehautand i realise ive forgotten the command prefix
22:34TimMc$karma Raynes
22:34lazybotRaynes has karma 0.
22:34TimMc$inc Raynes
22:34TimMcguess not
22:34brehaut$karma amalloy
22:34lazybotamalloy has karma 0.
22:34brehautyeah its really borken
22:34TimMchah
22:35brehautmaybe amalloy amassed so much karma that the bot couldnt track it any longer
22:35aperiodicRaynes: https://gist.github.com/1357108
22:35gfredericksRaynes: are the old karmas forgotten? If so, I'm going to stop being helpful.
22:36RaynesI'm getting it is a communication-with-database problem.
22:36Rayness/getting/thinking.
22:36brehautRaynes: signs do point that way
22:36gfredericksOkay. I will tentatively continue trying to be helpful.
22:36Rayneshttps://github.com/flatland/lazybot/blob/develop/src/lazybot/plugins/karma.clj if anyone wants to take a look and be super cool and try to fix it themselves before I get a chance.
22:37brehautRaynes: switched from mongo to dev null?
22:37RaynesAlso, update congomongo while you're at it.
22:37Raynes;)
22:37Raynesaperiodic: One sec.
22:37aperiodicRaynes: also, when i ran &(doc foo), all the "s"s in the docstring were removed. i have no idea how
22:37Raynes&(doc slurp)
22:37lazybot⇒ "([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments."
22:37aperiodicthey were replaced with spaces
22:38aperiodici felt crazy
22:38RaynesAre you using the latest from the develop branch on github.com/flatland/lazybot
22:38Raynes?
22:38RaynesLike, the very latest? I seem to recall fixing that 100 years ago.
22:38leo2007brehaut: thanks
22:38Raynes(a couple of weeks ago)
22:39aperiodicRaynes: not the very latest, no
22:39RaynesUpdating ought to fix that 's' problem.
22:39RaynesSo, how were you trying to evaluate commands?
22:39RaynesShow me an example
22:40aperiodicRaynes: it was at a2ab9d
22:41aperiodicRaynes: "$fortune"
22:41Raynesaperiodic: Look at the ':prepends' key in your config.
22:41RaynesThose are what the bot will respond to normal commands for.
22:41aperiodicah, so that's what that is
22:41RaynesBy default, that'd be @.
22:41RaynesI need to rename that to 'prefixes'.
22:42RaynesI don't think prepend is a word.
22:42aperiodici think it is a word, but it's not obvious what it was for
22:42RaynesAgreed.
22:42aperiodicthanks for the help!
22:42RaynesNo problem.
22:42Raynes:)
22:43RaynesAlso, lazybot recently went under heavy renovation, including a move to 1.3. If any of the plugins don't work, let me know by creating an issue on the Github page.
22:43RaynesNight #clojure!
22:43brehautlater Raynes
22:44aperiodicgnight!
22:51leo2007If I change project.clj do I need to restart swank?
22:51brehautleo2007: it might depend on what the change is, but i suspect so?
22:52leo2007I just changed :dev-dependencies
22:52brehautthen yes
22:59gfredericks,(:foo :bar :baz)
22:59clojurebot:baz
23:02brehautlol
23:04gfredericksclojure: it just works.
23:05gfredericks(def identity (partial :foo :bar))
23:05brehautclassic
23:05brehautkeywords also double as false then
23:06gfrederickshow so?
23:06brehautin lambda calc true is (fn [t _] t) and false is (fn [_ f] f)
23:07gfredericksaah
23:07gfredericksnot if you pass them a map
23:07brehauthah
23:07brehauttrue
23:07gfredericks(def true (comp first list)) (def false (comp second list))
23:08gfredericksokay on that note, I'm going to go dream about lambdas.
23:08brehautbrain fart time. i think and is (fn [a b] (a b a)) and or is (fn [a b] (a a b)) ?
23:09gfrederickswhich I assume are some kind of sheep/llama-type animal
23:09brehauthaha
23:09brehautnight
23:58brehautwoo enlive to the rescue
23:59brehautmy atom feed is no longer the worst quality on the clojure planet