#clojure logs

2012-04-19

00:02echo-areaHmm, he has quited
00:02pablo_nsDoes anyone know what does "java.lang.IllegalArgumentException: No matching field found: getBytes for class [B" mean? I've been getting this error and I am pretty much clueless about Java stack traces...
00:03yoklovpablo: i think that means you're doing something like calling .getBytes on an array of bytes
00:04pablo_nsyoklov: yes, I am calling getBytes on a stream.. It was working ok until suddenly I started getting this message...
00:04cmajor7,(.getBytes (byte-array 10))
00:04yoklovoh
00:04clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getBytes for class [B>
00:05yoklov,(.getBytes "foo")
00:05clojurebot#<byte[] [B@13775d4>
00:05yoklovits a method on string (and other stuff?)
00:05pablo_nsto tell you the truth, I'm not really sure what getBytes does since I have zero Java knowledge
00:05cmajor7"[B" means a byte array "type"
00:05yoklovgetBytes gets you a byte array
00:05cmajor7where do you get that exception from?
00:06pablo_nscmajor7 thanks. I'm using ring's multipart-params to put a file on S3
00:06pablo_nsring provides a key :bytes
00:06cmajor7the gist is you are/or one of the libs is calling a "getBytes" on a "byte[]"
00:07echo-areadnolen: http://pastebin.com/gwt1ViZB <-- Please take a look at it
00:07pablo_nsmy code is calling getBytes
00:08cmajor7it seems that you already are getting a "byte[]" (what would getBytes for example from a string.getBytes give you)
00:08dnolenecho-area: loop can't return unboxed values, don't bother with int casting - CLJ emphasizes 64bit arithmetic
00:08cmajor7so it may not be necessary
00:09cmajor7,(.getBytes "")
00:09clojurebot#<byte[] [B@3e5af>
00:10echo-areadnolen: I did find the Clojure counterpart faster than in my last experiment. Something has changed.
00:10cmajor7,( .getBytes (.getBytes "") )
00:10clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getBytes for class [B>
00:10pablo_nscmajor7: without it I get "java.lang.IllegalArgumentException: No implementation of method: :put-request of protocol: #'aws.sdk.s3/ToPutRequest found for class: [B"
00:11drewrdnolen: yeah, I'm not sure either. thought I would get your initial reaction first before I tackled that part
00:11dnolendrewr: doesn't make any sense to me.
00:12pablo_nscmajor7: Is there any good resource to read on getBytes? I actually have no idea what a byte array is
00:12yoklovpablo_ns, are you familiar at all with c?
00:12pablo_nscmajor7: Everything Google gave me was pretty much worthless for someone who doesn't know a thing about Java
00:12echo-areadnolen: So did I experiment in a wrong manner, and what I tried to do is not practical?
00:12cmajor7pablo_ns: I have not worked with ring (yet), but what both exceptions that you posted mean is that you are trying to call these "methods" on a byte array, while a byte array is just a "collection" of bytes => 8 bits each
00:13dnolenecho-area: try this, http://gist.github.com/2418471
00:13pablo_nscmajor7: so a byte array is just a regular array?
00:14pablo_nsyoklov: done very little C, many years ago.
00:14technomancypablo_ns: in some languages that don't handle encoding strings are just byte arrays themselves
00:14yoklovits like a C string/char array
00:15yoklovthats what java's essentially giving you if you call getBytes on a string
00:15technomancybut on the JVM strings are higher-level because they carry their encoding information around with them.
00:15yoklovjust raw binary data
00:15pablo_nsok I get it.. so .getBytes would be a decode method?
00:16cmajor7".getBytes" is usually a method to "convert" things to a byte array
00:17cmajor7so if you have a string "hello byte array", when you call a .getBytes on it, you'd get a "collection" of characters h,e,l,l,o.. those characters are really just 8 bit numbers..
00:18echo-areadnolen: Only slightly faster: 6.0 secs ==> 5.7 secs
00:18technomancycmajor7: if only that were true... the JVM uses UTF-16 =(
00:19cmajor7,( map print (.getBytes "hello byte array") )
00:19clojurebot(104101nil 108nil 108nil 111nil 32nil 98...)
00:19echo-areatechnomancy: Hi :) How do you set a compilerarg for javac-options in leiningen?
00:19pablo_nscmajor7: ok, so based on what you said my usage seems correct
00:19technomancyecho-area: I haven't used javac; maybe ask in #leiningen?
00:19dnolenecho-area: and you are timing at REPL?
00:19dnolenecho-area: or are you measuring cost of loading CLJ?
00:20hiredmandakrone: I cannot for the life of me get rid of opennlp.tools.util.InvalidFormatException: Missing the manifest.properties! when trying to use clj-opennlp
00:20cmajor7technomancy: which bit of a collection of 8 bit things is off?
00:20echo-areadnolen: Oh, forgot about that. Let me reevaluate it
00:20echo-areatechnomancy: Ah thanks
00:20technomancycmajor7: most characters are 16 bits on the JVM
00:22cmajor7oh.. yea double words.. I guess throwing octets in a mix would be a bit more confusing.. I think "8 bit things" is a good general understanding language agnostic
00:22pablo_nscmajor7: so, the usage is right: convert a stream back into a file: http://pastebin.com/fSt8Qrpu
00:23dnolenecho-area: fwiw it takes 2.6s on a JDK 7 OS X 2.66ghz i7
00:25echo-areadnolen: Something is wrong here: http://pastebin.com/nxxR04Mu
00:26cmajor7pablo_ns: from the docs: (s3/put-object cred "my-bucket" "some-key" "some-value"), are you saying that your "some-value" (e.g. params) comes in as a byte array
00:27cmajor7"The value can be
00:27cmajor7 a String, InputStream or File (or anything that implements the ToPutRequest
00:27cmajor7 protocol).
00:27cmajor7"
00:27cmajor7https://github.com/weavejester/clj-aws-s3/blob/master/src/aws/sdk/s3.clj
00:27dakronehiredman: in clojurebot? I can take a look
00:27dakronehiredman: master branch?
00:28pablo_nscmajor7: oops, I pasted the wroing code! It's actually (s3/put-object cred "rod-bucket" (:filename params) (.getBytes (:bytes params)))
00:28hiredmandakrone: I figured it out, I was still trying to use the models gzipped, which I guess opennlp doesn't support anymore
00:28cmajor7pablo_ns: right, so why are you calling ".getBytes"?
00:29cmajor7pablo_ns: params are coming in as what?
00:29cmajor7probably byte-array already, according to an exception..
00:31pablo_nsI tried without getBytes and it did not work.. I tried with getBytes and it worked. I renamed a few symbols before commiting the code and it broke again
00:31pablo_nscmajor7: params comes as a byte array
00:31cmajor7,(apply str (map char (.getBytes "hello byte array")))
00:32clojurebot"hello byte array"
00:32pablo_nscmajor7: from the docs: appengine-magic.multipart-params/wrap-multipart-params works just like the Ring equivalent, except file upload parameters become maps with a :bytes key (instead of :tempfile). This key contains a byte array with the upload data.
00:32dakronehiredman: cool
00:32cmajor7if you know it "should" be just a string, convert it to such..
00:32dnolenecho-area: https://gist.github.com/2418471
00:32dnolenecho-area: runs in the exact same time as the Java.
00:33cmajor7pablo_ns: (apply str (map char params))
00:33dnolenecho-area: the main unintuitive bit here is that loop can't return primitives - by pulling it out into a seperate primitive fn - we can get JVM perf juice.
00:33pablo_nscmajor7: it's not a string, it's a binary file
00:33cmajor7yea, I see it
00:34dnolenecho-area: on my machine both versions take 1s
00:35pablo_nscmajor7: so, if it comes from wrap-multipart-params as a byte array it should work with getBytes, correct?
00:35cmajor7I am looking at API: http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/PutObjectRequest.html
00:35cmajor7I would say yes, but one sec
00:36echo-areadnolen: I see. This time the program runs as fast as the Java counterpart. Thank you very much, there's many things I can study for now
00:36dnolenecho-area: np
00:38pablo_nscmajor7: oh no, don't bother cause the stack trace means the function s3/put-object hasn't even been called
00:38pablo_nscmajor7: it breaks before that
00:39cmajor7I found it
00:39cmajor7it can only be one of 3
00:39cmajor7InputStream, File or a String
00:40cmajor7since in your case it is a byte array, I deduct that you should convert it to String, since this is what it does with a String: {:input-stream (ByteArrayInputStream. (.getBytes s))
00:40cmajor7(where 's' is your value)
00:40cmajor7https://github.com/weavejester/clj-aws-s3/blob/master/src/aws/sdk/s3.clj#L91
00:41hiredman,(clojure-version)
00:41clojurebot"1.4.0-master-SNAPSHOT"
00:41pablo_nscmajor7: humm, I see it
00:41hiredmanclojurebot: snapshot? really?
00:41clojurebotTitim gan éirí ort.
00:42cmajor7pablo_ns: so slap => (apply str (map char params)) on it, and let it handle it
00:43cmajor7(no "=>", of course)
00:44pablo_nscmajor =) of course
00:45pablo_nscmajor7: you mean: (apply str (map char (:bytes params)))
00:46cmajor7pablo_ns: I would first try (:bytes (apply str (map char params)))
00:48pablo_nscmajor7: heh.. another cryptic error java.lang.IllegalArgumentException: No implementation of method: :put-request of protocol: #'aws.sdk.s3/ToPutRequest found for class: [B
00:48pablo_nscmajor7: but this one at least I kinda understand
00:49cmajor7pablo_ns: it means it did not convert to string properly
00:49cmajor7since conversion to "putRequest" accepts Strings
00:49cmajor7https://github.com/weavejester/clj-aws-s3/blob/master/src/aws/sdk/s3.clj#L85
00:50dgrnbrgI just updated paredit mode for vim with new features: https://github.com/dgrnbrg/paredit-vim
00:50cmajor7pablo_ns: let's rewind… why do you need to prefix it with ":bytes" ?
00:51cmajor7I think that is what converts it back (unwillingly)..
00:52pablo_nscmajor7: Here's the thing: I'm using Google Appengine to accept a file from another app via POST and storing that file on S3
00:52pablo_nscmajor7: Appengine doesn't allow writing to a tempfile, which is what the middleware multipart-params does by default
00:52devndgrnbrg: nice
00:53pablo_nscmajor7: so there's a library called appengine-magic that forked mutlipart-params and, instead of creatinga temp file, creates that :byte entry
00:54cmajor7pablo_ns: but according to s3 APIs you don't need that ":byte" entry
00:54cmajor7is that something you can just omit?
00:54devncemerick: i think this is a long shot at this point, but did extensible reader stuff make it into the book?
00:55cmajor7e.g. (s3/put-object cred "rod-bucket" name (apply str (map char params))))
00:55pablo_nscmajor7: yes, I need it because that's where the data is stored.
00:55cemerickdevn: Nope.
00:55devncemerick: aww, bummer
00:55pablo_nscmajor7: it wont work because "params" is a map
00:56cmajor7so what is you current code looks like, because the one you posted does not seem right
00:56pablo_nscmajor7: I'll paste the entire snippet
00:56cemerickdevn: It was a conscious decision.
00:57cemerickWe don't talk about #=, *read-eval*, and all sorts of other esoterica either.
00:57devncemerick: i suppose 1.4 is a smaller release so maybe it's better to hang back for a cycle
00:57devncemerick: ah, that's another reason
00:58cemerickreader literals are a big improvement over #=, but there's a *lot* of rope there
00:58devnthe confusion about why you'd want the extensible reader or how you'd use it is in need of pre-emptive repair
00:58cmajor7pablo_ns: it just hit me… then yes of course => (apply str (map char (:bytes params)))
00:58cemerickright
00:58devni've only seen a spot or two of it, but i hope 8th light takes up the cause like they did with the ns macro
00:58devnor..maybe i should shut my yapper and get to work
00:59devnone of those is more honorable. i'll leave that as an exercise to the reader.
00:59pablo_nscmajor7: http://pastebin.com/2rD6vm1r
01:00pablo_nscmajor7: java.lang.IllegalArgumentException: Value out of range for char: -1 =(
01:00devncemerick: regardless of audience there's one line about clojure that i've always liked: clojure is a consenting adults language
01:00technomancyeven adults can get grumpy about being fed crap though
01:00cemerickdevn: absolutely.
01:01cemerickThough we ended up being super-comprehensive, we didn't want to write an encyclopedia, either.
01:01cmajor7pablo_ns: it's ok, at least now it does what it says
01:02cemericktechnomancy: dude, got to get the grumps out ;-)
01:02cmajor7the reason it cannot convert it to String is because characters are "positive" bytes
01:03technomancycemerick: couldn't it have waited another year? wouldn't that be a reasonable price to pay for avoiding the Worst Class in the Whole JDK?
01:03devnthere seem to be at most a few distinct styles when it comes to presentation. one is marked by its concision, another by its completeness, and another still by its pragmatism
01:03technomancy*year or too
01:03technomancytwo
01:03technomancywhatever
01:03devndid somebody say grumps?
01:03technomancyI definitely said grumps.
01:04cemericktechnomancy: Who you think you're talking to? :-P
01:04technomancyhttp://sthelensnarpo.site90.net/cms/images/GRAPHICS/old%20grumpy%202.jpg
01:04technomancycemerick: who's listening?
01:04cmajor7pablo_ns: ok, so S3 expects String / InputStream or File, and "appengine-magic" creates a byte array instead
01:04devnfrumps. the matronly sort of grumps.
01:04pablo_nscmajor7: the map that gets in looks like this: {:content-type audio/mp3, :filename music.mp3, :size 4378768, :bytes #<byte[] [B@7a4b59dd>}
01:06cemericktechnomancy: by that I mean, been there, said that (or something close). :-)
01:06technomancyoh, naturally =)
01:06cmajor7pablo_ns: so we just need to convert it to ByteArrayInputStream
01:06devnpablo_ns: walk it out: (map char (:bytes (m/save-rec! rec-info))
01:06technomancycemerick: I guess the solution is to make the default lein new skeleton bring in joda and a reader overrides file
01:06devnerr missing paren above^
01:07cemericktechnomancy: year or two, as in, when the new date JSR lands?
01:07devntechnomancy: when is new clojars going to be around?
01:07technomancyright
01:07technomancydevn: depends on GSOC
01:07devnno it doesn't!
01:07hiredmanclojurebot's uberjar is around 17megs
01:07cemericktechnomancy: oh, don't get me started
01:07devndude. we need to make better the clojars.
01:07devnit is a must.
01:07technomancydevn: dude, have you seen xeqi? he's on a roll!
01:08devnwha!?
01:08technomancycemerick: TBH there are a few other gsoc proposals that are probably more strategic than clojars
01:08cemericktechnomancy: that doesn't make me feel better
01:09technomancytyped clojure of course, and the pluggable clojurescript backend thingy
01:09devnclojars is important, damnit.
01:09technomancydevn: yeah, but if it doesn't happen from gsoc it will still happen
01:09devnwe also need to tie up some of these disparate documentation sources and possibly move them to contrib
01:09cemerickdevn: FWIW, I don't think I'm grumping on GSoC; I think the whole thing is a cynical effort
01:09devncemerick: why do you think that?
01:09cemerickWhich makes me the idealistic one, I think.
01:10devncemerick: I guess I don't follow
01:10cmajor7pablo_ns: not sure if there is clojure way to do it, but here is a Java way:
01:10cmajor7,(new java.io.ByteArrayInputStream (.getBytes "hello byte array") )
01:10clojurebot#<ByteArrayInputStream java.io.ByteArrayInputStream@10c0fa7>
01:10devnI did GSoC in 2007 and I got a ton out of it. I got paid to not have a totally impractical summer job, and to learn about plan9 and inferno-os
01:11pablo_nscmajor7: that might work
01:11devnit was /awesome/ -- i wish i was in school so I could devote 3.5 months to clojure
01:12cmajor7pablo_ns: e.g. (new java.io.ByteArrayInputStream (:bytes params))
01:12devncemerick: what is cynical about gsoc? google's involvement? the vibe of the community towards it? what?
01:12technomancya friend of mine tried to submit a one-line CSS patch to the gsoc web app and they wouldn't take it because he hadn't submitted copyright paperwork
01:13cemerickdevn: tl;dr is: piloting/co-opting open source projects through a PHB's dream process-heavy workflow that pays crazy-below-market wages to incredibly bright, eminently hirable programmers is not an obvious good.
01:13devnsounds like the clojure CA
01:13pablo_nscmajor7: Man, I so own you a beer!
01:13devn*hiss* *boo*
01:13pablo_nscmajor7: I mean, owe
01:13cmajor7pablo_ns: it worked?
01:13pablo_nscmajor7: Yes it did, sir!
01:13devncemerick: i put "Google Summer of Code: Bell Labs" on my resume out of college
01:14devnthat *is* a good
01:14cemerickugh
01:14technomancycemerick: most of the proposals have come from outside the US, so eminently hireable doesn't really apply
01:14dnolencemerick: eh?
01:14devntechnomancy: not so fast. ill find you a visa. :)
01:14technomancydevn: for three months? =)
01:15devn"i've heard things can be done"
01:15pablo_nscmajor7: just checked on S3, it's there
01:15cmajor7pablo_ns: great. there should be a cleaner way to convert it to an input stream though..
01:16cemericktechnomancy, dnolen: don't expect rigor from my OT irc gruntings. ;-)
01:16devncemerick: you can't smiley-wink your way out of this one
01:16devn;)
01:16cemerickheh
01:16technomancycemerick: I do think the timing is unfortunate on the clojars proposal
01:16technomancybecause I don't want to wait till august, dammit
01:17cemericktechnomancy: that's where I got the "co-opting" part.
01:17technomancy=\
01:17pablo_nscmajor7: now, why did it work with (.getBytes (:bytes params)) before? That's weird, right?
01:17technomancythen I look at the pile of issues for lein2-final and think summer might not be too late anyway
01:18cemerickThe "eminently-hirable" part I get from a couple of applicants I've met that did GSoC last year, but worked as entry-level programmers the year prior at market wages.
01:18cmajor7pablo_ns: if it was scala, I would say there is an implicit conversion that does it. if it was java, I would say it is AOP.. but theoretically it would not have worked given the (github) source that handles it
01:18devnno, but seriously, i think i see where you're coming from (maybe) but I feel like it's an extreme view. There are plenty of substantial contributions that come about via GSoC. Maybe I'm taking what you're saying the wrong direction but, sometimes the work is the reward. I felt like that was the case with GSoC. I "worked" for 3.5 months. It was heavenly.
01:20cemerickdevn: well, if that's the case, then I'll say the process and the $5k probably incentivizes people in the wrong directions.
01:20dnolencemerick: I'm struggling hard to understand your point about market wages and GSoC ...
01:20dnolenand failing
01:21devncemerick: I'm not sure what you're critique is when in the "eminently-hirable" statement above. You think they should be making more money? That they're using GSoC to milk the system? Or what?
01:21devns/you're/your
01:22devni should just rewrite my previous statement. I think i wrote with two tenses simultaneously.
01:23devncemerick: I'm not sure what your critique is in the "eminently-hirable" statement above. You think GSoC applicants should be making more money? That they're using GSoC to milk the system and are underqualified? Or what?
01:24pablo_nscmajor7: well, thanks again for the tremendous help!
01:24cemerickdevn: No, that people opt to work for $5K when they could work for $ddK, presumably in order to have the GSoC credential.
01:24cemerickdnolen: ^^
01:24cemerickI'm not saying it's bad or wrong or whatever, but that it's not necessarily an unvarnished good.
01:24cmajor7pablo_ns: sure, it was fun :)
01:24devncemerick: academics, man. some of these people have $ddK jobs at their university but are able to do GSoC.
01:24technomancyI think it's very common among new programmers to underestimate what their time is worth.
01:25bbloomi've been digging through the irc logs and found the various discussions with rhickey about cells to be facinating, but i can't find anything similar for (the successor idea?) pods — any pointers?
01:25devnthe confidence in knowing your value is something that comes with time. you can tell someone they're worth X dollars and that they should act like it, but that's a losing battle. people come around to the idea they're worth X after having some amount of experience.
01:26dnolencemerick: er, if money is an issue I don't think a student would do a GSoC, given the proposals, it's clear that's not what it's about anyhow
01:26dnolencemerick: given your viewpoint - I take it you haven't had the time to follow along closely.
01:26technomancybbloom: they're on hold afaict
01:26bbloomtechnomancy: 1) why? and 2) where would i find that out? :-)
01:27technomancybbloom: not going to get a better answer than "because rich said so" I'm afraid =\
01:27hiredmando you mean cells in the data flow sense?
01:27hiredmanbecause pods are not those
01:27bbloomhiredman: that's what i was initially looking for, but that's not what i found & then i fell down the irc logs rabbit hole
01:28dnolenbbloom: they aren't on hold per se - based on the conj keynote somebody could take them over.
01:29bbloomi've been experimenting with clojurescript, trying to come up with something really nice to work with for UI development — was just researching reactive programming, cells, pods, etc
01:29bbloomdnolen: http://blip.tv/clojure/rich-hickey-keynote-5970064 this keynote?
01:29bbloomjust about to watch that :-)
01:29dnolenbbloom: yep
01:30devndnolen: thanks for heading up gsoc by the way. i've mentioned that in here since 2009 and i always failed to get the ball rolling.
01:30dnolenbbloom: I think they would be easiest to prototype in ClojureScript - no concurrency issues to worry about.
01:30bbloomdnolen: but there's still parallelism ;-)
01:31devndnolen: im really glad you took the reigns. i have a feeling we'll continue to hear about some of the successes of this summer for years. that seems to be a trend. communities who do GSoC end up mentioning: "Thanks to the work that Joe did on making the world a better place, we built X."
01:31bbloomsimply trying to stand on the shoulders of giants
01:31dnolenbbloom: simple benefit - transients become an implementation detail
01:32bbloomdnolen: yup, I understood the cells conversation quite well
01:33dnolendevn: I think we'll get some good stuff out of GSoC - it's a positive community building thing IMO
01:33devndnolen: yeah, im confident we will too.
01:33muhooclojars.org is down?
01:33dnolendevn: I don't understand the JIRA hate, github issues aren't that great.
01:33devnit's up for me muhoo
01:34bbloomhttp://clojure-log.n01se.net/date/2010-02-15.html and http://clojure-log.n01se.net/date/2010-02-17.html
01:34devndnolen: fair enough, but I just...honestly, I have access and what-not, but I find myself in these UI scenarios where I don't know what friggen site I'm on
01:34devnor how to get from point A to point B
01:34bbloomwas hoping there was a similar span of logs for the transition from cells -> pods
01:34bbloomjust out of curiosity
01:34cemerickdnolen: Right, presumably no one does GSoC *for* the money; the impact of the extrinsic motivation can't be nil though.
01:35muhoohuh, weird
01:35bbloomi find that studying the evolution of ideas *sticks* better than simply reading the distilled end results
01:35muhooclojars.org is being rejected by firefox as having an "ABE" error
01:35Lajla&(= #(%1) #(%1))
01:35lazybot⇒ false
01:36bbloomdnolen: is "pods" simply a name change, or any new ideas along with them?
01:36devncemerick: that's pretty judgmental. That's like saying that people are in it for *stuff* by default. The quality proposals don't come anywhere near that realm. They're focused, reading the list, trying to make something useful.
01:36muhooit appears to be trying to access browser.xul. wtf?
01:36devncemerick: Are you gonna tell Ambrose he's misguided for doing GSoC?
01:37cmajor7devn: https://answers.atlassian.com/questions/6753/display-wallboard-without-login
01:37Lajla&(let [fn list] #(1 2 3))
01:37lazybot⇒ #<sandbox3826$eval7766$fn__7767 sandbox3826$eval7766$fn__7767@1c9078e>
01:37LajlaWooow, wtf is that
01:37LajlaIs there a special form to expand a macro?
01:37cemerickdevn: Hardly. It's Google's intentions and objectives that I'm skeptical of, not the participants all around.
01:38clojure_newbI like clojure. I like OpenGL. How do I use OpenGL inside of Clojure?
01:38clojure_newbThere seems to be two choices, JOGL, and JLWGL, but there are various claims about them being outdated.
01:38cmajor7clojure_newb: https://github.com/ztellman/penumbra ?
01:38devncemerick: okay, that's way clearer.
01:39clojure_newbhmm
01:39clojure_newbit says at the top:
01:39clojure_newb"Penumbra is not under active development."
01:39dnolencemerick: Google's intentions & objectives? You think they care that much about a small community of Lispers on JVM?
01:40devndnolen: i think he's referring to "future hiring pool" considerations they may have
01:40cemerickdnolen: No, I think it ends up being an efficient HR filter for them.
01:40muhoo+1 for gsoc as recruiting tool
01:40cemerickCertainly, one can say "so what?".
01:41devncemerick: tbqh i've seen that first hand. i've been contacted by google, and i believe it is a result of my association with GSoC
01:41devnbut, uh... i dont work there.
01:41dnolencemerick: as far as I can tell - no one's telling us what to do or how to do it.
01:41cmajor7clojure_newb: right, but I find the next sentence a lot more interesting: "However, it’s still a fun way to play around with OpenGL and Clojure" :)
01:42cemerickoh, it's right on the tin http://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2012/faqs#recruiting
01:42muhoopablo_ns: clojurebook.com saved me from exactly that. it seems friendly to people coming from ruby/python/etc
01:42devnpablo_ns: write simple wrapper fns. it's like slicing cheese for the first time. you're going to get some odd shapes, but they become more consistent over time.
01:42cemerickdnolen: Sure, it wouldn't make sense for them to.
01:42bbloomcemerick: I learned more about software engineering in a 3 month internship at Google than in *years* full-time at other companies. so what if GSoC is a hiring tool? good work gets done & you can't fault google for a relatively friendly tactic: hiring good engineers is *hard*
01:43devnnevermind the fact that communication skills and styles in GSoC are relegated in some cases to text-only
01:43pablo_nsmuhoo: interesting. I'm just finishing Clojure in Action and that book is up next, but I must confess that I usually skip the boring Java interop chapters since I pretty much have no idea what they're talking about anyway.
01:43devnit's an indicator, but you can use google to find my github profile too
01:44devnwhich is more effective?
01:44dnolencemerick: I'm certainly not saying Google is getting something out of it. But I think the cards are severely tipped in our favor. Getting 4 slots is unusual.
01:44devnto me it's the PR campaign more than it is the secret motive
01:44dnolen"is not getting something"
01:44devngoogle doesn't do traditional advertising, so GSoC /is/ their advertising budget
01:45devnexcept they do something that is not "teh suck"
01:45devnthey get contributions in on languages they don't use in-house
01:46pablo_nsdevn: Nice analogy. Too bad I don't even know where to go looking for Java libs.
01:46ivancat */project.clj
01:47muhooseriously, wtf? https://refheap.com/paste/2226
01:47devnpablo_ns: what are you interested in writing?
01:47ivanmuhoo: are you being captive portal'ed on free wifi?
01:48muhooivan: good point. it's comcast, and they suck very much.
01:48devnpablo_ns: i think a lot of books are missing the "read this paper about the java object model"
01:48dnolenbbloom: pods is just a name change
01:48devnyou can learn what you need to know about java in an afternoon from the clojure perspective
01:48bbloomdnolen: thanks
01:49devngetting used to reading their docs is a comfort thing
01:49pablo_nsdevn: Web apps and machine learning. Most of the interesting Erlang libraries that I though about porting to Clojure have already been ported.
01:49zakwilsonWow. 1.4 is out. I think I might need to get my production code off 1.2.
01:49cemerickbbloom: Sure. Perhaps it's a win-win on balance for everyone involved, but weighing out all the pieces seems worthwhile.
01:49devnpablo_ns: write a wrapper for an existing java web-related lib
01:49devnor machine learning lib
01:50devngoogle "java library tag parser" or something. stuff will show up, and you can learn to wrap that.
01:50pablo_nsdevn: Do you know of a small library that could serve as an example?
01:51devnof a wrapper?
01:51pablo_nsdevn yes
01:51devnclojure.core ;) i kid
01:51devn(only slightly)
01:52devnthere's a lot of java interop in 3rd party libs
01:52muhooivan: ahahaaa, it was alzheimer's again. a few days ago, i added a hosts entry to send clojars to null, to make absolutely sure that lein deploy didn't send a private jar to clojars and sent it instead to a private repo. i forgot to remove the entry. derp.
01:52devnmuhoo: i have a present for you
01:52muhoodevn: memory-restoring pills?
01:53pablo_nsdevn: I actually just found a worthy candidate
01:53pablo_nshttps://github.com/tropo/tropo-webapi-java
01:53pablo_nssmall and simpe
01:53pablo_nssmall and simple
01:54devnmuhoo: http://30.media.tumblr.com/tumblr_m2i5bkJCMP1rtlkwvo1_500.png
01:54muhoodevn: wat?
01:55devnpablo_ns: close... i guess that looks like it is to be used /from/ java at first blush
01:55devni think i was suggesting the opposite: a lib used primarily from clojure that wraps java stuff
01:55devnbut in an almost superficial way
01:56pablo_nsdevn: if it can be used from java, it can be used from clojure, right?
01:56cemerickdnolen, devn: do you think GSoC projects would end up being worked on even if GSoC didn't exist?
01:56devnlike (import '[foo.bar Baz]) (.. Baz method args)
01:56devncemerick: maybe, maybe not
01:56cemerickeh, just missed him
01:56devncemerick: im not sure what you're driving at again though
01:57devnbecause it's not whether it'd be worked on, it's whether or not there'd be a timetable for delivering if it was left up to everyone
01:57cemericknot driving at anything at the moment. Thinking through what the influences are.
01:57cemerickso, it's more a matter of a process serving as a forcing function?
01:58devnthat's one dimension i think
01:58cemerickplus the credential, plus the "bonus" of the money, in some combination
01:59devnand that is helpful to open source communities in that they can offload the forcing function onto a third party they can villify in case of failure
01:59cemerickheh
01:59cemerickugh, the GSoC homepage actually calls the $5K "a nice paycheck".
01:59devndude. i wasn't working when i did GSoC.
01:59pablo_nsI guess Clojure is taking the inverse path when compared to Ruby. Most small shops would take a hole in the head before using Java. So Clojure gets accepted in the Enterprise world before finding its way into small shops.
02:00devni /didn't have a job/ when I did GSoC
02:00devn5k was fun money.
02:00cemerickMmm.
02:01cemerickI probably have an unusual history / posture towards money.
02:01devni didn't want any corporate ladders to climb. i just wanted to talk to rob pike and get paid to learn "everything is a file" and the acme editor.
02:01devnand limbo, and... well, a lot more, but still.
02:02devncemerick: i think we're all biased or skewed in one direction or another
02:03devnbut i think that there are people who are doing grad school and are getting paid to do XYZ, but it's like in the public school system: You're a teacher, and you do PE summer school for kids and make an addtl 5k.
02:04devn*or* you're a college kid who lives happy on peanut butter, and 5k makes you a miniature millionaire for a moment.
02:04cemerickheh
02:06cemerickWhen I was in college, I was breaking down powerbooks and selling parts on ebay to pay tuition and keep gas in the car.
02:06devni was spoiled, had college paid for, and then dropped out.
02:06cemerick*gawd*
02:06devnthe world is a funny place.
02:06cemerick"and I did it all in the snow, both ways"
02:06cemerickfunny, I worked my ass off to pay for it, and then dropped out.
02:06cemerick:-P
02:07devnthe humanity of it all...
02:07LajlaI do sor ecall there being a special form which expands macros
02:07LajlaProvide me with it, and you shall be handsomely rewarded.
02:07devnit's disgustingly...realistic.
02:07pablo_nsdevn: I could live for a year on 5K where I live. Comfortably.
02:07LajlaFail me, and your life shall be taken from you
02:07devnpablo_ns: where are you at?
02:07cemerickdevn: it's all stranger than fiction, yah? :-D
02:07devncemerick: something like that. :)
02:08pablo_nsdevn: Bolivia
02:08devnpablo_ns: ive never been there.
02:08pablo_nsprobably the only clojurian in a 3k mile range =)
02:08devnpablo_ns: do you have a clojure group there?
02:09pablo_nsdevn: nops, only Ruby/Python groups
02:09devnpablo_ns: you *think* that's true, but you're wrong! you should start a group. I thought I was alone where I was, but I have people who are into erlang, haskell, clojure, scala, scheme, common lisp, java, ruby, and more showing up on a regular basis
02:09devnyou need to put it out there
02:10pablo_nsdevn: but where?
02:10devnpablo_ns: go to the ruby and python meetup groups and tell people you're starting a clojure group
02:10devni sat alone for 3 months before anyone showed up at my meetup group.
02:10wkmanireIs it wise to abstract away IO access with partially applied functions for unit testing purposes?
02:10pablo_nsdevn: I thought about asking in the main list, but I'm not sure if it's appropriate
02:10wkmanireOr is there a sort of standard way of doing that?
02:11devnpablo_ns: growing the community is appropriate so long as you dont hog the list
02:11pablo_nsdevn: where are you at?
02:11devnpablo_ns: the US, the upper midwest
02:11devnthere are people everywhere who are into lisp, scheme, clojure, FP, etc.
02:11devnyou just need to give them a place to go
02:12devn*everywhere*
02:12pablo_nsI've been there.. ages ago when I was living in KS
02:13pablo_nsdevn: I'm not sure about that... Clojure is still too niche around here.
02:14pablo_nsdevn: in the past 2 years I've tried to get people around here interested in Erlang and Scheme with zero success.
02:15wkmanirenevermind, I don't think I'm using the right terminology. I'll give it a go and study some more and hope it turns out alright.
02:15wkmanire:)
02:18devnpablo_ns: coming back from bible camp doesn't help your cause.
02:19devnpablo_ns: it's a long pull, not a quick turnover.
02:19pablo_nsdevn: Yeah, guilty of shunning the non-believers.
02:20devnpablo_ns: people change their minds slowly.
02:20devnpablo_ns: but progress *does* happen. it's just not at the immediate rate you sometimes desire.
02:21ben_mDoes anyone know if you can run quil (formerly known as clj-processing) in a browser, like "real" Processing?
02:21pablo_nsdevn: here's an interesting data point: in a recent poll in the local ruby group, the most used language at work is Delphi.
02:22devnpablo_ns: the subtle, unspoken goal in my opinion is to tell developers who care that they should quit working in delphi
02:23devnit's sort of the "drop out of college and start your own company" mantra
02:23bbloompablo_ns: to be fair: Delphi was pretty awesome in it's day. I did *a lot* of professional work in VB 3-6, which were heavily Delphi inspired (several of the same core team members) and what a great experience that was compared to trying to write an app with win32 or MFC
02:23devnbut it's not explicit. it should be about chinks in the armor.
02:24devnnot an abrupt change
02:24bblooms/it's/its
02:24devnim not hating on delphi
02:24pablo_nsbbloom: And I agree. But I thought Delphi was pretty much dead and buried.
02:24devnbut the philosophy behind clojure's design is so much more nuanced
02:24devnyou need to bring that in small doses
02:25bbloompablo_ns: behind the corporate firewall, nothing is ever dead and burried
02:25muhoodelphi? pascal?
02:25devncobol?
02:25clojurebotThe use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. -- Dijkstra
02:25devnfortrant?
02:25devnfortran*
02:26charles_rI'm looking for repl/editor to use with clojure. What do you recommend?
02:26bbloomdevn: do not google for cobol jobs, you may begin crying
02:26devncharles_r: depends on what you're used to
02:26devnwhat do you normally use to edit?
02:26charles_rI'm coming from Sublime Text. From what I hear, it can't auto-indent well.
02:27muhoohttp://en.wikipedia.org/wiki/Sturgeon%27s_Law
02:27pablo_nscharles_r: have you seen sublimerepl ?
02:27pablo_nshttps://github.com/wuub/SublimeREPL
02:27charles_rI saw it while googling
02:27bbloomcharles_r: if you're not addicted to (*real*) vim bindings (like myself), emacs isn't that big of a leap
02:28charles_rI'm more comfortable in vim than emacs, but compare to native apps, the fonts are really hard on my eyes.
02:28bbloomcharles_r: which os?
02:28pablo_nscharles_r: sublimerepl + vim mode = poor man's emacs + slime
02:28charles_ros x
02:28bbloomcharles_r: I use MacVim & the fonts look great
02:29bbloomhttp://code.google.com/p/macvim/
02:30devncharles_r: you could try clooj?
02:30devncharles_r: are you trying to do heavy development, or just toying around?
02:30charles_rI tried that for about 5 seconds.
02:30bbloomcharles_r: i run `rlwrap lein repl` under tmux and use this vim plugin: http://www.vim.org/scripts/script.php?script_id=3023 — works well for me
02:30pablo_nsdevn: last time I checked clooj looked good, but no syntax highlighting
02:30charles_rdevelopment. I'm coming from ruby/python
02:30bbloomit's no slime, but it gets the job done
02:31devnpablo_ns: meh. it's overrated.
02:31muhoobeen a linux guy for way too long. i looked at assoc-in, and immediately went "oh, it's like mkdir -p"
02:31devn(highlighting)
02:31devnyou can write in notepad with the same level of efficency
02:31pablo_nscharles_r: so, what's wrong with sublime text in your opinion?
02:32charles_rI don't think it auto-indents correctly for clojure, but you know… I haven't really tried.
02:32devncharles_r: "correct" is a loose concept when it comes to indentation
02:33pablo_nscharles_r: I used it or clojure 50% of the time and in my case it idents correctly
02:33devnsometimes i see autoindented code that i think looks like garbage.
02:33pablo_nsI *use* it
02:33devnit's a style thing
02:35pablo_nsdevn: what's your setup? vim?
02:36charles_rwell, I just tried something and it did fine, guess the stuff I found while googling was out of date
02:36devni use vimclojure, emacs + clojure + paredit, and clooj
02:36devni teach some clojure on the side, so i use a variety of editors
02:36devnwhatever is comfortable to the person im working with
02:37devneditors don't matter. code does.
02:37Borkdude4clojure not working?
02:37BorkdudeI get a 504 "Gateway Time-out"
02:37bbloomBorkdude: seemed to be down yesterday too
02:38devnRaynes: amalloy_ 4clojure is down.
02:38Borkdudegood timing, my students need to do one of the exercises as part of their homework...
02:38devnBorkdude: haha
02:39devnBorkdude: make them do it on paper!
02:39bsteubermaybe one was too lazy so he rather did a small DOS attack ^^
02:39bbloomBorkdude: it's open source, you could try running it: https://github.com/4clojure/4clojure
02:39devnbbloom: yeah but i dont know if it has the problem set
02:39bbloomdevn: bummer
02:40devni think there's a way to seed some problems
02:40devnbut maybe not all of them
02:40devnoh, there it is: load-data.sh
02:40Borkdudebbloom: yes, but I'd rather concentrate on finishing my course material ;)
02:40charles_rpablo_ns: how do you link sublime text with the repl?
02:40pablo_nscharles_r: you mean with sublimerpl?
02:41devncharles_r: https://github.com/wuub/SublimeREPL
02:41charles_rI just want to be able to click on a block and see the result. Is that what sublimerepl does?
02:42pablo_nscharles_r: that's not possible in sublimerpl
02:42charles_rthat's what I thought
02:43pablo_nscharles_r: but you can send code to and from the repl, plus you get all the text editing goodies inside the repl
02:43pablo_nscharles_r: autocompletion, syntax highlighting, auto identation, etc
02:49pablo_nscharles_r: http://www.sublimetext.com/forum/viewtopic.php?f=5&amp;t=3330
02:49michaelr525pablo_ns: Is there a debugger with it?
02:50charles_rI'm trying to figure out how to install it.
02:50charles_rcan't find the packages folder
02:51pablo_nsmichaelr525: not for clojure afaik. But there is for python and ruby.
02:52pablo_nscharles_r: what OS are you running?
02:52charles_ros x
02:53charles_rI've seen it before
02:53pablo_nsPreferences -> Browse Packages
02:53pablo_nsor ~/Library/Application Support/Sublime Text 2
02:53michaelr525that's one of the things that slows me down with clojure, the lack of integrated debugger like in Visual Studio
02:54pablo_nscharles_r: there's also sublimePTY which I haven't installed.
02:55charles_rokay, I should have it installed
02:58charles_rso this repl, how is it running clojure, its own version or is it finding the one I previously installed?
02:59charles_rauto-indent… nice...
02:59pablo_nscharles_r: it depends on the project structure that you have
03:01charles_rI can't seem to cycle through previous commands though
03:02pablo_nsctrl + P
03:02pablo_nsand ctrl + N
03:02charles_rit should be the arrow key
03:24autodidaktoI'm trying to understand the .m2 directory. Is this storage for any dependency you've used before?
03:28Raynesautodidakto: It is a local maven repository.
03:28Raynesautodidakto: When you download a dependency, it downloads from a remote maven repository to your local maven repository.
03:28RaynesSo yes, storage for dependencies you've downloaded.
03:29autodidaktoRaynes: And from there, it's copied to your projects as needed?
03:29RaynesNot in lein 2.
03:29autodidakto(as requested by your project.clj, i mean)
03:29autodidaktoLein 2 doesn't move it over?
03:29autodidakto(copy)
03:29RaynesThere is no real reason to copy dependencies to your project, so lein just sets the classpath with the jars in their current place in .m2.
03:30autodidaktoI see
03:32autodidaktoRaynes: is it the "classes" folder that lein 1 copied the deps to?
03:32RaynesNo, lib.
03:33autodidaktoGotcha. But I see that the clojure jar, if not the default (ie, 1.4) is copied to the lib folder. Anything else go there?
03:35antares_autodidakto: dependencies go under ./lib
03:36RaynesIn lein 1.
03:36autodidakto...non maven deps, then?
03:37RaynesNothing goes to lib/. Unless checkout deps do?
03:45antares_autodidakto: I was talking about lein1. Yes, Maven dependencies. Checkouts (dependencies via symlinks to local directories) go under ./checkouts.
03:46autodidaktoantares_: Thanks. So the lib folder, in a lein2 project, could possibly have an updated clojure jar. Anything else?
03:47antares_actually, I see that lein2 projects also have lib/* with Maven deps :)
03:47antares_autodidakto: are you trying to track down what causes updated Clojure jar to be on your classpath?
03:48autodidaktoNot that. Just trying to understand lein1/2.... the directory tree and dependencies and the maven..
03:48autodidaktoheh, the maven
03:49antares_deps are under lib/, checkouts are under checkouts/. Compiled .class files in lein1 are under ./classes/, in lein2 they are under target/classes
03:49antares_slightly closer to Maven ecosystem conventions
03:50antares_everything else (src, test) is the same (and configurable to your taste)
03:52autodidaktoantares_: Thanks. That helps
04:04Raynesantares_: Define 'maven deps'
04:04antares_Raynes: I just used autodidakto's terminology
04:04gf3gm Raynes
04:04RaynesOkay, then he should define maven deps.
04:04Raynes:p
04:04RaynesMaven and lein deps are exactly the same thing.
04:04Raynesgf3: Morning.
04:05RaynesAnyways, I have to go sleepy time now. Work tomorrow.
04:21casperchello
05:15Fullmoon(map
05:15Fullmoon (fn [[x y] args] x)
05:15Fullmoon {:a [1 2 3 4] :b [5 6 7 8 9 10]})
05:15FullmoonSomething is wrong with this destructuring, I am getting Wrong number of args (1) passed to: core$eval3085$fn can-t figure out why
05:17Fullmoonfirst of a map returns a vector with [key value], so this should work...
05:18clgvFullmoon: a map is converted to a seq of key-value pairs when passed to 'map. this works: ##(map (fn [[x y]] x) {:a [1 2 3 4] :b [5 6 7 8 9 10]})
05:18lazybot⇒ (:a :b)
05:21clgvjust selecting keys or values can be done via 'keys and 'vals
05:24FullmoonAh, ok, thanks.
06:48casperci'm wondering if it is possible to make the following structure with a macro:
06:49casperc(defstep step-name [order] (ACTION ...) (CALLBACK ...))
06:50caspercthe intention is that the ACTION and CALLBACK forms should end up creating a function which is put into a hashmap or record
06:50caspercthose functions should have access to the parameters provided in the defstep, i.e. order in this example
06:52casperci'm having a hard time figuring out how to get ACTION and CALLBACK to have access to order without providing it
07:07clgvcasperc: you should write down the resulting function definitions and data creations. it explains better what you want to do
07:12caspercclgv: thanks, I know I was being a bit vague :)
07:14caspercclgv: i basicly want to end up with a map containing three functions, like this {:action (fn [] ...) :callback (fn [] ...) :cancel (fn [] ...)}
07:15clgvcasperc: why do you chose the map and not a protocol with an implementing defrecord (or deftype)?
07:16caspercclgv: it's meant as a step in a flow to be defined like this (defstep step-name [order] (ACTION ...) (CALLBACK ...) (CANCEL ...)), where the body in cancel is the respective fns, and has access to order, given in defstep
07:18caspercclgv: that might well be a better solution. The important bit to me is the defstep abstraction and being able to invoke e.g. the cancel action
07:18casperci'm kinda coming up short though
07:18Chousukecasperc: that doesn't seem too hard to implement
07:18clgvcasperc: but why dont you define (defprotocol IStep (action [this]) (callback [this]) (cancel [this])) (deftype OrderStep [order] (action [this] (dosomething order)) (callback [this] ...) (cancel [this] ...))
07:22caspercclgv: that might be a good solution, the type system of clojure is a bit of a black area for me currently. How would I got about making different types of steps? Define a type for each type of step i need (there would be many)?
07:22Chousukedo you need multiple instances of each step?
07:22clgvcasperc: yes, you can implement IStep on multiple deftypes/defrecords
07:23clgvhm yeah, reify is an option as well, if anonymous types are sufficient
07:24caspercChousuke: yeah, basicly want i am trying to create is a flow for processing an order, where it is possible to define a bunch of steps and put them into a flow
07:25Chousukecasperc: I mean, would most orders use the same steps, but with different parameters?
07:25caspercthe flow macro would look something like this: (defflow name-of-flow step1 step2 step2)
07:25Chousukein that case, I'd probably go with a protocol and defrecords.
07:26Chousukecasperc: don't make a macro for everything
07:26Chousukewhat's wrong with just (def name-of-flow [step1 step2 step3])? :)
07:26clgvdeftype is then basically your defstep ;)
07:27caspercChousuke: not much i guess, just trying to make it look nice in use :)
07:27Chousukekeep it simple, first
07:28Chousukeif your flow is really a vector of steps, then there's no reason to make it anything else
07:28caspercpoint taken, thanks for the input clgv and Chousuke :)
07:28casperci'll try the deftype solution and see if that isn't in fact the right way :)
07:29Chousukego with defrecord unless you have a special reason to use deftype
07:30Chousukeit shouldn't waste any resources and they work like maps, which is nicer to use than a plain deftype
07:30Chousukeand more flexible.
07:33caspercChousuke: yeah, record might be the way to go here
07:35caspercChousuke: sorry, that i keep coming back to this, but if I wanted to create the record with the action, cancel and callback using this abstraction i mentioned before, how would that look?
07:35caspercChousuke: given that you thought it was easy and i have no idea, now you got me even more interested :)
07:36Chousukewell you basically take the name. the argvec, and three lists as parameters to your macro
07:36caspercChousuke: this one btw: (defstep step1 [ordre] (ACTION ...) (CALLBACK ...) (CANCEL ...))
07:36caspercah you got it
07:37Chousukeso you define whatever, then remove the first item from all the lists and use them as bodies in the macro expansion
07:37clgvcasperc: exactly like the deftype example above but with defrecord ;)
07:37caspercmind writing it out, I have a pretty bad mental model when it comes to macros
07:37Chousukeit'll work pretty nicely if you just replace the ACTION, CALLBACK and CANCEL symbols with 'do :P
07:37Chousukethen put them in the right place
07:38Chousukedunno, it's not quite an oneliner. But it's not hard if you remember you're dealing with data structures
07:41caspercChousuke: hmm, i'll try that
07:44caspercChousuke: something like this:
07:44casperc(defmacro defstep [uuid ordre & [action callback cancel]] `(defrecord OrderStep [~uuid ~order] (action [this] (replace-do action)) (callback [this] (replace-do callback)) (cancel [this] (replace-do cancel))))
07:44clgvcasperc: you can try somthing like this (defmacro defstep [name [order] & impl] `(deftype ~name [~order] IStep ~@(map (fn [l] (list (first l) '[this] (rest l))))))
07:44clgvor defrecord ;)
07:45caspercclgv: ooh, yours looks more correct than mine :)
07:45clgvcasper: but it does not enforce your 3 particular functions.
07:46Chousukethat [~order] is a bit funky
07:46Chousukeyou could just use "argvec" as the parameter and do ~argvec
07:47clgvChousuke: yeah thats possible as well. but you would have to call 'vec on it then as well
07:47Chousukewhy?
07:47clojurebothttp://clojure.org/rationale
07:47clgvChousuke: deftype/defrecord insists on a vector and not something seqable, right?
07:47Chousukeclgv: it will be a vector
07:47caspercclgv: true, also mine requires the correct order and all to be present, which would also be nice if it didn't
07:48Chousukesince you call it as (defstep name [order] ...)
07:48clojurebot,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25))
07:48Chousukeuhh, what
07:48clgvlol
07:49caspercclojurebot has an oppion too :D
07:49mmarczykgood morning
07:49mmarczykwould anyone care to run a perf test for the persistent hash map implementation for ClojureScript? http://jsperf.com/cljs-persistent-hash-map-miniscule-assoc
07:50clgvmmarczyk: done. PHM is the fastest
07:51mmarczykclgv: thanks! :-)
07:51mmarczykI have to say, I still can't believe it
07:51mmarczykbasically my testing methodology must be flawed, right?
07:51ChousukeI tested, objmap is fastest
07:52Chousukephm is 16% slower and HashMap 50%
07:52mmarczykthanks
07:52clgvanother chrome result
07:52mmarczykthat sorta makes sense
07:53ChousukeI'm running it again a few times
07:53Chousuke(64-bit iceweasel 10.0.3, linux)
07:54Chousukegetting somewhat jittery results for the phm; objmap remains fastest but phm ranges from 8-16% slower
07:55mmarczykhm, not sure why that would be the case
07:55Chousukeit might be chrome finds something and manages to optimise away stuff
07:55ChousukeI'll test with chromium too
07:55mmarczykyeah, V8 is absolutely crazy
07:56mmarczykthere are links to other tests in comments on the ticket
07:56Chousukephm is fastest in chromium
07:56Chousukeinteresting
07:56mmarczykin all cases V8 is the fastest and for some reason really, really likes PHM
07:57Chousukeis objmap mutable?
07:57mmarczykChousuke: nope, copy-on-write
07:58mmarczykand it actually copies two things -- the underlying js object and the keys array
07:59clgvmmarczyk: the performance of a plain js map would be interesting in comparison
07:59mmarczykclgv: true, I'll make a separate test for that
07:59mmarczyksince it needs to be mutable
07:59mmarczykI'll include the transient code :-)
08:00mmarczykhttp://jsperf.com/cljs-persistent-hash-map-transient-support
08:00Bronsammarczyk tested on opera mobile from android, phm 15% faster
08:00Chousukemaybe the v8 GV likes phm
08:00ChousukeGC*
08:00mmarczyk^ PHM vs. TransientHashMap for building a 500-entry map
08:00mmarczykBronsa: thanks!
08:00mmarczykChousuke: yeah, they hit it off immediately
08:01clgvlol opera mobile looks funny in that chart ^^
08:02mmarczykwow, transients apparently a good idea on iceweasel
08:02mmarczykclgv: :-)
08:02Bronsaclgv yeah, after that, it crashed.
08:03Chousukechrome with phm is almost as fast as iceweasel with transients :P
08:05Chousukelooks like ff11 has improved a lot
08:05Chousukeor it might just be the difference in computer speed
08:06ChousukeI don't have ff11 to test myself
08:06clgvff11 pc: Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz
08:11Chousukefor some reason ff11 is still only in debian experimental :/
08:12mmarczykunsurprisingly, nothing quite as fast as js-obj when mutability is not an issue: http://jsperf.com/cljs-persistent-hash-map-vs-js-object-small
08:15mmarczykthanks for running the transient tests
08:15mmarczykapparently they make a bigger difference when not on V8, interesting
08:16mmarczykI have a TransientObjMap impl ready
08:16mmarczykguess I could dig it up and include it
08:17ChousukeChrome is way faster at this than FF :p
08:17mmarczykI have a conceptual problem with it, though -- should it switch to PHM at some load threshold? otherwise first non-string assoc coming @ 5000 entries would be problematic
08:18Chousukefortunately FF is plenty fast enough.
08:18mmarczykalso maybe just not worthwhile, since it's easy enough to build an ObjMap mutably by hand
08:18ChousukeI can't use Chrome :( no pentadactyl
08:18mmarczykChousuke: oh yes, Pentadactyl FTW!
08:18mmarczykbut I make do with Vimium
08:19mmarczyklast time I checked, Pentadactyl didn't like that expose-like thingy
08:20mmarczykwhich I started to use anyway, only to find that the "buffer list" became completely useless
08:20mmarczykmaybe they've made progress on that though?
08:20Chousukeprobably not
08:20ChousukeI don't use it so I wouldn't know
08:24babilenChousuke: Try http://mozilla.debian.net for newer IW/FF releases.
08:50Chousukebabilen: I know of that, it just tells me the newest version is in debian experimental :P
08:51babilenChousuke: 11 is in iceweasel-release (cf. http://mozilla.debian.net/dists/squeeze-backports/iceweasel-release/binary-amd64/Packages)
08:51Chousukethat's for squeeze though
08:51ChousukeI run testing
08:52Chousukebut I'm testing out ff12 beta
08:58babilenThose packages should work on testing as well fwiw -- You can also get iceweasel-beta or iceweasel-aurora -- but I guess this is better suited for #debian or even #debian-next (irc.oftc.net)
09:10jedmtnmanis there a better channel to ask a simple question about hiccup or should I ask here?
09:14fliebeljedmtnman: I think here is fine. Not sure if there is any more specific channel.
09:14fliebel#clojure-web maybe
09:16jedmtnmanfliebel: im just not sure of the intended use to put together an xml-declaration and the ensuing html. the xml-declaration function returns an escaped string but the html method does not...
09:17jedmtnmansomething ilke (str (xml-declaration "UTF-8") (html […])) is what i was thinking but not sure that is what is normally done.
09:20fliebeljedmtnman: It seems you just supplyt it to html? https://github.com/weavejester/hiccup/blob/master/src/hiccup/page.clj#L32
09:24jedmtnmanfliebel: hmm. I'm building xml, not html, but it does seem to work, providing the xml-declaration as the first tag for the html function.
09:44jedmtnmanfliebel: I mis-interpreted what i was seeing on the repl. it was just escaping the double quotes. thanks
10:06sadgerhi there, can anyone please tell me which is the easiest way to find out which functions are in a given namespace?
10:07S11001001,(doc ns-publics)
10:07clojurebot"([ns]); Returns a map of the public intern mappings for the namespace."
10:08sadgerthank you
10:08sadger:)
10:14clgvsadger: you better call it like this ##(keys (ns-publics 'clojure.string))
10:14lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
10:14clgv,(keys (ns-publics 'clojure.string))
10:14clojurebot(trim lower-case split join upper-case ...)
10:14gfredericksclgv: now make a map from those to their docstrings and print it out as a table
10:15S11001001experimentally call all the functions and figure out their argument and result types
10:15sadgerclgv: for readability purposes?
10:15gfrederickssadger: yes
10:15clgvsadger: yes.
10:15sadgerclgv: I can see now! filled up my whole page
10:15sadgerclgv: thanks
10:21sadger,(sort (keys (ns-publics 'clojure.string)))
10:21clojurebot(blank? capitalize escape join lower-case ...)
10:21gfredericks,(-> clojure.string quote ns-publics keys sort)
10:21clojurebot(blank? capitalize escape join lower-case ...)
10:21sadgeralways have to do one better :)
10:21sadgerwhat does the -> do?
10:21gfredericksit has lots of fun
10:21gfredericksit turns my thing into your thing
10:21gfrederickswithout so much nesting
10:22S11001001though the quote is a little excessive
10:22gfredericksit is obnoxious
10:22S11001001albeit good illustration of the exact semantics
10:22sadgerah its some sort of composition?
10:23gfredericks,(macroexpand '(-> foo bar))
10:23clojurebot(bar foo)
10:23gfredericks,(macroexpand '(-> (one two three) (four five six)))
10:23clojurebot(four (one two three) five six)
10:24gfredericks,(macroexpand '(-> (one two three) (four five six) (seven eight nine) ten))
10:24clojurebot(ten (clojure.core/-> (clojure.core/-> (one two three) (four five six)) (seven eight nine)))
10:24gfrederickspoop
10:24gfredericks,(macroexpand-all '(-> (one two three) (four five six) (seven eight nine) ten))
10:24clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macroexpand-all in this context, compiling:(NO_SOURCE_PATH:0)>
10:24caspercdoes anyone know how it is possible to tell which methods are implemented on a given record, or if a method is present on that record?
10:24sadgerso gfredericks in simple terms what does it do?
10:25gfrederickssadger: it takes each successive form (syntactically) and places it as the first "argument" of the next form
10:25sadgerahh so to avoid the nesting
10:25gfredericksexactly
10:25Iceland_jack> Inserts x as the second item in the first form, [...]
10:25gfredericks->> does something similar, but as the last "argument" instead of the first
10:25sadger(-> 'clojure.string ns-publics keys sort)
10:25sadger,(-> 'clojure.string ns-publics keys sort)
10:25clojurebot(blank? capitalize escape join lower-case ...)
10:26mdeboardspam
10:26sadgeri will try and remember this
10:26sadgeri have just ordered the new o'reilly book
10:26sadgerhave heard good things
10:26mdeboardsadger: I got it in the mail yesterday, most practical clojure book yet imo
10:26clgvcasperc: no. not as a builtin function
10:26cemericksadger, mdeboard: I hope we live up to them, thanks :-)
10:27sadgermdeboard: I got "the joy of clojure" just out of interest
10:27mdeboardsadger: Ditto, I have joy and practical both
10:27mdeboardsadger: Both good in their own ways, but this one seems more focused on actual productivity
10:27mdeboardvice exclusively learning language features
10:27caspercclgv: so i need to do some java interop with reflection to find out?
10:28sadgerYes I think the joy of clojure focuses on what is idiomatic a lot which can cause confusion (important but also can go off on a tangent)
10:28mdeboardOr I should say, vice exclusively enumerating language features for the reader
10:28clgvcasperc: what do you really want to do?
10:30caspercwell i am still on the thing you helped me with before :) So now I have a macro working to create a record which implements a protocol IStep, but it doesn't implement all methods necessarily and it would be nice to have a way to know what methods are implemented
10:31clgvcasperc: is this really sane behavior? it could implement not used methods as empty methods
10:31sadgeri look forward to this book cemerick, can't wait to get stuck in
10:32gfredericksI'm getting a "symbol ain't a seq" error from this ns form, and am totally baffled: https://refheap.com/paste/2231
10:33caspercclgv: hmm, maybe not but i need a way to find out of a step is cancelable or not
10:33clgvcasperc: you can add a method for that to the protocol
10:34sadgerquestion, are there any better tools at error reporting over the usual stack trace (particularly for the repl) it's not overly informative i feel
10:35caspercclgv: yeah that might be the solution
10:50beffbernardIs there a way to find all references of a def/defn using slime/clojure-jack-in?
10:51gfredericksI think there's a function for that; I don't think it ever worked for me though
10:51gfredericksM-x rgrep is always there :)
10:51beffbernardhaha I M-x grep-find :(
10:51beffbernardOr just delete the thing and fix the compiler errors
10:52gfredericksscrap the project and start over
10:52gfredericks`lein new at-least-this-will-compile`
10:52beffbernardC-h del
10:52beffbernard:)
10:54beffbernardgfredericks: +1 on the rgrep
10:54gfredericksrgrep is my secret to handling legacy clojure code
10:54beffbernardThat's probably the closest thing to find all references as I'll get
10:57devnibdknox: what was the JS library or framework you were talking about using for Light Table?
10:58devnnevermind, codemirror
11:00anieroreading the fogus interview with djspiewak... why is it that (drop 1 [1 2 3]) returns a list, not a vector?
11:00gfredericksit returns a seq not a list
11:00gfredericksand doing that is much more efficent
11:00gfredericksyou can't easily remove arbitrary ranges from the front of a vector
11:02mmarczykanybody got a moment to run http://jsperf.com/cljs-persistent-hash-map-vs-records-minuscule ?
11:03anierogfredericks: ohh, looking at the source of drop, that makes sense
11:03anierothanks
11:03anierogfredericks: is it generally better to think of things in terms of sequences, rather than whether or not they're vectors/lists initially?
11:04gfredericksmmarczyk: I'm totally on it
11:04mmarczykgfredericks: thanks :-)
11:04gfredericksaniero: absolutely; seqs are one of the main abstractions in clojure
11:04anierocool, ok!
11:05gfredericksmmarczyk: do I gotta tell you something or did it auto-report to you?
11:06mmarczykgfredericks: no auto-reporting, thanks :-)
11:06gfredericksmmarczyk: oh so how do I communicate this to you?
11:07mmarczykgfredericks: oh, no worries about that -- I reload those tests all the time :-D
11:07gfredericksdid "no auto-reporting" mean "no, it is auto-reporting"?
11:08mmarczykgfredericks: no, but right after posting the link here, I'm sorta anxious to know the results and reload every couple of minutes
11:08mmarczykgfredericks: this tends to reinforce my impression that PHM is working *just fine*, which is great :-D
11:09gfredericksokay I have no idea what we're talking about anymore. Let me know if you need me to do anything else.
11:09mmarczykgfredericks: fair enough, thanks for running the test ;-)
11:09gfredericksyessir
11:10gfredericksand/or madam
11:12clgvmmarczyk: firefox outperforms chrome on records?
11:13mmarczykclgv: weird... some superfast machine running that test maybe?
11:13mmarczykclgv: but then, who knows, it's not by a huge margin
11:13clgvmmarczyk: no. both results on my machine
11:13mmarczykclgv: in that case, interesting
11:14wkmanireGood morning.
11:16gfrederickswkmanire: morning? but here in <location> it is actually <some other time of day>!
11:17neotykgood morning everyone
11:17sadger4.10pm!
11:17clgvgfredericks: your template engine failed to fill in the values ;)
11:17sadgerwaiting to leave the office!
11:17neotykgfredericks: it is universal greeting time
11:17wkmaniregfredericks: Traditional courtesies are hard to apply on the itnernet.
11:17wkmanireAnd also on the internet too.
11:17sadgergood day
11:18sadgergood period of time at which you currently reside
11:18sadgercatchy
11:18gfredericksgood time zone everybody!
11:18wkmanireTime zones are overrated.
11:18gfredericksI think they are a nice abstraction
11:18wkmaniresadger: I probably aughta just say "Hi".
11:18neotykgfredericks: http://www.total-knowledge.com/~ilya/mips/ugt.html
11:18sadgerif you look across the boundery of a time zone you can see into the future
11:18TimMc.g universal greeting time
11:18sadgerwkmanire: maybe
11:19TimMc$google universal greeting time
11:19lazybot[UGT] http://www.total-knowledge.com/~ilya/mips/ugt.html
11:19sadgermaybe we need the lazybot to do that to send a personalised message to everyone depending on timezone :P
11:19TimMcIn another channel, we say "Good $TOD"
11:19sadgerdon;t want to offend
11:19gfrederickshaha
11:19wkmanireTimMc: That just about sums it up doesn't it?
11:20wkmanireIt's amazing how many truths we unconciously learn about IRC.
11:20TimMcalthough the Germans are amused that that sounds like "good death"
11:21wkmanireIt is only barely morning here anyway. 11:13.
11:21TimMcwkmanire: Ah, you must be in the same 1/24 band of the globe as I am!
11:22TimMcWe're practically family.
11:22gfredericksyay for similar longitudes!
11:22wkmanireTimMc: Cuiabá, Brazil.
11:22TimMcBoston, MA, USA
11:22wkmanireYep.
11:22gfredericksI'm leaving this time zone next week
11:23asphalteHey
11:25asphalteI'm quite new to Clojure. I have a vector of strings that I am trying to transform into an expression, e.g., ["cmd" "verb" "arg0"] -> (cmd verb arg). Could someone point me in the right direction pls?
11:25gfredericks(map symbol my-string-vector)
11:26TimMcasphalte: What do you intend to do with it after that?
11:27asphalteOh, thanks. I wasn't aware of 'symbol'
11:27wkmanire:/
11:27Iceland_jackasphalte: If you intend to run it using eval there is probably a better way
11:27gfredericksTimMc: he's going to put it right into production
11:28asphalteI want to send it over the wire, execute it, having predefined functions for the various commands. Just messign around experimenting really.
11:34sadgerWhat if you had say ["+" "1" "2"] and wanted to parse that and evaluate it what would be the best approach
11:34sadgerevaluate it as (+ 1 2)
11:35gfredericks(eval (map read-string ["+" "1" "2"]))
11:37sadgerah thanks, sorry for the flooding questions just a interesting noobie :)
11:40asphalteI think it was a good question, thanks for asking it.
11:40gfredericksasphalte: read-string could have been used in your case too
11:41sadgergfredericks: that's what I wondered, I tried an example which I thought asphalte might have been using in some form but it didnt work
11:41gfredericks,(map type [(read-string "78") (symbol "843") (read-string "foo") (symbol "foo")])
11:42clojurebot(java.lang.Long clojure.lang.Symbol clojure.lang.Symbol clojure.lang.Symbol)
11:43sadgerhmm
11:43sadgerbut if you evaulate say (map symbol ["+" "1" "2])
11:44sadgerobvious it has no symbol for the integers
11:44sadger(badly worded)
11:44gfredericksyou'd be passing symbols to the + function which doesn't like that
11:44gfredericksno wait
11:44sadgerI think it is
11:44gfredericksit'd fail to compile because of what you were probably saying
11:44sadgerit says symbol cant be casted to integer
11:44sadgerwhich is what + expects
11:44gfrederickshrm
11:45gfredericksthen I'm confused
11:45sadgerit does fail on compile
11:45clojurebotthe scala compiler | is | <reply> see: http://harrah.github.com/browse/samples/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala.html#65760
11:45sadger,(eval (map symbol '("+" "1" "2")))
11:45clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
11:46asphalte,(eval (map read-string '("+" "1" "2")))
11:46clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
11:46Iceland_jack,(class (symbol "2"))
11:46clojurebotclojure.lang.Symbol
11:46sadgeroh we can't eval in here
11:46sadgeri guess
11:46asphalte:(
11:47sadgerdont want throwing dangerous code about
11:47asphalte"try this at home only"
11:47sadgeryes
11:47sadgerwith safety goggles and a hard hat
11:47asphaltesounds wise
11:47sadger;)
11:48sadgeranyway I gotta get home and grab some food shopping
11:48sadgergood $TOD to all $persons
11:48gfredericksmaybe in the future lazybot will accept eval
11:48gfredericksI opened up an issue for it
11:48asphalteCatch you later. Thx for the discussion.
11:49clgvgfredericks: likely, it won't - since the sandbox would get headaches ;)
11:50gfredericksclgv: sandbox could redef eval to call itself
11:50gfrederickseval is what the sandbox does
11:50gfredericksin my primitive understanding at least
11:51clgvgfredericks: hmmm, could be possible
11:51gfrederickshttps://github.com/flatland/clojail/issues/2
11:55jedmtnmancool what are you using clojail for?
11:56jedmtnmanis flatland someone you will be working with. he's the one that started the utlis lib too
11:56gfredericksI'm not using clojail, just thought it would be cool if lazybot could eval
11:57gfredericksflatland is a group I believe
11:57muhooclojure seems to lure me irresistably into code golf. is it just me, or is it the language?
11:58muhooi find myself yak shaving by making functions that work perfectly well as they are, 50% shorter, as a way of procrastinating
12:00S11001001muhoo: just say you're eliminating code paths, making the functions more reliable
12:00muhooheh, thanks
12:03muhoo&2r11001001
12:03lazybot⇒ 201
12:03gtrak,2r111
12:03clojurebot7
12:04gtrak,0xCAFEBABE
12:04clojurebot3405691582
12:04gtrak,010
12:04clojurebot8
12:06antares_seancorfield: hi. What do you think about moving clj-time to lein2?
12:07antares_seancorfield: I want to eliminate reflection warnings in it and lein1/lein2 projects do not work very well via checkouts. So I have to edit project.clj in clj-time to see them :(
12:17muhoo[5~[5~[5~/sb end
12:19wkmaniremuhoo: What does that mean?
12:20muhooit means i typed a bunch of garbage in irssi while scrolling back, then told it to bring me here to the end :-)
12:21muhoo /sb end means, scroll to the bottom
12:21wkmanireI thought a [5~ might be an ASCII fish or something.
12:21muhoobtw is there a library or function for composing urls? i suppose i could write one, but why reinvent the wheel?
12:22RickInGAwow, light table > 1000 backers
12:22muhoolike give it a map, and it gives me back http://foo.bar.com?baz=quux&amp;blah=ahem ?
12:22wkmaniremuhoo: I don't know for sure but there has to be. The Noir framework must deal with that fequently, I bet there is an example of how to build a URL in that code base.
12:22muhooall urlstringified etc
12:23gtraki think someone just made one, maybe cemerick?
12:23anierohttp://www.mail-archive.com/clojure@googlegroups.com/msg29338.html has an implementation
12:23gtrakhttps://github.com/cemerick/url
12:23anierooh awesome
12:24muhoowow, thanks
12:24muhooi swear, it seems like a huge portion of the practical stuff i need to do actual work was written by cemerick, ibdknox, and weavejester
12:25muhoomany thanks to them!
12:25duck1123https://github.com/michaelklishin/urly
12:25wkmanireHey, that looks exactly like what I thought it would look like.
12:25antares_how do I type hint arrays of objects, like here: (into-array DateTimeParser parsers)?
12:26S11001001,(.getName (class (into-array java.util.Date [])))
12:26clojurebot"[Ljava.util.Date;"
12:27S11001001like ^"[Ljava.util.Date;"
12:28mmarczyk^objects works for Object []
12:30amalloyjedmtnman: you asked about flatland; you can come hang out in #flatland if you want
12:30jedmtnmanamalloy: thanks!
12:32wkmaniremuhoo: Because of Cemerick's book there are going to be a lot of people that program like him too I imagine.
12:32wkmanireMight come to call us Cemerickians or something cool like that.
12:34muhoowkmanire: how are your explorations with clojure coming so far?
12:35wkmaniremuhoo: Very well.
12:35wkmanireI built my first app a few days ago that is just a little guessing game.
12:35wkmanireI'm working on my second one now.
12:36RickInGAwkmanire what did you do for UI? noir? seesaw?
12:37wkmaniremuhoo, RickInGA: https://github.com/wkmanire/clojureguessinggame/blob/master/src/guessing_game/core.clj
12:37wkmanireJust terminal.
12:37RickInGAcool
12:37wkmanireThe second app is just a simple address book manager.
12:37wkmanireI'm unit testing it
12:37wkmanireI intend to use Swing for the UI.
12:38amalloywkmanire: raw swing, or via seesaw?
12:38wkmanirehttps://github.com/wkmanire/clojureaddressbook
12:38RickInGAwkmanire seesaw is a wrapper for swing
12:38RickInGAand really cool
12:38wkmanireWell, I'd like to try to use clojure as much as possible.
12:38wkmanireAs much as practical.
12:38amalloyi haven't used swing in years, and haven't used seesaw ever, but everyone says seesaw is way easier
12:38wkmanireSo I'll take a look at seesaw.
12:39RickInGAhttp://blog.darevay.com/2011/12/a-seesaw-tutorial/
12:39wkmanireI'm trying to take a MVC approach to this little app, so as soon as I've fleshed out the controllers I'll start in on the UI.
12:39wkmanireAnyway, nothing special. Just a newbie doing newb stuff.
12:40technomancyI can't tell if djspiewak is intentionally ignoring issues of laziness in this interview or just unaware. (re: drop) http://clojure.com/blog/2012/04/19/take5-daniel-spiewak.html
12:40jdmmmmmCould someone see my mistake leading to "Can only recur from tail position" with http://pastie.org/3817633 ?
12:41TimMcrecur doesn't work across a lazy-* boundary
12:41TimMcOh, hmm...
12:41hiredmanno, the problem is line 18
12:42wkmanireRickInGA: Wow, I'm looking over this tutorial and seesaw does look really good.
12:42hiredman19
12:42wkmanireI used swing like about 6 years ago.
12:42RickInGAwkmanire: yeah, swing is actually fun when you can do it in a repl
12:42wkmanireIN Java, and I remember how much I disliked newing up handfuls of objects and setting properties on them to get my forms going.
12:43tmciverjdmmmmm: looks like recure is getting 3 args; the new-bindings on line 18 shouldn't be there?
12:43RickInGAwkmanire in a repl with seesaw loaded you can do (doc frame) and see what methods frame supports
12:43TimMcwkmanire: doto helps with that in Clojure :-)
12:43hiredmanit is hard to read the indentation
12:44wkmaniredoto?
12:45jdmmmmmtmciver: I don't see the three args; just two: (rest bindings) and the (lazy-cat ...)
12:45amalloy&(seq (doto (java.util.ArrayList.) (.add 5) (.add 1)))
12:45lazybot⇒ (5 1)
12:47FullmoonLet's say I have a process that is blocking on network-based IO, and I want to limit it to n parallell connections (unrelated to the number of cores on the box) at a time, how go I about that? Multiple vectors of agents?
12:47gtraka semaphore?
12:48amalloysounds like a job for...executors! i think?
12:48gtrakhttp://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Semaphore.html
12:49wkmanireCan I use lein to install seesaw?
12:49RickInGAyeah
12:49RickInGAwkmanire: https://github.com/daveray/seesaw
12:49FullmoonI see, I was thinking in the wrong context, I can also use java's multithreading methods, and use them safely with the clojure primitives...
12:50duck1123(Executors/newFixedThreadPool thread-count) is how I've done it
12:50amalloygtrak: a semaphore is awfully low-level
12:50amalloyhttp://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html
12:50gtrakit's probably best to use the highest level thing that has the right semantics?
12:51RickInGAwkmanire: dependancy is [seesaw "1.4.0"]
12:51wkmanireRickInGA: I'm still trying to install it. Lein doesn't work to well for me on my windows box.
12:52wkmanireSo it might have to wait until tonight when I get back to sanity.
12:52wkmanireAs in, when I get to clock out and boot into windows.
12:52Fullmoonduck1123: That looks good, cool!
12:52duck1123wkmanire: you don't "install" it as much as you declare it a dependency of your project
12:53RickInGAwkmanire: this post is about setting up clojre on windows, and one section is on lein, in excruciating detail: http://onbeyondlambda.blogspot.com/2012/01/setting-up-clojure-emacs-on-windows.html
12:53wkmanireYeah, lein crashed again with an IOException. The plugin install command seems to be borked because of permissions issues.
12:53RickInGAah
12:53RickInGAseesaw isn't a plugin
12:54RickInGAyou add it to your project dependencies
12:54RickInGAthen type lein deps
12:54RickInGAits just a jar file
12:54wkmanireIs there a command for killing the REPL process?
12:54RickInGActrl-d
12:54wkmanireCTRL-C doesn't work in my windows command prompt emulator.
12:55wkmanirethanks.
12:55wkmanirethat worked.
12:55RickInGAi have had issues in the past that the jvm is still running so I hav had to forecably shut them with task manager
12:56wkmanireI think I'm going to reinstall everything following this tutorial. but not right now. I really am looking forward to finishing my little address book app with seesaw.
12:56amalloywkmanire: anyway, stop trying to install things. the number of clojure libraries you have to install is very small, so probably start by assuming you don't need to install it. this meshes well with your apparent inability to install anything correctly
12:56wkmanireamalloy: Hey, I got it all working on Linux just fine.
12:56wkmanireamalloy: :P
12:57wkmanireamalloy: You can't blame me for wanting to use lein's plugin install command to install plugins.
12:57amalloyindeed not
12:58amalloyyou just prematurely assume things are plugins, i guess
12:58technomancyif it has permissions issues it was probably run as the wrong user
12:58wkmaniretechnomancy: Could be, but windows should be using admin privs to run lein since the command window was run with admin privs.
12:59wkmanireBasically like being root.
12:59RickInGAI was reading on the cljs-template project that in lein 2, you dont have to install the template, lein will install it when you invoke it
12:59RickInGAwkmanire: /agree
12:59technomancyhuh; very strange
12:59wkmanireamalloy: I'm just starting out here. Cut me some slack. I think I'm doing pretty ok for two weeks into learning a completely new and different thing.
13:00technomancywkmanire: the plugin system in lein2 is different; might have better luck there
13:00cmajor7discussing trampoline with people made me wonder: how often do you use mutual recursion in clojure?
13:00wkmaniretechnomancy: Ok. Thanks.
13:00RickInGAtechnomancy in lein2 do plugins also install themselves, for example if I haven't installed noir will lein noir new mywebsite install noir pluggin?
13:01amalloywkmanire: sorry, i don't mean to offend. i just suggested you stop trying to install things, which is generally pretty sound advice. if you don't like the way i said it, i apologize. just a bit of joking
13:01duck1123RickInGA: how would lein know what "noir" means?
13:01wkmanireNo problems.
13:02RickInGAduck1123 no idea, but from what I understand it knows to lookup templates, so it may know where to look for plugins as well
13:03RickInGAduck1123: my understanding of templates is based on : https://github.com/ibdknox/cljs-template
13:07technomancyRickInGA: templates for lein new are a special case
13:07technomancythat's the only place the install-on-demand logic is triggered
13:07RickInGAtechnomancy: cool, thanks!
13:11muhoocandidate for best project name: https://github.com/davidsantiago/pathetic
13:12seancorfieldclj-time 0.4.1 with fewer reflection warnings - thank you michael klishin
13:14duck1123there are so many clever clojure project names. I don't think I could ever pick the best
13:15Null-Aduck1123: there's a clojure app for that
13:24gtrakduck1123, do you need help naming something?
13:25duck1123gtrak: no, muhoo mentioned a cleverly named clojure project. I was pointing out that there are several great clojure project names
13:26gtrakoh yea. definitely
13:26muhooruby projects tend to have creative names too, like "texticle"
13:26gtrakhaha
13:27duck1123I wonder how many -jure projects lein new has squashed
13:34muhooi saw that in the code and lol'ed. it will literally reject -jure's
13:34muhooit needs to reject foo-clj and clj-foo now tooo
13:34muhooi should submit a patch to do that :-)
13:34technomancymuhoo: highly tempted
13:35dnolenibdknox: I know your busy, but have you had a chance to try out the PHM patch?
13:36ibdknoxdnolen: I haven't :(
13:36ibdknoxI'll try to give it a go later today, what exactly are you wanting to see?
13:36dnolenibdknox: yoklov more or less signed off on it. You're the other person that I know uses maps heavily CLJS.
13:36ibdknoxrather, what are you worried about/verifying
13:36dnolenibdknox: just that it's not crazy slow.
13:37ibdknoxshould there be improvement or is it just mostly a lateral move?
13:37dnolenibdknox: on jsperf it looks good, but I'd like to get some verification on real apps.
13:37dnolenibdknox: yoklov saw 2X speed boost, but he was using large maps.
13:37dnolenibdknox: I'm curious about apps that use smaller maps.
13:37ibdknoxI use mostly small ones
13:38dnolenibdknox: yeah that's what I thought
13:38ibdknoxdnolen: k, I'll give it a go later this afternoon and report back
13:39zerokarmaleftcemerick_away: what's the status on https://github.com/cemerick/raposo?
13:39ibdknoxdnolen: looking at it here, is there an easy way to just apply all of the patches? (haven't dealt with .patch files much)
13:40dnolenibdknox: sorry we went a little crazy there - you only want this one http://dev.clojure.org/jira/secure/attachment/11055/0001-PersistentHashMap-ported-from-Clojure.patch
13:40ibdknoxdnolen: great, thanks :)
13:41dnolenibdknox: if you're going to test it w/ the checkouts trick - make sure to set your extra classpath to both clj *and* cljs src dirs
13:41dnolenibdknox: thx much
13:42jsabeaudryim doing something ugly because I don't know better, what can i replace this with: (swap! my-atom #(do % new-value))
13:42mmarczykibdknox: note that if you use -strobj anywhere, this is going to break
13:42ibdknoxhm
13:42ibdknoxI think I did at one point as a hack
13:42Raynesibdknox: curl http://dev.clojure.org/jira/secure/attachment/11055/0001-PersistentHashMap-ported-from-Clojure.patch | git am
13:43ibdknoxRaynes: you rock
13:43ibdknox:)
13:43sadgerhello Raynes how is the book coming along
13:43RaynesSlowly.
13:43RaynesIt should be out by 2099.
13:44sadgerah nice i look forward to reading it on my deathbed
13:44sadgeror in the afterlife depending on how it goes
13:44mmarczykibdknox: after a quick check -- jayq.util uses that in a reduce/assoc in clj->js, but could absolutely use (js-obj) as seed and aset
13:44RaynesI'm taking it slow because once we have cryo chambers nobody is going to care how long something takes.
13:45sadgerah shrewd move
13:45Raynesmmarczyk: O, hai!
13:45mmarczykRaynes: hi!
13:45RaynesLong time no see.
13:45sadgerI am from dreamincode originally, that's where I found out abou it
13:45mmarczykRaynes: indeed
13:45pooya72hello, noob question here about concurrency: Does one have to tell an OS on a multi-core processor that the program handles concurrency or does it happen automatically, or what?...
13:45Raynessadger: I see. Welcome to Clojureland. Our tea is always hot.
13:46sadgerRaynes: I do like tea, my brother is "simown" the python moderator actually, started learning clojure recently
13:46sadgerRaynes: the functional programming forum is pretty dead though
13:47RaynesIndeed. Most of the posts are from people who are learning Haskell or Scheme in a school.
13:47RaynesIt's dead because most people realize they're better off coming to stackoverflow or a place like this to get help with these lesser-known languages.
13:47sadgerbetter than what I had to learn! Maude, some function abstract data type language so painful
13:48technomancyso just in case anyone's interested in contributing to Leiningen, I've tagged a number of tickets as "newbie" https://github.com/technomancy/leiningen/issues?direction=desc&amp;labels=Newbie&amp;milestone=&amp;sort=created&amp;state=open
13:48sadgerRaynes: Indeed and it's hiding away in Other Languages > Functional Languages
13:48pablo_nssadger: You're the brother of Simon Willison ?
13:48RaynesI've done what I can to energize that forum, but I don't have time for challenges and such these days, what with work and fixing technomancy's bugs all the time.
13:48sadgerpablo_ns: no
13:48sadgertechnomancy: sounds good how "newbie" are you talking
13:49sadgerRaynes: ha ha
13:49aaelonyFound a nice cookbook style clojure reference. What do people think? http://langref.org/clojure/all
13:50Raynesaaelony: Are you coming to lunch today?
13:50pablo_nsIs this code idiomatic in Clojure: (defn ask [& colls] {:ask (apply merge `(~@colls))}) ?
13:50aaelonyI'll be there... traffic notwithstanding :)
13:50technomancysadger: I was thinking new to the leiningen codebase rather than new to clojure itself, but depending on your background; dunno
13:50Raynesaaelony: Excellent. Look forward to meeting you. :)
13:51aaelony:) lol, we've met, but you don't remember
13:51Raynesorly
13:51RaynesAt a conj?
13:51pablo_nsIt does work but doesn't seem very idiomatic to me. I'm sure there's an easier way.
13:51aaelonyindeed
13:51RaynesMan, I've met so many people are those things.
13:51sadgertechnomancy: Ah new to clojure myself but once i've grasped the basics im sure i can contribute to something, i'll keep that page bookmarked
13:51aaelonywell, you're famous
13:51RaynesWhen you meet 30-40 people a day one after the other...
13:51RaynesIt's overwhelming.
13:51sadgerRaynes: hide in your room and cry :)
13:52RaynesAnyways, I look forward to meeting you again and damn well remembering it this time.
13:53aaelonyexcellent ;)
13:54Raynesaaelony: eharmony, eh. Do they use Clojure there at all>
13:54Raynes?*
13:55amalloypablo_ns: isn't (apply merge `(~@colls)) exactly equivalent to (apply merge colls)?
13:56pablo_nsamalloy: depends on the number of args
13:57gfrederickso_O
13:57amalloysupply a value for colls where that's true
13:57aaelonyThey're not averse to clj use. It's a java shop.
13:58aaelonyBiggest question is who will maintain your code when you've been hit by a bus?
13:58pablo_nsamalloy: this: (say {:option1 a :option2 b}) doesn't work with (apply merge colls)
13:58Raynesaaelony: Whoever they hire to do so.
13:59duck1123aaelony: that's why I argue that everyone around me should learn clojure
13:59zerokarmaleftaaelony: the scala guy
13:59Raynesaaelony: Or you could just.. you know, not die.
13:59amalloy&((fn [& colls] (apply merge colls)) {:option1 a :option2 b})
13:59lazybotjava.lang.RuntimeException: Unable to resolve symbol: a in this context
13:59amalloy&((fn [& colls] (apply merge colls)) '{:option1 a :option2 b})
13:59lazybot⇒ {:option1 a, :option2 b}
13:59amalloy&((fn [& colls] (apply merge `(~@colls))) '{:option1 a :option2 b})
13:59lazybot⇒ {:option1 a, :option2 b}
14:00amalloypablo_ns: try again? i guarantee you those two function bodies are identical, except the one with ~@ is slightly slower
14:00aaelonyraynes: true. The argument goes that it is hard to find good java devs and much harder to find clojure devs. But smart people that learn quick are really all that is required in both cases IMHO.
14:00TimMcyup
14:01technomancyaaelony: just point out that you're less likely to leave the company if they let you use Clojure =)
14:01TimMcIt's almost more work to learn the company's codebase than to a learn a new language.
14:01aaelonyduck1123: indeed!
14:01pablo_nsamalloy: you're right! so weird.
14:01amalloyTimMc: "almost"
14:01RaynesTimMc: 'almost'?
14:01Raynesamalloy: o/
14:01aaelonytechnomancy: i love it
14:01TimMcWell, it depends.
14:01mmarczyk"almost" ?! :-)
14:01TimMcOK, always.
14:01TimMcYou've convinced me.
14:01muhoohas someone already written a version of the ns or in-ns macros that will automatically (do (use 'clojure.repl) (use 'clojure.pprint)) when in an actual repl?
14:01TimMcwith your clever rhetoric
14:01technomancymuhoo: clj-nstools sorta does that
14:01amalloypablo_ns: weird how? consider the expansion of `(~@x):
14:01amalloy&(quote `(~@x))
14:01lazybot⇒ (clojure.core/seq (clojure.core/concat x))
14:02RaynesTimMc: I'm still unfamiliar with 80% of the codebase at work and I've learned 3 languages since I've been here.
14:02duck1123I just left a company that was letting me use Clojure, but only because the team was dying and it was unlikely my project would see much use
14:02pablo_nsamalloy: I mean my thought process to get to that piece of code, that's what was weird =)
14:02amalloyaha
14:02mmarczykRaynes: out of curiosity -- which ones?
14:02pablo_nsamalloy: after you explained it seems so obvious
14:03Raynesmmarczyk: Elixir, Ruby (okay, I've semi-learned Ruby), and an imaginary language I added to sound smarter than I actually am.
14:03Null-AI'm not sure what it's like for other people, but I don't know why some employers think learning a new language is hard
14:03thearthurhappen to know where repl-utils/show went in the clojure.contrib reshuffle?
14:03mmarczykRaynes: oh, good idea
14:03mmarczykRaynes: I think I'll learn that last one myself
14:03Null-Alanguages are so trivially different
14:03gfredericksNull-A: because they go on resumes. Things on resumes take significant effort.
14:03muhooduck1123: i just took on a customer who said "i don't care what you write it in, just make it work". i love that. except i'm so new to clojure that it's taking me an order of magnitude slower to get the job done than it would othersise.
14:03muhoootherwise
14:04pablo_nsRaynes: What do you think of Elixir?
14:04aaelonyI'm lucky in that if I'm analyzing data, few care what language I use b/c the output is the findings not the code. For code with a broader use case that changes quickly though.
14:04Raynespablo_ns: Good stuff.
14:04pablo_nsRaynes: I was very excited about it myself until I learned Clojure
14:04technomancygfredericks: FWIW "implemented a scheme" has a really high impressive-on-resume to effort ratio
14:05muhootechnomancy: clj-nstools doesn't exactly do that, but thanks.
14:05Null-Atechnomancy: just do that write a scheme interpreter in 24 hours tutorial
14:05RaynesNull-A: He wrote scheme on a bus.
14:05pablo_nsRaynes: I've met Valim, very smart guy. But for now it just feels to me like a sugared Erlang, and I have no problem with Erlang's syntax. Have you written anything in it?
14:05RaynesHe had to fold his ego 6 times to get out the door at his destination.
14:05gfrederickstechnomancy: that's a funny one if you don't know what "scheme" means but think you do
14:06Null-Aif you write scheme with clojure, doesn't take long at all
14:06gfredericks"...but it was foiled"
14:06Null-Ahaha
14:06Raynespablo_ns: Sure, I'm writing a build tool for it and I've contributed code to core (like a URI library).
14:06technomancygfredericks: heh
14:06pablo_nsRaynes: have you seen Joxa?
14:07Raynespablo_ns: I think the major point behind the language is to be a better syntax for Erlang. It also has macros, records, protocols, destructuring, etc, as well as a libraries completely separate from Erlang.
14:07RaynesI've seen Joxa. Couldn't ever get it to build, plus I'm not at all interested in it right now because I already have a Lisp.
14:07muhooc
14:08zamaterianRaynes, have you looked at erjang ?
14:08trilispHi, who has signed to take the introduction to Clojure at codelesson?
14:08RaynesHave you ever looked down to see if you were wearing pants
14:09pablo_nsRaynes: I'm actually more excited about Joxa than Elixir. The semantics of Elixir are the same as Erlang's. Joxa is quite the different beast.
14:09Raynespablo_ns: Joxa seems like a nice thing, but I just don't really have a reason to use it. It isn't much different from anything I've already done, I have no real need for a beam language other than fun, etc.
14:10RaynesI feel like Clojure has pretty much won the ballgame as far as new Lisps go. Couldn't imagine getting into another one anytime soon.
14:11Iceland_jackRaynes: the start-up speed makes it impossible to use for certain things sadly
14:11aaelonywhat's interesting is that clojure is colonizing python and perhaps other hosts soon :)
14:12RaynesIceland_jack: Is Joxa any better? Will it always be better? Furthermore, wont clojure-py eventually solve this if it doesn't already?
14:12RaynesCertainly clojurescript doesn't have a slow startup problem.
14:12pablo_nsRaynes: On that point I agree completely. I wish they had instead implemented Clojure on top of Erlang's VM instead of going for a new Lisp dialect.
14:12Raynespablo_ns: Totally agree. That would have been more interesting to me.
14:13Iceland_jackJoxa being slow doesn't make Clojure any more suitable
14:13pablo_nsaaelony: oh yes, Clojure-py will be a game changer for me if it ever sees a stable version.
14:13technomancyI could see another lisp making sense that targeted embedded devices where persistent data structures would be infeasible
14:13RaynesIceland_jack: Then I don't understand what we're talking about.
14:13Iceland_jackRaynes: "I feel like Clojure has pretty much won the ballgame as far as new Lisps go. Couldn't imagine getting into another one anytime soon."
14:13technomancythen again, maybe just a Clojure dialect with array literals would fit the bill
14:13muhoosomeone will write a clojure for erlang beam vm
14:14Iceland_jackI was just saying that there's still a market for other Lisps
14:14RaynesNo there isn't. There is a market for a stable Clojure on a platform with faster startup time.
14:14RaynesLike Python.
14:14Iceland_jackwow, ok
14:14RaynesI'm not saying nobody can ever make another Lisp ever.
14:14pablo_nstechnomancy: Lua perhaps?
14:14RaynesI'm just saying that Clojure hasn't completely lost the startup time battle.
14:15Iceland_jackI'm not talking about “losing” any battles
14:15technomancypablo_ns: I don't know anything about embedded systems, so I'm just making everything up =)
14:15hiredman"embedded devices" not small anymore
14:15hiredman$100 will get you something with a 1ghz cpu and gobs of ram
14:16RaynesIceland_jack: What I got from what you've said is "Clojure is slow to startup. We need another Lisp that starts up fast.". My response is simply "No, we just need an implementation of Clojure on a host that allows it to startup fast.". No more, no less. :)
14:16muhooi have run clojure on a beagleboard
14:16muhooit was fine, no problems
14:16technomancyhiredman: yeah... maybe real-time scenarios where GC delays aren't acceptable?
14:16technomancyno idea
14:17amalloyhiredman: $100 is way too much for the cpu in many products, though, right? i'm not sure what point you're making
14:17aaelonyhiredman: the singularity is near... lol
14:18duck1123aaelony: when approaching the singularity, it's the last mile that gets you
14:18pbostromI was wondering if someone can give me some pointers on organizing a Clojurescript app. My instinct is to define various namespaces with functions I need, then have a "main"-type namespace to make calls to those namespaces. Now I want to create a 2nd page for my app that loads a 2nd "main" ns. I feel like I need to move away from compiling everything down to one giant bootstrap.js file.
14:18gtrakyou'd never use it to replace C, but people use python in embedded stuff, too, it could do that
14:18technomancyXeno's singularity
14:18hiredmanamalloy: my point is people tend to think of embedded systems they think of limited devices
14:18aaelonyduck1123: lol
14:19pablo_nshiredman: I agree. But today's power house is tomorrow's limitations.
14:20aaelonytechnomancy: Xeno, Kurzweill, ...
14:20gfrederickswhat do http proxies do about host headers?
14:21muhoowow. (> (comp cemerick.url slurp cheshire) (PreBakedAPILibrary. ))
14:21aaelonyhttp://www-rohan.sdsu.edu/faculty/vinge/misc/singularity.html
14:21LauJensenEvening gents
14:22zamaterianLauJensen, God Aften
14:23goodieboywhat's the best way for me to test if at least 1 of a set of predicate functions returns true with a single argument?
14:23gfrederickssome-fn
14:23pablo_nsWhat I find intriguing is the possibility of sharing native data structures between multiple runtimes. I don't think I've ever seen something like that (granted, I'm young).
14:23gfredericks,(map (some-fn true? false? nil? neg?) [nil :foo -3 4])
14:23clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number>
14:24gfrederickseh whatever
14:24goodieboyha thanks gfredericks
14:24goodieboygfredericks: is some-fn a clojure 1.3 function? I don't seem to have it
14:24goodieboy,(doc some-fn)
14:24clojurebot"([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns the first logical true value returned by one of its composing predicates against any of its arguments, else it returns logical false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical true result against the original predicates."
14:24gfredericks,(meta #'some-fn)
14:24clojurebot{:ns #<Namespace clojure.core>, :name some-fn, :arglists ([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]), :added "1.3", :doc "Takes a set of predicates and returns a function f that returns the first logical true value\n returned by one of its composing predicates against any of its arguments, else it returns\n logical false. Note that f is short-circuiting in that it will stop execution on the first\n...
14:25gfrederickslooks like it
14:25goodieboyahh ok
14:25pablo_nsI think we've probably seen 1% of what's possible between Clojure & ClojureScript integration.
14:25goodieboyrats
14:25muhoohmm, actually clj-http, not slurp, if i want to do POSTs and PUTs. still great tho
14:25dakronemuhoo: :)
14:25gfredericksgoodieboy: easy to write your own until you upgrade
14:25goodieboytrue
14:25muhoodakrone: thanks for clj-http!
14:26dakronemuhoo: you're very welcome, thank Mark McGranaghan also
14:27gfredericksdakrone: can I add an issue for coming up with a pronunciation that is less than seven syllables?
14:27technomancygfredericks: gnir!
14:27gfredericksgnir!?
14:27dakronegnir is awesome, but I'd worry about people not being able to find it
14:27technomancygfredericks: it's the reverse of ring, natch
14:28gfredericksah ha; I see this has been discussed before
14:28gfredericksgoogling "natch" was more fruitful than googling "gnir"
14:29technomancyoh man... super mega high-fives to xeqi for this: http://clojars.org/clj-http/versions
14:30ibdknoxtechnomancy: not that I currently have time do anything about it, but we should just rewrite clojars.
14:30technomancyibdknox: working on it
14:30ibdknox:)
14:30goodieboyis there a predicate function for testing if something is a regular expression?
14:30gfredericks$findfn #"foo" true
14:30lazybot[clojure.core/== clojure.core/distinct? clojure.core/boolean clojure.core/< clojure.core/= clojure.core/> clojure.core/>= clojure.core/<=]
14:30technomancyor more accurately, xeqi is working on it and I'm going to be working on it
14:31gfrederickso_O goodieboy: can at least test its type
14:31technomancyibdknox: have you seen http://groups.google.com/group/clojars-maintainers/browse_thread/thread/77c1cd77e478bb0f ?
14:31goodieboyok thanks
14:34gfredericksgoodieboy: (def regex? (partial instance? java.util.regex.Pattern))
14:34ibdknoxtechnomancy: I hadn't
14:35goodieboygfredericks: oh nice, better than what i just came up with: (defn- re? [x] (= (type x) java.util.regex.Pattern))
14:35technomancyibdknox: that's the plan. feedback welcome.
14:35gfredericksgoodieboy: point-free code for greater job security!
14:36tscheiblHallo Bernhard
14:36tscheiblhttp://www.heise.de/hardware-hacks/artikel/Angetestet-TinkerForge-Elektronik-Baukasten-1500925.html
14:36tscheibllies dir das mal durch
14:36goodieboygfredericks: what is point-free code?
14:37tscheibloops.. wrong window.. sorry
14:37gfredericksgoodieboy: I think it's just coding without locals (like the x in your version)
14:37goodieboygfredericks: ahh yes, much cleaner
14:50trilispHi, anyone registered to the introduction to clojure at codelesson?
14:51RoxxiSo, is this the right place to ask some newb Clojure questions?
14:51scriptoryep
14:55RoxxiAwesome. So I'm trying to develop some library code somewhat interactively. I'm going about this by [already] defining a new project with lein, creating a new foo.clj file, and filling it out as I test things using the repl (in another buffer). Now I want to make a file called bar.clj that uses functionality from foo.clj- and in keeping the spirit of interactive development, test it in the command line. As such, the first line in my
14:55Roxxibar.clj file is
14:55Roxxi(ns my-project.bar
14:55Roxxi (:require [cheshire.core :as cheshire])
14:55Roxxi (:use [my-project.foo]))
14:55RoxxiWhen I run this in the repl, I get an error saying it can't find the foo class
14:56Roxxipartcularly FileNotFoundException Could not locate my-project/foo__init.class or my-project/foo.clj on classpath: clojure.lang.RT.load (RT.java:430)
14:57hiredmanwhat is the actual file path?
14:57RaynesRoxxi: foo.clj exists at src/my_project/foo.clj?
14:59Roxxipwd: ~/clojure/my-project/src/my-project
14:59Roxxi ls: core.clj foo.clj bar.clj
14:59Roxxiso, yup
14:59amalloymy_project
14:59amalloynot my-project
14:59Roxxiah, really? Thanks, I'll try that.
15:00Roxxiis that the same for .clj files too? i.e. foo-bar.clj should be foo_bar.clj?
15:00Bronsayes
15:00amalloyyes
15:00amalloyclojure namespaces are (roughly) java packages, and those can't have - in them
15:01technomancy`lein new` should have handled that for you though
15:02Roxxiwell, names were changed to protect the innocent :) But my files had foo-bar.clj type names
15:03Roxxibut, that was it! Thanks!
15:03sadgerI have a similarly named project "lein new foo-bar" gives you a foo-bar namespace in core.clj
15:04technomancyboo =(
15:05scriptorfeex eet
15:05technomancyclojurebot: patches?
15:05clojurebotCool story bro.
15:05technomancy=(
15:06sadgerit's feels right to name projects like that as it is how you would write multi word functions
15:06sadgerbit of a pain though :P
15:08ibdknoxanyone know of an alternative to aleph for TCP?
15:08ibdknoxother than going to the Java socket stuff, of course
15:09ibdknoxpotemkin doesn't seem to play nicely with my updated compiler :(
15:09technomancythere's momentum
15:11ibdknoxoo
15:11technomancyaw yeah
15:11ibdknoxthat looks like it might work
15:11technomancygnir
15:11ibdknoxring backwards?
15:12technomancyyeah
15:12technomancyaka clj-http
15:12ibdknoxlol
15:12Bronsalol
15:12scriptorhah
15:13technomancy3-lol combo; very good!
15:13fliebelibdknox: I just dropped in, are you lookign for an http *client*? neotyk demoed something around that async cline t ysed by sonatype.
15:14ibdknoxnope, TCP
15:14fliebeloh, hm. I meant this one, in any case: https://github.com/neotyk/http.async.client
15:15weavejesterdakrone: Would you be interested in link header support in clj-http, or do you think that would be a separate library?
15:15TimMckludge hit-up
15:16pablo_nsAnyone used Cloudbees to deploy web apps? I've hit a wall with GAE and I'm thinking either Heroku or Cloudbees.
15:17ibdknoxweavejester: I see you have a TCP server, you don't happen to have TCP client, do you? :)
15:17ibdknoxpablo_ns: heroku is incredibly simple, fwiw
15:17weavejesteribdknox: Nope, and the TCP server I have is pretty basic. :)
15:17ibdknoxokidoke, gonna give this momentum thing a try then!
15:18pablo_nsibdknox: plus I believe heroku support is built into Noir right? But not Cloudbees?
15:18ibdknoxpablo_ns: not sure about Cloudbees, yes for heroku
15:18ibdknoxlein noir new ... produces something immediately pushable to heroku
15:19weavejesteribdknox: Isn't it more that Heroku supports any Clojure project with a defined :main property?
15:19weavejesteribdknox: I mean, you're not doing anything special for Heroku, right?
15:19ibdknoxweavejester: you need to have the port selection stuff
15:19pablo_nsibdknox: thanks, I'll try Heroku first
15:19ibdknoxweavejester: for http anyways
15:19weavejesteribdknox: Oh yes, that's true.
15:20ibdknoxweavejester: past that, nothing :)
15:20dakroneweavejester: I'm not familiar with link headers, let me look them up
15:20weavejesterdakrone: http://www.w3.org/TR/REC-html40/present/styles.html#h-14.6
15:21weavejesterdakrone: They're becoming commonly used for pagination in APIs.
15:21hiredman"abused for"
15:21weavejesterdakrone: http://developer.github.com/v3/#pagination
15:22weavejesterhiredman: Why abused?
15:22technomancyis that like an HTTP equivalent of meta rel=next/prev?
15:23TimMc<link rel>
15:23weavejestertechnomancy: Yep. It's a way of specifying <link> elements as HTTP headers.
15:23pablo_nsweavejester: I was talking to brehaut the other day, do you think a universal "reverse url" ring utility is possible?
15:23technomancycool
15:23dakroneweavejester: wow, that is a strange use of Link, but I guess it makes sense
15:23technomancyI wish rel=next/prev were more common
15:23technomancyit sucks that muggle browsers ignore them
15:23dakroneweavejester: not sure what support would look like, but I'd be interested in seeing it
15:24technomancyautomatic lazy pagination with clj-http would be sweet if we could somehow turn drop into a no-op
15:24weavejesterdakrone: Well, like how cookie headers are parsed into the :cookies key, link headers could be parsed into a :link map
15:24dakroneweavejester: that would be nice to add
15:24weavejesterdakrone: So you could do something like: (-> response :links :next :href)
15:24FullmoonCan i somehow get a lazy seg that returns a every ten items from another lazy set on every invocation?
15:24Fullmoon*lazy seq
15:25technomancyFullmoon: lazy seqs are cached
15:25weavejesterpablo_ns: A universal "reverse url" isn't really possible, because routing logic could potentially be complex.
15:25technomancyso running over them multiple times is guaranteed to get the same result
15:25dakroneweavejester: yea, feel free to open an issue if you'd like me to do it, or a pull request if you get to it before me :)
15:25weavejesterpablo_ns: But you could have a simplified version.
15:25Fullmoontechnomancy: I am looking for something like ruby's in_groups_of(10)
15:26weavejesterpablo_ns: That would work for, say, 95% of cases.
15:26weavejesterdakrone: I'll send you a pull request :)
15:26pablo_nsweavejester: at least a compojure one with support for "context"? I've been thinking about it a lot lately
15:26technomancyFullmoon: oh, probably partition-all then
15:27technomancy,(partition-all 3 (range 10))
15:27clojurebot((0 1 2) (3 4 5) (6 7 8) (9))
15:27Fullmoontechnomancy: That looks great, thanks!
15:27weavejesterpablo_ns: Compojure routes are hard, because whether they match or not can be due to any code.
15:28technomancyFullmoon: there was a Ruby Enumerable => Clojure seq cheat sheet somewhere; might want to see if you can find it
15:28technomancyit's pretty old, but the core stuff hasn't changed
15:28weavejesterpablo_ns: But I've been thinking about a way of grouping routes into a resource
15:28weavejesterpablo_ns: Which would be reversible
15:28edwHas anyone gotten a CLJS REPL running *in* the browser?
15:29weavejesterpablo_ns: So kinda like a reversible "context"
15:29anierowhat's the best up-to-date clojure reference? read the source?
15:29TimMcedw: Define "in".
15:29TimMcedw: https://github.com/fogus/himera
15:29weavejesteredw: http://himera.herokuapp.com/index.html ?
15:29weavejesterHah
15:29edwTimMc: I'm typing into the browser, not into a terminal.
15:29edwweavejester: Thanks!
15:30TimMcJust don't try to divide numbers.
15:30edw(It was fogus's tweet on the subject that led me to ask.)
15:30pablo_nsweavejester: yes... I've taken a look at Django's reverse() aproach and Padrino's url_for and they all depend on resources or named routes.
15:31weavejesterpablo_ns: It's a tricky problem, and not a huge priority for me personally right now. The web services I design tend to be small.
15:31weavejesterpablo_ns: I kinda wonder how necessary reversing routes is if you keep things simple.
15:31RoxxiSo, I got another repl question. I had two forms: (def poop 6) (def foo-poop [y] (+ poo y)) As you can see, I typed "poo" when I meant to type "poop." When I loaded my file via (ns ... (:use <file that contains these forms)) the repl throws an exception CompilerException java.lang.RuntimeException: Unable to resolve symbol: poo in this context, compiling:(my_project/foo.clj:35) I corrected the file, quit and restarted the repl, and I
15:31Roxxikeep getting this error, even though I turned "poo" into "poop". More magic I'm missing?
15:32RoxxiI also tried lein clean, compile no changes there
15:32technomancyaniero: clojuredocs.org and the mark volkmann article are decent
15:32pablo_nsweavejester: I understand. In my case it's a very large app originally written in Django. Keeping tabs on hardcoded routes has been hell to me, so I'm trying to come up with a solution instead of a multimethod hack.
15:33pablo_nsweavejester: very large for average ring apps, that is. =)
15:34weavejesterI have problems with the way some frameworks do MVC… though I don't know Django nearly as well as I do Rails.
15:35ibdknoxpablo_ns: why not just have a file that defs a bunch of route strings?
15:36ibdknoxand use those
15:36ibdknoxyou can do the equivalent in noir and use url-for to do filling in and such
15:37anierotechnomancy: 'course clojuredocs are out of date now, since 1.4 was released... :)
15:38pablo_nsibdknox: that works, and it is part of my approach, but it doesn't seem scalable.
15:38ibdknoxpablo_ns: in what way?
15:38ibdknoxpablo_ns: I mean you have to write them down somewhere right?
15:38technomancyaniero: yeah, luckily actual breaking changes are very rare
15:38pablo_nsibdknox: it breaks down if I use moustache, for example.
15:39ibdknoxI didn't know people still used moustache lol
15:39technomancyso you're just missing obscure references
15:39ibdknoxpablo_ns: not sure how that applies to scale though? it's not often people switch routing frameworks
15:40pablo_nsibdknox: and I run into some circular import issues.
15:40ibdknoxpablo_ns: that's why you put them in a single file that is just (def admin "/admin")
15:40ibdknoxthere are no circular dependencies then :)
15:41ibdknoxsince a file with just a bunch of strings in it doesn't need to depend on anything
15:41pablo_nsibdknox: oh, I see. a separate namespace for those defs
15:41ibdknoxpablo_ns: yessir. myapp.routes or some such
15:41ibdknoxtechnomancy: have you ever used momentum - it seems like I would really like it.. if I could get it to work :)
15:42technomancyibdknox: no, just heard about it a few days ago
15:42pablo_nsibdknox: I'll think about it, thanks!
15:43kovasbwhat is this 'momentum' ? hard to google
15:44Bronsai'm guessing https://github.com/momentumclj/momentum
15:44kovasbthanks!
15:45ibdknoxhah
15:45ibdknoxfor future reference, one must start the reactors
15:45ibdknoxnot sure if I just missed that or it wasn't written anywhere :p
15:46goodieboyanyone know how i can add custom mime-types using ring and/or compojure?
15:46goodieboyI tried (wrap-file-info {"type" "handler") in my middleware, but that doesn't seem to do the trick
15:47ibdknoxthe resources route takes mime-types
15:47ibdknoxas I recall
15:48ibdknoxgoodieboy: https://github.com/weavejester/compojure/blob/master/src/compojure/route.clj#L24
15:48ibdknoxhuh
15:49ibdknoxthat just delegates to wrap-file-info though
15:49ibdknox(wrap-file-info {"less" "whatever-ct-less-is"})
15:50goodieboyibdknox: interesting hmm, i'll try it again
15:51weavejestergoodieboy: The map is for wrap-file-info is {file-extension mime-type}
15:52goodieboyweavejester: ok cool, so does this look right? {"cur" "image/vnd.microsoft.icon"}
15:52weavejestergoodieboy: Looks it.
15:53weavejestergoodieboy: That would make anything ending in ".cur" have the content type of "image/vnd.microsoft.icon", assuming there's no content-type already.
15:54weavejestergoodieboy: Is this a static resource? If so, you can add the types directly to the route/resources function.
15:54BostXdoes anyone use lein-tarsier? Do you know what to do when I get "Error executing Nail! (227)"
15:54BostX?
15:54goodieboyweavejester: yes it is a static resource
15:55weavejestergoodieboy: In which case...
15:55emezeskeBostX: I'd start by making sure that "lein vimclojure" is running in your project somewhere
15:55weavejestergoodieboy: (route/resources "/" {:mime-types {"cur" "image/vnd.microsoft.icon"}})
15:56goodieboyweavejester: ahh ok, i'll try that
15:56BostXemezeske, my lein-tarsier works if I use it on a local machine
15:56emezeskeBostX: Then I'd check to make sure that the nailgun binary "ng" is in your PATH
15:56BostXemezeske, but I get "Error executing Nail! (227)" when trying to connect to a remote computer
15:57emezeskeBostX: Oh
15:57emezeskeBostX: I've never tried that before.
15:58emezeskeBostX: When I run "lein vimclojure", I see "Starting VimClojure server on 127.0.0.1, port 2113"
15:58emezeskeBostX: Have you configured it to listen on 0.0.0.0 or the outside IP instead of 127.0.0.1?
15:58BostXemezeske, on 0.0.0.0 ? are you sure? I start it as
15:59BostXemezeske, lein vimclojure :host 192.168.178.21 :port 2113
15:59sadgerI use the vimclojure plugin and lein nailgun seems to work equally
15:59emezeskeBostX: "0.0.0.0 or the outside IP"
15:59BostXemezeske, no no, Im on a local network
15:59BostXemezeske, and then I get
15:59emezeskeBostX: Yeah, by outside IP I just mean the one that you can connect to
16:00emezeskeBostX: Anyway, I can't help, good luck
16:00goodieboyweavejester: is it possible to define a patterned route with route/resources? Something like #".*\.cur" ?
16:00BostXemezeske, All namespaces already :aot compiled
16:00BostXemezeske, Starting VimClojure server on 192.168.178.21, port 2113
16:00BostXemezeske, Happy hacking!
16:00weavejestergoodieboy: No, but you can always wrap it in more complex middleware
16:01goodieboyweavejester: gotcha ok
16:01pablo_ns weavejester: is it possible to serve multiple Compojure apps from one Jetty process?
16:01BostXemezeske, well I use lein2 at the moment but I get the same "Error executing Nail! (227)" when using lein 1.7.1
16:02weavejesterpablo_ns: Yes, because a Compojure app is just a route.
16:03muhoooh this is so frickin awesome. i was able to replace an entire java API client library with this: https://refheap.com/paste/2234
16:03weavejesterpablo_ns: You'd just combine your apps into a larger route with defroutes/routes and context
16:04muhooi love this damn language.
16:04weavejestermuhoo: I'm a fan of clj-http :)
16:04sadgerwhat are the pros/cons at using lein vimclojure over using the nailgun server with the vimclojure bundle for vim?
16:05weavejesterI've spent quite some time going through all the Ruby HTTP client libraries, looking for one that supported various things like streaming bodies.
16:05pablo_ns weavejester: so separate apps with different deployment strategies would have to be started up by separate processes?
16:05weavejesterAnd clj-http just blows them all out of the water.
16:06BostXsadger, hmm gut question... maybe less stuff to configure, easier for newbies, etc
16:06weavejesterweavejester: If they have different deployment strategies, surely they're separate processes by definition?
16:07sadgerBostX: I found the vim plugin very simple to work, but maybe I was lucky t
16:07pablo_nsweavejester: yes, but it just seems wasteful when the apps are low traffic. the JVM is such a memory hog.
16:08BostXsadger, im not that lucky... Im trying to get it work over local network but I get "Error executing Nail! (227)"
16:08sattvikBostX: Are you sure that Vim is looking at the right port?
16:08pablo_nsweavejester: I was thinking along the linest of vhosts
16:08sattvikThe default is 2114, I think.
16:09BostXhi sattvik
16:09BostXsattvik, :) no it is 2113
16:10sattvikAh, that's right.
16:10BostXsattvik, I may try to check my if my i have that port opened. I did open it but one never knows
16:11sattvikYou could try telnetting to that port, or doing something like using curl or wget to try to connect.
16:12weavejesterpablo_ns: I thought you said the problem was the JVM being a memory hog?
16:13weavejesterpablo_ns: If your apps can't be deployed together, surely that means they also can't be in the same JVM by definition?
16:13weavejesterpablo_ns: If they can be, then you can just use defroutes and context to combine them.
16:13BostXsattvik, telnet 192.168.178.21 2113
16:14BostXsattvik, Connected to 192.168.178.21. - looks like the port is opened and the server is running
16:14sattvikoh, did you set the nailgun host in your vimrc?
16:14sattvikThat defaults to 127.0.0.1, as well.
16:15BostXsattvik, nailgun host?
16:15mtm_hmm, just noticed that (every? true? nil) returns 'true'; that just seems wrong
16:15BostXsattvik, I started it with lein2 vimclojure :host 192.168.178.21 :port 2113
16:15sattviki.e: let vimclojure#NailgunServer = "192.168.178.21"
16:16sattvikThe lein2 command tells the server where to listen, but your client needs to know where to connect to.
16:16BostXsattvik, and I set let vimclojure#NailgunServer = "192.168.178.21" in my .vimrc
16:16sattvikHmm...
16:17pablo_nsweavejester: not necessarily. For example, in my current setup Nginx proxies requests to uWsgi, which serves various Python apps from the same "process pool", instead of starting up new interpreters for each app. I was wondering wether this was possible with Jetty or any Ring-capable Java server.
16:17BostXsattvik, on another computer where Im editing the code in gvim
16:17mtm_,(every? true? nil)
16:17clojurebottrue
16:17weavejesterpablo_ns: Well, of course it is. What's the difference between an app and a set of routes?
16:18Iceland_jackeverything of nothing satisifes ⊥
16:18Iceland_jackand no something of nothing satisfies ⊤
16:18mtm_,(every? true? nil)
16:18clojurebottrue
16:18mtm_that just seems wrong
16:18Iceland_jackYou've posted that example 3 times mtm_
16:18mtm_ugh, sorry
16:19mtm_bad IRC connection
16:19Iceland_jackyou may also feel that ##(*) or ##(+) are wrong
16:19lazybot(*) ⇒ 1
16:19lazybot(+) ⇒ 0
16:19ynnivanyone know if aleph is practical for a commercial app yet?
16:19Iceland_jackIt's a matter of definition
16:19sattvikBostX: What happens if you run 'ng --nailgun-server 192.168.178.21 ng-stats' on the client/gvim machine?
16:20ynniva small commercial app, but non-academic none-the-less
16:20pablo_nsweavejester: Yes, but all the routes share the same classes/libraries. If I have one app/routes that uses library A 1.0 and another that uses A 1.2, this wouldn't work, right?
16:20BanaaninkontIceland_jack, no it's not, if you define it differently stuff goes wrong
16:21Banaaninkontthe sum of nothing is the additive identity, the product of nothing the multiplicative identity
16:21BanaaninkontIf you have it any other way stuff actually goes wrong
16:21weavejesterpablo_ns: Ah, I see. You'd need separate classloaders for that, but that sounds like a separate problem.
16:21weavejesterpablo_ns: And I think I'd prefer independent processes over classloaders :)
16:21BanaaninkontBesides, (*) >> 0 obviously follows from x^0 = 1, which follows from rules on expontents and all
16:21Iceland_jackYes, but that doesn't change it that you could define the multiplication of nothing to be an exception
16:21BostXsattvik, hmm... it says I need to install ng at first
16:22Banaaninkontx^0 = x^1/x^1 = x/x = 0 (assuming x != 0)
16:22Banaaninkont= 1*
16:22BanaaninkontIceland_jack, not at all
16:22Banaaninkontit follows from the arithmetic rules
16:22Iceland_jackWhat rules again?
16:22BostXsattvik, that's strange cause I can use your lein-tarsier when connecting to a server running the same machine
16:22BanaaninkontSee above x^0 = x^1/x^1 = x/x = 1
16:22mtm_Iceland_jack: I see what you're saying re: every? but most of the time I'd like every? to fail on an empty list/nil
16:22BanaaninkontAssuming x != 0
16:23Iceland_jackRight, it was a joke
16:23Banaaninkontx * 0 = 0, therefore, the sum of nothing at all is 0
16:23Iceland_jackBanaaninkont: Math is all about definition and you can define things arbitrarily
16:23BanaaninkontAnd that x * 0 = 0 is indeed an axiom of arithmetic by the way
16:23BanaaninkontTrue
16:23Iceland_jackSo you can define things to “not make sense”
16:23Banaaninkontbut what I m saying is that x^0 = 1 and x * 0 = 0 follows from the axiomns that lead to everything else
16:23BanaaninkontQuite
16:24Banaaninkontbut you can't just have the other rules without this
16:24Banaaninkontthis follows from the other rules
16:24Iceland_jackand indeed many things were discovered not to make sense so they were changed
16:24Banaaninkontmtm_, not at all, the conjunction of nothing is true, the disjunction of nothing is false.
16:25pablo_nsweavejester: Classloaders... i'll look into that, thanks.
16:25BanaaninkontYou can actually 'exponentiate' over conjunction, it doesn't have to be binary.
16:25weavejester(every? true? nil) should be true. I can't see why it should be anything else.
16:25hiredmanpablo_ns: what you want is immutant, they have a website and #immutant
16:25sattvikBostX: From the same client/configuration? That does odd.
16:25technomancyweavejester: well... (every? true? ()) should be true
16:25BanaaninkontYou can like say that true!6 is like true & true & true & true & true
16:25sattviks/does/does seem/
16:25weavejesterpablo_ns: Look up classlojure and um..
16:25technomancynil-punning there is debatable
16:25mtm_(every? any-predicate nil) is true
16:26BanaaninkontIndeed
16:26Banaaninkontthe conjunction of nothing is true
16:26weavejestertechnomancy: Isn't it idiomatic Clojure to treat nil the same as an empty seq for the purpose of iteration?
16:26Banaaninkontthat's just logic, if you have it any other way it leads to inconsistencies
16:26BanaaninkontAssuming the law of excluded middle, therefore it is true.
16:26mtm_I suppose, just means I have to guard for that case
16:26charles_ranyone have experience setting up slime/swank in emacs can help me get through a tutorial where I got stuck?
16:26weavejesterI didn't know about Immutant.
16:27BostXsattvik, the ng --nailgun-server ... opened something and now I need to find out how to close it
16:27Banaaninkontmtm_, I beg to differ, using that case as the base case is often very useable in recursion
16:27BostXsattvik, :)
16:27BanaaninkontIndeed, it is how you would define it
16:27technomancyweavejester: the new laziness stuff moved us away from certain types of nil-punning... maybe that's not relevant here though.
16:27hiredmanweavejester: apps get their own isolated classloader, etc
16:27pablo_nshiredman: immutant fits the bill perfectly, thanks
16:27technomancyanyway, I guess we're not getting away from nil on the JVM's type system =(
16:27sattvikBostX: I think you can just ctrl-c. If you add 'ng-stats' to the command, it should print a little summary and exit.
16:28Banaaninkont(defn [every? p l] (if (empty? l) True (and (p (first l)) (every? p (rest l)))) it is I believe
16:28hiredmanwas
16:28BostXsattvik, ctrl x, ctrl c quits the emacs
16:28pablo_nshiredman: funny cos I googled like hell and it never showed up anywhere
16:29mtm_Banaaninkont: not arguing that that is the case (and probably should be); just my specific use case needs to treat an empty list as false
16:29Banaaninkontmtm_, can I see that code?
16:30BanaaninkontI never ever encountered that namely becausde it just doesn't seem to appear because well.. it's not true and computers are very logical in that
16:30Banaaninkontprograms tend to flow in that way
16:30BostXsattvik, oh I got on "java.lang.NegativeArraySizeException" on my server
16:30BostXsattvik, at vimclojure.nailgun.NGSession.run(NGSession.java:199)
16:30ynnivclojure should have a big nil-punning warning label
16:31ynnivI lost half a day a while ago to that :(
16:31mtm_(defn existence-map? [m]
16:31mtm_ (every? true? (vals m)))
16:31BanaaninkontClojure should have TCO
16:31mtm_in my case I want to treat empty maps as maps
16:31devnBanaaninkont: talk to the java folks
16:31BanaaninkontI know
16:32ynnivTCO and try/catch keep me from fully embracing clojure
16:32Banaaninkontmtm_, well, surely empty maps are treated as maps here right?
16:32S11001001ynniv: perhaps clojure-scheme has tco :)
16:32ynnivis there a clojure-scheme?!
16:32ynnivwhere do I sign up! :)
16:33mtm_this fn is being used to detect sets in deserialized JSON (which doesn't support sets; I have them encoded as existence maps)
16:33ynnivI was one of the two people who voted for clojure being ported to common lisp
16:33ynnivbut at some point I have to wonder if the problem isn't with clojure...
16:34technomancyCL doesn't have immutable strings
16:34technomancyso it'd be a bit of a nightmare
16:35BanaaninkontCL has the difference between mutable and immutable strings right?
16:35BanaaninkontAt least, most implementations do if I recall correctly.
16:35mtm_so {:a true :b true} would be the encoding coming back from deserialized JSON for the set #{:a :b}
16:35sattvikBostX: That might be related to your 'ng' use. Does that happend when trying to do things from gvim?
16:36ynnivtechnomancy: interop would be exciting, but surely it isn't difficult to create an immutable string type
16:36BostXsattvik, no I was looking away when the exception came and now I cannot reproduce it :(
16:36mtm_back in a bit
16:38sattvikBostX: What's the reason Vimclojure gives?
16:38BostXsattvik, the same error as before "Error executing Nail! (227)"
16:38ynnivbut my preference would be to run clojure outside of the jvm. ClojureScript is a step in that direction, but it doesn't fix exception handing, and I don't think it supports TCO either
16:40BostXsattvik, again, what I find really strange is that it works when editing in vim on the same machine where lein2 vimclojure :host ... :port ...
16:40BostXsattvik, but it does not work when trying to edit a file from on a remote machine
16:41sattvikHave you tried launching the server on the remote machine to verify that it works locally there?
16:42BostXsattvik, yes I did
16:43BostXsattvik, I can try to run the ng --nailgun-server ... on the vimclojure server machine
16:43sattvikHmm... I wish I knew what that error code meant.
16:44BostXsattvik, btw when I quit the telnet session started from remote machine I get an error:
16:45BostXsattvik, EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197)
16:45sattvikBostX: I think that's normal.
16:46BostXsattvik, yea... at least it shows that the vimclojure server hasn't been frozen
16:47sattvikBostX: Well, I'm afraid I have to go. I hope you figure out what's going on. Worst case, you could try something like netcat.
16:48BostXsattvik, no problem it's just my hobby project.. thx a lot anyway!!!
16:51goodieboyanyone here deploy their ring apps to beanstalk?
16:57charles_rI need a working repl for clojure. Can someone help me?
16:57sandbagsi'm losing a certain amount of patience with the Prag's clojure book
16:58sandbagsit seems to be completely all over the place
16:59sandbagsinstead of building up from simpler concepts to more complex ones
16:59sandbagsthey just throw a bucket of stuff at you over and over
16:59sandbagsand then refer to later parts of the book
17:00sandbagslike page 48 they rewrite a Java function in Clojure, but not using anything they've already developed, even in the previous part of the chapter
17:00kovasbcharles_r: what have you tried so far ?
17:00charles_rlein repl, sublime text repl
17:00kovasbits not working at all?
17:01kovasbor just not in the way you want it to work?
17:01charles_rI would like something that can auto-indent correct so I don't have to space over every time
17:01kovasbthat is a code editor feature
17:01kovasbnot really a repl feature
17:02charles_rthen I want a repl that can talk to an editor
17:02jedmtnmancharles_r: have you tried using swank
17:02charles_rI am trying unsuccessfully to get swank installed
17:02kovasbI haven't used sublime, but I would guess it allows you to evaluate forms that are in the editor
17:02kovasbusually you have to place the cursor after the form in question, and then execute some command
17:03kovasbthats how it works in emacs
17:04kovasbalso i think clooj has that feature
17:05charles_rI've tried clooj.
17:05devncharles_r: are you trying to use emacs?
17:06charles_remacs or vim
17:06charles_rwhichever one I get working first is the one I'll try
17:06devnwhich would you prefer?
17:06charles_rI'm more comfortable in vim.
17:06devndo you have leiningen installed?
17:07charles_ryes
17:07devnif so, what version? 1.7 or 2?
17:07charles_r1.7.1
17:07devn"lein plugin install swank-clojure 1.4.2"
17:07devncharles_r: https://github.com/daveray/vimclojure-easy
17:08devnif you're on a mac you need to `brew install nailgun` to use the nailgun server
17:08devnthat should get you rolling
17:09zerokarmaleftdevn: isn't there a way to get slime-like functionality in vim without nailgun?
17:09zerokarmaleftdevn: https://github.com/vim-scripts/slimv.vim <= hooray google
17:16charles_rit works until I get to
17:16charles_rlein vimclojure
17:16charles_rThat's not a task. Use "lein help" to list all tasks.
17:17charles_rnm
17:21RoxxiWhen do I want to do (def foo [1 2 3]) as opposed to (def *foo* [1 2 3]) The compiler notes that it seems I want to notate that *foo* is dynamic, but forgot to.
17:21RoxxiIf the answer to that is long, if someone could point me at a resource, that'd be great.
17:24charles_rdevn, thanks
17:25apwalkRoxxi: a good place to start is: http://clojure.org/vars
17:26kovasbRoxxi: are you rebinding foo elsewhere in your program,?
17:29bubba42hi is there any alternate to defining a global variable ?
17:30brehautthats an extremely general question
17:30brehautan extremely general answer is: yes
17:30brehautbut what are you trying to do
17:30bubba42ok here is what I'm trying to do
17:30bubba42I need to keep a list of generated list of primes
17:30bubba42prime numbers
17:30brehaut,(doc memoize)
17:30clojurebot"([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use."
17:31bubba42mmmm
17:32brehauta basic memoization pattern is probably what you want though: a function that closes over a private reference type frinstance
17:32SlavikG,(doc expand)
17:32clojurebotexcusez-moi
17:32SlavikGOh you again
17:32SlavikG&(doc expand)
17:32lazybotjava.lang.RuntimeException: Unable to resolve var: expand in this context
17:33brehauteg (defn make-counter [initial] (let [c (atom initial)] (fn [] (swap! c inc))))
17:33brehautSlavikG: what function are you looking for?
17:33bubba42@brehaut -- many thanks -- thought I think it will take two lifetimes to learn clojure :-)
17:34brehautbubba42: once you grok the basics things fall into place more quickly
17:34SlavikGbrehaut, one that expands a macro
17:34SlavikGSpecial form in this case
17:34SlavikGOne assumes
17:34brehautSlavikG: macro-expand, macro-expand1
17:34brehaut,(apropos 'expand)
17:34clojurebot(macroexpand-1 macroexpand)
17:34SlavikGWhat is the difference with expand1?
17:34brehautoh, sorry, misplaced hyphens
17:34SlavikGOkido
17:35brehautmacroexpand-1 only expands once, it doesnt keep expanding i believe (ie, if the result includes a macro in the head of the form, it wont expand where macroexpand would)
17:35SlavikG&(macroexpand (apply list #(%1 "I worship his shadow")))
17:35lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: sandbox3826$eval7976$fn__7977
17:36brehautyou need to quote the form
17:36SlavikG&(macroexpand '(apply list #(%1 "I worship his shadow")))
17:36lazybot⇒ (apply list (fn* [p1__7980#] (p1__7980# "I worship his shadow")))
17:36brehaut,(macroexpand '(apply list [1 2 3]))
17:36clojurebot(apply list [1 2 3])
17:37brehautSlavikG: however, you cant expand a special form; they are implemented in the compiler
17:37brehaut(although a lot of the special forms are wrapped in utility macros)
17:37SlavikGI can do anything I want, and so can you.
17:37SlavikGI know
17:52Roxxikovasb: No, I'm not
17:53Roxxikovasb: I figured it might have something to do with that.
17:53kovasbRoxxi: i don't see why the compiler things (def foo [1 2 3]) is of any interest then..
17:53kovasb*thinks
17:53kovasbis there a specific message
17:54Roxxi(def *foo* [1 2 3 4])
17:54RoxxiWarning: *foo* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *foo* or change the name.
17:55RoxxiYou can type that into the repl and you'll see the message.
17:55kovasboh ok
17:55kovasbthats nothing to worry about then
17:55RoxxiI suppose I'm just trying to understand when I see the * convention, what that should mean to me in terms of symantecs
17:55kovasbright
17:55kovasbthe convention is that *ear-muffed-vars* are dynamically rebindable
17:56brehautonly if you include the ^:dynamic hint
17:56Roxxiheh ear-muffed... I like that
17:56kovasbright
17:56Roxxiright
17:56Roxxiso no ear-muffs => a constant
17:56kovasbbut old versions of clojure didn't require that they include the ^:dynamic hint
17:56Roxxiear-muffs => this thing may change
17:56brehauthalf-ear muffs are used to denote an alternate formulation or backing implementation
17:56kovasbso now when the compiler sees earmuffs without the hit, it gives warnings
17:57brehauteg let, let*
17:57brehautlist, list*
17:57RoxxiYeah, like scheme.
17:58RoxxiIn scheme we used *thing* to denote globals, but that was convention
17:58kovasbtypically you will see things like references to database servers inside earmuffs
17:58kovasbsince u might want to change it
17:58Roxxiright
17:58brehautnewer clojures (1.3+) support primes at the end of function names too
17:58huangjsmy swank will crash when slime-autodoc is enabled, so I'm currently disabling it in slime-mode (but not in slime-repl-mode), is there a way to solve it?
17:58brehaut,(let [a 1 a' (inc 1)] a')
17:58clojurebot2
17:59Roxxithanks kovasb and brehaut
17:59kovasbnp
18:00RoxxiWhat's a prime?
18:00Roxxioh
18:00Roxxithe '
18:00Roxxigotcha
18:04huangjstechnomancy: slime-autodoc will cause swank to crash, I'm using latest slime, is there a way to make it work?
18:26Cyrikhey, can someone explain to me how its possible that i´m getting a stackoverflow error with a loop-recur? here´s the code: https://gist.github.com/2424582
18:28BostX,(clojure-version)
18:28clojurebot"1.4.0-master-SNAPSHOT"
18:53rahcolaCyrik: only thing I can come up with is that you somewho manage to make either x or state bigger on every iteration
18:53rahcolathus filling the stack, even though you are using tail recursion
18:54ben_mHey everyone! Trying to play with the fancy new stuff in 1.4. Where would I put the data_readers.clj?
18:54ben_mIn a typical empty lein project
18:55rahcolaCyrik: but pretty please, give some real names to those x and xs and stuff
18:56Cyrikrahcola: state is getting smaller on each iteration. you see that when you try stress-test with 999
18:56llasramCyrik: What is `(first xs)` in `((first xs) x (first xs2))`? Without reading deeper, that looks suspicious to me
18:56kovasbben_m: the documentation says "at the root of the class path", which i imagine is the root folder of the project
18:56ben_mkovasb, I've tried that, but it doesn't seem to pick it up :/
18:57kovasbben_m : have u tried other locations?
18:57Cyrikrahcola: and sorry about thhe names, was just experimenting. they were destructered with real names before i renamed it xs again to see if that was the reason
18:57rahcolaahh, it was odd that destructuring was not used :)
18:58ben_mkovasb, yeah
18:58ben_mWhen I try to compile a file where the reader function gets used, I get "No reader function for tag"
18:58Cyrikilasrm: (first xs) at that position is #(list :| %1 %2)
18:58kovasbben_m : i would figure out what the class path at the time of compile
18:58sadgerben_m: maybe it wants a tag like :tag rather than the word tag
18:59sadgerI remember the trace examples using (trace tag ...) as an example but obviously tag is unresolved symbol
18:59kovasbben_m : when I've played with this is just changed the binding for *data-readers*
19:00Cyrikit seems the stackoverflow happens once the whole state has been parsed and he´s trying to generate the return, since it doesn blow up with even numbers. just now sure why:(
19:01ben_mkovasb, oh well, it's not important anyways. Just wanted to play with it :D
19:02kovasbben_m : seems like the kind of thing that should be figured out for everyone's benefit.. try posting to the mailing list?
19:02rahcolaCyrik: so it runs when n given to stress-test is smaller than something?
19:02llasramCyrik: HAHA. You've found a bug in... Clojure? I'm using emacs/swank -- what about you?
19:02kovasbben_m : does it work at the repl? or only fail when u try to compile?
19:02llasramIf you change the last line (def result (stress-test 99999)), then no problems
19:02llasramUntil you try to print the result
19:03rahcolaCyrik: because it does seem to me that ((first xs) x (first xs2)) is making "multiplying" x on every iteration
19:03llasramNo no, that's not the problem
19:03rahcolas
19:03rahcolas/making//
19:04ben_mkovasb, works at neither
19:04kovasbben_m : bummer. unless u want to read the source, suggest posting to group
19:05ben_mI shall investigate a bit.
19:05llasramCyrik: (def result (stress-test 9999)) (drop 1 result) ;;=> ("")
19:05llasramer, 99999 rather
19:06mmarczykCyrik: the SO happens when printing the result
19:06mmarczykCyrik: because the structure is so deeply nested
19:07llasrammmarczyk: Yeah, crazy
19:07mmarczykCyrik: (set! *print-level* 20) and you'll be "fine" (except you'll only see part of it)
19:07Cyrikuhhh, that you ilasram and mmarczyk!
19:08Cyrikerrm i mean thank you!
19:08Cyriki was going crazy trying to find a lazy operation in there:)
19:08llasrammmarczyk: Ahhhh, forgot about that. StackOverlfowError doesn't feel like the correct response to me though
19:09llasrammmarczyk: At the very least, its confusing
19:09llasrams,its,it's,
19:09mmarczykllasram: well, I suppose
19:10llasramYou don't think so?
19:10mmarczykllasram: I'm trying to make up my mind as to whether it's worthwhile to implement explicit delimiter stack for printing delimited lists :-)
19:10mmarczykllasram: obviously you can't just keep count, since Clojure concrete syntax uses three delimiter types out of the box
19:11rahcolaand that doesn't solve it for arbitrary constructors
19:12mmarczykllasram: could do a trick to encode a "stack" in a number, assuming fixed delimiter set...
19:12rahcolaif the idea was to eliminate the recursion in printing with a stack?
19:13Cyrikwell i´d say that *print-level* should at least be set to something that doesnt blow the stack, as a default value
19:13llasramWhat about catching StackOverflowError when printing and act as if *print-level* had been hit?
19:13Cyrikeven better
19:14Cyrikits damn confusing otherwise
19:56TimMcIs Lobos actually in a usable state yet?
19:56TimMcThe docs seem to indicate it is half-built.
20:02FrozenlockAny explanation on what might be this error? clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref
20:02FrozenlockI get it with (rule false [:username "Usernames must have a value"]) From noir.validation
20:02hiredmanyou are derefing and unbound var
20:03brehauteg (declare v) @v
20:03TimMcI see weavejester's Ragtime, but that doesn't have all the pieces I need...
20:03TimMcDrift looks to have been last touched some months back.
20:03weavejesterTimMc: What's Ragtime missing, out of interest?
20:04TimMcSQL schema DSLs.
20:04weavejesterTimMc: It is a little unfinished, but I'm curious as to what people want.
20:04weavejesterTimMc: Isn't that what Lobos is for?
20:04TimMcYes, but I can't tell if it already has it or not. :-/
20:04TimMcThe documentation is old and ragged.
20:05weavejesterI liked Lobos for creating tables etc, but didn't like the migration stuff there, and I thought migration is really a separate problem to creating schema anyway.
20:06weavejesterIf I wasn't using so much NoSQL, I'd just use Ragtime to handle the migrations, and Lobos to build the SQL
20:06TimMcAh, I see.
20:06weavejesterI don't believe I got around to adding in Leiningen support for Ragtime, though.
20:11TimMcOK, I think I understand Ragtime better now. (Second pass through the README.)
20:17TimMcweavejester: How is the initial schema creation handled in Ragtime + Lobos?
20:21unmarshalanyone know of a way to tab complete java method signatures using vim clojure?
20:29RoxxiIs there a convenient method to call to determine whether or not a particular value is contained in the set of a collections values?
20:29Roxxi(e.g. (member 'hello '[hi hello yes]) => #t
20:30amalloy&(doc some), but also consider whether you should be using a map/set for your test collection - something with indexed access
20:30lazybot⇒ "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
20:31RoxxiThanks amalloy
20:31amalloyyou can get scheme's 'member by (defn member? [item coll] (some #(= item %) coll)), but you usually should have coll be a set, in which case you can just do a fast (contains? coll item)
20:32Roxxidoes the = operator implicitly use .equals defined for that object?
20:32Roxxior is it reference equality?
20:33Roxxi(contains? [:wilma :fred :barney :betty] :fred) => false which is what the documentation of contains? implies
20:35hiredman= is more or less egal
20:35amalloy~contains
20:35clojurebotcontains? checks whether an indexed collection (set, map, vector) contains an object as a key. to search a sequence for a particular object, use the `some` function, which accepts a predicate. if you want to only match a certain object, you can use a set as the predicate: for example, (some #{5} (range)) finds the first occurrence of 5
20:50langmartinI'm stuck on a threading problem: where do I put code to get it to run in a thread context where the dynamic environment is not passed from the caller?
20:50dgrnbrglangmartin: do you want to capture the caller's dynamic environment? or reset the dynamic environment?
20:50langmartinfuture, send, send-to all copy the dynamic environment (good!). a watch also gets the dynamic environment of the caller
20:50langmartinreset
20:51dgrnbrgjust start a new thread
20:51dgrnbrg(-> (Thread. my-fn) .start)
20:51langmartindgrnbrg: in what way?
20:51langmartinah
20:51langmartinin a java way
20:51dgrnbrgor, you can use the executor pool that clojure starts up
20:52dgrnbrghttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L48
20:53dgrnbrgi.e. (. clojure.lang.Agent/pooledExecutor execute my-fn)
20:53dgrnbrgactually, that might not work
20:53langmartinaha
20:53dgrnbrgi can't remember the syntax for getting static members of java objects
20:53langmartin/
20:53langmartinthey're treated like a namespce
20:53dgrnbrgthen do that :)
20:54langmartinok, but the idea is that I must start a new java thread in order to drop the dynamic environment
20:54langmartinbecause all of the clojure bits will pass it along
20:55langmartindgrnbrg: thanks for your help! I've been getting mysterious errors from this for a few days
20:55dgrnbrgoh, you're not interested in multithreading?
20:55dgrnbrgthen there might be another solution
20:55dgrnbrgI thought you wanted to spawn a thread w/o capturing the environment
20:56langmartinthat's correct
20:56langmartinyou got it
20:57alexykhow do you do catch any exception?
20:57dgrnbrg(try … (catch Throwable _ …))
20:57sritchie(catch Throwable e ...)
20:57aperiodicRoxxi: /go dor
20:57aperiodicoops
20:57dgrnbrglangmartin: the first thing that pops into mind is using (alter-var-root)
20:57langmartin(clojure.java.jdbc uses a dynamic variable to mark the extent of a transaction, so if you go off to another thread db calls in the other thread will try to use the transaction connection, unless they don't know it exists)
20:58langmartindgrnbrg: yeah, see my problem is that it isn't my dynamic variable, and I don't want to patch my libraries
20:59dgrnbrgi'm going with (. #'your-var root)
20:59dgrnbrgbetter yet
20:59dgrnbrg(. #'your-var getRawRoot)
21:00dgrnbrglangmartin: i think that's the best bet
21:00dgrnbrgI always write crazy clojure with this page open: https://github.com/clojure/clojure/tree/master/src/jvm/clojure/lang
21:00dgrnbrgit's really easy to understand the compiler
21:00dgrnbrgand runtime
21:06langmartindgrnbrg: it's fugly, but that might work
21:06dgrnbrgwhat you want to do isn't one of the intended use cases
21:06dgrnbrgso you have to reach into the platform
21:06dgrnbrgI think that it's beautiful that it's possible
21:07dgrnbrgand in so few lines of code
21:07dgrnbrg(. #'you-var root) is cleaner
21:07dgrnbrgor (.root #'your-var)
21:07dgrnbrgif you look at the code of getRawRoot, you're not really getting anything over just using root
21:07langmartindgrnbrg: it's really just that the lib uses the dynamic environment wrong
21:07langmartinyeah, I saw that
21:08langmartinthe fugly part is just that I'm doing this to a var way outside of my code
21:09dgrnbrgoh, yeah
21:09dgrnbrghave you seen robert.hooke?
21:12langmartinneat
21:17dgrnbrglangmartin: it's designed to help you mess around with libs you don't control
21:21langmartindgrnbrg: all I really have to do is this:
21:21langmartin(binding [clojure.java.jdbc.internal/*db*
21:21langmartin (. #'clojure.java.jdbc.internal/*db* getRawRoot)]
21:21langmartin (apply proc args))
21:22dgrnbrgoh, that's easy then
21:22langmartinit just has to be done anytime you start a future or whatever from a db transaction
21:23langmartinthat does seem easier than dumping the dynamic env and copying just the parts I care about
21:23langmartinbut it's less correct
21:24dgrnbrggood luck :)
21:35RoxxiHow do you iterate through a sequence that may be infinite, stopping when some condition is met?
21:35Roxxi(e.g. (range 200) returns a sequence and I want to iterate over it until some condition is true- like the current value equals 169)
21:36Roxxior, rather, how do you programatically generate numbers until some condition is met, one call at a time. Kind of like python's yeild expression
21:36technomancy,(count (take-while (partial = 169) (range 200)))
21:36amalloy&(doc take-while)
21:36lazybot⇒ "([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."
21:36amalloytechnomancy: 0, right?
21:37technomancyoops
21:37technomancyyes
21:37technomancyamalloy: wow, you're faster than clojurebot
21:37technomancy=P
21:37amalloyyeah, i was noticing that too
21:37amalloy~ping
21:37RoxxiRight, but I don't want the result to be a sequence- I want the result to be that specific item
21:37amalloy&(doc first)
21:37lazybot⇒ "([coll]); Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil."
21:39emezeske&(first (filter #(= 169 %) (range 200)))
21:39lazybot⇒ 169
21:40Roxxiright, but that's essentially straight iteration
21:41emezeskeRoxxi: ?
21:41RoxxiHere's an example..
21:41Roxxi(defn foo [] ...) where (foo) => 0 (foo) =>1 (foo) => 2 ...
21:41emezeske&(first (filter #(= 169 %) (range)))
21:41lazybot⇒ 169
21:41RoxxiI want to define foo in such a way that each time i invoke it I get the next number
21:42emezeskeAre you sure that's what you want to do, and you don't actually want to create a lazy-seq that does that?
21:42RoxxiSo, for instance if I have a list of all the files in a folder and I want to save a file without over writing something that exists, I want to build new file names.
21:42RoxxiWell, I'm not quite sure how to create, then use a lazy sequence that does that.
21:42RoxxiI see range
21:43Roxxiand that seems to give me a lazy sequence, but I don't know how to iterate until I'm able to construct a unique file name
21:43RoxxiFor the record, I know in scheme, I could accomplish this by defining a function inside of a let binding, that increments and returns. And passing that function around.
21:44RoxxiBut I don't know if that approach is the right idiom for clojure, or what the idiom is for set! if it is.
21:44sritchie(let [i (atom 0)]
21:44sritchie (defn gen-unique-suffix []
21:44sritchie (str "__gen" (swap! i inc))))
21:44sritchielet over lambda!
21:45Roxxiwell defn inside is basically a lambda with a name ;p
21:45Roxxiso swap! is what I was missing
21:45sritchieyup
21:45sritchieswap! mutates the atom and returns its old value
21:45Roxxiand inc itself is a value?
21:45sritchiesorry, new value
21:45sritchieyeah, inc is the increment function
21:46sritchieswap! takes an atom and a function to apply to the atom's current val --
21:46sritchiethen returns the new value, leaving the atom mutated
21:46sritchiesince the initial val is 0, you'll get "__gen1" the first time you call this
21:46sritchieand the atom in the closure will now hold 1
21:47sritchieif you wanted to jump by 5 every time, you'd do (swap! atom + 5)
21:47RoxxiI see. What's the consequence of omitting atom? Lack of thread saftey?
21:47RoxxiHmm, interesting
21:47gtrak``you shouldn't call it atom tho
21:47sritchieRoxxi: that's just clojure's way of handling state
21:48sritchieso if you want it to keep incrementing, you need to use one of the stateful containers
21:48RoxxiI see.
21:48RoxxiThanks sritchie!
21:48sritchieso "i" in this case is an immutable reference to a mutable thing
21:48Roxxi(I didn't mean to interrupt, heh.)
21:48RoxxiOh really?
21:49metellusloop/recur
21:49sritchiehmm, maybe if you pass back in the old path
21:49RoxxiYeah, but that's parse-unparse
21:49sritchiethe other way is (defn uuid [] (str (UUID/randomUUID)))
21:50sritchie(take 10 (repeatedly uuid))
21:50sritchiegives you 10 unique filenames
21:50sritchieand (repeatedly uuid) is an infinite stream of them
21:51sritchie,(take 10 (iterate inc 1))
21:51sritchieif you just want increasing numbers
21:54Roxxiright
21:55Roxxibut I'd just get a collection of 10 things
21:55Roxxiwhich seems to be the same as calling (range 10)
21:55sritchieRoxxi: yeah, I don't see how to do it w/o state
21:56RoxxiIndeed.
22:00RoxxiIf you're curious, here's what the final product ended up looking like (works like a charm too!)
22:00Roxxi(defn uniqueify-sheet-name
22:00Roxxi ([sheet names]
22:00Roxxi (let [i (atom 0)]
22:00Roxxi (defn next-val []
22:00Roxxi (swap! i inc))
22:00Roxxi (uniqueify-sheet-name sheet names next-val)))
22:00Roxxi ([sheet names next-val-fn]
22:00Roxxi (let [proposed-name (str (sheet-name sheet) "-" (next-val-fn))]
22:00Roxxi (if (member? proposed-name names)
22:01Roxxi (uniqueify-sheet-name sheet names next-val-fn)
22:01Roxxi (rename-sheet sheet proposed-name)))))
22:01Roxxi
22:01Roxxi
22:01ben_mRoxxi, before people maul you, consider using a pastebin in the future.
22:01RoxxiAh, oops, sorry.
22:01wkmanire_awayRoxxi: Holy Sheet!
22:01RoxxiDidn't know!
22:02RoxxiHeh.
22:02wkmanire_awayRoxxi: Have you ever used IRC before?
22:02ben_mgist.github.com is pretty decent
22:02Roxxi1998 :(
22:02RoxxiIt's been a LOONG time.
22:03wkmanire_awayOh, well hopefully you'll not stay gone so long this time around.
22:03wkmanire_away#clojure rocks.
22:03wkmanire_away:)
22:03RoxxiI agree! I'm pretty stoked being here today.
22:03wkmanire_awayOne of the regular patrons here made refheap.com
22:03RoxxiMainly because I can use IRC via Emacs
22:04RoxxiWow. Pastebin is awesome. How did I never know about this D:
22:04wkmanire_awayIt is implemented using the Noir web framework, which another patron of #clojure implemented.
22:04RoxxiNice.
22:04wkmanire_awayNoir is of course, written with clojure.
22:04wkmanire_away:D
22:04wkmanire_awayTrying to keep it in the family here in #clojure.
22:04wkmanire_awayhe he he
22:04Roxxihehehe
22:04wkmanireRoxxi: I'm a complete newb here by the way.
22:04wkmanireDon't want you to mistake me for knowing what I'm doing.
22:05ben_mI wonder if you could use CPS to get rid of the state in Roxxi's example
22:05RoxxiI was about to say, "you sure seem to know an awful lot..."
22:05TimMc$findarg map % ["4" "4.5"] [4 nil]
22:05lazybot[]
22:05TimMcAh well, worth a try.
22:06mutinyonthebayI'm drooling over some of these clojure/west presentations -- anyone have any idea when the presentation videos are to be released?
22:06RoxxiSo, for next time, instead of pasting an example, I should just paste a link?
22:06Roxxi(... to pastebin)
22:06gfredericksyep
22:07wkmanireRoxxi: to refheap. wink wink
22:07RoxxiHaha, ok, taking a look at that.
22:08TimMcpastebin is allowed
22:08TimMcrefheap just happens to be better :-)
22:08Roxxiheh, excellent. Well either are better than pasting it straight in.
22:09TimMcHere's what I was going for, "maybe-integer": https://refheap.com/paste/2240
22:09TimMcGoes well with if-let
22:10technomancysritchie: hey, did you get your lein2 issues sorted out?
22:10sritchiehey, I think so, it's been working well
22:10technomancygreat
22:10sritchieI've got to come up w/ a good workflow for using intellij w/ leiningen 2, bow
22:10sritchienow
22:11technomancyis there a plugin that only works with lein1?
22:11TimMcerr, put % instead of s in the postcondition
22:40brweber2__Has the :or default in map restructuring been removed in 1.4 or is it just broken atm?
22:40brweber2__https://gist.github.com/2425421
22:44apwalkbrweber2_: {:keys [x y] :or {x 10}}
22:46jayunit100heylo
22:46brweber2__apwalk: that's what I have. Did you check out the gist?
22:46jayunit100just came across this on SO ... thought it was an interesting question.
22:46jayunit100http://stackoverflow.com/questions/10238399/clojure-jdbc-create-table-statement-does-not-run-unless-using-leiningen-repl
22:47brweber2__or do I have to change the :or x to not be a keyword...
22:47apwalkbrweber2__: correct
22:47brweber2__apwalk: thanks!
22:48brweber2__apwalk: that kind of stinks when you have an existing map where x is not defined :(
22:52apwalkbrweber2__: I don't follow. Isn't that your intent by defining a default?
22:52brweber2__apwalk: didn't say that correctly. I have a map defined elsewhere in the code, where x is not in scope. I'll have to convert the keys to symbols in the map
23:00apwalkbrweber2__: That sounds off. The map you pass to the function should still be (foo {:x 1 :y 2}); the syntax for the :keys/:or just lets you specify the params as symbols instead of keywords.
23:01brweber2__apwalk: here is an example
23:01brweber2__(defn rr-ns [{:keys [zone dclass ttl the-ns] :or rr-defaults}]
23:01brweber2__ (NSRecord. (to-name zone) (int dclass) (long ttl) (to-name the-ns)))
23:02brweber2__rr-defaults is a map with {:ttl 1000 :dclass 1}
23:02brweber2__apwalk: but when keywords are there, :or doesn't work
23:02trilispHi, I'm following 'A Brief Beginner's guide to Clojure' tutorial and in an example using seesaw I get 'java.awt.HeadlessException' can someone help?
23:02apwalkah, I thought you might be doing that.
23:02brweber2__apwalk: and when I convert the keywords to symbols in rr-defaults
23:03brweber2__apwalk: the :or still doesn't take effect
23:03brweber2__apwalk: does it *have* to be a map literal in there?
23:03gfredericks,(let [{:keys [x] :syms [x] :strs [x]} {:x :keyword "x" :string 'x :symbol}] x)
23:04technomancyclojurebot is MIA
23:04gfredericks&(let [{:keys [x] :syms [x] :strs [x]} {:x :keyword "x" :string 'x :symbol}] x)
23:04lazybot⇒ :symbol
23:05amalloybrweber2__: it surely has to be a keyword
23:05amalloyer, a literal map
23:06amalloyserious deep magic would be required to make it work for non-literals, and those who invoked such magic would generally be surprised
23:06brweber2__amalloy: ok, that would explain it
23:08brweber2__apwalk: amalloy: thanks, got it working!
23:12amalloybrweber2__: if you want to use a non-literal map, you can use ##(doc merge) before you destructure
23:12lazybot⇒ "([& maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result."
23:13brweber2__amalloy: I did this hack :or {something (:something my-defaults)}
23:13brweber2__amalloy: more verbose, but works
23:13amalloyfair enough
23:20TimMc~transpose
23:21TimMchmm, no clojurebot
23:23amalloyhe diiiiiied
23:23amalloywow, hiredman isn't here either. did the two of them go out in some final blaze of glory?
23:25sritchieamalloy: romeo and juliet shared suicide deal?
23:25sritchieheavy shit
23:25amalloyi was actually thinking more like an action movie
23:25brehauta hail of arrows
23:25amalloythe two of them gearing up to assault the enemy stronghold
23:26sritchieah, got it, arrows blocking out the sun
23:26sritchieTHIS IS CLOJURE
23:28brehaut(http://www.intensivesystems.net/tutorials/stream_proc.html)
23:29amalloyhave i heard of Intensive Systems Consulting, or do they just have such a generic name that it sounds familiar?
23:29brehautjim duey's old site; lots of monads in clojure tutorials
23:30amalloyaha
23:30brehautbut apparently my clojurebot arrows joke was too lame
23:32amalloyoh god
23:32brehautim very sorry
23:32amalloyi would say rather that it was too far removed
23:33amalloyif i have to read through pages of crap to see you're making a joke about arrows, you're demonstrably not
23:33brehautits probably ok for it to be both lame and far removed
23:33brehauti guess a link to clojurebots source would have been better. oh well
23:46dnolenunless someone complains I'm pushing PHMs to CLJS
23:46dnolendone
23:48brehautawesome
23:49ben_mBut I was going to complain :(
23:49ben_mJust kidding, I don't even know what PHM is.
23:49brehautpointy haired manager
23:49brehaut(persistent hash maps)
23:49ben_mNice :)