#clojure log - Apr 19 2012

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:02 echo-area: Hmm, he has quited

0:02 pablo_ns: Does 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...

0:03 yoklov: pablo: i think that means you're doing something like calling .getBytes on an array of bytes

0:04 pablo_ns: yoklov: yes, I am calling getBytes on a stream.. It was working ok until suddenly I started getting this message...

0:04 cmajor7: ,(.getBytes (byte-array 10))

0:04 yoklov: oh

0:04 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getBytes for class [B>

0:05 yoklov: ,(.getBytes "foo")

0:05 clojurebot: #<byte[] [B@13775d4>

0:05 yoklov: its a method on string (and other stuff?)

0:05 pablo_ns: to tell you the truth, I'm not really sure what getBytes does since I have zero Java knowledge

0:05 cmajor7: "[B" means a byte array "type"

0:05 yoklov: getBytes gets you a byte array

0:05 cmajor7: where do you get that exception from?

0:06 pablo_ns: cmajor7 thanks. I'm using ring's multipart-params to put a file on S3

0:06 ring provides a key :bytes

0:06 cmajor7: the gist is you are/or one of the libs is calling a "getBytes" on a "byte[]"

0:07 echo-area: dnolen: http://pastebin.com/gwt1ViZB <-- Please take a look at it

0:07 pablo_ns: my code is calling getBytes

0:08 cmajor7: it seems that you already are getting a "byte[]" (what would getBytes for example from a string.getBytes give you)

0:08 dnolen: echo-area: loop can't return unboxed values, don't bother with int casting - CLJ emphasizes 64bit arithmetic

0:08 cmajor7: so it may not be necessary

0:09 ,(.getBytes "")

0:09 clojurebot: #<byte[] [B@3e5af>

0:10 echo-area: dnolen: I did find the Clojure counterpart faster than in my last experiment. Something has changed.

0:10 cmajor7: ,( .getBytes (.getBytes "") )

0:10 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getBytes for class [B>

0:10 pablo_ns: cmajor7: without it I get "java.lang.IllegalArgumentException: No implementation of method: :put-request of protocol: #'aws.sdk.s3/ToPutRequest found for class: [B"

0:11 drewr: dnolen: yeah, I'm not sure either. thought I would get your initial reaction first before I tackled that part

0:11 dnolen: drewr: doesn't make any sense to me.

0:12 pablo_ns: cmajor7: Is there any good resource to read on getBytes? I actually have no idea what a byte array is

0:12 yoklov: pablo_ns, are you familiar at all with c?

0:12 pablo_ns: cmajor7: Everything Google gave me was pretty much worthless for someone who doesn't know a thing about Java

0:12 echo-area: dnolen: So did I experiment in a wrong manner, and what I tried to do is not practical?

0:12 cmajor7: pablo_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

0:13 dnolen: echo-area: try this, http://gist.github.com/2418471

0:13 pablo_ns: cmajor7: so a byte array is just a regular array?

0:14 yoklov: done very little C, many years ago.

0:14 technomancy: pablo_ns: in some languages that don't handle encoding strings are just byte arrays themselves

0:14 yoklov: its like a C string/char array

0:15 thats what java's essentially giving you if you call getBytes on a string

0:15 technomancy: but on the JVM strings are higher-level because they carry their encoding information around with them.

0:15 yoklov: just raw binary data

0:15 pablo_ns: ok I get it.. so .getBytes would be a decode method?

0:16 cmajor7: ".getBytes" is usually a method to "convert" things to a byte array

0:17 so 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..

0:18 echo-area: dnolen: Only slightly faster: 6.0 secs ==> 5.7 secs

0:18 technomancy: cmajor7: if only that were true... the JVM uses UTF-16 =(

0:19 cmajor7: ,( map print (.getBytes "hello byte array") )

0:19 clojurebot: (104101nil 108nil 108nil 111nil 32nil 98...)

0:19 echo-area: technomancy: Hi :) How do you set a compilerarg for javac-options in leiningen?

0:19 pablo_ns: cmajor7: ok, so based on what you said my usage seems correct

0:19 technomancy: echo-area: I haven't used javac; maybe ask in #leiningen?

0:19 dnolen: echo-area: and you are timing at REPL?

0:19 echo-area: or are you measuring cost of loading CLJ?

0:20 hiredman: dakrone: I cannot for the life of me get rid of opennlp.tools.util.InvalidFormatException: Missing the manifest.properties! when trying to use clj-opennlp

0:20 cmajor7: technomancy: which bit of a collection of 8 bit things is off?

0:20 echo-area: dnolen: Oh, forgot about that. Let me reevaluate it

0:20 technomancy: Ah thanks

0:20 technomancy: cmajor7: most characters are 16 bits on the JVM

0:22 cmajor7: oh.. 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

0:22 pablo_ns: cmajor7: so, the usage is right: convert a stream back into a file: http://pastebin.com/fSt8Qrpu

0:23 dnolen: echo-area: fwiw it takes 2.6s on a JDK 7 OS X 2.66ghz i7

0:25 echo-area: dnolen: Something is wrong here: http://pastebin.com/nxxR04Mu

0:26 cmajor7: pablo_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

0:27 "The value can be

0:27 a String, InputStream or File (or anything that implements the ToPutRequest

0:27 protocol).

0:27 "

0:27 https://github.com/weavejester/clj-aws-s3/blob/master/src/aws/sdk/s3.clj

0:27 dakrone: hiredman: in clojurebot? I can take a look

0:27 hiredman: master branch?

0:28 pablo_ns: cmajor7: oops, I pasted the wroing code! It's actually (s3/put-object cred "rod-bucket" (:filename params) (.getBytes (:bytes params)))

0:28 hiredman: dakrone: I figured it out, I was still trying to use the models gzipped, which I guess opennlp doesn't support anymore

0:28 cmajor7: pablo_ns: right, so why are you calling ".getBytes"?

0:29 pablo_ns: params are coming in as what?

0:29 probably byte-array already, according to an exception..

0:31 pablo_ns: I 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

0:31 cmajor7: params comes as a byte array

0:31 cmajor7: ,(apply str (map char (.getBytes "hello byte array")))

0:32 clojurebot: "hello byte array"

0:32 pablo_ns: cmajor7: 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.

0:32 dakrone: hiredman: cool

0:32 cmajor7: if you know it "should" be just a string, convert it to such..

0:32 dnolen: echo-area: https://gist.github.com/2418471

0:32 echo-area: runs in the exact same time as the Java.

0:33 cmajor7: pablo_ns: (apply str (map char params))

0:33 dnolen: echo-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.

0:33 pablo_ns: cmajor7: it's not a string, it's a binary file

0:33 cmajor7: yea, I see it

0:34 dnolen: echo-area: on my machine both versions take 1s

0:35 pablo_ns: cmajor7: so, if it comes from wrap-multipart-params as a byte array it should work with getBytes, correct?

0:35 cmajor7: I am looking at API: http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/PutObjectRequest.html

0:35 I would say yes, but one sec

0:36 echo-area: dnolen: 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

0:36 dnolen: echo-area: np

0:38 pablo_ns: cmajor7: oh no, don't bother cause the stack trace means the function s3/put-object hasn't even been called

0:38 cmajor7: it breaks before that

0:39 cmajor7: I found it

0:39 it can only be one of 3

0:39 InputStream, File or a String

0:40 since 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))

0:40 (where 's' is your value)

0:40 https://github.com/weavejester/clj-aws-s3/blob/master/src/aws/sdk/s3.clj#L91

0:41 hiredman: ,(clojure-version)

0:41 clojurebot: "1.4.0-master-SNAPSHOT"

0:41 pablo_ns: cmajor7: humm, I see it

0:41 hiredman: clojurebot: snapshot? really?

0:41 clojurebot: Titim gan éirí ort.

0:42 cmajor7: pablo_ns: so slap => (apply str (map char params)) on it, and let it handle it

0:43 (no "=>", of course)

0:44 pablo_ns: cmajor =) of course

0:45 cmajor7: you mean: (apply str (map char (:bytes params)))

0:46 cmajor7: pablo_ns: I would first try (:bytes (apply str (map char params)))

0:48 pablo_ns: cmajor7: heh.. another cryptic error java.lang.IllegalArgumentException: No implementation of method: :put-request of protocol: #'aws.sdk.s3/ToPutRequest found for class: [B

0:48 cmajor7: but this one at least I kinda understand

0:49 cmajor7: pablo_ns: it means it did not convert to string properly

0:49 since conversion to "putRequest" accepts Strings

0:49 https://github.com/weavejester/clj-aws-s3/blob/master/src/aws/sdk/s3.clj#L85

0:50 dgrnbrg: I just updated paredit mode for vim with new features: https://github.com/dgrnbrg/paredit-vim

0:50 cmajor7: pablo_ns: let's rewind… why do you need to prefix it with ":bytes" ?

0:51 I think that is what converts it back (unwillingly)..

0:52 pablo_ns: cmajor7: Here's the thing: I'm using Google Appengine to accept a file from another app via POST and storing that file on S3

0:52 cmajor7: Appengine doesn't allow writing to a tempfile, which is what the middleware multipart-params does by default

0:52 devn: dgrnbrg: nice

0:53 pablo_ns: cmajor7: so there's a library called appengine-magic that forked mutlipart-params and, instead of creatinga temp file, creates that :byte entry

0:54 cmajor7: pablo_ns: but according to s3 APIs you don't need that ":byte" entry

0:54 is that something you can just omit?

0:54 devn: cemerick: i think this is a long shot at this point, but did extensible reader stuff make it into the book?

0:55 cmajor7: e.g. (s3/put-object cred "rod-bucket" name (apply str (map char params))))

0:55 pablo_ns: cmajor7: yes, I need it because that's where the data is stored.

0:55 cemerick: devn: Nope.

0:55 devn: cemerick: aww, bummer

0:55 pablo_ns: cmajor7: it wont work because "params" is a map

0:56 cmajor7: so what is you current code looks like, because the one you posted does not seem right

0:56 pablo_ns: cmajor7: I'll paste the entire snippet

0:56 cemerick: devn: It was a conscious decision.

0:57 We don't talk about #=, *read-eval*, and all sorts of other esoterica either.

0:57 devn: cemerick: i suppose 1.4 is a smaller release so maybe it's better to hang back for a cycle

0:57 cemerick: ah, that's another reason

0:58 cemerick: reader literals are a big improvement over #=, but there's a *lot* of rope there

0:58 devn: the confusion about why you'd want the extensible reader or how you'd use it is in need of pre-emptive repair

0:58 cmajor7: pablo_ns: it just hit me… then yes of course => (apply str (map char (:bytes params)))

0:58 cemerick: right

0:58 devn: i'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

0:58 or..maybe i should shut my yapper and get to work

0:59 one of those is more honorable. i'll leave that as an exercise to the reader.

0:59 pablo_ns: cmajor7: http://pastebin.com/2rD6vm1r

1:00 cmajor7: java.lang.IllegalArgumentException: Value out of range for char: -1 =(

1:00 devn: cemerick: regardless of audience there's one line about clojure that i've always liked: clojure is a consenting adults language

1:00 technomancy: even adults can get grumpy about being fed crap though

1:00 cemerick: devn: absolutely.

1:01 * technomancy still can't get over getting mutable objects back from the out-of-the-box reader

1:01 cemerick: Though we ended up being super-comprehensive, we didn't want to write an encyclopedia, either.

1:01 cmajor7: pablo_ns: it's ok, at least now it does what it says

1:02 cemerick: technomancy: dude, got to get the grumps out ;-)

1:02 cmajor7: the reason it cannot convert it to String is because characters are "positive" bytes

1:03 technomancy: cemerick: 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?

1:03 devn: there 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

1:03 technomancy: *year or too

1:03 two

1:03 whatever

1:03 devn: did somebody say grumps?

1:03 technomancy: I definitely said grumps.

1:04 cemerick: technomancy: Who you think you're talking to? :-P

1:04 technomancy: http://sthelensnarpo.site90.net/cms/images/GRAPHICS/old%20grumpy%202.jpg

1:04 cemerick: who's listening?

1:04 cmajor7: pablo_ns: ok, so S3 expects String / InputStream or File, and "appengine-magic" creates a byte array instead

1:04 devn: frumps. the matronly sort of grumps.

1:04 pablo_ns: cmajor7: the map that gets in looks like this: {:content-type audio/mp3, :filename music.mp3, :size 4378768, :bytes #<byte[] [B@7a4b59dd>}

1:06 cemerick: technomancy: by that I mean, been there, said that (or something close). :-)

1:06 technomancy: oh, naturally =)

1:06 cmajor7: pablo_ns: so we just need to convert it to ByteArrayInputStream

1:06 devn: pablo_ns: walk it out: (map char (:bytes (m/save-rec! rec-info))

1:06 technomancy: cemerick: I guess the solution is to make the default lein new skeleton bring in joda and a reader overrides file

1:06 devn: err missing paren above^

1:07 cemerick: technomancy: year or two, as in, when the new date JSR lands?

1:07 devn: technomancy: when is new clojars going to be around?

1:07 technomancy: right

1:07 devn: depends on GSOC

1:07 devn: no it doesn't!

1:07 hiredman: clojurebot's uberjar is around 17megs

1:07 cemerick: technomancy: oh, don't get me started

1:07 devn: dude. we need to make better the clojars.

1:07 it is a must.

1:07 technomancy: devn: dude, have you seen xeqi? he's on a roll!

1:08 devn: wha!?

1:08 * cemerick really needs to write that GSoC skeptic post.

1:08 * devn reads

1:08 * devn needs to write a "get rid of those grumps" comment on cemerick's post

1:08 technomancy: cemerick: TBH there are a few other gsoc proposals that are probably more strategic than clojars

1:08 cemerick: technomancy: that doesn't make me feel better

1:09 technomancy: typed clojure of course, and the pluggable clojurescript backend thingy

1:09 devn: clojars is important, damnit.

1:09 technomancy: devn: yeah, but if it doesn't happen from gsoc it will still happen

1:09 devn: we also need to tie up some of these disparate documentation sources and possibly move them to contrib

1:09 cemerick: devn: FWIW, I don't think I'm grumping on GSoC; I think the whole thing is a cynical effort

1:09 devn: cemerick: why do you think that?

1:09 cemerick: Which makes me the idealistic one, I think.

1:10 devn: cemerick: I guess I don't follow

1:10 cmajor7: pablo_ns: not sure if there is clojure way to do it, but here is a Java way:

1:10 ,(new java.io.ByteArrayInputStream (.getBytes "hello byte array") )

1:10 clojurebot: #<ByteArrayInputStream java.io.ByteArrayInputStream@10c0fa7>

1:10 devn: I 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

1:11 pablo_ns: cmajor7: that might work

1:11 devn: it was /awesome/ -- i wish i was in school so I could devote 3.5 months to clojure

1:12 cmajor7: pablo_ns: e.g. (new java.io.ByteArrayInputStream (:bytes params))

1:12 devn: cemerick: what is cynical about gsoc? google's involvement? the vibe of the community towards it? what?

1:12 technomancy: a 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

1:13 cemerick: devn: 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.

1:13 devn: sounds like the clojure CA

1:13 pablo_ns: cmajor7: Man, I so own you a beer!

1:13 devn: *hiss* *boo*

1:13 pablo_ns: cmajor7: I mean, owe

1:13 cmajor7: pablo_ns: it worked?

1:13 pablo_ns: cmajor7: Yes it did, sir!

1:13 devn: cemerick: i put "Google Summer of Code: Bell Labs" on my resume out of college

1:14 that *is* a good

1:14 cemerick: ugh

1:14 technomancy: cemerick: most of the proposals have come from outside the US, so eminently hireable doesn't really apply

1:14 dnolen: cemerick: eh?

1:14 devn: technomancy: not so fast. ill find you a visa. :)

1:14 technomancy: devn: for three months? =)

1:15 devn: "i've heard things can be done"

1:15 pablo_ns: cmajor7: just checked on S3, it's there

1:15 cmajor7: pablo_ns: great. there should be a cleaner way to convert it to an input stream though..

1:16 cemerick: technomancy, dnolen: don't expect rigor from my OT irc gruntings. ;-)

1:16 devn: cemerick: you can't smiley-wink your way out of this one

1:16 ;)

1:16 cemerick: heh

1:16 technomancy: cemerick: I do think the timing is unfortunate on the clojars proposal

1:16 because I don't want to wait till august, dammit

1:17 cemerick: technomancy: that's where I got the "co-opting" part.

1:17 technomancy: =\

1:17 pablo_ns: cmajor7: now, why did it work with (.getBytes (:bytes params)) before? That's weird, right?

1:17 technomancy: then I look at the pile of issues for lein2-final and think summer might not be too late anyway

1:18 cemerick: The "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.

1:18 cmajor7: pablo_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

1:18 devn: no, 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.

1:20 cemerick: devn: well, if that's the case, then I'll say the process and the $5k probably incentivizes people in the wrong directions.

1:20 dnolen: cemerick: I'm struggling hard to understand your point about market wages and GSoC ...

1:20 and failing

1:21 devn: cemerick: 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?

1:21 s/you're/your

1:22 i should just rewrite my previous statement. I think i wrote with two tenses simultaneously.

1:23 cemerick: 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?

1:24 pablo_ns: cmajor7: well, thanks again for the tremendous help!

1:24 cemerick: devn: No, that people opt to work for $5K when they could work for $ddK, presumably in order to have the GSoC credential.

1:24 dnolen: ^^

1:24 I'm not saying it's bad or wrong or whatever, but that it's not necessarily an unvarnished good.

1:24 cmajor7: pablo_ns: sure, it was fun :)

1:24 devn: cemerick: academics, man. some of these people have $ddK jobs at their university but are able to do GSoC.

1:24 technomancy: I think it's very common among new programmers to underestimate what their time is worth.

1:25 bbloom: i'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?

1:25 devn: the 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.

1:26 dnolen: cemerick: 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

1:26 cemerick: given your viewpoint - I take it you haven't had the time to follow along closely.

1:26 technomancy: bbloom: they're on hold afaict

1:26 bbloom: technomancy: 1) why? and 2) where would i find that out? :-)

1:27 technomancy: bbloom: not going to get a better answer than "because rich said so" I'm afraid =\

1:27 hiredman: do you mean cells in the data flow sense?

1:27 because pods are not those

1:27 bbloom: hiredman: that's what i was initially looking for, but that's not what i found & then i fell down the irc logs rabbit hole

1:28 dnolen: bbloom: they aren't on hold per se - based on the conj keynote somebody could take them over.

1:29 bbloom: i'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

1:29 dnolen: http://blip.tv/clojure/rich-hickey-keynote-5970064 this keynote?

1:29 just about to watch that :-)

1:29 dnolen: bbloom: yep

1:30 devn: dnolen: 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.

1:30 dnolen: bbloom: I think they would be easiest to prototype in ClojureScript - no concurrency issues to worry about.

1:30 bbloom: dnolen: but there's still parallelism ;-)

1:31 devn: dnolen: 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."

1:31 bbloom: simply trying to stand on the shoulders of giants

1:31 dnolen: bbloom: simple benefit - transients become an implementation detail

1:32 bbloom: dnolen: yup, I understood the cells conversation quite well

1:32 * bbloom digs up link

1:33 dnolen: devn: I think we'll get some good stuff out of GSoC - it's a positive community building thing IMO

1:33 * devn wonders if there's a way to present an interface to jira that would prevent the need to ever...ever...log into jira

1:33 devn: dnolen: yeah, im confident we will too.

1:33 muhoo: clojars.org is down?

1:33 dnolen: devn: I don't understand the JIRA hate, github issues aren't that great.

1:33 devn: it's up for me muhoo

1:34 bbloom: http://clojure-log.n01se.net/date/2010-02-15.html and http://clojure-log.n01se.net/date/2010-02-17.html

1:34 devn: dnolen: 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

1:34 or how to get from point A to point B

1:34 bbloom: was hoping there was a similar span of logs for the transition from cells -> pods

1:34 just out of curiosity

1:34 cemerick: dnolen: Right, presumably no one does GSoC *for* the money; the impact of the extrinsic motivation can't be nil though.

1:35 muhoo: huh, weird

1:35 bbloom: i find that studying the evolution of ideas *sticks* better than simply reading the distilled end results

1:35 muhoo: clojars.org is being rejected by firefox as having an "ABE" error

1:35 Lajla: &(= #(%1) #(%1))

1:35 lazybot: ⇒ false

1:36 bbloom: dnolen: is "pods" simply a name change, or any new ideas along with them?

1:36 devn: cemerick: 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.

1:36 muhoo: it appears to be trying to access browser.xul. wtf?

1:36 devn: cemerick: Are you gonna tell Ambrose he's misguided for doing GSoC?

1:37 cmajor7: devn: https://answers.atlassian.com/questions/6753/display-wallboard-without-login

1:37 Lajla: &(let [fn list] #(1 2 3))

1:37 lazybot: ⇒ #<sandbox3826$eval7766$fn__7767 sandbox3826$eval7766$fn__7767@1c9078e>

1:37 Lajla: Wooow, wtf is that

1:37 Is there a special form to expand a macro?

1:37 cemerick: devn: Hardly. It's Google's intentions and objectives that I'm skeptical of, not the participants all around.

1:38 clojure_newb: I like clojure. I like OpenGL. How do I use OpenGL inside of Clojure?

1:38 There seems to be two choices, JOGL, and JLWGL, but there are various claims about them being outdated.

1:38 cmajor7: clojure_newb: https://github.com/ztellman/penumbra ?

1:38 devn: cemerick: okay, that's way clearer.

1:39 clojure_newb: hmm

1:39 it says at the top:

1:39 "Penumbra is not under active development."

1:39 dnolen: cemerick: Google's intentions & objectives? You think they care that much about a small community of Lispers on JVM?

1:40 devn: dnolen: i think he's referring to "future hiring pool" considerations they may have

1:40 cemerick: dnolen: No, I think it ends up being an efficient HR filter for them.

1:40 muhoo: +1 for gsoc as recruiting tool

1:40 cemerick: Certainly, one can say "so what?".

1:41 devn: cemerick: 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

1:41 but, uh... i dont work there.

1:41 dnolen: cemerick: as far as I can tell - no one's telling us what to do or how to do it.

1:41 * pablo_ns wish there was a "Java for Clojure" book for those not coming from the OO world...

1:41 cmajor7: clojure_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" :)

1:42 cemerick: oh, it's right on the tin http://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2012/faqs#recruiting

1:42 muhoo: pablo_ns: clojurebook.com saved me from exactly that. it seems friendly to people coming from ruby/python/etc

1:42 devn: pablo_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.

1:42 cemerick: dnolen: Sure, it wouldn't make sense for them to.

1:42 bbloom: cemerick: 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*

1:43 devn: nevermind the fact that communication skills and styles in GSoC are relegated in some cases to text-only

1:43 pablo_ns: muhoo: 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.

1:43 devn: it's an indicator, but you can use google to find my github profile too

1:44 which is more effective?

1:44 dnolen: cemerick: 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.

1:44 devn: to me it's the PR campaign more than it is the secret motive

1:44 dnolen: "is not getting something"

1:44 devn: google doesn't do traditional advertising, so GSoC /is/ their advertising budget

1:45 except they do something that is not "teh suck"

1:45 they get contributions in on languages they don't use in-house

1:46 pablo_ns: devn: Nice analogy. Too bad I don't even know where to go looking for Java libs.

1:46 ivan: cat */project.clj

1:47 muhoo: seriously, wtf? https://refheap.com/paste/2226

1:47 devn: pablo_ns: what are you interested in writing?

1:47 ivan: muhoo: are you being captive portal'ed on free wifi?

1:48 muhoo: ivan: good point. it's comcast, and they suck very much.

1:48 devn: pablo_ns: i think a lot of books are missing the "read this paper about the java object model"

1:48 dnolen: bbloom: pods is just a name change

1:48 devn: you can learn what you need to know about java in an afternoon from the clojure perspective

1:48 bbloom: dnolen: thanks

1:49 devn: getting used to reading their docs is a comfort thing

1:49 pablo_ns: devn: Web apps and machine learning. Most of the interesting Erlang libraries that I though about porting to Clojure have already been ported.

1:49 zakwilson: Wow. 1.4 is out. I think I might need to get my production code off 1.2.

1:49 cemerick: bbloom: Sure. Perhaps it's a win-win on balance for everyone involved, but weighing out all the pieces seems worthwhile.

1:49 devn: pablo_ns: write a wrapper for an existing java web-related lib

1:49 or machine learning lib

1:50 google "java library tag parser" or something. stuff will show up, and you can learn to wrap that.

1:50 pablo_ns: devn: Do you know of a small library that could serve as an example?

1:51 devn: of a wrapper?

1:51 pablo_ns: devn yes

1:51 devn: clojure.core ;) i kid

1:51 (only slightly)

1:52 there's a lot of java interop in 3rd party libs

1:52 muhoo: ivan: 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.

1:52 devn: muhoo: i have a present for you

1:52 muhoo: devn: memory-restoring pills?

1:53 pablo_ns: devn: I actually just found a worthy candidate

1:53 https://github.com/tropo/tropo-webapi-java

1:53 small and simpe

1:53 small and simple

1:54 devn: muhoo: http://30.media.tumblr.com/tumblr_m2i5bkJCMP1rtlkwvo1_500.png

1:54 muhoo: devn: wat?

1:55 devn: pablo_ns: close... i guess that looks like it is to be used /from/ java at first blush

1:55 i think i was suggesting the opposite: a lib used primarily from clojure that wraps java stuff

1:55 but in an almost superficial way

1:56 pablo_ns: devn: if it can be used from java, it can be used from clojure, right?

1:56 cemerick: dnolen, devn: do you think GSoC projects would end up being worked on even if GSoC didn't exist?

1:56 devn: like (import '[foo.bar Baz]) (.. Baz method args)

1:56 cemerick: maybe, maybe not

1:56 cemerick: eh, just missed him

1:56 devn: cemerick: im not sure what you're driving at again though

1:57 because 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

1:57 cemerick: not driving at anything at the moment. Thinking through what the influences are.

1:57 so, it's more a matter of a process serving as a forcing function?

1:58 devn: that's one dimension i think

1:58 cemerick: plus the credential, plus the "bonus" of the money, in some combination

1:59 devn: and 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

1:59 cemerick: heh

1:59 ugh, the GSoC homepage actually calls the $5K "a nice paycheck".

1:59 devn: dude. i wasn't working when i did GSoC.

1:59 pablo_ns: I 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.

2:00 devn: i /didn't have a job/ when I did GSoC

2:00 5k was fun money.

2:00 cemerick: Mmm.

2:01 I probably have an unusual history / posture towards money.

2:01 devn: i 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.

2:01 and limbo, and... well, a lot more, but still.

2:02 cemerick: i think we're all biased or skewed in one direction or another

2:03 but 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.

2:04 *or* you're a college kid who lives happy on peanut butter, and 5k makes you a miniature millionaire for a moment.

2:04 cemerick: heh

2:06 * devn shrugs

2:06 cemerick: When I was in college, I was breaking down powerbooks and selling parts on ebay to pay tuition and keep gas in the car.

2:06 devn: i was spoiled, had college paid for, and then dropped out.

2:06 cemerick: *gawd*

2:06 devn: the world is a funny place.

2:06 cemerick: "and I did it all in the snow, both ways"

2:06 funny, I worked my ass off to pay for it, and then dropped out.

2:06 :-P

2:07 devn: the humanity of it all...

2:07 Lajla: I do sor ecall there being a special form which expands macros

2:07 Provide me with it, and you shall be handsomely rewarded.

2:07 devn: it's disgustingly...realistic.

2:07 pablo_ns: devn: I could live for a year on 5K where I live. Comfortably.

2:07 Lajla: Fail me, and your life shall be taken from you

2:07 devn: pablo_ns: where are you at?

2:07 cemerick: devn: it's all stranger than fiction, yah? :-D

2:07 devn: cemerick: something like that. :)

2:08 pablo_ns: devn: Bolivia

2:08 devn: pablo_ns: ive never been there.

2:08 pablo_ns: probably the only clojurian in a 3k mile range =)

2:08 devn: pablo_ns: do you have a clojure group there?

2:09 pablo_ns: devn: nops, only Ruby/Python groups

2:09 devn: pablo_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

2:09 you need to put it out there

2:10 pablo_ns: devn: but where?

2:10 devn: pablo_ns: go to the ruby and python meetup groups and tell people you're starting a clojure group

2:10 i sat alone for 3 months before anyone showed up at my meetup group.

2:10 wkmanire: Is it wise to abstract away IO access with partially applied functions for unit testing purposes?

2:10 pablo_ns: devn: I thought about asking in the main list, but I'm not sure if it's appropriate

2:10 wkmanire: Or is there a sort of standard way of doing that?

2:11 devn: pablo_ns: growing the community is appropriate so long as you dont hog the list

2:11 pablo_ns: devn: where are you at?

2:11 devn: pablo_ns: the US, the upper midwest

2:11 there are people everywhere who are into lisp, scheme, clojure, FP, etc.

2:11 you just need to give them a place to go

2:12 *everywhere*

2:12 pablo_ns: I've been there.. ages ago when I was living in KS

2:13 devn: I'm not sure about that... Clojure is still too niche around here.

2:14 devn: in the past 2 years I've tried to get people around here interested in Erlang and Scheme with zero success.

2:15 wkmanire: nevermind, 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.

2:15 :)

2:18 devn: pablo_ns: coming back from bible camp doesn't help your cause.

2:19 pablo_ns: it's a long pull, not a quick turnover.

2:19 pablo_ns: devn: Yeah, guilty of shunning the non-believers.

2:20 devn: pablo_ns: people change their minds slowly.

2:20 pablo_ns: but progress *does* happen. it's just not at the immediate rate you sometimes desire.

2:21 ben_m: Does anyone know if you can run quil (formerly known as clj-processing) in a browser, like "real" Processing?

2:21 pablo_ns: devn: here's an interesting data point: in a recent poll in the local ruby group, the most used language at work is Delphi.

2:22 devn: pablo_ns: the subtle, unspoken goal in my opinion is to tell developers who care that they should quit working in delphi

2:23 it's sort of the "drop out of college and start your own company" mantra

2:23 bbloom: pablo_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

2:23 devn: but it's not explicit. it should be about chinks in the armor.

2:24 not an abrupt change

2:24 bbloom: s/it's/its

2:24 devn: im not hating on delphi

2:24 pablo_ns: bbloom: And I agree. But I thought Delphi was pretty much dead and buried.

2:24 devn: but the philosophy behind clojure's design is so much more nuanced

2:24 you need to bring that in small doses

2:25 bbloom: pablo_ns: behind the corporate firewall, nothing is ever dead and burried

2:25 muhoo: delphi? pascal?

2:25 devn: cobol?

2:25 clojurebot: The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. -- Dijkstra

2:25 devn: fortrant?

2:25 fortran*

2:26 charles_r: I'm looking for repl/editor to use with clojure. What do you recommend?

2:26 bbloom: devn: do not google for cobol jobs, you may begin crying

2:26 devn: charles_r: depends on what you're used to

2:26 what do you normally use to edit?

2:26 charles_r: I'm coming from Sublime Text. From what I hear, it can't auto-indent well.

2:27 muhoo: http://en.wikipedia.org/wiki/Sturgeon%27s_Law

2:27 pablo_ns: charles_r: have you seen sublimerepl ?

2:27 https://github.com/wuub/SublimeREPL

2:27 charles_r: I saw it while googling

2:27 bbloom: charles_r: if you're not addicted to (*real*) vim bindings (like myself), emacs isn't that big of a leap

2:28 charles_r: I'm more comfortable in vim than emacs, but compare to native apps, the fonts are really hard on my eyes.

2:28 bbloom: charles_r: which os?

2:28 pablo_ns: charles_r: sublimerepl + vim mode = poor man's emacs + slime

2:28 charles_r: os x

2:28 bbloom: charles_r: I use MacVim & the fonts look great

2:29 http://code.google.com/p/macvim/

2:30 devn: charles_r: you could try clooj?

2:30 charles_r: are you trying to do heavy development, or just toying around?

2:30 charles_r: I tried that for about 5 seconds.

2:30 bbloom: charles_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

2:30 pablo_ns: devn: last time I checked clooj looked good, but no syntax highlighting

2:30 charles_r: development. I'm coming from ruby/python

2:30 bbloom: it's no slime, but it gets the job done

2:31 devn: pablo_ns: meh. it's overrated.

2:31 muhoo: been a linux guy for way too long. i looked at assoc-in, and immediately went "oh, it's like mkdir -p"

2:31 devn: (highlighting)

2:31 you can write in notepad with the same level of efficency

2:31 pablo_ns: charles_r: so, what's wrong with sublime text in your opinion?

2:32 charles_r: I don't think it auto-indents correctly for clojure, but you know… I haven't really tried.

2:32 devn: charles_r: "correct" is a loose concept when it comes to indentation

2:33 pablo_ns: charles_r: I used it or clojure 50% of the time and in my case it idents correctly

2:33 devn: sometimes i see autoindented code that i think looks like garbage.

2:33 pablo_ns: I *use* it

2:33 devn: it's a style thing

2:35 pablo_ns: devn: what's your setup? vim?

2:36 charles_r: well, I just tried something and it did fine, guess the stuff I found while googling was out of date

2:36 devn: i use vimclojure, emacs + clojure + paredit, and clooj

2:36 i teach some clojure on the side, so i use a variety of editors

2:36 whatever is comfortable to the person im working with

2:37 editors don't matter. code does.

2:37 Borkdude: 4clojure not working?

2:37 I get a 504 "Gateway Time-out"

2:37 bbloom: Borkdude: seemed to be down yesterday too

2:38 devn: Raynes: amalloy_ 4clojure is down.

2:38 Borkdude: good timing, my students need to do one of the exercises as part of their homework...

2:38 devn: Borkdude: haha

2:39 Borkdude: make them do it on paper!

2:39 bsteuber: maybe one was too lazy so he rather did a small DOS attack ^^

2:39 bbloom: Borkdude: it's open source, you could try running it: https://github.com/4clojure/4clojure

2:39 devn: bbloom: yeah but i dont know if it has the problem set

2:39 bbloom: devn: bummer

2:40 devn: i think there's a way to seed some problems

2:40 but maybe not all of them

2:40 oh, there it is: load-data.sh

2:40 Borkdude: bbloom: yes, but I'd rather concentrate on finishing my course material ;)

2:40 charles_r: pablo_ns: how do you link sublime text with the repl?

2:40 pablo_ns: charles_r: you mean with sublimerpl?

2:41 devn: charles_r: https://github.com/wuub/SublimeREPL

2:41 charles_r: I just want to be able to click on a block and see the result. Is that what sublimerepl does?

2:42 pablo_ns: charles_r: that's not possible in sublimerpl

2:42 charles_r: that's what I thought

2:43 pablo_ns: charles_r: but you can send code to and from the repl, plus you get all the text editing goodies inside the repl

2:43 charles_r: autocompletion, syntax highlighting, auto identation, etc

2:49 charles_r: http://www.sublimetext.com/forum/viewtopic.php?f=5&t=3330

2:49 michaelr525: pablo_ns: Is there a debugger with it?

2:50 charles_r: I'm trying to figure out how to install it.

2:50 can't find the packages folder

2:51 pablo_ns: michaelr525: not for clojure afaik. But there is for python and ruby.

2:52 charles_r: what OS are you running?

2:52 charles_r: os x

2:53 I've seen it before

2:53 pablo_ns: Preferences -> Browse Packages

2:53 or ~/Library/Application Support/Sublime Text 2

2:53 michaelr525: that's one of the things that slows me down with clojure, the lack of integrated debugger like in Visual Studio

2:54 pablo_ns: charles_r: there's also sublimePTY which I haven't installed.

2:55 charles_r: okay, I should have it installed

2:58 so this repl, how is it running clojure, its own version or is it finding the one I previously installed?

2:59 auto-indent… nice...

2:59 pablo_ns: charles_r: it depends on the project structure that you have

3:01 charles_r: I can't seem to cycle through previous commands though

3:02 pablo_ns: ctrl + P

3:02 and ctrl + N

3:02 charles_r: it should be the arrow key

3:24 autodidakto: I'm trying to understand the .m2 directory. Is this storage for any dependency you've used before?

3:28 Raynes: autodidakto: It is a local maven repository.

3:28 autodidakto: When you download a dependency, it downloads from a remote maven repository to your local maven repository.

3:28 So yes, storage for dependencies you've downloaded.

3:29 autodidakto: Raynes: And from there, it's copied to your projects as needed?

3:29 Raynes: Not in lein 2.

3:29 autodidakto: (as requested by your project.clj, i mean)

3:29 Lein 2 doesn't move it over?

3:29 (copy)

3:29 Raynes: There 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.

3:30 autodidakto: I see

3:32 Raynes: is it the "classes" folder that lein 1 copied the deps to?

3:32 Raynes: No, lib.

3:33 autodidakto: Gotcha. But I see that the clojure jar, if not the default (ie, 1.4) is copied to the lib folder. Anything else go there?

3:35 antares_: autodidakto: dependencies go under ./lib

3:36 Raynes: In lein 1.

3:36 autodidakto: ...non maven deps, then?

3:37 Raynes: Nothing goes to lib/. Unless checkout deps do?

3:45 antares_: autodidakto: I was talking about lein1. Yes, Maven dependencies. Checkouts (dependencies via symlinks to local directories) go under ./checkouts.

3:46 autodidakto: antares_: Thanks. So the lib folder, in a lein2 project, could possibly have an updated clojure jar. Anything else?

3:47 antares_: actually, I see that lein2 projects also have lib/* with Maven deps :)

3:47 autodidakto: are you trying to track down what causes updated Clojure jar to be on your classpath?

3:48 autodidakto: Not that. Just trying to understand lein1/2.... the directory tree and dependencies and the maven..

3:48 heh, the maven

3:49 antares_: deps are under lib/, checkouts are under checkouts/. Compiled .class files in lein1 are under ./classes/, in lein2 they are under target/classes

3:49 slightly closer to Maven ecosystem conventions

3:50 everything else (src, test) is the same (and configurable to your taste)

3:52 autodidakto: antares_: Thanks. That helps

4:04 Raynes: antares_: Define 'maven deps'

4:04 antares_: Raynes: I just used autodidakto's terminology

4:04 gf3: gm Raynes

4:04 Raynes: Okay, then he should define maven deps.

4:04 :p

4:04 Maven and lein deps are exactly the same thing.

4:04 gf3: Morning.

4:05 Anyways, I have to go sleepy time now. Work tomorrow.

4:21 casperc: hello

5:15 Fullmoon: (map

5:15 (fn [[x y] args] x)

5:15 {:a [1 2 3 4] :b [5 6 7 8 9 10]})

5:15 Something is wrong with this destructuring, I am getting Wrong number of args (1) passed to: core$eval3085$fn can-t figure out why

5:17 first of a map returns a vector with [key value], so this should work...

5:18 clgv: Fullmoon: 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]})

5:18 lazybot: ⇒ (:a :b)

5:21 clgv: just selecting keys or values can be done via 'keys and 'vals

5:24 Fullmoon: Ah, ok, thanks.

6:48 casperc: i'm wondering if it is possible to make the following structure with a macro:

6:49 (defstep step-name [order] (ACTION ...) (CALLBACK ...))

6:50 the intention is that the ACTION and CALLBACK forms should end up creating a function which is put into a hashmap or record

6:50 those functions should have access to the parameters provided in the defstep, i.e. order in this example

6:52 i'm having a hard time figuring out how to get ACTION and CALLBACK to have access to order without providing it

7:07 clgv: casperc: you should write down the resulting function definitions and data creations. it explains better what you want to do

7:12 casperc: clgv: thanks, I know I was being a bit vague :)

7:14 clgv: i basicly want to end up with a map containing three functions, like this {:action (fn [] ...) :callback (fn [] ...) :cancel (fn [] ...)}

7:15 clgv: casperc: why do you chose the map and not a protocol with an implementing defrecord (or deftype)?

7:16 casperc: clgv: 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

7:18 clgv: 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

7:18 i'm kinda coming up short though

7:18 Chousuke: casperc: that doesn't seem too hard to implement

7:18 clgv: casperc: but why dont you define (defprotocol IStep (action [this]) (callback [this]) (cancel [this])) (deftype OrderStep [order] (action [this] (dosomething order)) (callback [this] ...) (cancel [this] ...))

7:22 casperc: clgv: 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)?

7:22 Chousuke: do you need multiple instances of each step?

7:22 clgv: casperc: yes, you can implement IStep on multiple deftypes/defrecords

7:23 hm yeah, reify is an option as well, if anonymous types are sufficient

7:24 casperc: Chousuke: 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

7:25 Chousuke: casperc: I mean, would most orders use the same steps, but with different parameters?

7:25 casperc: the flow macro would look something like this: (defflow name-of-flow step1 step2 step2)

7:25 Chousuke: in that case, I'd probably go with a protocol and defrecords.

7:26 casperc: don't make a macro for everything

7:26 what's wrong with just (def name-of-flow [step1 step2 step3])? :)

7:26 clgv: deftype is then basically your defstep ;)

7:27 casperc: Chousuke: not much i guess, just trying to make it look nice in use :)

7:27 Chousuke: keep it simple, first

7:28 if your flow is really a vector of steps, then there's no reason to make it anything else

7:28 casperc: point taken, thanks for the input clgv and Chousuke :)

7:28 i'll try the deftype solution and see if that isn't in fact the right way :)

7:29 Chousuke: go with defrecord unless you have a special reason to use deftype

7:30 it shouldn't waste any resources and they work like maps, which is nicer to use than a plain deftype

7:30 and more flexible.

7:33 casperc: Chousuke: yeah, record might be the way to go here

7:35 Chousuke: 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?

7:35 Chousuke: given that you thought it was easy and i have no idea, now you got me even more interested :)

7:36 Chousuke: well you basically take the name. the argvec, and three lists as parameters to your macro

7:36 casperc: Chousuke: this one btw: (defstep step1 [ordre] (ACTION ...) (CALLBACK ...) (CANCEL ...))

7:36 ah you got it

7:37 Chousuke: so you define whatever, then remove the first item from all the lists and use them as bodies in the macro expansion

7:37 clgv: casperc: exactly like the deftype example above but with defrecord ;)

7:37 casperc: mind writing it out, I have a pretty bad mental model when it comes to macros

7:37 Chousuke: it'll work pretty nicely if you just replace the ACTION, CALLBACK and CANCEL symbols with 'do :P

7:37 then put them in the right place

7:38 dunno, it's not quite an oneliner. But it's not hard if you remember you're dealing with data structures

7:41 casperc: Chousuke: hmm, i'll try that

7:44 Chousuke: something like this:

7:44 (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))))

7:44 clgv: casperc: you can try somthing like this (defmacro defstep [name [order] & impl] `(deftype ~name [~order] IStep ~@(map (fn [l] (list (first l) '[this] (rest l))))))

7:44 or defrecord ;)

7:45 casperc: clgv: ooh, yours looks more correct than mine :)

7:45 clgv: casper: but it does not enforce your 3 particular functions.

7:46 Chousuke: that [~order] is a bit funky

7:46 you could just use "argvec" as the parameter and do ~argvec

7:47 clgv: Chousuke: yeah thats possible as well. but you would have to call 'vec on it then as well

7:47 Chousuke: why?

7:47 clojurebot: http://clojure.org/rationale

7:47 clgv: Chousuke: deftype/defrecord insists on a vector and not something seqable, right?

7:47 Chousuke: clgv: it will be a vector

7:47 casperc: clgv: true, also mine requires the correct order and all to be present, which would also be nice if it didn't

7:48 Chousuke: since you call it as (defstep name [order] ...)

7:48 clojurebot: ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25))

7:48 Chousuke: uhh, what

7:48 clgv: lol

7:49 casperc: clojurebot has an oppion too :D

7:49 mmarczyk: good morning

7:49 would anyone care to run a perf test for the persistent hash map implementation for ClojureScript? http://jsperf.com/cljs-persistent-hash-map-miniscule-assoc

7:50 clgv: mmarczyk: done. PHM is the fastest

7:51 mmarczyk: clgv: thanks! :-)

7:51 I have to say, I still can't believe it

7:51 basically my testing methodology must be flawed, right?

7:51 Chousuke: I tested, objmap is fastest

7:52 phm is 16% slower and HashMap 50%

7:52 mmarczyk: thanks

7:52 clgv: another chrome result

7:52 mmarczyk: that sorta makes sense

7:53 Chousuke: I'm running it again a few times

7:53 (64-bit iceweasel 10.0.3, linux)

7:54 getting somewhat jittery results for the phm; objmap remains fastest but phm ranges from 8-16% slower

7:55 mmarczyk: hm, not sure why that would be the case

7:55 Chousuke: it might be chrome finds something and manages to optimise away stuff

7:55 I'll test with chromium too

7:55 mmarczyk: yeah, V8 is absolutely crazy

7:56 there are links to other tests in comments on the ticket

7:56 Chousuke: phm is fastest in chromium

7:56 interesting

7:56 mmarczyk: in all cases V8 is the fastest and for some reason really, really likes PHM

7:57 Chousuke: is objmap mutable?

7:57 mmarczyk: Chousuke: nope, copy-on-write

7:58 and it actually copies two things -- the underlying js object and the keys array

7:59 clgv: mmarczyk: the performance of a plain js map would be interesting in comparison

7:59 mmarczyk: clgv: true, I'll make a separate test for that

7:59 since it needs to be mutable

7:59 I'll include the transient code :-)

8:00 http://jsperf.com/cljs-persistent-hash-map-transient-support

8:00 Bronsa: mmarczyk tested on opera mobile from android, phm 15% faster

8:00 Chousuke: maybe the v8 GV likes phm

8:00 GC*

8:00 mmarczyk: ^ PHM vs. TransientHashMap for building a 500-entry map

8:00 Bronsa: thanks!

8:00 Chousuke: yeah, they hit it off immediately

8:01 clgv: lol opera mobile looks funny in that chart ^^

8:02 mmarczyk: wow, transients apparently a good idea on iceweasel

8:02 clgv: :-)

8:02 Bronsa: clgv yeah, after that, it crashed.

8:03 Chousuke: chrome with phm is almost as fast as iceweasel with transients :P

8:05 looks like ff11 has improved a lot

8:05 or it might just be the difference in computer speed

8:06 I don't have ff11 to test myself

8:06 clgv: ff11 pc: Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz

8:11 Chousuke: for some reason ff11 is still only in debian experimental :/

8:12 mmarczyk: unsurprisingly, nothing quite as fast as js-obj when mutability is not an issue: http://jsperf.com/cljs-persistent-hash-map-vs-js-object-small

8:15 thanks for running the transient tests

8:15 apparently they make a bigger difference when not on V8, interesting

8:16 I have a TransientObjMap impl ready

8:16 guess I could dig it up and include it

8:17 Chousuke: Chrome is way faster at this than FF :p

8:17 mmarczyk: I 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

8:18 Chousuke: fortunately FF is plenty fast enough.

8:18 mmarczyk: also maybe just not worthwhile, since it's easy enough to build an ObjMap mutably by hand

8:18 Chousuke: I can't use Chrome :( no pentadactyl

8:18 mmarczyk: Chousuke: oh yes, Pentadactyl FTW!

8:18 but I make do with Vimium

8:19 last time I checked, Pentadactyl didn't like that expose-like thingy

8:20 which I started to use anyway, only to find that the "buffer list" became completely useless

8:20 maybe they've made progress on that though?

8:20 Chousuke: probably not

8:20 I don't use it so I wouldn't know

8:24 babilen: Chousuke: Try http://mozilla.debian.net for newer IW/FF releases.

8:50 Chousuke: babilen: I know of that, it just tells me the newest version is in debian experimental :P

8:51 babilen: Chousuke: 11 is in iceweasel-release (cf. http://mozilla.debian.net/dists/squeeze-backports/iceweasel-release/binary-amd64/Packages)

8:51 Chousuke: that's for squeeze though

8:51 I run testing

8:52 but I'm testing out ff12 beta

8:58 babilen: Those 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)

9:10 jedmtnman: is there a better channel to ask a simple question about hiccup or should I ask here?

9:14 fliebel: jedmtnman: I think here is fine. Not sure if there is any more specific channel.

9:14 #clojure-web maybe

9:16 jedmtnman: fliebel: 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...

9:17 something ilke (str (xml-declaration "UTF-8") (html […])) is what i was thinking but not sure that is what is normally done.

9:20 fliebel: jedmtnman: It seems you just supplyt it to html? https://github.com/weavejester/hiccup/blob/master/src/hiccup/page.clj#L32

9:24 jedmtnman: fliebel: 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.

9:44 fliebel: I mis-interpreted what i was seeing on the repl. it was just escaping the double quotes. thanks

10:06 sadger: hi there, can anyone please tell me which is the easiest way to find out which functions are in a given namespace?

10:07 S11001001: ,(doc ns-publics)

10:07 clojurebot: "([ns]); Returns a map of the public intern mappings for the namespace."

10:08 sadger: thank you

10:08 :)

10:14 clgv: sadger: you better call it like this ##(keys (ns-publics 'clojure.string))

10:14 lazybot: java.lang.SecurityException: You tripped the alarm! ns-publics is bad!

10:14 clgv: ,(keys (ns-publics 'clojure.string))

10:14 clojurebot: (trim lower-case split join upper-case ...)

10:14 gfredericks: clgv: now make a map from those to their docstrings and print it out as a table

10:15 S11001001: experimentally call all the functions and figure out their argument and result types

10:15 sadger: clgv: for readability purposes?

10:15 gfredericks: sadger: yes

10:15 clgv: sadger: yes.

10:15 sadger: clgv: I can see now! filled up my whole page

10:15 clgv: thanks

10:21 ,(sort (keys (ns-publics 'clojure.string)))

10:21 clojurebot: (blank? capitalize escape join lower-case ...)

10:21 gfredericks: ,(-> clojure.string quote ns-publics keys sort)

10:21 clojurebot: (blank? capitalize escape join lower-case ...)

10:21 sadger: always have to do one better :)

10:21 what does the -> do?

10:21 gfredericks: it has lots of fun

10:21 it turns my thing into your thing

10:21 without so much nesting

10:22 S11001001: though the quote is a little excessive

10:22 gfredericks: it is obnoxious

10:22 S11001001: albeit good illustration of the exact semantics

10:22 sadger: ah its some sort of composition?

10:23 gfredericks: ,(macroexpand '(-> foo bar))

10:23 clojurebot: (bar foo)

10:23 gfredericks: ,(macroexpand '(-> (one two three) (four five six)))

10:23 clojurebot: (four (one two three) five six)

10:24 gfredericks: ,(macroexpand '(-> (one two three) (four five six) (seven eight nine) ten))

10:24 clojurebot: (ten (clojure.core/-> (clojure.core/-> (one two three) (four five six)) (seven eight nine)))

10:24 gfredericks: poop

10:24 ,(macroexpand-all '(-> (one two three) (four five six) (seven eight nine) ten))

10:24 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macroexpand-all in this context, compiling:(NO_SOURCE_PATH:0)>

10:24 * gfredericks gives up

10:24 casperc: does 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:24 sadger: so gfredericks in simple terms what does it do?

10:25 gfredericks: sadger: it takes each successive form (syntactically) and places it as the first "argument" of the next form

10:25 sadger: ahh so to avoid the nesting

10:25 gfredericks: exactly

10:25 Iceland_jack: > Inserts x as the second item in the first form, [...]

10:25 gfredericks: ->> does something similar, but as the last "argument" instead of the first

10:25 sadger: (-> 'clojure.string ns-publics keys sort)

10:25 ,(-> 'clojure.string ns-publics keys sort)

10:25 clojurebot: (blank? capitalize escape join lower-case ...)

10:26 mdeboard: spam

10:26 sadger: i will try and remember this

10:26 i have just ordered the new o'reilly book

10:26 have heard good things

10:26 mdeboard: sadger: I got it in the mail yesterday, most practical clojure book yet imo

10:26 clgv: casperc: no. not as a builtin function

10:26 cemerick: sadger, mdeboard: I hope we live up to them, thanks :-)

10:27 sadger: mdeboard: I got "the joy of clojure" just out of interest

10:27 mdeboard: sadger: Ditto, I have joy and practical both

10:27 sadger: Both good in their own ways, but this one seems more focused on actual productivity

10:27 vice exclusively learning language features

10:27 casperc: clgv: so i need to do some java interop with reflection to find out?

10:28 sadger: Yes 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:28 mdeboard: Or I should say, vice exclusively enumerating language features for the reader

10:28 clgv: casperc: what do you really want to do?

10:30 casperc: well 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:31 clgv: casperc: is this really sane behavior? it could implement not used methods as empty methods

10:31 sadger: i look forward to this book cemerick, can't wait to get stuck in

10:32 gfredericks: I'm getting a "symbol ain't a seq" error from this ns form, and am totally baffled: https://refheap.com/paste/2231

10:33 casperc: clgv: hmm, maybe not but i need a way to find out of a step is cancelable or not

10:33 clgv: casperc: you can add a method for that to the protocol

10:34 sadger: question, 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:35 casperc: clgv: yeah that might be the solution

10:50 beffbernard: Is there a way to find all references of a def/defn using slime/clojure-jack-in?

10:51 gfredericks: I think there's a function for that; I don't think it ever worked for me though

10:51 M-x rgrep is always there :)

10:51 beffbernard: haha I M-x grep-find :(

10:51 Or just delete the thing and fix the compiler errors

10:52 gfredericks: scrap the project and start over

10:52 `lein new at-least-this-will-compile`

10:52 beffbernard: C-h del

10:52 :)

10:54 gfredericks: +1 on the rgrep

10:54 gfredericks: rgrep is my secret to handling legacy clojure code

10:54 beffbernard: That's probably the closest thing to find all references as I'll get

10:57 devn: ibdknox: what was the JS library or framework you were talking about using for Light Table?

10:58 nevermind, codemirror

11:00 aniero: reading the fogus interview with djspiewak... why is it that (drop 1 [1 2 3]) returns a list, not a vector?

11:00 gfredericks: it returns a seq not a list

11:00 and doing that is much more efficent

11:00 you can't easily remove arbitrary ranges from the front of a vector

11:02 mmarczyk: anybody got a moment to run http://jsperf.com/cljs-persistent-hash-map-vs-records-minuscule ?

11:03 aniero: gfredericks: ohh, looking at the source of drop, that makes sense

11:03 thanks

11:03 gfredericks: is it generally better to think of things in terms of sequences, rather than whether or not they're vectors/lists initially?

11:04 gfredericks: mmarczyk: I'm totally on it

11:04 mmarczyk: gfredericks: thanks :-)

11:04 gfredericks: aniero: absolutely; seqs are one of the main abstractions in clojure

11:04 aniero: cool, ok!

11:05 gfredericks: mmarczyk: do I gotta tell you something or did it auto-report to you?

11:06 mmarczyk: gfredericks: no auto-reporting, thanks :-)

11:06 gfredericks: mmarczyk: oh so how do I communicate this to you?

11:07 mmarczyk: gfredericks: oh, no worries about that -- I reload those tests all the time :-D

11:07 * gfredericks is confused

11:07 gfredericks: did "no auto-reporting" mean "no, it is auto-reporting"?

11:08 mmarczyk: gfredericks: no, but right after posting the link here, I'm sorta anxious to know the results and reload every couple of minutes

11:08 gfredericks: this tends to reinforce my impression that PHM is working *just fine*, which is great :-D

11:09 gfredericks: okay I have no idea what we're talking about anymore. Let me know if you need me to do anything else.

11:09 mmarczyk: gfredericks: fair enough, thanks for running the test ;-)

11:09 gfredericks: yessir

11:10 and/or madam

11:12 clgv: mmarczyk: firefox outperforms chrome on records?

11:13 mmarczyk: clgv: weird... some superfast machine running that test maybe?

11:13 clgv: but then, who knows, it's not by a huge margin

11:13 clgv: mmarczyk: no. both results on my machine

11:13 mmarczyk: clgv: in that case, interesting

11:14 wkmanire: Good morning.

11:16 gfredericks: wkmanire: morning? but here in <location> it is actually <some other time of day>!

11:17 neotyk: good morning everyone

11:17 sadger: 4.10pm!

11:17 clgv: gfredericks: your template engine failed to fill in the values ;)

11:17 sadger: waiting to leave the office!

11:17 neotyk: gfredericks: it is universal greeting time

11:17 wkmanire: gfredericks: Traditional courtesies are hard to apply on the itnernet.

11:17 And also on the internet too.

11:17 sadger: good day

11:18 good period of time at which you currently reside

11:18 catchy

11:18 gfredericks: good time zone everybody!

11:18 wkmanire: Time zones are overrated.

11:18 gfredericks: I think they are a nice abstraction

11:18 wkmanire: sadger: I probably aughta just say "Hi".

11:18 neotyk: gfredericks: http://www.total-knowledge.com/~ilya/mips/ugt.html

11:18 sadger: if you look across the boundery of a time zone you can see into the future

11:18 TimMc: .g universal greeting time

11:18 sadger: wkmanire: maybe

11:19 TimMc: $google universal greeting time

11:19 lazybot: [UGT] http://www.total-knowledge.com/~ilya/mips/ugt.html

11:19 sadger: maybe we need the lazybot to do that to send a personalised message to everyone depending on timezone :P

11:19 TimMc: In another channel, we say "Good $TOD"

11:19 sadger: don;t want to offend

11:19 gfredericks: haha

11:19 wkmanire: TimMc: That just about sums it up doesn't it?

11:20 It's amazing how many truths we unconciously learn about IRC.

11:20 TimMc: although the Germans are amused that that sounds like "good death"

11:21 wkmanire: It is only barely morning here anyway. 11:13.

11:21 TimMc: wkmanire: Ah, you must be in the same 1/24 band of the globe as I am!

11:22 We're practically family.

11:22 gfredericks: yay for similar longitudes!

11:22 wkmanire: TimMc: Cuiabá, Brazil.

11:22 TimMc: Boston, MA, USA

11:22 wkmanire: Yep.

11:22 gfredericks: I'm leaving this time zone next week

11:23 asphalte: Hey

11:25 I'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:25 gfredericks: (map symbol my-string-vector)

11:26 TimMc: asphalte: What do you intend to do with it after that?

11:27 asphalte: Oh, thanks. I wasn't aware of 'symbol'

11:27 wkmanire: :/

11:27 Iceland_jack: asphalte: If you intend to run it using eval there is probably a better way

11:27 gfredericks: TimMc: he's going to put it right into production

11:28 asphalte: I want to send it over the wire, execute it, having predefined functions for the various commands. Just messign around experimenting really.

11:34 sadger: What if you had say ["+" "1" "2"] and wanted to parse that and evaluate it what would be the best approach

11:34 evaluate it as (+ 1 2)

11:35 gfredericks: (eval (map read-string ["+" "1" "2"]))

11:37 sadger: ah thanks, sorry for the flooding questions just a interesting noobie :)

11:40 asphalte: I think it was a good question, thanks for asking it.

11:40 gfredericks: asphalte: read-string could have been used in your case too

11:41 sadger: gfredericks: 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:41 gfredericks: ,(map type [(read-string "78") (symbol "843") (read-string "foo") (symbol "foo")])

11:42 clojurebot: (java.lang.Long clojure.lang.Symbol clojure.lang.Symbol clojure.lang.Symbol)

11:43 sadger: hmm

11:43 but if you evaulate say (map symbol ["+" "1" "2])

11:44 obvious it has no symbol for the integers

11:44 (badly worded)

11:44 gfredericks: you'd be passing symbols to the + function which doesn't like that

11:44 no wait

11:44 sadger: I think it is

11:44 gfredericks: it'd fail to compile because of what you were probably saying

11:44 sadger: it says symbol cant be casted to integer

11:44 which is what + expects

11:44 gfredericks: hrm

11:45 then I'm confused

11:45 sadger: it does fail on compile

11:45 clojurebot: the scala compiler | is | <reply> see: http://harrah.github.com/browse/samples/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala.html#65760

11:45 sadger: ,(eval (map symbol '("+" "1" "2")))

11:45 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

11:46 asphalte: ,(eval (map read-string '("+" "1" "2")))

11:46 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

11:46 Iceland_jack: ,(class (symbol "2"))

11:46 clojurebot: clojure.lang.Symbol

11:46 sadger: oh we can't eval in here

11:46 i guess

11:46 asphalte: :(

11:47 sadger: dont want throwing dangerous code about

11:47 asphalte: "try this at home only"

11:47 sadger: yes

11:47 with safety goggles and a hard hat

11:47 asphalte: sounds wise

11:47 sadger: ;)

11:48 anyway I gotta get home and grab some food shopping

11:48 good $TOD to all $persons

11:48 gfredericks: maybe in the future lazybot will accept eval

11:48 I opened up an issue for it

11:48 asphalte: Catch you later. Thx for the discussion.

11:49 clgv: gfredericks: likely, it won't - since the sandbox would get headaches ;)

11:50 gfredericks: clgv: sandbox could redef eval to call itself

11:50 eval is what the sandbox does

11:50 in my primitive understanding at least

11:51 clgv: gfredericks: hmmm, could be possible

11:51 gfredericks: https://github.com/flatland/clojail/issues/2

11:55 jedmtnman: cool what are you using clojail for?

11:56 is flatland someone you will be working with. he's the one that started the utlis lib too

11:56 gfredericks: I'm not using clojail, just thought it would be cool if lazybot could eval

11:57 flatland is a group I believe

11:57 muhoo: clojure seems to lure me irresistably into code golf. is it just me, or is it the language?

11:58 i find myself yak shaving by making functions that work perfectly well as they are, 50% shorter, as a way of procrastinating

12:00 S11001001: muhoo: just say you're eliminating code paths, making the functions more reliable

12:00 muhoo: heh, thanks

12:03 &2r11001001

12:03 lazybot: ⇒ 201

12:03 gtrak: ,2r111

12:03 clojurebot: 7

12:04 gtrak: ,0xCAFEBABE

12:04 clojurebot: 3405691582

12:04 gtrak: ,010

12:04 clojurebot: 8

12:06 antares_: seancorfield: hi. What do you think about moving clj-time to lein2?

12:07 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:17 muhoo: [5~[5~[5~/sb end

12:19 wkmanire: muhoo: What does that mean?

12:20 muhoo: it means i typed a bunch of garbage in irssi while scrolling back, then told it to bring me here to the end :-)

12:21 /sb end means, scroll to the bottom

12:21 wkmanire: I thought a [5~ might be an ASCII fish or something.

12:21 muhoo: btw is there a library or function for composing urls? i suppose i could write one, but why reinvent the wheel?

12:22 RickInGA: wow, light table > 1000 backers

12:22 muhoo: like give it a map, and it gives me back http://foo.bar.com?baz=quux&blah=ahem ?

12:22 wkmanire: muhoo: 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:22 muhoo: all urlstringified etc

12:23 gtrak: i think someone just made one, maybe cemerick?

12:23 aniero: http://www.mail-archive.com/clojure@googlegroups.com/msg29338.html has an implementation

12:23 gtrak: https://github.com/cemerick/url

12:23 aniero: oh awesome

12:24 muhoo: wow, thanks

12:24 i 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:25 many thanks to them!

12:25 duck1123: https://github.com/michaelklishin/urly

12:25 wkmanire: Hey, that looks exactly like what I thought it would look like.

12:25 antares_: how do I type hint arrays of objects, like here: (into-array DateTimeParser parsers)?

12:26 S11001001: ,(.getName (class (into-array java.util.Date [])))

12:26 clojurebot: "[Ljava.util.Date;"

12:27 S11001001: like ^"[Ljava.util.Date;"

12:28 mmarczyk: ^objects works for Object []

12:30 amalloy: jedmtnman: you asked about flatland; you can come hang out in #flatland if you want

12:30 jedmtnman: amalloy: thanks!

12:32 wkmanire: muhoo: Because of Cemerick's book there are going to be a lot of people that program like him too I imagine.

12:32 Might come to call us Cemerickians or something cool like that.

12:34 muhoo: wkmanire: how are your explorations with clojure coming so far?

12:35 wkmanire: muhoo: Very well.

12:35 I built my first app a few days ago that is just a little guessing game.

12:35 I'm working on my second one now.

12:36 RickInGA: wkmanire what did you do for UI? noir? seesaw?

12:37 wkmanire: muhoo, RickInGA: https://github.com/wkmanire/clojureguessinggame/blob/master/src/guessing_game/core.clj

12:37 Just terminal.

12:37 RickInGA: cool

12:37 wkmanire: The second app is just a simple address book manager.

12:37 I'm unit testing it

12:37 I intend to use Swing for the UI.

12:38 amalloy: wkmanire: raw swing, or via seesaw?

12:38 wkmanire: https://github.com/wkmanire/clojureaddressbook

12:38 RickInGA: wkmanire seesaw is a wrapper for swing

12:38 and really cool

12:38 wkmanire: Well, I'd like to try to use clojure as much as possible.

12:38 As much as practical.

12:38 amalloy: i haven't used swing in years, and haven't used seesaw ever, but everyone says seesaw is way easier

12:38 wkmanire: So I'll take a look at seesaw.

12:39 RickInGA: http://blog.darevay.com/2011/12/a-seesaw-tutorial/

12:39 wkmanire: I'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:39 Anyway, nothing special. Just a newbie doing newb stuff.

12:40 technomancy: I 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:40 jdmmmmm: Could someone see my mistake leading to "Can only recur from tail position" with http://pastie.org/3817633 ?

12:41 TimMc: recur doesn't work across a lazy-* boundary

12:41 Oh, hmm...

12:41 hiredman: no, the problem is line 18

12:42 wkmanire: RickInGA: Wow, I'm looking over this tutorial and seesaw does look really good.

12:42 hiredman: 19

12:42 wkmanire: I used swing like about 6 years ago.

12:42 RickInGA: wkmanire: yeah, swing is actually fun when you can do it in a repl

12:42 wkmanire: IN Java, and I remember how much I disliked newing up handfuls of objects and setting properties on them to get my forms going.

12:43 tmciver: jdmmmmm: looks like recure is getting 3 args; the new-bindings on line 18 shouldn't be there?

12:43 RickInGA: wkmanire in a repl with seesaw loaded you can do (doc frame) and see what methods frame supports

12:43 TimMc: wkmanire: doto helps with that in Clojure :-)

12:43 hiredman: it is hard to read the indentation

12:44 wkmanire: doto?

12:45 jdmmmmm: tmciver: I don't see the three args; just two: (rest bindings) and the (lazy-cat ...)

12:45 amalloy: &(seq (doto (java.util.ArrayList.) (.add 5) (.add 1)))

12:45 lazybot: ⇒ (5 1)

12:47 Fullmoon: Let'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:47 gtrak: a semaphore?

12:48 amalloy: sounds like a job for...executors! i think?

12:48 gtrak: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Semaphore.html

12:49 wkmanire: Can I use lein to install seesaw?

12:49 RickInGA: yeah

12:49 wkmanire: https://github.com/daveray/seesaw

12:49 Fullmoon: I 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:50 duck1123: (Executors/newFixedThreadPool thread-count) is how I've done it

12:50 amalloy: gtrak: a semaphore is awfully low-level

12:50 http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html

12:50 gtrak: it's probably best to use the highest level thing that has the right semantics?

12:51 RickInGA: wkmanire: dependancy is [seesaw "1.4.0"]

12:51 wkmanire: RickInGA: I'm still trying to install it. Lein doesn't work to well for me on my windows box.

12:52 So it might have to wait until tonight when I get back to sanity.

12:52 As in, when I get to clock out and boot into windows.

12:52 Fullmoon: duck1123: That looks good, cool!

12:52 duck1123: wkmanire: you don't "install" it as much as you declare it a dependency of your project

12:53 RickInGA: wkmanire: 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:53 wkmanire: Yeah, lein crashed again with an IOException. The plugin install command seems to be borked because of permissions issues.

12:53 RickInGA: ah

12:53 seesaw isn't a plugin

12:54 you add it to your project dependencies

12:54 then type lein deps

12:54 its just a jar file

12:54 wkmanire: Is there a command for killing the REPL process?

12:54 RickInGA: ctrl-d

12:54 wkmanire: CTRL-C doesn't work in my windows command prompt emulator.

12:55 thanks.

12:55 that worked.

12:55 RickInGA: i have had issues in the past that the jvm is still running so I hav had to forecably shut them with task manager

12:56 wkmanire: I 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:56 amalloy: wkmanire: 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:56 wkmanire: amalloy: Hey, I got it all working on Linux just fine.

12:56 amalloy: :P

12:57 amalloy: You can't blame me for wanting to use lein's plugin install command to install plugins.

12:57 amalloy: indeed not

12:58 you just prematurely assume things are plugins, i guess

12:58 technomancy: if it has permissions issues it was probably run as the wrong user

12:58 wkmanire: technomancy: Could be, but windows should be using admin privs to run lein since the command window was run with admin privs.

12:59 Basically like being root.

12:59 RickInGA: I 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:59 wkmanire: /agree

12:59 technomancy: huh; very strange

12:59 wkmanire: amalloy: 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:00 technomancy: wkmanire: the plugin system in lein2 is different; might have better luck there

13:00 cmajor7: discussing trampoline with people made me wonder: how often do you use mutual recursion in clojure?

13:00 wkmanire: technomancy: Ok. Thanks.

13:00 RickInGA: technomancy in lein2 do plugins also install themselves, for example if I haven't installed noir will lein noir new mywebsite install noir pluggin?

13:01 amalloy: wkmanire: 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:01 duck1123: RickInGA: how would lein know what "noir" means?

13:01 wkmanire: No problems.

13:02 RickInGA: duck1123 no idea, but from what I understand it knows to lookup templates, so it may know where to look for plugins as well

13:03 duck1123: my understanding of templates is based on : https://github.com/ibdknox/cljs-template

13:07 technomancy: RickInGA: templates for lein new are a special case

13:07 that's the only place the install-on-demand logic is triggered

13:07 RickInGA: technomancy: cool, thanks!

13:11 muhoo: candidate for best project name: https://github.com/davidsantiago/pathetic

13:12 seancorfield: clj-time 0.4.1 with fewer reflection warnings - thank you michael klishin

13:14 duck1123: there are so many clever clojure project names. I don't think I could ever pick the best

13:15 Null-A: duck1123: there's a clojure app for that

13:24 gtrak: duck1123, do you need help naming something?

13:25 duck1123: gtrak: no, muhoo mentioned a cleverly named clojure project. I was pointing out that there are several great clojure project names

13:26 gtrak: oh yea. definitely

13:26 muhoo: ruby projects tend to have creative names too, like "texticle"

13:26 gtrak: haha

13:27 duck1123: I wonder how many -jure projects lein new has squashed

13:34 muhoo: i saw that in the code and lol'ed. it will literally reject -jure's

13:34 it needs to reject foo-clj and clj-foo now tooo

13:34 i should submit a patch to do that :-)

13:34 technomancy: muhoo: highly tempted

13:35 dnolen: ibdknox: I know your busy, but have you had a chance to try out the PHM patch?

13:36 ibdknox: dnolen: I haven't :(

13:36 I'll try to give it a go later today, what exactly are you wanting to see?

13:36 dnolen: ibdknox: yoklov more or less signed off on it. You're the other person that I know uses maps heavily CLJS.

13:36 ibdknox: rather, what are you worried about/verifying

13:36 dnolen: ibdknox: just that it's not crazy slow.

13:37 ibdknox: should there be improvement or is it just mostly a lateral move?

13:37 dnolen: ibdknox: on jsperf it looks good, but I'd like to get some verification on real apps.

13:37 ibdknox: yoklov saw 2X speed boost, but he was using large maps.

13:37 ibdknox: I'm curious about apps that use smaller maps.

13:37 ibdknox: I use mostly small ones

13:38 dnolen: ibdknox: yeah that's what I thought

13:38 ibdknox: dnolen: k, I'll give it a go later this afternoon and report back

13:39 zerokarmaleft: cemerick_away: what's the status on https://github.com/cemerick/raposo?

13:39 ibdknox: dnolen: looking at it here, is there an easy way to just apply all of the patches? (haven't dealt with .patch files much)

13:40 dnolen: ibdknox: 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:40 ibdknox: dnolen: great, thanks :)

13:41 dnolen: ibdknox: 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:41 ibdknox: thx much

13:42 jsabeaudry: im doing something ugly because I don't know better, what can i replace this with: (swap! my-atom #(do % new-value))

13:42 mmarczyk: ibdknox: note that if you use -strobj anywhere, this is going to break

13:42 ibdknox: hm

13:42 I think I did at one point as a hack

13:42 Raynes: ibdknox: curl http://dev.clojure.org/jira/secure/attachment/11055/0001-PersistentHashMap-ported-from-Clojure.patch | git am

13:43 ibdknox: Raynes: you rock

13:43 * Raynes files his nails.

13:43 ibdknox: :)

13:43 sadger: hello Raynes how is the book coming along

13:43 Raynes: Slowly.

13:43 It should be out by 2099.

13:44 sadger: ah nice i look forward to reading it on my deathbed

13:44 or in the afterlife depending on how it goes

13:44 mmarczyk: ibdknox: 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:44 Raynes: I'm taking it slow because once we have cryo chambers nobody is going to care how long something takes.

13:45 sadger: ah shrewd move

13:45 Raynes: mmarczyk: O, hai!

13:45 mmarczyk: Raynes: hi!

13:45 Raynes: Long time no see.

13:45 sadger: I am from dreamincode originally, that's where I found out abou it

13:45 mmarczyk: Raynes: indeed

13:45 pooya72: hello, 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:45 Raynes: sadger: I see. Welcome to Clojureland. Our tea is always hot.

13:46 sadger: Raynes: I do like tea, my brother is "simown" the python moderator actually, started learning clojure recently

13:46 Raynes: the functional programming forum is pretty dead though

13:47 Raynes: Indeed. Most of the posts are from people who are learning Haskell or Scheme in a school.

13:47 It'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:47 sadger: better than what I had to learn! Maude, some function abstract data type language so painful

13:48 technomancy: so 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&labels=Newbie&milestone=&sort=created&state=open

13:48 sadger: Raynes: Indeed and it's hiding away in Other Languages > Functional Languages

13:48 pablo_ns: sadger: You're the brother of Simon Willison ?

13:48 Raynes: I'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:48 sadger: pablo_ns: no

13:48 technomancy: sounds good how "newbie" are you talking

13:49 Raynes: ha ha

13:49 aaelony: Found a nice cookbook style clojure reference. What do people think? http://langref.org/clojure/all

13:50 Raynes: aaelony: Are you coming to lunch today?

13:50 pablo_ns: Is this code idiomatic in Clojure: (defn ask [& colls] {:ask (apply merge `(~@colls))}) ?

13:50 aaelony: I'll be there... traffic notwithstanding :)

13:50 technomancy: sadger: I was thinking new to the leiningen codebase rather than new to clojure itself, but depending on your background; dunno

13:50 Raynes: aaelony: Excellent. Look forward to meeting you. :)

13:51 aaelony: :) lol, we've met, but you don't remember

13:51 Raynes: orly

13:51 At a conj?

13:51 pablo_ns: It does work but doesn't seem very idiomatic to me. I'm sure there's an easier way.

13:51 aaelony: indeed

13:51 Raynes: Man, I've met so many people are those things.

13:51 sadger: technomancy: 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:51 aaelony: well, you're famous

13:51 Raynes: When you meet 30-40 people a day one after the other...

13:51 It's overwhelming.

13:51 sadger: Raynes: hide in your room and cry :)

13:52 Raynes: Anyways, I look forward to meeting you again and damn well remembering it this time.

13:53 aaelony: excellent ;)

13:54 Raynes: aaelony: eharmony, eh. Do they use Clojure there at all>

13:54 ?*

13:55 amalloy: pablo_ns: isn't (apply merge `(~@colls)) exactly equivalent to (apply merge colls)?

13:56 pablo_ns: amalloy: depends on the number of args

13:57 gfredericks: o_O

13:57 amalloy: supply a value for colls where that's true

13:57 aaelony: They're not averse to clj use. It's a java shop.

13:58 Biggest question is who will maintain your code when you've been hit by a bus?

13:58 pablo_ns: amalloy: this: (say {:option1 a :option2 b}) doesn't work with (apply merge colls)

13:58 Raynes: aaelony: Whoever they hire to do so.

13:59 duck1123: aaelony: that's why I argue that everyone around me should learn clojure

13:59 zerokarmaleft: aaelony: the scala guy

13:59 Raynes: aaelony: Or you could just.. you know, not die.

13:59 amalloy: &((fn [& colls] (apply merge colls)) {:option1 a :option2 b})

13:59 lazybot: java.lang.RuntimeException: Unable to resolve symbol: a in this context

13:59 amalloy: &((fn [& colls] (apply merge colls)) '{:option1 a :option2 b})

13:59 lazybot: ⇒ {:option1 a, :option2 b}

13:59 amalloy: &((fn [& colls] (apply merge `(~@colls))) '{:option1 a :option2 b})

13:59 lazybot: ⇒ {:option1 a, :option2 b}

14:00 amalloy: pablo_ns: try again? i guarantee you those two function bodies are identical, except the one with ~@ is slightly slower

14:00 aaelony: raynes: 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:00 TimMc: yup

14:01 technomancy: aaelony: just point out that you're less likely to leave the company if they let you use Clojure =)

14:01 TimMc: It's almost more work to learn the company's codebase than to a learn a new language.

14:01 aaelony: duck1123: indeed!

14:01 pablo_ns: amalloy: you're right! so weird.

14:01 amalloy: TimMc: "almost"

14:01 Raynes: TimMc: 'almost'?

14:01 amalloy: o/

14:01 aaelony: technomancy: i love it

14:01 TimMc: Well, it depends.

14:01 mmarczyk: "almost" ?! :-)

14:01 TimMc: OK, always.

14:01 You've convinced me.

14:01 muhoo: has 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:01 TimMc: with your clever rhetoric

14:01 technomancy: muhoo: clj-nstools sorta does that

14:01 amalloy: pablo_ns: weird how? consider the expansion of `(~@x):

14:01 &(quote `(~@x))

14:01 lazybot: ⇒ (clojure.core/seq (clojure.core/concat x))

14:02 Raynes: TimMc: I'm still unfamiliar with 80% of the codebase at work and I've learned 3 languages since I've been here.

14:02 duck1123: I 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:02 pablo_ns: amalloy: I mean my thought process to get to that piece of code, that's what was weird =)

14:02 amalloy: aha

14:02 mmarczyk: Raynes: out of curiosity -- which ones?

14:02 pablo_ns: amalloy: after you explained it seems so obvious

14:03 Raynes: mmarczyk: Elixir, Ruby (okay, I've semi-learned Ruby), and an imaginary language I added to sound smarter than I actually am.

14:03 Null-A: I'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:03 thearthur: happen to know where repl-utils/show went in the clojure.contrib reshuffle?

14:03 mmarczyk: Raynes: oh, good idea

14:03 Raynes: I think I'll learn that last one myself

14:03 Null-A: languages are so trivially different

14:03 gfredericks: Null-A: because they go on resumes. Things on resumes take significant effort.

14:03 muhoo: duck1123: 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:03 otherwise

14:04 pablo_ns: Raynes: What do you think of Elixir?

14:04 aaelony: I'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:04 Raynes: pablo_ns: Good stuff.

14:04 pablo_ns: Raynes: I was very excited about it myself until I learned Clojure

14:04 technomancy: gfredericks: FWIW "implemented a scheme" has a really high impressive-on-resume to effort ratio

14:05 muhoo: technomancy: clj-nstools doesn't exactly do that, but thanks.

14:05 Null-A: technomancy: just do that write a scheme interpreter in 24 hours tutorial

14:05 Raynes: Null-A: He wrote scheme on a bus.

14:05 pablo_ns: Raynes: 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:05 Raynes: He had to fold his ego 6 times to get out the door at his destination.

14:05 gfredericks: technomancy: that's a funny one if you don't know what "scheme" means but think you do

14:06 Null-A: if you write scheme with clojure, doesn't take long at all

14:06 gfredericks: "...but it was foiled"

14:06 Null-A: haha

14:06 Raynes: pablo_ns: Sure, I'm writing a build tool for it and I've contributed code to core (like a URI library).

14:06 technomancy: gfredericks: heh

14:06 pablo_ns: Raynes: have you seen Joxa?

14:07 Raynes: pablo_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:07 I'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:07 muhoo: c

14:08 zamaterian: Raynes, have you looked at erjang ?

14:08 trilisp: Hi, who has signed to take the introduction to Clojure at codelesson?

14:08 Raynes: Have you ever looked down to see if you were wearing pants

14:09 pablo_ns: Raynes: 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:09 Raynes: pablo_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:10 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:11 Iceland_jack: Raynes: the start-up speed makes it impossible to use for certain things sadly

14:11 aaelony: what's interesting is that clojure is colonizing python and perhaps other hosts soon :)

14:12 Raynes: Iceland_jack: Is Joxa any better? Will it always be better? Furthermore, wont clojure-py eventually solve this if it doesn't already?

14:12 Certainly clojurescript doesn't have a slow startup problem.

14:12 pablo_ns: Raynes: 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:12 Raynes: pablo_ns: Totally agree. That would have been more interesting to me.

14:13 Iceland_jack: Joxa being slow doesn't make Clojure any more suitable

14:13 pablo_ns: aaelony: oh yes, Clojure-py will be a game changer for me if it ever sees a stable version.

14:13 technomancy: I could see another lisp making sense that targeted embedded devices where persistent data structures would be infeasible

14:13 Raynes: Iceland_jack: Then I don't understand what we're talking about.

14:13 Iceland_jack: Raynes: "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:13 technomancy: then again, maybe just a Clojure dialect with array literals would fit the bill

14:13 muhoo: someone will write a clojure for erlang beam vm

14:14 Iceland_jack: I was just saying that there's still a market for other Lisps

14:14 Raynes: No there isn't. There is a market for a stable Clojure on a platform with faster startup time.

14:14 Like Python.

14:14 Iceland_jack: wow, ok

14:14 Raynes: I'm not saying nobody can ever make another Lisp ever.

14:14 pablo_ns: technomancy: Lua perhaps?

14:14 Raynes: I'm just saying that Clojure hasn't completely lost the startup time battle.

14:15 Iceland_jack: I'm not talking about “losing” any battles

14:15 technomancy: pablo_ns: I don't know anything about embedded systems, so I'm just making everything up =)

14:15 hiredman: "embedded devices" not small anymore

14:15 $100 will get you something with a 1ghz cpu and gobs of ram

14:16 Raynes: Iceland_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:16 muhoo: i have run clojure on a beagleboard

14:16 it was fine, no problems

14:16 technomancy: hiredman: yeah... maybe real-time scenarios where GC delays aren't acceptable?

14:16 no idea

14:17 amalloy: hiredman: $100 is way too much for the cpu in many products, though, right? i'm not sure what point you're making

14:17 aaelony: hiredman: the singularity is near... lol

14:18 duck1123: aaelony: when approaching the singularity, it's the last mile that gets you

14:18 pbostrom: I 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:18 gtrak: you'd never use it to replace C, but people use python in embedded stuff, too, it could do that

14:18 technomancy: Xeno's singularity

14:18 hiredman: amalloy: my point is people tend to think of embedded systems they think of limited devices

14:18 aaelony: duck1123: lol

14:19 pablo_ns: hiredman: I agree. But today's power house is tomorrow's limitations.

14:20 aaelony: technomancy: Xeno, Kurzweill, ...

14:20 gfredericks: what do http proxies do about host headers?

14:21 muhoo: wow. (> (comp cemerick.url slurp cheshire) (PreBakedAPILibrary. ))

14:21 aaelony: http://www-rohan.sdsu.edu/faculty/vinge/misc/singularity.html

14:21 LauJensen: Evening gents

14:22 zamaterian: LauJensen, God Aften

14:23 goodieboy: what'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:23 gfredericks: some-fn

14:23 pablo_ns: What 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:23 gfredericks: ,(map (some-fn true? false? nil? neg?) [nil :foo -3 4])

14:23 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number>

14:24 gfredericks: eh whatever

14:24 goodieboy: ha thanks gfredericks

14:24 gfredericks: is some-fn a clojure 1.3 function? I don't seem to have it

14:24 ,(doc some-fn)

14:24 clojurebot: "([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:24 gfredericks: ,(meta #'some-fn)

14:24 clojurebot: {: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:25 gfredericks: looks like it

14:25 goodieboy: ahh ok

14:25 pablo_ns: I think we've probably seen 1% of what's possible between Clojure & ClojureScript integration.

14:25 goodieboy: rats

14:25 muhoo: hmm, actually clj-http, not slurp, if i want to do POSTs and PUTs. still great tho

14:25 dakrone: muhoo: :)

14:25 gfredericks: goodieboy: easy to write your own until you upgrade

14:25 goodieboy: true

14:25 muhoo: dakrone: thanks for clj-http!

14:26 dakrone: muhoo: you're very welcome, thank Mark McGranaghan also

14:27 gfredericks: dakrone: can I add an issue for coming up with a pronunciation that is less than seven syllables?

14:27 technomancy: gfredericks: gnir!

14:27 gfredericks: gnir!?

14:27 dakrone: gnir is awesome, but I'd worry about people not being able to find it

14:27 technomancy: gfredericks: it's the reverse of ring, natch

14:28 gfredericks: ah ha; I see this has been discussed before

14:28 googling "natch" was more fruitful than googling "gnir"

14:29 technomancy: oh man... super mega high-fives to xeqi for this: http://clojars.org/clj-http/versions

14:30 ibdknox: technomancy: not that I currently have time do anything about it, but we should just rewrite clojars.

14:30 technomancy: ibdknox: working on it

14:30 ibdknox: :)

14:30 goodieboy: is there a predicate function for testing if something is a regular expression?

14:30 gfredericks: $findfn #"foo" true

14:30 lazybot: [clojure.core/== clojure.core/distinct? clojure.core/boolean clojure.core/< clojure.core/= clojure.core/> clojure.core/>= clojure.core/<=]

14:30 technomancy: or more accurately, xeqi is working on it and I'm going to be working on it

14:31 gfredericks: o_O goodieboy: can at least test its type

14:31 technomancy: ibdknox: have you seen http://groups.google.com/group/clojars-maintainers/browse_thread/thread/77c1cd77e478bb0f ?

14:31 goodieboy: ok thanks

14:34 gfredericks: goodieboy: (def regex? (partial instance? java.util.regex.Pattern))

14:34 ibdknox: technomancy: I hadn't

14:35 goodieboy: gfredericks: oh nice, better than what i just came up with: (defn- re? [x] (= (type x) java.util.regex.Pattern))

14:35 technomancy: ibdknox: that's the plan. feedback welcome.

14:35 gfredericks: goodieboy: point-free code for greater job security!

14:36 tscheibl: Hallo Bernhard

14:36 http://www.heise.de/hardware-hacks/artikel/Angetestet-TinkerForge-Elektronik-Baukasten-1500925.html

14:36 lies dir das mal durch

14:36 goodieboy: gfredericks: what is point-free code?

14:37 tscheibl: oops.. wrong window.. sorry

14:37 gfredericks: goodieboy: I think it's just coding without locals (like the x in your version)

14:37 goodieboy: gfredericks: ahh yes, much cleaner

14:50 trilisp: Hi, anyone registered to the introduction to clojure at codelesson?

14:51 Roxxi: So, is this the right place to ask some newb Clojure questions?

14:51 scriptor: yep

14:55 Roxxi: Awesome. 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:55 bar.clj file is

14:55 (ns my-project.bar

14:55 (:require [cheshire.core :as cheshire])

14:55 (:use [my-project.foo]))

14:55 When I run this in the repl, I get an error saying it can't find the foo class

14:56 partcularly FileNotFoundException Could not locate my-project/foo__init.class or my-project/foo.clj on classpath: clojure.lang.RT.load (RT.java:430)

14:57 hiredman: what is the actual file path?

14:57 Raynes: Roxxi: foo.clj exists at src/my_project/foo.clj?

14:59 Roxxi: pwd: ~/clojure/my-project/src/my-project

14:59 ls: core.clj foo.clj bar.clj

14:59 so, yup

14:59 amalloy: my_project

14:59 not my-project

14:59 Roxxi: ah, really? Thanks, I'll try that.

15:00 is that the same for .clj files too? i.e. foo-bar.clj should be foo_bar.clj?

15:00 Bronsa: yes

15:00 amalloy: yes

15:00 clojure namespaces are (roughly) java packages, and those can't have - in them

15:01 technomancy: `lein new` should have handled that for you though

15:02 Roxxi: well, names were changed to protect the innocent :) But my files had foo-bar.clj type names

15:03 but, that was it! Thanks!

15:03 sadger: I have a similarly named project "lein new foo-bar" gives you a foo-bar namespace in core.clj

15:04 technomancy: boo =(

15:05 scriptor: feex eet

15:05 technomancy: clojurebot: patches?

15:05 clojurebot: Cool story bro.

15:05 technomancy: =(

15:06 sadger: it's feels right to name projects like that as it is how you would write multi word functions

15:06 bit of a pain though :P

15:08 ibdknox: anyone know of an alternative to aleph for TCP?

15:08 other than going to the Java socket stuff, of course

15:09 potemkin doesn't seem to play nicely with my updated compiler :(

15:09 technomancy: there's momentum

15:11 ibdknox: oo

15:11 technomancy: aw yeah

15:11 ibdknox: that looks like it might work

15:11 technomancy: gnir

15:11 ibdknox: ring backwards?

15:12 technomancy: yeah

15:12 aka clj-http

15:12 ibdknox: lol

15:12 Bronsa: lol

15:12 scriptor: hah

15:13 technomancy: 3-lol combo; very good!

15:13 fliebel: ibdknox: I just dropped in, are you lookign for an http *client*? neotyk demoed something around that async cline t ysed by sonatype.

15:14 ibdknox: nope, TCP

15:14 fliebel: oh, hm. I meant this one, in any case: https://github.com/neotyk/http.async.client

15:15 weavejester: dakrone: Would you be interested in link header support in clj-http, or do you think that would be a separate library?

15:15 TimMc: kludge hit-up

15:16 pablo_ns: Anyone used Cloudbees to deploy web apps? I've hit a wall with GAE and I'm thinking either Heroku or Cloudbees.

15:17 ibdknox: weavejester: I see you have a TCP server, you don't happen to have TCP client, do you? :)

15:17 pablo_ns: heroku is incredibly simple, fwiw

15:17 weavejester: ibdknox: Nope, and the TCP server I have is pretty basic. :)

15:17 ibdknox: okidoke, gonna give this momentum thing a try then!

15:18 pablo_ns: ibdknox: plus I believe heroku support is built into Noir right? But not Cloudbees?

15:18 ibdknox: pablo_ns: not sure about Cloudbees, yes for heroku

15:18 lein noir new ... produces something immediately pushable to heroku

15:19 weavejester: ibdknox: Isn't it more that Heroku supports any Clojure project with a defined :main property?

15:19 ibdknox: I mean, you're not doing anything special for Heroku, right?

15:19 ibdknox: weavejester: you need to have the port selection stuff

15:19 pablo_ns: ibdknox: thanks, I'll try Heroku first

15:19 ibdknox: weavejester: for http anyways

15:19 weavejester: ibdknox: Oh yes, that's true.

15:20 ibdknox: weavejester: past that, nothing :)

15:20 dakrone: weavejester: I'm not familiar with link headers, let me look them up

15:20 weavejester: dakrone: http://www.w3.org/TR/REC-html40/present/styles.html#h-14.6

15:21 dakrone: They're becoming commonly used for pagination in APIs.

15:21 hiredman: "abused for"

15:21 weavejester: dakrone: http://developer.github.com/v3/#pagination

15:22 hiredman: Why abused?

15:22 technomancy: is that like an HTTP equivalent of meta rel=next/prev?

15:23 TimMc: <link rel>

15:23 weavejester: technomancy: Yep. It's a way of specifying <link> elements as HTTP headers.

15:23 pablo_ns: weavejester: I was talking to brehaut the other day, do you think a universal "reverse url" ring utility is possible?

15:23 technomancy: cool

15:23 dakrone: weavejester: wow, that is a strange use of Link, but I guess it makes sense

15:23 technomancy: I wish rel=next/prev were more common

15:23 it sucks that muggle browsers ignore them

15:23 dakrone: weavejester: not sure what support would look like, but I'd be interested in seeing it

15:24 technomancy: automatic lazy pagination with clj-http would be sweet if we could somehow turn drop into a no-op

15:24 weavejester: dakrone: Well, like how cookie headers are parsed into the :cookies key, link headers could be parsed into a :link map

15:24 dakrone: weavejester: that would be nice to add

15:24 weavejester: dakrone: So you could do something like: (-> response :links :next :href)

15:24 Fullmoon: Can i somehow get a lazy seg that returns a every ten items from another lazy set on every invocation?

15:24 *lazy seq

15:25 technomancy: Fullmoon: lazy seqs are cached

15:25 weavejester: pablo_ns: A universal "reverse url" isn't really possible, because routing logic could potentially be complex.

15:25 technomancy: so running over them multiple times is guaranteed to get the same result

15:25 dakrone: weavejester: 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:25 weavejester: pablo_ns: But you could have a simplified version.

15:25 Fullmoon: technomancy: I am looking for something like ruby's in_groups_of(10)

15:26 weavejester: pablo_ns: That would work for, say, 95% of cases.

15:26 dakrone: I'll send you a pull request :)

15:26 pablo_ns: weavejester: at least a compojure one with support for "context"? I've been thinking about it a lot lately

15:26 technomancy: Fullmoon: oh, probably partition-all then

15:27 ,(partition-all 3 (range 10))

15:27 clojurebot: ((0 1 2) (3 4 5) (6 7 8) (9))

15:27 Fullmoon: technomancy: That looks great, thanks!

15:27 weavejester: pablo_ns: Compojure routes are hard, because whether they match or not can be due to any code.

15:28 technomancy: Fullmoon: there was a Ruby Enumerable => Clojure seq cheat sheet somewhere; might want to see if you can find it

15:28 it's pretty old, but the core stuff hasn't changed

15:28 weavejester: pablo_ns: But I've been thinking about a way of grouping routes into a resource

15:28 pablo_ns: Which would be reversible

15:28 edw: Has anyone gotten a CLJS REPL running *in* the browser?

15:29 weavejester: pablo_ns: So kinda like a reversible "context"

15:29 aniero: what's the best up-to-date clojure reference? read the source?

15:29 TimMc: edw: Define "in".

15:29 edw: https://github.com/fogus/himera

15:29 weavejester: edw: http://himera.herokuapp.com/index.html ?

15:29 Hah

15:29 edw: TimMc: I'm typing into the browser, not into a terminal.

15:29 weavejester: Thanks!

15:30 TimMc: Just don't try to divide numbers.

15:30 edw: (It was fogus's tweet on the subject that led me to ask.)

15:30 pablo_ns: weavejester: 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:31 weavejester: pablo_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:31 pablo_ns: I kinda wonder how necessary reversing routes is if you keep things simple.

15:31 Roxxi: So, 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:31 keep getting this error, even though I turned "poo" into "poop". More magic I'm missing?

15:32 I also tried lein clean, compile no changes there

15:32 technomancy: aniero: clojuredocs.org and the mark volkmann article are decent

15:32 pablo_ns: weavejester: 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:33 weavejester: very large for average ring apps, that is. =)

15:34 weavejester: I have problems with the way some frameworks do MVC… though I don't know Django nearly as well as I do Rails.

15:35 ibdknox: pablo_ns: why not just have a file that defs a bunch of route strings?

15:36 and use those

15:36 you can do the equivalent in noir and use url-for to do filling in and such

15:37 aniero: technomancy: 'course clojuredocs are out of date now, since 1.4 was released... :)

15:38 pablo_ns: ibdknox: that works, and it is part of my approach, but it doesn't seem scalable.

15:38 ibdknox: pablo_ns: in what way?

15:38 pablo_ns: I mean you have to write them down somewhere right?

15:38 technomancy: aniero: yeah, luckily actual breaking changes are very rare

15:38 pablo_ns: ibdknox: it breaks down if I use moustache, for example.

15:39 ibdknox: I didn't know people still used moustache lol

15:39 technomancy: so you're just missing obscure references

15:39 ibdknox: pablo_ns: not sure how that applies to scale though? it's not often people switch routing frameworks

15:40 pablo_ns: ibdknox: and I run into some circular import issues.

15:40 ibdknox: pablo_ns: that's why you put them in a single file that is just (def admin "/admin")

15:40 there are no circular dependencies then :)

15:41 since a file with just a bunch of strings in it doesn't need to depend on anything

15:41 pablo_ns: ibdknox: oh, I see. a separate namespace for those defs

15:41 ibdknox: pablo_ns: yessir. myapp.routes or some such

15:41 technomancy: have you ever used momentum - it seems like I would really like it.. if I could get it to work :)

15:42 technomancy: ibdknox: no, just heard about it a few days ago

15:42 pablo_ns: ibdknox: I'll think about it, thanks!

15:43 kovasb: what is this 'momentum' ? hard to google

15:44 Bronsa: i'm guessing https://github.com/momentumclj/momentum

15:44 kovasb: thanks!

15:45 ibdknox: hah

15:45 for future reference, one must start the reactors

15:45 not sure if I just missed that or it wasn't written anywhere :p

15:46 goodieboy: anyone know how i can add custom mime-types using ring and/or compojure?

15:46 I tried (wrap-file-info {"type" "handler") in my middleware, but that doesn't seem to do the trick

15:47 ibdknox: the resources route takes mime-types

15:47 as I recall

15:48 goodieboy: https://github.com/weavejester/compojure/blob/master/src/compojure/route.clj#L24

15:48 huh

15:49 that just delegates to wrap-file-info though

15:49 (wrap-file-info {"less" "whatever-ct-less-is"})

15:50 goodieboy: ibdknox: interesting hmm, i'll try it again

15:51 weavejester: goodieboy: The map is for wrap-file-info is {file-extension mime-type}

15:52 goodieboy: weavejester: ok cool, so does this look right? {"cur" "image/vnd.microsoft.icon"}

15:52 weavejester: goodieboy: Looks it.

15:53 goodieboy: That would make anything ending in ".cur" have the content type of "image/vnd.microsoft.icon", assuming there's no content-type already.

15:54 goodieboy: Is this a static resource? If so, you can add the types directly to the route/resources function.

15:54 BostX: does anyone use lein-tarsier? Do you know what to do when I get "Error executing Nail! (227)"

15:54 ?

15:54 goodieboy: weavejester: yes it is a static resource

15:55 weavejester: goodieboy: In which case...

15:55 emezeske: BostX: I'd start by making sure that "lein vimclojure" is running in your project somewhere

15:55 weavejester: goodieboy: (route/resources "/" {:mime-types {"cur" "image/vnd.microsoft.icon"}})

15:56 goodieboy: weavejester: ahh ok, i'll try that

15:56 BostX: emezeske, my lein-tarsier works if I use it on a local machine

15:56 emezeske: BostX: Then I'd check to make sure that the nailgun binary "ng" is in your PATH

15:56 BostX: emezeske, but I get "Error executing Nail! (227)" when trying to connect to a remote computer

15:57 emezeske: BostX: Oh

15:57 BostX: I've never tried that before.

15:58 BostX: When I run "lein vimclojure", I see "Starting VimClojure server on 127.0.0.1, port 2113"

15:58 BostX: Have you configured it to listen on 0.0.0.0 or the outside IP instead of 127.0.0.1?

15:58 BostX: emezeske, on 0.0.0.0 ? are you sure? I start it as

15:59 emezeske, lein vimclojure :host 192.168.178.21 :port 2113

15:59 sadger: I use the vimclojure plugin and lein nailgun seems to work equally

15:59 emezeske: BostX: "0.0.0.0 or the outside IP"

15:59 BostX: emezeske, no no, Im on a local network

15:59 emezeske, and then I get

15:59 emezeske: BostX: Yeah, by outside IP I just mean the one that you can connect to

16:00 BostX: Anyway, I can't help, good luck

16:00 goodieboy: weavejester: is it possible to define a patterned route with route/resources? Something like #".*\.cur" ?

16:00 BostX: emezeske, All namespaces already :aot compiled

16:00 emezeske, Starting VimClojure server on 192.168.178.21, port 2113

16:00 emezeske, Happy hacking!

16:00 weavejester: goodieboy: No, but you can always wrap it in more complex middleware

16:01 goodieboy: weavejester: gotcha ok

16:01 pablo_ns: weavejester: is it possible to serve multiple Compojure apps from one Jetty process?

16:01 BostX: emezeske, well I use lein2 at the moment but I get the same "Error executing Nail! (227)" when using lein 1.7.1

16:02 weavejester: pablo_ns: Yes, because a Compojure app is just a route.

16:03 muhoo: oh this is so frickin awesome. i was able to replace an entire java API client library with this: https://refheap.com/paste/2234

16:03 weavejester: pablo_ns: You'd just combine your apps into a larger route with defroutes/routes and context

16:04 muhoo: i love this damn language.

16:04 weavejester: muhoo: I'm a fan of clj-http :)

16:04 sadger: what are the pros/cons at using lein vimclojure over using the nailgun server with the vimclojure bundle for vim?

16:05 weavejester: I've spent quite some time going through all the Ruby HTTP client libraries, looking for one that supported various things like streaming bodies.

16:05 pablo_ns: weavejester: so separate apps with different deployment strategies would have to be started up by separate processes?

16:05 weavejester: And clj-http just blows them all out of the water.

16:06 BostX: sadger, hmm gut question... maybe less stuff to configure, easier for newbies, etc

16:06 weavejester: weavejester: If they have different deployment strategies, surely they're separate processes by definition?

16:07 sadger: BostX: I found the vim plugin very simple to work, but maybe I was lucky t

16:07 pablo_ns: weavejester: yes, but it just seems wasteful when the apps are low traffic. the JVM is such a memory hog.

16:08 BostX: sadger, im not that lucky... Im trying to get it work over local network but I get "Error executing Nail! (227)"

16:08 sattvik: BostX: Are you sure that Vim is looking at the right port?

16:08 pablo_ns: weavejester: I was thinking along the linest of vhosts

16:08 sattvik: The default is 2114, I think.

16:09 BostX: hi sattvik

16:09 sattvik, :) no it is 2113

16:10 sattvik: Ah, that's right.

16:10 BostX: sattvik, I may try to check my if my i have that port opened. I did open it but one never knows

16:11 sattvik: You could try telnetting to that port, or doing something like using curl or wget to try to connect.

16:12 weavejester: pablo_ns: I thought you said the problem was the JVM being a memory hog?

16:13 pablo_ns: If your apps can't be deployed together, surely that means they also can't be in the same JVM by definition?

16:13 pablo_ns: If they can be, then you can just use defroutes and context to combine them.

16:13 BostX: sattvik, telnet 192.168.178.21 2113

16:14 sattvik, Connected to 192.168.178.21. - looks like the port is opened and the server is running

16:14 sattvik: oh, did you set the nailgun host in your vimrc?

16:14 That defaults to 127.0.0.1, as well.

16:15 BostX: sattvik, nailgun host?

16:15 mtm_: hmm, just noticed that (every? true? nil) returns 'true'; that just seems wrong

16:15 BostX: sattvik, I started it with lein2 vimclojure :host 192.168.178.21 :port 2113

16:15 sattvik: i.e: let vimclojure#NailgunServer = "192.168.178.21"

16:16 The lein2 command tells the server where to listen, but your client needs to know where to connect to.

16:16 BostX: sattvik, and I set let vimclojure#NailgunServer = "192.168.178.21" in my .vimrc

16:16 sattvik: Hmm...

16:17 pablo_ns: weavejester: 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:17 BostX: sattvik, on another computer where Im editing the code in gvim

16:17 mtm_: ,(every? true? nil)

16:17 clojurebot: true

16:17 weavejester: pablo_ns: Well, of course it is. What's the difference between an app and a set of routes?

16:18 Iceland_jack: everything of nothing satisifes ⊥

16:18 and no something of nothing satisfies ⊤

16:18 mtm_: ,(every? true? nil)

16:18 clojurebot: true

16:18 mtm_: that just seems wrong

16:18 Iceland_jack: You've posted that example 3 times mtm_

16:18 mtm_: ugh, sorry

16:19 bad IRC connection

16:19 Iceland_jack: you may also feel that ##(*) or ##(+) are wrong

16:19 lazybot: (*) ⇒ 1

16:19 (+) ⇒ 0

16:19 ynniv: anyone know if aleph is practical for a commercial app yet?

16:19 Iceland_jack: It's a matter of definition

16:19 sattvik: BostX: What happens if you run 'ng --nailgun-server 192.168.178.21 ng-stats' on the client/gvim machine?

16:20 ynniv: a small commercial app, but non-academic none-the-less

16:20 pablo_ns: weavejester: 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:20 Banaaninkont: Iceland_jack, no it's not, if you define it differently stuff goes wrong

16:21 the sum of nothing is the additive identity, the product of nothing the multiplicative identity

16:21 If you have it any other way stuff actually goes wrong

16:21 weavejester: pablo_ns: Ah, I see. You'd need separate classloaders for that, but that sounds like a separate problem.

16:21 pablo_ns: And I think I'd prefer independent processes over classloaders :)

16:21 Banaaninkont: Besides, (*) >> 0 obviously follows from x^0 = 1, which follows from rules on expontents and all

16:21 Iceland_jack: Yes, but that doesn't change it that you could define the multiplication of nothing to be an exception

16:21 BostX: sattvik, hmm... it says I need to install ng at first

16:22 Banaaninkont: x^0 = x^1/x^1 = x/x = 0 (assuming x != 0)

16:22 = 1*

16:22 Iceland_jack, not at all

16:22 it follows from the arithmetic rules

16:22 Iceland_jack: What rules again?

16:22 BostX: sattvik, that's strange cause I can use your lein-tarsier when connecting to a server running the same machine

16:22 Banaaninkont: See above x^0 = x^1/x^1 = x/x = 1

16:22 mtm_: 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:22 Banaaninkont: Assuming x != 0

16:23 Iceland_jack: Right, it was a joke

16:23 Banaaninkont: x * 0 = 0, therefore, the sum of nothing at all is 0

16:23 Iceland_jack: Banaaninkont: Math is all about definition and you can define things arbitrarily

16:23 Banaaninkont: And that x * 0 = 0 is indeed an axiom of arithmetic by the way

16:23 True

16:23 Iceland_jack: So you can define things to “not make sense”

16:23 Banaaninkont: but what I m saying is that x^0 = 1 and x * 0 = 0 follows from the axiomns that lead to everything else

16:23 Quite

16:24 but you can't just have the other rules without this

16:24 this follows from the other rules

16:24 Iceland_jack: and indeed many things were discovered not to make sense so they were changed

16:24 Banaaninkont: mtm_, not at all, the conjunction of nothing is true, the disjunction of nothing is false.

16:25 pablo_ns: weavejester: Classloaders... i'll look into that, thanks.

16:25 Banaaninkont: You can actually 'exponentiate' over conjunction, it doesn't have to be binary.

16:25 weavejester: (every? true? nil) should be true. I can't see why it should be anything else.

16:25 hiredman: pablo_ns: what you want is immutant, they have a website and #immutant

16:25 sattvik: BostX: From the same client/configuration? That does odd.

16:25 technomancy: weavejester: well... (every? true? ()) should be true

16:25 Banaaninkont: You can like say that true!6 is like true & true & true & true & true

16:25 sattvik: s/does/does seem/

16:25 weavejester: pablo_ns: Look up classlojure and um..

16:25 technomancy: nil-punning there is debatable

16:25 mtm_: (every? any-predicate nil) is true

16:26 Banaaninkont: Indeed

16:26 the conjunction of nothing is true

16:26 weavejester: technomancy: Isn't it idiomatic Clojure to treat nil the same as an empty seq for the purpose of iteration?

16:26 Banaaninkont: that's just logic, if you have it any other way it leads to inconsistencies

16:26 Assuming the law of excluded middle, therefore it is true.

16:26 mtm_: I suppose, just means I have to guard for that case

16:26 charles_r: anyone have experience setting up slime/swank in emacs can help me get through a tutorial where I got stuck?

16:26 weavejester: I didn't know about Immutant.

16:27 BostX: sattvik, the ng --nailgun-server ... opened something and now I need to find out how to close it

16:27 Banaaninkont: mtm_, I beg to differ, using that case as the base case is often very useable in recursion

16:27 BostX: sattvik, :)

16:27 Banaaninkont: Indeed, it is how you would define it

16:27 technomancy: weavejester: the new laziness stuff moved us away from certain types of nil-punning... maybe that's not relevant here though.

16:27 hiredman: weavejester: apps get their own isolated classloader, etc

16:27 pablo_ns: hiredman: immutant fits the bill perfectly, thanks

16:27 technomancy: anyway, I guess we're not getting away from nil on the JVM's type system =(

16:27 sattvik: BostX: I think you can just ctrl-c. If you add 'ng-stats' to the command, it should print a little summary and exit.

16:28 Banaaninkont: (defn [every? p l] (if (empty? l) True (and (p (first l)) (every? p (rest l)))) it is I believe

16:28 * hiredman as one of 4 people that showed up to the immutant bof at the last conj

16:28 hiredman: was

16:28 BostX: sattvik, ctrl x, ctrl c quits the emacs

16:28 pablo_ns: hiredman: funny cos I googled like hell and it never showed up anywhere

16:29 mtm_: 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:29 Banaaninkont: mtm_, can I see that code?

16:30 I 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:30 programs tend to flow in that way

16:30 BostX: sattvik, oh I got on "java.lang.NegativeArraySizeException" on my server

16:30 sattvik, at vimclojure.nailgun.NGSession.run(NGSession.java:199)

16:30 ynniv: clojure should have a big nil-punning warning label

16:31 I lost half a day a while ago to that :(

16:31 mtm_: (defn existence-map? [m]

16:31 (every? true? (vals m)))

16:31 Banaaninkont: Clojure should have TCO

16:31 mtm_: in my case I want to treat empty maps as maps

16:31 devn: Banaaninkont: talk to the java folks

16:31 Banaaninkont: I know

16:32 ynniv: TCO and try/catch keep me from fully embracing clojure

16:32 Banaaninkont: mtm_, well, surely empty maps are treated as maps here right?

16:32 S11001001: ynniv: perhaps clojure-scheme has tco :)

16:32 ynniv: is there a clojure-scheme?!

16:32 where do I sign up! :)

16:33 mtm_: this fn is being used to detect sets in deserialized JSON (which doesn't support sets; I have them encoded as existence maps)

16:33 ynniv: I was one of the two people who voted for clojure being ported to common lisp

16:33 but at some point I have to wonder if the problem isn't with clojure...

16:34 technomancy: CL doesn't have immutable strings

16:34 so it'd be a bit of a nightmare

16:35 Banaaninkont: CL has the difference between mutable and immutable strings right?

16:35 At least, most implementations do if I recall correctly.

16:35 mtm_: so {:a true :b true} would be the encoding coming back from deserialized JSON for the set #{:a :b}

16:35 sattvik: BostX: That might be related to your 'ng' use. Does that happend when trying to do things from gvim?

16:36 ynniv: technomancy: interop would be exciting, but surely it isn't difficult to create an immutable string type

16:36 BostX: sattvik, no I was looking away when the exception came and now I cannot reproduce it :(

16:36 mtm_: back in a bit

16:38 sattvik: BostX: What's the reason Vimclojure gives?

16:38 BostX: sattvik, the same error as before "Error executing Nail! (227)"

16:38 ynniv: but 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:40 BostX: sattvik, again, what I find really strange is that it works when editing in vim on the same machine where lein2 vimclojure :host ... :port ...

16:40 sattvik, but it does not work when trying to edit a file from on a remote machine

16:41 sattvik: Have you tried launching the server on the remote machine to verify that it works locally there?

16:42 BostX: sattvik, yes I did

16:43 sattvik, I can try to run the ng --nailgun-server ... on the vimclojure server machine

16:43 sattvik: Hmm... I wish I knew what that error code meant.

16:44 BostX: sattvik, btw when I quit the telnet session started from remote machine I get an error:

16:45 sattvik, EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197)

16:45 sattvik: BostX: I think that's normal.

16:46 BostX: sattvik, yea... at least it shows that the vimclojure server hasn't been frozen

16:47 sattvik: BostX: 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:48 BostX: sattvik, no problem it's just my hobby project.. thx a lot anyway!!!

16:51 goodieboy: anyone here deploy their ring apps to beanstalk?

16:57 charles_r: I need a working repl for clojure. Can someone help me?

16:57 sandbags: i'm losing a certain amount of patience with the Prag's clojure book

16:58 it seems to be completely all over the place

16:59 instead of building up from simpler concepts to more complex ones

16:59 they just throw a bucket of stuff at you over and over

16:59 and then refer to later parts of the book

17:00 like 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:00 kovasb: charles_r: what have you tried so far ?

17:00 charles_r: lein repl, sublime text repl

17:00 kovasb: its not working at all?

17:01 or just not in the way you want it to work?

17:01 charles_r: I would like something that can auto-indent correct so I don't have to space over every time

17:01 kovasb: that is a code editor feature

17:01 not really a repl feature

17:02 charles_r: then I want a repl that can talk to an editor

17:02 jedmtnman: charles_r: have you tried using swank

17:02 charles_r: I am trying unsuccessfully to get swank installed

17:02 kovasb: I haven't used sublime, but I would guess it allows you to evaluate forms that are in the editor

17:02 usually you have to place the cursor after the form in question, and then execute some command

17:03 thats how it works in emacs

17:04 also i think clooj has that feature

17:05 charles_r: I've tried clooj.

17:05 devn: charles_r: are you trying to use emacs?

17:06 charles_r: emacs or vim

17:06 whichever one I get working first is the one I'll try

17:06 devn: which would you prefer?

17:06 charles_r: I'm more comfortable in vim.

17:06 devn: do you have leiningen installed?

17:07 charles_r: yes

17:07 devn: if so, what version? 1.7 or 2?

17:07 charles_r: 1.7.1

17:07 devn: "lein plugin install swank-clojure 1.4.2"

17:07 charles_r: https://github.com/daveray/vimclojure-easy

17:08 if you're on a mac you need to `brew install nailgun` to use the nailgun server

17:08 that should get you rolling

17:09 zerokarmaleft: devn: isn't there a way to get slime-like functionality in vim without nailgun?

17:09 devn: https://github.com/vim-scripts/slimv.vim <= hooray google

17:16 charles_r: it works until I get to

17:16 lein vimclojure

17:16 That's not a task. Use "lein help" to list all tasks.

17:17 nm

17:21 Roxxi: When 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:21 If the answer to that is long, if someone could point me at a resource, that'd be great.

17:24 charles_r: devn, thanks

17:25 apwalk: Roxxi: a good place to start is: http://clojure.org/vars

17:26 kovasb: Roxxi: are you rebinding foo elsewhere in your program,?

17:29 bubba42: hi is there any alternate to defining a global variable ?

17:30 brehaut: thats an extremely general question

17:30 an extremely general answer is: yes

17:30 but what are you trying to do

17:30 bubba42: ok here is what I'm trying to do

17:30 I need to keep a list of generated list of primes

17:30 prime numbers

17:30 brehaut: ,(doc memoize)

17:30 clojurebot: "([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:31 bubba42: mmmm

17:32 brehaut: a basic memoization pattern is probably what you want though: a function that closes over a private reference type frinstance

17:32 SlavikG: ,(doc expand)

17:32 clojurebot: excusez-moi

17:32 SlavikG: Oh you again

17:32 &(doc expand)

17:32 lazybot: java.lang.RuntimeException: Unable to resolve var: expand in this context

17:33 brehaut: eg (defn make-counter [initial] (let [c (atom initial)] (fn [] (swap! c inc))))

17:33 SlavikG: what function are you looking for?

17:33 bubba42: @brehaut -- many thanks -- thought I think it will take two lifetimes to learn clojure :-)

17:34 brehaut: bubba42: once you grok the basics things fall into place more quickly

17:34 SlavikG: brehaut, one that expands a macro

17:34 Special form in this case

17:34 One assumes

17:34 brehaut: SlavikG: macro-expand, macro-expand1

17:34 ,(apropos 'expand)

17:34 clojurebot: (macroexpand-1 macroexpand)

17:34 SlavikG: What is the difference with expand1?

17:34 brehaut: oh, sorry, misplaced hyphens

17:34 SlavikG: Okido

17:35 brehaut: macroexpand-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:35 SlavikG: &(macroexpand (apply list #(%1 "I worship his shadow")))

17:35 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: sandbox3826$eval7976$fn__7977

17:36 brehaut: you need to quote the form

17:36 SlavikG: &(macroexpand '(apply list #(%1 "I worship his shadow")))

17:36 lazybot: ⇒ (apply list (fn* [p1__7980#] (p1__7980# "I worship his shadow")))

17:36 brehaut: ,(macroexpand '(apply list [1 2 3]))

17:36 clojurebot: (apply list [1 2 3])

17:37 brehaut: SlavikG: however, you cant expand a special form; they are implemented in the compiler

17:37 (although a lot of the special forms are wrapped in utility macros)

17:37 SlavikG: I can do anything I want, and so can you.

17:37 I know

17:52 Roxxi: kovasb: No, I'm not

17:53 kovasb: I figured it might have something to do with that.

17:53 kovasb: Roxxi: i don't see why the compiler things (def foo [1 2 3]) is of any interest then..

17:53 *thinks

17:53 is there a specific message

17:54 Roxxi: (def *foo* [1 2 3 4])

17:54 Warning: *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:55 You can type that into the repl and you'll see the message.

17:55 kovasb: oh ok

17:55 thats nothing to worry about then

17:55 Roxxi: I suppose I'm just trying to understand when I see the * convention, what that should mean to me in terms of symantecs

17:55 kovasb: right

17:55 the convention is that *ear-muffed-vars* are dynamically rebindable

17:56 brehaut: only if you include the ^:dynamic hint

17:56 Roxxi: heh ear-muffed... I like that

17:56 kovasb: right

17:56 Roxxi: right

17:56 so no ear-muffs => a constant

17:56 kovasb: but old versions of clojure didn't require that they include the ^:dynamic hint

17:56 Roxxi: ear-muffs => this thing may change

17:56 brehaut: half-ear muffs are used to denote an alternate formulation or backing implementation

17:56 kovasb: so now when the compiler sees earmuffs without the hit, it gives warnings

17:57 brehaut: eg let, let*

17:57 list, list*

17:57 Roxxi: Yeah, like scheme.

17:58 In scheme we used *thing* to denote globals, but that was convention

17:58 kovasb: typically you will see things like references to database servers inside earmuffs

17:58 since u might want to change it

17:58 Roxxi: right

17:58 brehaut: newer clojures (1.3+) support primes at the end of function names too

17:58 huangjs: my 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:58 brehaut: ,(let [a 1 a' (inc 1)] a')

17:58 clojurebot: 2

17:59 Roxxi: thanks kovasb and brehaut

17:59 kovasb: np

18:00 Roxxi: What's a prime?

18:00 oh

18:00 the '

18:00 gotcha

18:04 huangjs: technomancy: slime-autodoc will cause swank to crash, I'm using latest slime, is there a way to make it work?

18:26 Cyrik: hey, 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:28 BostX: ,(clojure-version)

18:28 clojurebot: "1.4.0-master-SNAPSHOT"

18:53 rahcola: Cyrik: only thing I can come up with is that you somewho manage to make either x or state bigger on every iteration

18:53 thus filling the stack, even though you are using tail recursion

18:54 ben_m: Hey everyone! Trying to play with the fancy new stuff in 1.4. Where would I put the data_readers.clj?

18:54 In a typical empty lein project

18:55 rahcola: Cyrik: but pretty please, give some real names to those x and xs and stuff

18:56 Cyrik: rahcola: state is getting smaller on each iteration. you see that when you try stress-test with 999

18:56 llasram: Cyrik: What is `(first xs)` in `((first xs) x (first xs2))`? Without reading deeper, that looks suspicious to me

18:56 kovasb: ben_m: the documentation says "at the root of the class path", which i imagine is the root folder of the project

18:56 ben_m: kovasb, I've tried that, but it doesn't seem to pick it up :/

18:57 kovasb: ben_m : have u tried other locations?

18:57 Cyrik: rahcola: 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:57 rahcola: ahh, it was odd that destructuring was not used :)

18:58 ben_m: kovasb, yeah

18:58 When I try to compile a file where the reader function gets used, I get "No reader function for tag"

18:58 Cyrik: ilasrm: (first xs) at that position is #(list :| %1 %2)

18:58 kovasb: ben_m : i would figure out what the class path at the time of compile

18:58 sadger: ben_m: maybe it wants a tag like :tag rather than the word tag

18:59 I remember the trace examples using (trace tag ...) as an example but obviously tag is unresolved symbol

18:59 kovasb: ben_m : when I've played with this is just changed the binding for *data-readers*

19:00 Cyrik: it 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:01 ben_m: kovasb, oh well, it's not important anyways. Just wanted to play with it :D

19:02 kovasb: ben_m : seems like the kind of thing that should be figured out for everyone's benefit.. try posting to the mailing list?

19:02 rahcola: Cyrik: so it runs when n given to stress-test is smaller than something?

19:02 llasram: Cyrik: HAHA. You've found a bug in... Clojure? I'm using emacs/swank -- what about you?

19:02 kovasb: ben_m : does it work at the repl? or only fail when u try to compile?

19:02 llasram: If you change the last line (def result (stress-test 99999)), then no problems

19:02 Until you try to print the result

19:03 rahcola: Cyrik: because it does seem to me that ((first xs) x (first xs2)) is making "multiplying" x on every iteration

19:03 llasram: No no, that's not the problem

19:03 rahcola: s

19:03 s/making//

19:04 ben_m: kovasb, works at neither

19:04 kovasb: ben_m : bummer. unless u want to read the source, suggest posting to group

19:05 ben_m: I shall investigate a bit.

19:05 llasram: Cyrik: (def result (stress-test 9999)) (drop 1 result) ;;=> ("")

19:05 er, 99999 rather

19:06 mmarczyk: Cyrik: the SO happens when printing the result

19:06 Cyrik: because the structure is so deeply nested

19:07 llasram: mmarczyk: Yeah, crazy

19:07 mmarczyk: Cyrik: (set! *print-level* 20) and you'll be "fine" (except you'll only see part of it)

19:07 Cyrik: uhhh, that you ilasram and mmarczyk!

19:08 errm i mean thank you!

19:08 i was going crazy trying to find a lazy operation in there:)

19:08 llasram: mmarczyk: Ahhhh, forgot about that. StackOverlfowError doesn't feel like the correct response to me though

19:09 mmarczyk: At the very least, its confusing

19:09 s,its,it's,

19:09 mmarczyk: llasram: well, I suppose

19:10 llasram: You don't think so?

19:10 mmarczyk: llasram: I'm trying to make up my mind as to whether it's worthwhile to implement explicit delimiter stack for printing delimited lists :-)

19:10 llasram: obviously you can't just keep count, since Clojure concrete syntax uses three delimiter types out of the box

19:11 rahcola: and that doesn't solve it for arbitrary constructors

19:12 mmarczyk: llasram: could do a trick to encode a "stack" in a number, assuming fixed delimiter set...

19:12 rahcola: if the idea was to eliminate the recursion in printing with a stack?

19:13 Cyrik: well i´d say that *print-level* should at least be set to something that doesnt blow the stack, as a default value

19:13 llasram: What about catching StackOverflowError when printing and act as if *print-level* had been hit?

19:13 Cyrik: even better

19:14 its damn confusing otherwise

19:56 TimMc: Is Lobos actually in a usable state yet?

19:56 The docs seem to indicate it is half-built.

20:02 Frozenlock: Any explanation on what might be this error? clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref

20:02 I get it with (rule false [:username "Usernames must have a value"]) From noir.validation

20:02 hiredman: you are derefing and unbound var

20:03 brehaut: eg (declare v) @v

20:03 TimMc: I see weavejester's Ragtime, but that doesn't have all the pieces I need...

20:03 Drift looks to have been last touched some months back.

20:03 weavejester: TimMc: What's Ragtime missing, out of interest?

20:04 TimMc: SQL schema DSLs.

20:04 weavejester: TimMc: It is a little unfinished, but I'm curious as to what people want.

20:04 TimMc: Isn't that what Lobos is for?

20:04 TimMc: Yes, but I can't tell if it already has it or not. :-/

20:04 The documentation is old and ragged.

20:05 weavejester: I 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:06 If I wasn't using so much NoSQL, I'd just use Ragtime to handle the migrations, and Lobos to build the SQL

20:06 TimMc: Ah, I see.

20:06 weavejester: I don't believe I got around to adding in Leiningen support for Ragtime, though.

20:11 TimMc: OK, I think I understand Ragtime better now. (Second pass through the README.)

20:17 weavejester: How is the initial schema creation handled in Ragtime + Lobos?

20:21 unmarshal: anyone know of a way to tab complete java method signatures using vim clojure?

20:29 Roxxi: Is there a convenient method to call to determine whether or not a particular value is contained in the set of a collections values?

20:29 (e.g. (member 'hello '[hi hello yes]) => #t

20:30 amalloy: &(doc some), but also consider whether you should be using a map/set for your test collection - something with indexed access

20:30 lazybot: ⇒ "([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:31 Roxxi: Thanks amalloy

20:31 amalloy: you 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:32 Roxxi: does the = operator implicitly use .equals defined for that object?

20:32 or is it reference equality?

20:33 (contains? [:wilma :fred :barney :betty] :fred) => false which is what the documentation of contains? implies

20:35 hiredman: = is more or less egal

20:35 amalloy: ~contains

20:35 clojurebot: contains? 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:50 langmartin: I'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:50 dgrnbrg: langmartin: do you want to capture the caller's dynamic environment? or reset the dynamic environment?

20:50 langmartin: future, send, send-to all copy the dynamic environment (good!). a watch also gets the dynamic environment of the caller

20:50 reset

20:51 dgrnbrg: just start a new thread

20:51 (-> (Thread. my-fn) .start)

20:51 langmartin: dgrnbrg: in what way?

20:51 ah

20:51 in a java way

20:51 dgrnbrg: or, you can use the executor pool that clojure starts up

20:52 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L48

20:53 i.e. (. clojure.lang.Agent/pooledExecutor execute my-fn)

20:53 actually, that might not work

20:53 langmartin: aha

20:53 dgrnbrg: i can't remember the syntax for getting static members of java objects

20:53 langmartin: /

20:53 they're treated like a namespce

20:53 dgrnbrg: then do that :)

20:54 langmartin: ok, but the idea is that I must start a new java thread in order to drop the dynamic environment

20:54 because all of the clojure bits will pass it along

20:55 dgrnbrg: thanks for your help! I've been getting mysterious errors from this for a few days

20:55 dgrnbrg: oh, you're not interested in multithreading?

20:55 then there might be another solution

20:55 I thought you wanted to spawn a thread w/o capturing the environment

20:56 langmartin: that's correct

20:56 you got it

20:57 alexyk: how do you do catch any exception?

20:57 dgrnbrg: (try … (catch Throwable _ …))

20:57 sritchie: (catch Throwable e ...)

20:57 aperiodic: Roxxi: /go dor

20:57 oops

20:57 dgrnbrg: langmartin: the first thing that pops into mind is using (alter-var-root)

20:57 langmartin: (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:58 dgrnbrg: yeah, see my problem is that it isn't my dynamic variable, and I don't want to patch my libraries

20:59 dgrnbrg: i'm going with (. #'your-var root)

20:59 better yet

20:59 (. #'your-var getRawRoot)

21:00 langmartin: i think that's the best bet

21:00 I always write crazy clojure with this page open: https://github.com/clojure/clojure/tree/master/src/jvm/clojure/lang

21:00 it's really easy to understand the compiler

21:00 and runtime

21:06 langmartin: dgrnbrg: it's fugly, but that might work

21:06 dgrnbrg: what you want to do isn't one of the intended use cases

21:06 so you have to reach into the platform

21:06 I think that it's beautiful that it's possible

21:07 and in so few lines of code

21:07 (. #'you-var root) is cleaner

21:07 or (.root #'your-var)

21:07 if you look at the code of getRawRoot, you're not really getting anything over just using root

21:07 langmartin: dgrnbrg: it's really just that the lib uses the dynamic environment wrong

21:07 yeah, I saw that

21:08 the fugly part is just that I'm doing this to a var way outside of my code

21:09 dgrnbrg: oh, yeah

21:09 have you seen robert.hooke?

21:12 langmartin: neat

21:17 dgrnbrg: langmartin: it's designed to help you mess around with libs you don't control

21:21 langmartin: dgrnbrg: all I really have to do is this:

21:21 (binding [clojure.java.jdbc.internal/*db*

21:21 (. #'clojure.java.jdbc.internal/*db* getRawRoot)]

21:21 (apply proc args))

21:22 dgrnbrg: oh, that's easy then

21:22 langmartin: it just has to be done anytime you start a future or whatever from a db transaction

21:23 that does seem easier than dumping the dynamic env and copying just the parts I care about

21:23 but it's less correct

21:23 * langmartin crosses fingers

21:24 dgrnbrg: good luck :)

21:35 Roxxi: How do you iterate through a sequence that may be infinite, stopping when some condition is met?

21:35 (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:36 or, 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:36 technomancy: ,(count (take-while (partial = 169) (range 200)))

21:36 amalloy: &(doc take-while)

21:36 lazybot: ⇒ "([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."

21:36 amalloy: technomancy: 0, right?

21:37 technomancy: oops

21:37 yes

21:37 amalloy: wow, you're faster than clojurebot

21:37 =P

21:37 amalloy: yeah, i was noticing that too

21:37 ~ping

21:37 Roxxi: Right, but I don't want the result to be a sequence- I want the result to be that specific item

21:37 amalloy: &(doc first)

21:37 lazybot: ⇒ "([coll]); Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil."

21:39 emezeske: &(first (filter #(= 169 %) (range 200)))

21:39 lazybot: ⇒ 169

21:40 Roxxi: right, but that's essentially straight iteration

21:41 emezeske: Roxxi: ?

21:41 Roxxi: Here's an example..

21:41 (defn foo [] ...) where (foo) => 0 (foo) =>1 (foo) => 2 ...

21:41 emezeske: &(first (filter #(= 169 %) (range)))

21:41 lazybot: ⇒ 169

21:41 Roxxi: I want to define foo in such a way that each time i invoke it I get the next number

21:42 emezeske: Are you sure that's what you want to do, and you don't actually want to create a lazy-seq that does that?

21:42 Roxxi: So, 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:42 Well, I'm not quite sure how to create, then use a lazy sequence that does that.

21:42 I see range

21:43 and 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:43 For 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:44 But I don't know if that approach is the right idiom for clojure, or what the idiom is for set! if it is.

21:44 sritchie: (let [i (atom 0)]

21:44 (defn gen-unique-suffix []

21:44 (str "__gen" (swap! i inc))))

21:44 let over lambda!

21:45 Roxxi: well defn inside is basically a lambda with a name ;p

21:45 so swap! is what I was missing

21:45 sritchie: yup

21:45 swap! mutates the atom and returns its old value

21:45 Roxxi: and inc itself is a value?

21:45 sritchie: sorry, new value

21:45 yeah, inc is the increment function

21:46 swap! takes an atom and a function to apply to the atom's current val --

21:46 then returns the new value, leaving the atom mutated

21:46 since the initial val is 0, you'll get "__gen1" the first time you call this

21:46 and the atom in the closure will now hold 1

21:47 if you wanted to jump by 5 every time, you'd do (swap! atom + 5)

21:47 Roxxi: I see. What's the consequence of omitting atom? Lack of thread saftey?

21:47 Hmm, interesting

21:47 gtrak``: you shouldn't call it atom tho

21:47 sritchie: Roxxi: that's just clojure's way of handling state

21:48 so if you want it to keep incrementing, you need to use one of the stateful containers

21:48 Roxxi: I see.

21:48 Thanks sritchie!

21:48 sritchie: so "i" in this case is an immutable reference to a mutable thing

21:48 * emezeske thinks that this problem can be handled without state at all.

21:48 Roxxi: (I didn't mean to interrupt, heh.)

21:48 Oh really?

21:49 metellus: loop/recur

21:49 sritchie: hmm, maybe if you pass back in the old path

21:49 Roxxi: Yeah, but that's parse-unparse

21:49 sritchie: the other way is (defn uuid [] (str (UUID/randomUUID)))

21:50 (take 10 (repeatedly uuid))

21:50 gives you 10 unique filenames

21:50 and (repeatedly uuid) is an infinite stream of them

21:51 ,(take 10 (iterate inc 1))

21:51 if you just want increasing numbers

21:54 Roxxi: right

21:55 but I'd just get a collection of 10 things

21:55 which seems to be the same as calling (range 10)

21:55 sritchie: Roxxi: yeah, I don't see how to do it w/o state

21:56 Roxxi: Indeed.

22:00 If you're curious, here's what the final product ended up looking like (works like a charm too!)

22:00 (defn uniqueify-sheet-name

22:00 ([sheet names]

22:00 (let [i (atom 0)]

22:00 (defn next-val []

22:00 (swap! i inc))

22:00 (uniqueify-sheet-name sheet names next-val)))

22:00 ([sheet names next-val-fn]

22:00 (let [proposed-name (str (sheet-name sheet) "-" (next-val-fn))]

22:00 (if (member? proposed-name names)

22:01 (uniqueify-sheet-name sheet names next-val-fn)

22:01 (rename-sheet sheet proposed-name)))))

22:01

22:01

22:01 ben_m: Roxxi, before people maul you, consider using a pastebin in the future.

22:01 Roxxi: Ah, oops, sorry.

22:01 wkmanire_away: Roxxi: Holy Sheet!

22:01 Roxxi: Didn't know!

22:02 Heh.

22:02 wkmanire_away: Roxxi: Have you ever used IRC before?

22:02 ben_m: gist.github.com is pretty decent

22:02 Roxxi: 1998 :(

22:02 It's been a LOONG time.

22:03 wkmanire_away: Oh, well hopefully you'll not stay gone so long this time around.

22:03 #clojure rocks.

22:03 :)

22:03 Roxxi: I agree! I'm pretty stoked being here today.

22:03 wkmanire_away: One of the regular patrons here made refheap.com

22:03 Roxxi: Mainly because I can use IRC via Emacs

22:04 Wow. Pastebin is awesome. How did I never know about this D:

22:04 wkmanire_away: It is implemented using the Noir web framework, which another patron of #clojure implemented.

22:04 Roxxi: Nice.

22:04 wkmanire_away: Noir is of course, written with clojure.

22:04 :D

22:04 Trying to keep it in the family here in #clojure.

22:04 he he he

22:04 Roxxi: hehehe

22:04 wkmanire: Roxxi: I'm a complete newb here by the way.

22:04 Don't want you to mistake me for knowing what I'm doing.

22:05 ben_m: I wonder if you could use CPS to get rid of the state in Roxxi's example

22:05 Roxxi: I was about to say, "you sure seem to know an awful lot..."

22:05 TimMc: $findarg map % ["4" "4.5"] [4 nil]

22:05 lazybot: []

22:05 TimMc: Ah well, worth a try.

22:06 mutinyonthebay: I'm drooling over some of these clojure/west presentations -- anyone have any idea when the presentation videos are to be released?

22:06 * wkmanire lurks much.

22:06 Roxxi: So, for next time, instead of pasting an example, I should just paste a link?

22:06 (... to pastebin)

22:06 gfredericks: yep

22:07 wkmanire: Roxxi: to refheap. wink wink

22:07 Roxxi: Haha, ok, taking a look at that.

22:08 TimMc: pastebin is allowed

22:08 refheap just happens to be better :-)

22:08 Roxxi: heh, excellent. Well either are better than pasting it straight in.

22:09 TimMc: Here's what I was going for, "maybe-integer": https://refheap.com/paste/2240

22:09 Goes well with if-let

22:10 technomancy: sritchie: hey, did you get your lein2 issues sorted out?

22:10 sritchie: hey, I think so, it's been working well

22:10 technomancy: great

22:10 sritchie: I've got to come up w/ a good workflow for using intellij w/ leiningen 2, bow

22:10 now

22:11 technomancy: is there a plugin that only works with lein1?

22:11 TimMc: err, put % instead of s in the postcondition

22:40 brweber2__: Has the :or default in map restructuring been removed in 1.4 or is it just broken atm?

22:40 https://gist.github.com/2425421

22:44 apwalk: brweber2_: {:keys [x y] :or {x 10}}

22:46 jayunit100: heylo

22:46 brweber2__: apwalk: that's what I have. Did you check out the gist?

22:46 jayunit100: just came across this on SO ... thought it was an interesting question.

22:46 http://stackoverflow.com/questions/10238399/clojure-jdbc-create-table-statement-does-not-run-unless-using-leiningen-repl

22:47 brweber2__: or do I have to change the :or x to not be a keyword...

22:47 apwalk: brweber2__: correct

22:47 brweber2__: apwalk: thanks!

22:48 apwalk: that kind of stinks when you have an existing map where x is not defined :(

22:52 apwalk: brweber2__: I don't follow. Isn't that your intent by defining a default?

22:52 brweber2__: 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:00 apwalk: brweber2__: 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:01 brweber2__: apwalk: here is an example

23:01 (defn rr-ns [{:keys [zone dclass ttl the-ns] :or rr-defaults}]

23:01 (NSRecord. (to-name zone) (int dclass) (long ttl) (to-name the-ns)))

23:02 rr-defaults is a map with {:ttl 1000 :dclass 1}

23:02 apwalk: but when keywords are there, :or doesn't work

23:02 trilisp: Hi, 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:02 apwalk: ah, I thought you might be doing that.

23:02 brweber2__: apwalk: and when I convert the keywords to symbols in rr-defaults

23:03 apwalk: the :or still doesn't take effect

23:03 apwalk: does it *have* to be a map literal in there?

23:03 gfredericks: ,(let [{:keys [x] :syms [x] :strs [x]} {:x :keyword "x" :string 'x :symbol}] x)

23:04 technomancy: clojurebot is MIA

23:04 gfredericks: &(let [{:keys [x] :syms [x] :strs [x]} {:x :keyword "x" :string 'x :symbol}] x)

23:04 lazybot: ⇒ :symbol

23:05 amalloy: brweber2__: it surely has to be a keyword

23:05 er, a literal map

23:06 serious deep magic would be required to make it work for non-literals, and those who invoked such magic would generally be surprised

23:06 brweber2__: amalloy: ok, that would explain it

23:08 apwalk: amalloy: thanks, got it working!

23:12 amalloy: brweber2__: if you want to use a non-literal map, you can use ##(doc merge) before you destructure

23:12 lazybot: ⇒ "([& 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:13 brweber2__: amalloy: I did this hack :or {something (:something my-defaults)}

23:13 amalloy: more verbose, but works

23:13 amalloy: fair enough

23:20 TimMc: ~transpose

23:21 hmm, no clojurebot

23:23 amalloy: he diiiiiied

23:23 wow, hiredman isn't here either. did the two of them go out in some final blaze of glory?

23:25 sritchie: amalloy: romeo and juliet shared suicide deal?

23:25 heavy shit

23:25 amalloy: i was actually thinking more like an action movie

23:25 brehaut: a hail of arrows

23:25 amalloy: the two of them gearing up to assault the enemy stronghold

23:26 sritchie: ah, got it, arrows blocking out the sun

23:26 THIS IS CLOJURE

23:28 brehaut: (http://www.intensivesystems.net/tutorials/stream_proc.html)

23:29 amalloy: have i heard of Intensive Systems Consulting, or do they just have such a generic name that it sounds familiar?

23:29 brehaut: jim duey's old site; lots of monads in clojure tutorials

23:30 amalloy: aha

23:30 brehaut: but apparently my clojurebot arrows joke was too lame

23:32 amalloy: oh god

23:32 brehaut: im very sorry

23:32 amalloy: i would say rather that it was too far removed

23:33 if i have to read through pages of crap to see you're making a joke about arrows, you're demonstrably not

23:33 brehaut: its probably ok for it to be both lame and far removed

23:33 i guess a link to clojurebots source would have been better. oh well

23:46 dnolen: unless someone complains I'm pushing PHMs to CLJS

23:46 done

23:48 brehaut: awesome

23:49 ben_m: But I was going to complain :(

23:49 Just kidding, I don't even know what PHM is.

23:49 brehaut: pointy haired manager

23:49 (persistent hash maps)

23:49 ben_m: Nice :)

Logging service provided by n01se.net