#clojure log - Mar 28 2012

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

0:00 ibdknox: many are golfed into hell

0:09 mk: nsxt: not the long ones then, and the ones that you can understand without needing to think through them

0:09 ibdknox: I think there's a bigger issue with newbies using long or awkward constructs than with people trying to golf their solutions down. You don't get points for a short solution

0:10 ibdknox: huh?

0:10 we're talking about 4clojure right

0:10 ?

0:10 mk: yes

0:10 ibdknox: the guys who are really into 4clojure are absolutely golfing the solutions down

0:10 you *do* get points, in a way :)

0:11 the league mode is about trying to get the shortest possible answer

0:12 which is definitely very neat to look at

0:12 but often far from idiomatic

0:12 mk: ibdknox: do you have an example? Most of the initial ones look just fine.

0:12 ibdknox: the earlier ones probably don't have particularly clever solutions

0:12 stirfoo: Is there a document that describes exactly what immutable means when applied towards the persistent data structures in clojure? The thing that bugs me is I can place say, a StringBuffer instance in a PersistentVector, then .append to it.

0:13 I want to say, that's mutating the vector, but I just don't know.

0:13 ibdknox: stirfoo: did the vector change? or the things inside of it?

0:13 stirfoo: ibdknox: right, right. and that was frontmost in my mind.

0:13 ibdknox: mk: I don't have one at hand, don't spend much time there. I'm sure amalloy could point you to some though

0:14 mk: ibdknox: I see - I think for the earlier problems the shortness heuristic is good - like I said, more newbies will end up doing something huge than experts will end up with something too short

0:14 ibdknox: stirfoo: if you use a mutable structure in an immutable one, that structure will still be mutable. In general, you have to dip down into java-land for that to happen

0:16 mk: stirfoo: immutable means that clojure will never mutate your structures, and that clojure's structures will never mutate

0:17 stirfoo: if you use java code on java structures inside clojure, then you lose the expectation of immutability

0:17 stirfoo: I actually understand the persistent aspect fairly well. How a history of actions is kept. You conj onto a vector, you get the 'tail' back and a reference to the original vector. The original is unchanged.

0:18 mk: ok, you've both cleared it up a bit for me, thanks

0:19 mk: stirfoo: the underlying mechanics of clojure differ from most lisps, but you usually don't have to worry about that - what's really important is the distinction between values and identities

0:19 qbg: the reference identities never change

0:19 mk: rich hickey has some nice talks about this up on infoq

0:20 the important thing is that what you usually think of as a value (like an object), isn't really a value, it's an identity (which is a bit like a changing sequence of values)

0:21 values never change, in the way that 1, "abc", and so on never change

0:22 and this extends to composite values, like collections and struct-like things

0:27 stirfoo: The internals of clojure are just a joy to study. There's some mind-boggling stuff going on in there, and I don't even know java that well. ;)

0:29 lynaghk: What do you guys think about embedded languages that compile down to HTML or CSS (e.g. HAML and SASS in the ruby world, or Hiccup in Clojure world)

0:29 ibdknox: lynaghk: ?

0:29 lynaghk: I'm pretty happy with HAML, but I'm looking at CSSgen (a Clojure project) and am on the fence about jumping over to it from Sass

0:30 (er, Hiccup, not haml. I'm using both, actually.)

0:30 ibdknox: I've not seen a lot of benefit with cssgen really

0:31 xeqi: the big gain for me in the ruby world was compass

0:31 lynaghk: Yeah; maybe it's just the amount of syntax compared to SASS but it doesn't look like a clear win to me (especially since I'm not doing any crazy CSS like I do crazy markup)

0:31 xeqi: that is the collection of Sass mixins so you could just say "+container" and stuff to get a grid going, yeah?

0:32 xeqi: that was part of it

0:32 ibdknox: a watcher

0:32 and such

0:32 xeqi: there were other parts that would abstract all the browser specific tags

0:33 lynaghk: xeqi: ah yeah. I can see that being a lifesaver if you need to worry about browser compatability.

0:33 xeqi: for gradients, rounded corners, etc

0:33 clearfix back to ie6

0:33 lynaghk: xeqi: you do a lot of frontend work?

0:34 xeqi: did web contracting for awhile

0:35 so yes, but not great at the design part

0:36 I haven't tried cssgen yet, but it would be hard to make me use it over bootstrap, less, or compass

0:36 lynaghk: ibdknox: the appeal of CSSgen for me is to get everything in Clojure where it's easier to handle dependencies and compilation workflow. There is no mechanism in C2 right now to do CSS, and I feel gross either inlining strings (as in the examples) or just ignoring the issue and letting people fend for themselves.

0:36 xeqi: yeah, the ecosystem is a huge win.

0:37 ibdknox: lynaghk: weavejester was working on a less compilation middleware I think

0:37 seems to me that the simplest solution would be to just build a simple asset chain

0:38 and let people use whatever

0:38 pandeiro: cljs still has no official way to turn a clojure map into a js obj right?

0:38 lynaghk: ibdknox: I'm not sure what you mean.

0:39 ibdknox: in the case of something like noir, yeah, just give them extend via middleware or whatever. I'm not sure what would be analogous for C2

0:40 ibdknox: lynaghk: why not have middleware there too? :)

0:40 yoklov: pandeiro: not that i've been able to figure out, i think you're just supposed to do it manually.

0:40 lynaghk: ibdknox: uh oh...

0:40 ibdknox: haha

0:40 yoklov: pandeiro: there's one in jayq

0:40 but nothing official

0:41 lynaghk: ibdknox: though, now that I think about it, these kinds of styles aren't dynamic at all. Maybe just write a macro that calls out to Sass on Jruby or whatever at compile-time.

0:41 mk: pandeiro: a js map must take strings as its keys

0:41 ibdknox: lynaghk: mhm

0:41 pandeiro: ibdknox: what does jquery do on that front?

0:41 ibdknox: pandeiro: nothing, but I needed it, so there's a util for it

0:41 yoklov: mk: yeah but keywords in cljs are just strings

0:41 though if you want it in normal js you'd have to call name on them

0:42 or enter weird unicode

0:42 mk: yoklov: right - I was thinking of maps that map arbitrary values

0:42 yoklov: oh, yeah those would be trickier.

0:42 pandeiro: just reflected on that being a major part missing while playing with the online compiler tonight

0:43 mk: pandeiro: I haven't heard the issue come up for people using cljs to do things

0:44 that may or may not be reassuring

0:44 ibdknox: it's a common need if you do any interop

0:45 lynaghk: mk: I think everyone just googles around until they find mmgrana's gist

0:45 pandeiro: yeah i mean json is the language

0:45 ibdknox: yep lol

0:45 pandeiro: lynaghk: `fogus should add that link to his compiler maybe

0:47 lynaghk: btw i did battle with c2 for hrs today, it won

0:48 lynaghk: pandeiro: what were you having trouble with?

0:48 pandeiro: i concluded it's not possible to use c2.geo.core in a noir view - vrepl works great

0:48 but geo->svg doesn't work when i require the ns

0:48 lynaghk: were you AOT compiling?

0:48 pandeiro: shit

0:48 ibdknox: ok

0:49 we should turn that off

0:49 lynaghk: there is a bug in core.match

0:49 pandeiro: was i supposed to? or not?

0:49 ibdknox: pandeiro: in project.clj :main add ^{:skip-aot true}

0:49 so it'll look like

0:49 lynaghk: I opened a ticket on JIRA a few weeks ago about it, but it's not a priority for David or I to dig into

0:50 ibdknox: :main ^{:skip-aot true} mycool.server

0:50 lynaghk: yeah, that bug with geo->svg took me a few hours to track down because everything is peachy in the REPL.

0:50 pandeiro: weird i was trying to test that match expression too but i thought the prob was geo->svg

0:50 the way it defines project and the other fn i cant remember now

0:50 those are present but unbound when you require c2.geo.core

0:51 lynaghk: As far as I know, it works, but I've only tried with the geoJSON that is included in vomnibus. If you keep having trouble feel free to open up an issue on the githubs.

0:51 pandeiro: alright i will check it out again tomorrow after skipping aot

0:52 hopefully that resolves it

0:52 Wrecktum: Anybody here sick of niggers?

0:52 I sure as hell am!

0:52 That is why I joined

0:52 chimpout

0:52 .com

0:52 /forum

1:01 yoklov: so, in clojurescript how do people deal with the state inherent in js events? (e.g. click toggling)

1:02 throw caution to the wind and let there be atoms?

1:03 pandeiro: yoklov: yeah most code i've seen uses atoms

1:35 ibdknox: statemachines!

1:47 muhoo: yoklov: waltz :-)

1:48 Raynes: ibdknox: Blue butterflies!

1:48 muhoo: flying spaghetti monsters!

1:49 sorry, finite state machines. still, everytime i see FSM, i thank His Noodly Appendage.

1:49 yoklov: i looked at that, it seems really neat but i don't know if it makes sense here… i have several button-like objects

1:49 several as in a large 2d array

1:50 ibdknox: do they all only have single states?

1:50 if so just use classes

1:50 yoklov: they all have a finite number

1:50 hm

1:50 ctually they are all exactly finite state machines themselves

1:50 ibdknox: :p

1:51 I win ;)

1:51 yoklov: haha, yeah.

1:52 jblomo: is it possible to use gen-class to extend a parameterized type?

1:53 i noticed http://groups.google.com/group/clojure/browse_thread/thread/5efd692804df3f47 and see that the work around was to create an intermediate class in Java, but wanted to see if that had changed

1:53 or if i was misunderstanding it

2:08 amalloy: jblomo: i don't think it is, exactly, but the good news is you don't really have to - type parameters are a nicety for javac, not a key component of the classfile

2:16 jblomo: amalloy: it looks like the framework expects a java.lang.reflect.ParameterizedType, so somehow it seems like Java is recognizing it after erasure

2:16 hmm, maybe I could just implement that interface

2:17 amalloy: yeah, i think if they're using reflection they can manage to make it impossible for you

2:18 lynaghk: Does anyone know how exactly GSoC students are supposed to sign up?

2:19 I know they have a deadline in a week. Some people have emailed me about working on C2; should I just tell them to submit something at http://www.google-melange.com/gsoc/homepage/google/gsoc2012

2:37 beffbernard: How do I make this unlazy? (read-string (take 1 lines))

2:38 ibdknox: lynaghk: yeah I think they have to submit a project proposal

2:38 I'm kind of confused about it myself

2:42 Raynes: ibdknox: It's late.

2:42 ibdknox: Y U NO SLEEP?

2:42 ibdknox: srsly

2:42 cuz I'm retarded

4:41 echo-area: Suppose I specify A as dependency, and B as dev-dependency, but B depends on A too. Leiningen complains there are multiple A's in the classpath.

4:42 How to resolve this besides setting LEIN_SNAPSHOTS_IN_RELEASE?

4:50 Oh, there are two different problems

4:53 clgv: I am experimenting with JPPF to execute Jobs on remote computers. Therefore I derive a task implementation from JPPFTask via proxy. The JPPF framework needs to load that class when submitting the task. unluckily, I get a ClassNotFoundException at that time. THe first thing I noticed is that JPPFClient (and all the other JPPF classes) have AppClassLoader as ClassLoader while my task implementation has Clojure's DynamicClassLoader as ClassLoader.

4:55 It makes sense that the AppClassLoader does not find my task implementation since the DynamicClassLoader is a child of the AppClassLoader and lookup is performed in parent direction. what can I do to solve this?

5:05 Lajjla: So, gentlemen, again, is ##(let [some-datum (list (symbol "I worship His Shadow"))] (= some-datum (read-string (print-str some-datum)))) a bug or a feature?

5:05 lazybot: ⇒ false

5:06 clgv: Lajjla: symbols must not contain whitespaces. there should be an error. hopefully that will be implemented

5:07 Lajjla: clgv, yes, one would assume, so it's a bug that ##(symbol? (symbol "I worship His Shadow"))

5:07 lazybot: ⇒ true

5:07 Lajjla: Or (symbol ":appparently-this-is-not-a-keyword")

5:08 clgv: Lajjla: yes. but it is also known - there were several other examples that violated symbol rules

5:09 Lajjla: clgv, ah, okay, I guess people have more important things to do then I guess, I'm no expert, the MicroSoft Chief Software Architect is stilla biove but it seems reaaaaaaaaaaaaaaallly trivial to fix this to me.

5:10 clgv: Lajjla: there are other issues where warnings/errors are also missing, e.g. usage of & in protocols

5:10 Lajjla: Ah okay

5:10 clgv: I have no clue why they are still around

5:10 Lajjla: My earnest opinion is that this is very sloppy honestly.

5:11 To just stick a symbol tag on a string like that without any form of validation

5:14 clgv: hmmm but a quick search on the issues with "symbol" in their topics doesnt yield any matching ticket.

5:16 Lajjla: clgv, ah, okay

5:16 clgv, would you for me make it?

5:16 I would appreciate it and be aeternally thankful

5:18 clgv: I have no jira account there

5:18 Lajjla: No idea what that is, but bawww.

5:18 clgv: there management system where you can create issues.

5:18 Lajjla: Can has hug instead?

5:18 Ahh

5:18 clgv: ;)

5:23 Lajjla: are you writing some macro or why do you need to create symbols indirectly via 'symbol?

5:25 Lajjla: clgv, not at all, I don't use clojure, I was just fooling around and noticed that (symbol "string which isn't a symbol") didn't return an error, then I decided to print it out and I found it sloppy so I wanted to know if it was a feature or a bug.

5:29 clgv: hmm would have been a good issue for clojure 1.4 since they wanted to improve documentation and errors afaik

5:29 but I dont see any change in the master branch

6:25 * ivan just realized "talks in video format suck" and "{{set syntax}}" is the same guy

7:59 solussd: ivan: are you referring to that thread on the mailing list?

8:00 {{'this 'is 'ugly 'and 'inconsistent}}, #{'at 'least 'I 'know 'this 'is 'a 'reader 'macro}

8:23 Belaf: Hello everybody, if I have a java class with a private constructor, is there any way to extend it (gen-class) in clojure?

9:26 Chiron: I need to use MongoDB, I create a couple of vars like (def mongo-url *url* "...") (def *collection* "....") . Any better idea? how to be idiomatic?

9:41 acagle: /flush

9:41 duck11231: Chiron: Have you looked at the two big mongo libraries for clojure? They both do a pretty good job of making it idiomatic

9:42 Chiron: actually I need to use Mongo with Storm, I found a library for that called Storm-Mongo

9:43 https://github.com/christkv/mongo-storm

10:41 TimMc: Just changed the Wikipedia article on Clojure to have an italicized "j". We'll see how long that lasts.

10:41 https://en.wikipedia.org/wiki/Clojure

10:59 clgv: TimMc: lol is that the TM version? ;)

11:00 TimMc: clgv: trademark?

11:00 clgv: yeah :P

11:00 TimMc: No idea.

11:11 clgv: I have an old project.clj where a leiningen plugin for native deps is used - is that still the way to go?

11:31 args. is there no working leiningen support to get native dependencies transitively?

11:51 dnolen: lynaghk: metadata core.logic patch applied, thanks much

12:24 lynaghk: dnolen: thank you. I had quite the adventure in logic.clj figuring out what I needed to change = )

12:24 dnolen: lynaghk: haha, I'm excited about how many people have looked at core.logic's internals now :)

12:25 lynaghk: dnolen: while I have you here---what should I tell students about GSoC

12:25 dnolen: lynaghk: hmm, what do you mean?

12:25 lynaghk: several people have contacted me about working on C2 this summer.

12:26 Should I tell them to go over to the google melenage site and sign up and submit a proposal?

12:26 dnolen: lynaghk: yes, or say they are applying for an existing proposal.

12:26 there's only a week 1/2 or so for them to submit.

12:26 lynaghk: And does Google just fund everything we come up with, or will the core team be sitting down to pick out the most promising projects from the student proposals?

12:27 dnolen: yeah, thankfully the first student who contacted me mentioned that, so I rushed out some posts to various mailing lists = )

12:29 dnolen: lynaghk: we'll have to pick the most promising proposal/student/mentor combinations

12:29 lynaghk: dnolen: any idea how many slots Clojure/core will get from The Google?

12:30 dnolen: In our organization form I said we'll have at least 4 killer projects we absolutely want to move forward with, and I've requested that in an ideal world we could do 8

12:31 lynaghk: dnolen: alright, sounds good. I'll keep my fingers crossed that some old-hat schemers are on the GSoC funding committee = )

12:31 dnolen: lynaghk: yes :)

12:38 pandeiro: lynaghk: was the aot with c2.geo.core, thanks ... want me to fork and add to the README or something?

12:39 technomancy: echo-area: the dev-dependencies/dependencies split in lein1 is really nasty; lein2 does away with it entirely

12:41 clgv: lein should pull in native deps transitively as long as they're formatted correctly

12:41 but it doesn't support cakes jar-in-a-jar scheme

12:41 oh, and good morning everyone

12:41 clgv: technomancy: what do I have to add to project.clj for native-deps in 1.7.1?

12:43 technomancy: clgv: it should scan all the jars brought in by :dependencies for native components

12:44 clgv: technomancy: so I dont have to add anything to project.clj?

12:45 technomancy: shouldn't have to

12:46 clgv: hmm maybe the layout of the dependency is wrong. its: jriengine 0.8.4

12:48 technomancy: yeah, some older jars use a cake-specific layout

12:48 clgv: technomancy: jriengine has a "native" and " lib" dir. seems the lib dir is not extracted

12:49 technomancy: yeah, you'll have to declare the jars in there as real dependencies if jriengine doesn't declare them

12:50 clgv: ah ok

12:53 lynaghk: pandeiro: what exactly do you want to change?

12:54 pandeiro: if you itchin' for a project, you could try figuring out what the underlying issue is in core.match and submit a patch for that.

12:56 bsteuber: in cljs, I am trying to generate (try ... (catch js/Error ..)) from a macro, which gives an "Assert failed: Can't qualify symbol in catch" - any ideas?

12:58 chouser: technomancy: btw, I have most of the longbottom features in clj-stacktrace, but there are a couple bugs yet.

12:58 pandeiro: lynaghk: actually the little testing i did of match didn't reveal any bug, but you think the issue is there? i just changed the readme to recommend skip-aot, is that not a good idea?

12:59 lynaghk: pandeiro: I am pretty sure it is an AOT issue with match---if you manually macroexpand the match clause in a REPL and inline it, then AOT will work fine.

13:01 autodidakto: I wish people would provide more info about their projects on clojars. Sometimes it's just half a sentence and no github link. Am I right or am I right?

13:01 chouser: technomancy: unfortunately, other priorities have come up so I've pushed what I've got to https://github.com/LonoCloud/clj-stacktrace and hope to get back to it in a week or so.

13:01 lynaghk: pandeiro: It's a pretty specific bug, so I don't really want to confuse people by mentioning it in the README---if you want, open up an issue on github and I'll look into it after I push through on cljs code generation stuff (though, that could be a week or two)

13:05 technomancy: chouser: no worries

13:12 autodidakto: Can anyone suggest good, general purpose leiningen plugins to pimp my lein? I found difftest and clj-stacktrace. I'm wondering what else I'm missing out on.

13:14 RickInGA: autodidakto: cljs-build

13:17 autodidakto: Assuming you are not on version 2 yet, lein-newnew

13:27 autodidakto: RickInGA: thanks, I'll check those out

13:27 TimMc: wait wait wait

13:28 Hiccup just concats strings into its HTML? It doesn't escape them?

13:29 https://github.com/andrewvc/rocksandsand/blob/master/src/rocksandsand/views/index.clj <-- I'd expect line 21 to have " <> " instead of " &lt;&gt; "

13:29 autodidakto: TimMc: I think you need to use escape-html *googling*

13:29 TimMc: ugh

13:30 * TimMc checks the calendar, confirms that it *is* indeed 2012...

13:30 autodidakto: "One thing to watch out with hiccup is that content is not escaped by default; you need wrap it in escape-html or its alias h. This is an unfortunate default that you definately need to be aware of if you choose to use hiccup."

13:30 TimMc: I thought we got over this shit a decade ago.

13:30 autodidakto: http://brehaut.net/blog/2011/ring_introduction

13:30 heh

13:32 TimMc: Every time you write an HTML templating toolkit that doesn't escape by default, an Estonian bot herder eats a kitten.

13:32 autodidakto: what's a bot herder?

13:33 TimMc: Controller of a botnet.

13:33 alexyakushev: Does anyone tried dynamic compilation on Android?

13:34 autodidakto: TimMc: ahh, gotcha. Reasonable complaint though. I wonder what the hiccup guys' excuse is.

13:35 TimMc: There is none.

13:35 pandeiro: does this map literal have an even number of forms? {:advanced {:externs ["resources/jquery.js"]}}

13:36 TimMc: ,{:advanced {:externs ["resources/jquery.js"]}}

13:36 clojurebot: {:advanced {:externs ["resources/jquery.js"]}}

13:36 TimMc: yup

13:37 autodidakto: TimMc: Heh. Yeah, I'm a HAML fan, and I wasn't overly excited when I checked out clojure's templating options...

13:37 TimMc: autodidakto: Luckily, the web server I am contemplating writing will not need to produce HTML.

13:38 autodidakto: TimMc: Web server? Sounds interesting. What are the servers clojure has now?

13:39 TimMc: I guess "web server" is ambiguous, isn't it. Web service, actually.

13:39 I'm looking into noir.

13:39 autodidakto: TimMc: ahh ok I see

13:39 TimMc: Something interesting for public consumption?

13:41 TimMc: Nah, just an API server for something internal.

13:42 pandeiro: TimMc: speaking json or clo/j/ure?

13:45 TimMc: json

13:46 It's an experimental platform with a couple of query endpoints and a UI server that talks to them... except we keep experimenting with new UIs, and it's time to separate out some of the business logic into an API server.

13:47 I'm advocating for Clojure, since it's fast to write and rewrite.

13:47 (off to a meeting)

13:49 autodidakto: TimMc: Keep fighting the good fight, homeboy

13:52 jaen: autodidakto: HAML is pretty cool, but I think Enlive isn't that bad either

13:53 devn: what do i need to do here? ##(map #(symbol (str "\u" %)) (range 800 850))

13:53 ,(map #(symbol (str "\u" %)) (range 800 850))

13:53 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid unicode escape: \u">

13:55 autodidakto: jaen: I'm reading about enlive right now. It's approach is different and interesting

13:56 devn: what do i need to do here? ##(map #(symbol (str "\u" %)) (range 8000 8025))

13:56 whoops, figured out the issue, disregard

13:56 autodidakto: jaen: you recommend it?

13:57 devn: &(map #(symbol (str "\u" %)) (range 8000 8025))

13:57 lazybot: java.lang.RuntimeException: Invalid unicode escape: \u"

13:57 devn: maybe not, heh

13:57 autodidakto: devn: heh

13:57 Chousuke: you sure you don't want "\\u"

13:57 jaen: autodidakto: actually, I didn't try it yet in anything big, but I like the approach

13:57 jblomo: does clojure expect to use sun/oracle java? does it reply on it?

13:57 Chousuke: +? :p

13:58 autodidakto: ,(map #(symbol (str "\\u" %)) (range 800 802))

13:58 clojurebot: (\u800 \u801)

13:59 devn: autodidakto: nah, i figured out the problem

13:59 it's this:

13:59 ,(str "\u" "8000")

13:59 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid unicode escape: \u">

13:59 devn: ,(str "\u8000")

13:59 clojurebot: "耀"

13:59 devn: ,(symbol "\8000")

13:59 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Invalid digit: 56>

13:59 devn: ,(symbol "\u8000")

13:59 clojurebot: 耀

14:00 devn: i want to build up a string that is \u8000, but str will make it a string and i want it as a symbol

14:00 autodidakto: hmm

14:00 devn: not sure how to accomplish that

14:01 autodidakto: ,(symbol (str "\u8000"))

14:01 clojurebot: 耀

14:02 autodidakto: ,(symbol (str "\\u" "8000"))

14:02 clojurebot: \u8000

14:03 jblomo: ,(char 8000)

14:03 clojurebot: \ὀ

14:03 pjstadig: you probably just want to use a method on java.lang.Character or something

14:03 devn: haha, doh

14:04 pjstadig: the \u is evaluated before the string object is even returned, so I don't think you have a chance of doing what you want

14:04 devn: nono that's fine -- i didnt know that char of int would handle higher values

14:04 Bronsa: ,(str "\…u8000")

14:04 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \…>

14:04 Bronsa: ,(str "\\u8000")

14:04 clojurebot: "\\u8000"

14:04 Bronsa: duh

14:04 autodidakto: hehe

14:05 devn: ,(map char (range 8500 8510))

14:05 clojurebot: (\ℴ \ℵ \ℶ \ℷ \ℸ ...)

14:05 devn: That's really all I wanted. Thanks guys.

14:05 autodidakto: lol np

14:05 pjstadig: ,(char (Integer/valueOf "8000" 16))

14:05 clojurebot: \耀

14:05 autodidakto: ,(char (Integer/valueOf "8503" 16))

14:05 clojurebot: \蔃

14:06 autodidakto: ,(char 8503)

14:06 clojurebot: \ℷ

14:06 pjstadig: ,(char 0x8000)

14:06 clojurebot: \耀

14:07 autodidakto: ,"clojurebot: you break it, you buy it"

14:07 clojurebot: "clojurebot: you break it, you buy it"

14:14 samaaron: how can i read a binary file into a byte array?

14:14 technomancy: samaaron: for some reason to-byte-array got dropped when clojure.contrib.io got promoted to clojure.java.io

14:14 samaaron: boo

14:15 technomancy: I think you can c.j.io/copy a j.io.File into a ByteArrayInputStream though

14:15 samaaron: oh, interesting

14:15 pjstadig: i was just going to suggest that

14:15 samaaron: technomancy: oh, and whilst we're chatting - lein2 fails for me when I'm trying to start a swank server and I don't have a network connection

14:16 I think it's trying to grab latest snapshots or something

14:16 technomancy: samaaron: oh, but not lein1?

14:16 oh, I see

14:16 samaaron: nope, lein1 wins

14:16 oh, also..

14:16 technomancy: I just added an :offline profile to lein2

14:16 samaaron: lein2 blows up if I have a .#foo.clj file in my project

14:16 which emacs kindly places there for edited files

14:17 technomancy: samaaron: do you have :aot :all set?

14:17 samaaron: nope

14:17 i've never used aot in my life

14:17 technomancy: wonder why it would care about that

14:17 samaaron: sounds too much like aol for my liking

14:17 technomancy: oh buuuuurn

14:17 yeah, aot sucks

14:19 can you open issues for those two?

14:19 samaaron: sure

14:19 autodidakto: samaaron: I suppose you're going to complain about the new :fasebuk option, too, eh?

14:19 technomancy: thanks

14:22 samaaron: autodidakto: what on earth is the :fasebuk option?

14:22 gtrak: :fasebuk = files attributes since every batch unknown kool-aid

14:23 samaaron: sounds like gobbeldygook to me

14:23 gf3: ahem

14:23 it's obviously the FACEBOOK option

14:23 pfffft

14:23 samaaron: :-p

14:23 i know that

14:23 i just couldn't come up with similar puns in time

14:23 gf3: just like the new :maispaec

14:24 samaaron: :siri

14:24 autodidakto: new? only the overtone kids use that

14:24 samaaron: the overtone kids are a crazy bunch

14:25 speaking of overtone, i just got my new nanoKontrol2 hooked up

14:25 i can even light up the buttons too

14:25 sweet

14:25 autodidakto: *googles* nice

14:26 samaaron: the bonus is that it fits in my bag

14:26 autodidakto: got plans for it?

14:26 samaaron: well, i'm always wanting to explore synth params

14:26 and i'm sick of hitting C-x-C-e with new vals

14:27 i want to slide a slider

14:27 so now i can

14:27 basically, i'll expose the controller as a map where the vals are atoms

14:28 which store the latest vals for all the controller components

14:28 so you can start usign it for whatever you want

14:28 you can either poll with derefs or add watchers

14:29 autodidakto: sounds good. Having the right tools that let you quickly experiment is important for creativity.

14:29 gtrak: adding a watcher is kinda equivalent to skipping the atom altogether, no?

14:29 event to event, i mean

14:30 samaaron: gtrak: yeah, overtone has an event stream you can listen in on

14:30 but it should also be possible to ask for the current state

14:30 without having to have had already observed all the events

14:31 so we'll have both :-)

14:31 gtrak: right, nice

14:31 I was just thinking about the same thing recently, using an atom for the state in an update loop

14:31 in a little physics simulation that happens to use quill :-)

14:32 samaaron: gtrak: you mean like this monstrosity: https://github.com/samaaron/gen-art/blob/master/src/gen_art/awful_animated_rotated_lines.clj

14:33 gtrak: samaaron, something like that but much more monstrous, in fact, my update loop runs at 500Hz and the Processing loops polls it at 60 for drawing :-)

14:33 samaaron: gtrak: you should be careful about using atoms within the Quil draw loop - you need to ensure that they're local to a given sketch

14:34 gtrak: samaaron, yea, I did that, I used applet/applet directly instead of defsketch

14:34 samaaron: one way to acheive that is to declare your atoms in a call to set-state!

14:34 gtrak: there are still some subtleties about the dynamic scoping that I have to work through

14:34 samaaron: which stores the state within the atom

14:35 gtrak: if you're curious: https://github.com/gtrak/quilltest/blob/master/src/quilltest/core.clj for the loop and https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj for the main prog, though it's not ready yet

14:36 samaaron: wow

14:36 gtrak: I also proxied KeyListener so I could take control of keys

14:36 samaaron: you're doing much more work than necessary

14:36 gtrak: heh, I imagine :-)

14:36 just messing around

14:36 samaaron: you don't need to do any of that proxying stuff

14:36 I need to document stuff too :-)

14:37 gtrak: samaaron, that semaphore thing, I stole from stackoverflow, it's actually interesting :-)

14:37 samaaron: so, first declare all your sketch state in set-state! within your setup fn

14:37 gtrak: http://stackoverflow.com/questions/5274619/investigation-of-optimal-sleep-time-calculation-in-game-loop

14:37 samaaron: then take a look at the handler options in https://github.com/quil/quil/blob/master/src/quil/core.clj#L4300

14:38 you've got :key-pressed, :key-typed, :key-released

14:38 I've done the proxying for you :-)

14:38 gtrak: yea, I tried to use the key-pressed functions, but it seemed like it was only happening once per frame? maybe I was doing it wrong

14:38 Raynes: samaaron: https://github.com/technomancy/leiningen/issues/477 Respond, damn you

14:38 samaaron: oh yes, definitely once per frame

14:38 at the end of a frame draw

14:39 gtrak: samaaron, mine is not once-per-frame

14:39 samaaron: oh, weird

14:39 why do you want that?

14:39 Raynes: what happened to your gentlemanly manners?

14:39 gtrak: I keep a set of currently pressed keys, then I look at the atom in my update loop

14:39 it works well

14:39 Raynes: samaaron: They began to wane along with the length of time I sleep at night.

14:40 samaaron: Raynes: you should be careful about that - good sleep is super important

14:41 technomancy: Raynes: maybe it's all the elixir you're consuming

14:41 Raynes: Bahaha

14:41 gtrak: samaaron, it acts just like the midi device you just described, would you rather poll a keyboard at 60fps or act on it as an event stream?

14:41 technomancy: are you sure it isn't a jekyll/hyde kind of brew?

14:42 gtrak: basically I couldn't make the 'set of currently pressed keys' thing work unless I did that

14:42 Raynes: technomancy: My URI library is now in Elixir proper. Hard work payed off.

14:43 technomancy: so they accept pull requests then? =)

14:43 that's cool

14:44 samaaron: gtrak: if i'm using the keyboard events to control my sketch, i'm happy to poll at the current framerate

14:44 given that i can't do anything faster than the current framerate anyway (in terms of drawing)

14:44 gtrak: right, I think it's a consequence of my asynchronous update loop existing

14:44 Raynes: technomancy: Yeah, dude, it's like they *want* contributions. Blew my mind.

14:44 technomancy: must be refreshing

14:44 Raynes: technomancy: I actually have commit rights now though.

14:44 technomancy: sweet

14:45 Raynes: technomancy: To put it in perspective, I started using this language less than a week ago.

14:45 autodidakto: Is this elixir-lang you speak off?

14:45 of

14:45 Raynes: Aye

14:45 gtrak: samaaron, well, the key thing works great, but I notice there's a little jitter in the drawing, probably due to GC

14:46 autodidakto: I just stumbled across it's webpage. Looks interesting.

14:46 samaaron: gtrak: the problem is that processing isn't as effecient as it could be

14:47 gtrak: samaaron, I imagine I'll end up implementing most of it if I keep on this path, haha :-). I'm new to processing,awt,swing and stuff

14:47 technomancy: samaaron: according to some guy in #android they considered using processing for the android graphics, but they found they could get better perf out of an 800MHz phone with their own stuff vs processing on a 2GHz desktop =(

14:47 "they" being google

14:47 samaaron: technomancy: doesn't surprise me at all

14:48 I see Quil more as a fun toy and a prototying tool

14:48 it's like a graphics gateway drug

14:48 gtrak: i do very much like how easy it is for me to visualize stuff and focus on business logic, without having to worry about the specifics so much

14:49 samaaron: gtrak: yeah, that's exactly the point :-)

14:49 also, if you use the :opengl renderer, things tend to go faster too


14:49 samaaron: but you need lein2 for that

14:49 Bronsa: oh gosh, sorry for the caps

14:49 Iceland_jack: Bronsa: ...

14:49 samaaron: Bronsa: LEARN ME A HASKELL

14:49 gtrak: samaaron, I'll show it to you once I get collision detection working :-), I'm a few days away

14:49 Bronsa: thanks

14:49 samaaron: gtrak: awesome

14:49 Bronsa: didnt mean to yell it

14:50 samaaron: Bronsa: THAT'S OK!

14:50 Bronsa: now you're making me feel unconfortable.

14:50 samaaron: Bronsa: I suggest remapping your CAPS LOCK key to CTRL

14:50 it's much handier that way

14:50 Bronsa: emacs?

14:50 clojurebot: emacs is best configured for Clojure with instructions at http://technomancy.us/126

14:51 samaaron: clojurebot: you're forgetting the overtone/live-coding-emacs config

14:51 clojurebot: No entiendo

14:51 Bronsa: i do actually like the position of CTRL

14:51 RickInGA: samaaron: that live coding config is fantastic

14:52 samaaron: RickInGA: why thank-you very much

14:52 RickInGA: or, at least I started to think so once I learned to live without a menu bar :)

14:52 samaaron: haha

14:52 * llasram checks out quil. Notices is a contributor

14:52 llasram: That one line patch to clj-processing has really paid off! :-)

14:52 samaaron: llasram: haha :-)

14:53 RickInGA: samaaron: probably means nothing to you, but I am racked with guilt..... I am sooo sorry that I missed overtone hack night at clojure west

14:53 samaaron: RickInGA: ah, that's a shame - it was a lot of fun

14:53 are you coming to EuroClojure?

14:54 RickInGA: samaaron I am trying to think up an excuse why I have to, and I just can't come up with one yet

14:54 samaaron: RickInGA: well I'm sure there will be plenty of other awesome opportunities to get your Overtone on

14:54 gtrak: cheaper wine?

14:54 RickInGA: I need to find out when my nephew is graduating from high school, if it is that weekend I have to stay here, if it is the previous weekend.... we'll just see

14:56 gtrak: samaaron, is quil purely a processing wrapper, or could it use some extra stuff?

14:57 in terms of contributions

14:57 autodidakto: Bronsa: Book length, Learn You a Haskell has a free and well formatted online version. Lisperati guy (conrad or wutever) has a intro to haskell for lisp people tutorial too

14:58 emezeske: Bronsa: I second "Learn You a Haskell...". It was really, really good.

14:58 Bronsa: i'll go with that then

14:58 thanks all

14:58 RickInGA: emezeske is it available to read free online?

14:59 Raynes: http://learnyouahaskell.com/

14:59 autodidakto: http://learnyouahaskell.com/chapters

14:59 emezeske: RickInGA: Yeah, definitely!

14:59 RickInGA: Although I'd recommend paying for it, it's that good ^_^

15:00 RickInGA: It's under the CC license, so I think someone ported it to the ebook formats too

15:01 RickInGA: I have an online subscription from oreilly, and it is available there

15:01 does any one know if authors get any royalties when I read books on the oreilly site?

15:02 autodidakto: RickInGA: Real World haskell, from oreilly, seems to be the second best book

15:03 fdaoud: emezeske as in lein cljsbuild auto?

15:03 ibdknox: fdaoud: that's him

15:04 * emezeske ducks behind a chair.

15:04 fdaoud: very cool--thank you for that :)

15:04 ibdknox: emezeske: you're famous!

15:04 emezeske: Woo!

15:04 fdaoud: Thanks, that's nice to hear.

15:04 * ibdknox gathers the fan girls

15:04 fdaoud: you guys are my heroes :)

15:04 amalloy: ibdknox is just trying to deflect his own unwanted internet fame

15:04 emezeske: amalloy: hahaha

15:04 ibdknox: amalloy: shhhh

15:05 samaaron: gtrak: at its core, Quil is just a processign wrapper, but there's definitely room for namespaces of associated goodies such as physics, scenegraphs etc.

15:05 fprefect: is there any advantage using send instead of send-off with agents?

15:05 gtrak: ah, you see where I am going with this, then :-)

15:05 mfex: hey guys, i wrote a demo for cljs <-> clj communication with browserchannel: https://github.com/thegeez/clj-browserchannel-demo

15:06 samaaron: gtrak: that's why i created the quil organisation ;-)

15:06 jaen: As for Haskell I second the Learn You A Haskell For Great Good then Real World Haskell route

15:06 RickInGA: mfex thanks for link

15:06 samaaron: i see a sea of sister projects

15:07 gtrak: coolio, I'll let you know if I come up with stuff, I can definitely break out the physics part of what I'm doing

15:08 though I'm no expert, pretty sure it will explode all over the place unless I use some real algorithms

15:09 autodidakto: jaen: I think what haskell needs next is a good learn-by-example, play-while-learning style book/tutorial. Like the "Haskell for the Evil Genius" tutorial, but longer

15:10 rhc: autodidakto: isnt that supposed to be what "learn you a haskell" is?

15:10 jaen: autodidakto: well yes, that was pretty short

15:11 autodidakto: rhc: Doesn't seem that way to me. It's well structured, building block by building block, but not really "have fun while learning". It's kind of intense. methinks

15:11 rhc: but definately well written, funny, and enjoyable

15:16 Zoka: mfex: Looks good. At what number of concurrent connections one might see performance impact regarding sync vs async?

15:16 samaaron: technomancy: unfortunately you can't c.j.io/copy from a File to a ByteArrayInputStream

15:16 emezeske: autodidakto: I thought Learn You A... was one of the most "fun while learning" books I've read in a long time

15:17 mfex: Zoka: I have no idea, the current deployment on heroku runs out of allowed connections before threads

15:18 jaen: Certainly does good job of not scaring people away

15:18 autodidakto: emezeske: I believe you. I guess my criteria aren't very objective....

15:18 jaen: Haskell was my first foray into functional programming and I didn't bounce off with an attituted of FP being weird shit for weird people most people I know have ; d

15:18 Zoka: mfex: So Heroku has limit on connections?

15:19 emezeske: autodidakto: Well yeah, humor is pretty darn subjective :)

15:19 autodidakto: emezeske: I like the humor alot..

15:20 But after doing the first several chapters, I still wondered "ok and this is a superior way of doing things because..?" Like, nteresting little applications of what you just learned

15:21 mfex: Zoka, that's what I gathered. I haven't done any load testing comparisons of sync vs async

15:22 autodidakto: A lot of what I've seen, concerning the power of haskell, are clean implementations of algorithms and math stuff. I'd like to see more variety... I know there are games too, though

15:22 alfborge: Is there a better way to do this: (zipmap v (map #(and nil %) v))


15:23 I just want to create a hash-map with values key => nil for each key in v

15:23 amalloy: (zipmap v (repeat nil))

15:24 alfborge: amalloy: Ah, nice... thanks.

15:24 Makes so much sense when you know it.

15:24 mfex: the demo is here: http://cold-stream-6156.herokuapp.com/index.html

15:24 amalloy: #(and nil %) is atrocious, btw. if you want a function that always returns nil, just use (constantly nil)

15:26 Raynes: Bahaha

15:26 autodidakto: amalloy: that sounds like a good self-deprecating clojure blog name. (constantly nil)

15:26 Raynes: That's pretty awesome though, amalloy.

15:26 amalloy: Raynes: what is?

15:26 Raynes: #(and nil %)

15:26 alfborge: amalloy: Thanks, that's why I'm here asking for how to do it better.

15:27 amalloy: yeah, i confess it is a clever trick. i kinda prefer #(do % nil) if we're looking for clever/short ways to write it

15:27 Raynes: alfborge: You'll come to love amalloy. He may tell you your code is disgusting, but he always helps you make it non-disgusting.

15:28 autodidakto: ,(#(and nil %) 42)

15:28 clojurebot: nil

15:28 autodidakto: ,(#(nil) 42)

15:28 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0)>

15:29 autodidakto: ,(#(do nil) 42)

15:29 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval83$fn>

15:29 Bronsa: ,((fn [& _]) 42)

15:29 clojurebot: nil

15:29 autodidakto: ah

15:31 ,((constantly nil) 42)

15:31 clojurebot: nil

15:34 Prasad: how do I break out of for loop in clojure? i am trying to iterate over a vector and on some condition being true, there is some action and I want to break out of the loop

15:34 autodidakto: Speaking of atrocious code, I'm looking for advice on my pull request on clojure.dongs (https://github.com/danlarkin/clojuredongs/pull/3#issuecomment-4769820)

15:34 Raynes: You can't 'break' out of a loop from any given location. You have to stop recuring at some point.

15:35 Prasad: when I am using for like a for each, how do I do that?

15:35 autodidakto: prasad, you're talking about the for [ list list :when cond] list comprehension thingie?

15:36 Prasad: for [i some-vector]

15:36 amalloy: :while

15:37 Prasad: (for [i list] (if (something) (break-after-doing (do-something) ) )

15:37 wanted something like that

15:38 AimHere: amalloy's :while might be what you want

15:38 amalloy: if you're using `for` for side effects, it will only end in tears

15:38 switch to doseq

15:38 autodidakto: it sounds like you looking through a list for the right thing, then doing something and exiting?

15:38 Prasad: autodidakto, yes

15:38 amalloy: oh, good point. don't use for or doseq

15:39 (do-something-to (first (filter something the-list)))

15:39 AimHere: If this sequence is lazy enough, couldn't you wrap it in a take-while?

15:39 Prasad: its a vector not a sequence

15:39 autodidakto: filter the list, do run a function on the result

15:39 AimHere: take-while works happily on a vector too

15:40 hhutch: Prasad: a vector is an ISeq, doseq works on any ISeq

15:40 autodidakto: AimHere: I think he's like for a specific thing, then doing something with just that and moving on. not really manipulating the whole list

15:40 *he's looking for

15:41 AimHere: Well if he's just looking for a vector/sequence/whatever entry that fulfils a condition, then won't 'filter' work?

15:41 Erm, no, sorry, because it'll keep riffling through the rest of the seq, unless you put a 'first' in it and it's lazy or sth

15:42 amalloy: &(instance? clojure.lang.ISeq [1])

15:42 lazybot: ⇒ false

15:42 autodidakto: AimHere: it looks like amalloy is way ahead of us

15:42 AimHere: So he is

15:42 amalloy: hhutch: vectors are seqable, not seqs. your point about filter is fine, just the details (ie, ISeq) are wrong

15:43 Prasad: so should I be trying filters?

15:43 autodidakto: ,(println (first (filter #(= "yes" %) ["yes"])))

15:43 clojurebot: yes

15:44 kurtharriger: is it possible to compile a clojure class file that (:imports a jova class without the static initializers in the java class being run?

15:46 TimMc: amalloy: ##(#(do %& 45) 1 2 3)

15:46 lazybot: ⇒ 45

15:46 TimMc: Moar general purpose.

15:46 amalloy: yes, i'm aware

15:46 TimMc: and still terrible

15:47 amalloy: kurtharriger: no. it's not possible to do that in java, either

15:47 kurtharriger: when using zookeeper-clj :aot compilation will result in a bunch of zookeeper log output during compile... I found it seems to be that simply (import java class) runs the static initializers... not sure if there is a way to prevent that during clojure compile

15:47 Prasad: autodidakto, what does that line do? println..

15:47 kurtharriger: yeah but you can compile java without running the code... kind of a weird mix here where compiling clojure code runs also runs it

15:48 autodidakto: Prasad: type (doc println) in your repl

15:48 Prasad: autodidakto, I mean the complete s-exp that you suggested

15:49 TimMc: kurtharriger: What's the use-case?

15:49 amalloy: it's kinda gross that zookeeper logs/activates just when you load the class. surely it should only do that if you call some methods at it

15:49 autodidakto: Prasad: ok so... ["yes"] is the vector... i should have done ["yes" "no" "maybe"] as a better example

15:49 amalloy: you can kinda fake it, if you're willing to forego the import

15:50 using the Class/forName trick to delay loading to runtime, if you don't need the class at compile-time (but then you can't, eg, typehint it)

15:50 kurtharriger: It looked like my project was attempting to connect to zookeeper during compile, which would fail if zookeepr is not running

15:50 autodidakto: Prasad: I filter that vector with an anonymous function (using the #( %) shortcut). It tries to find the word "yes"

15:50 Raynes: Man, where is brehaut. We need to talk about music and the merits of coffee.

15:50 Prasad: autodidakto, aah, got it, thnks

15:50 kurtharriger: it seemd that simply importing a java class with static initializer is causing the issue... but not sure how to prevent it from doing that... perhaps I could move the import into the defn

15:50 autodidakto: Prasad: first grabs the first result (there could be many "yes"'s), then i print it :)

15:51 Prasad: np

15:51 gtrak: kurtharriger, eval

15:52 alfborge: amalloy: Thanks, that's why I'm here asking for how to do it better.

15:52 sorry, wrong buffer...

15:52 TimMc: Raynes: brehaut is in NZ. Next question?

15:53 Raynes: TimMc: Yes, but he is always around when I'm around. At least, usually.

15:58 gtrak: kurtharriger, check out https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/impl.clj#L41 for an example

16:00 devn: just compiled core.cljs to C

16:00 crazy.

16:00 alfborge: Is there a reason why the following won't work: (map #(ref-set m (assoc @m % %)) input)? It's within a dosync and m is a ref.

16:01 to a hash-map

16:02 kurtharriger: gtrak: ah cool thanks

16:02 gtrak: np

16:02 replaca: dnolen: does core.match do any binding? I want to match a map/vector nested crazy combo and pull some values out in addition to verifying the structure.

16:02 gtrak: kurtharriger, actually the line above is the one that actually causes the class to get loaded

16:03 the eval is there so the code doesn't have to compile to it

16:03 dnolen: replaca: it does do binding - word of caution core.match has many edge case bugs and few patches at the moment.

16:03 kurtharriger: ok, I'll play around with it

16:04 replaca: dnolen: is there a binding example? I don't see anything in the readme (but I may be blind)

16:04 dnolen: replaca: :as

16:04 kurtharriger: it looks like its just reading config and logging config values not actually trying to connect

16:04 dnolen: if you want to capture a whole part of the pattern and give it name, otherwise just using variable will create bindings

16:04 Raynes: alfborge: Using ref-set is a 'side effect'. You don't want to use map for that. Besides that, ref-set is a huge warning side. You almost certainly don't need it for what you're trying to do. Do you have a larger example of what you're aiming for that we can look at?

16:05 replaca: ahh, ok so {:a a} is like (let [a (get ... :a)] ...) ?

16:05 gtrak: kurtharriger, well, if you want more control over when a class gets loaded, you'll have to use reflection, as in that example

16:05 alfborge: Raynes: I'm playing with the Anagram kata and I'm generating an anagram dictionary.

16:05 kurtharriger: I don't need aot here either but I find that during development if I compile with aot I find typos and such I wouldn't find otherwise till runtime

16:07 pipeline: all we need is a flymake-clojure ;)

16:08 ibdknox: dnolen: what'd you show for your demo the other day? :)

16:08 alfborge: Raynes: I was just surprised that the ref-set within the map didn't work.

16:08 gtrak: pipeline, flymake-clojure is paredit, I thought :-)

16:09 pipeline: gtrak: I can't stand paredit for whatever reason

16:09 deech: Hi all, does anyone know if Clojure has a Spring DSL? Something like this: http://code.google.com/p/dynaspring/

16:10 dnolen: ibdknox: I have a whole file that I can run in Sublime Text 2 running against Chrome (I don't reveal that to the end)

16:10 gtrak: well, not sure what else would count as 'syntax' to be checked

16:10 dnolen: ibdknox: I show the basic of the language - yesterday I showed core.logic running, people were pretty impressed by that.

16:10 ibdknox: folks were also pretty impressed by GClosure compression

16:10 ibdknox: :)

16:10 samaaron: how can i read in a file containing binary data into a byte array?

16:10 dnolen: I started reading the Reasoned Schemer yesterday

16:11 I need to find some jam to make the required stains

16:11 ibdknox: dnolen: you're using st2 for your clojurescript stuff?

16:14 alfborge: How about this? How would I make this work? (hash-map (map #('(sort %)) v))

16:15 samaaron: alfborge: what are you trying to do?

16:17 gtrak: alfborge, map creates a lazy sequence, a ref-set is a side-effect, it will only perform it when you realize the seq

16:18 alfborge: gtrak: Thanks, that explains it. :)

16:18 gtrak: np :-)

16:18 alfborge: samaaron: The latter is an attempt to, given a vector, create a hash map of the items in the vector with the sorted item as key and the item as value.

16:20 samaaron: alfborge: so is v a seq of seqs?

16:20 alfborge: v is a seq of strings

16:20 samaaron: (def v ["foo" "bar" "baz"])

16:21 and what would you like the output to look like?

16:21 alfborge: {"abr": "bar" "abz": "baz" "foo": "foo"}

16:22 samaaron: ,(sort "bar")

16:22 clojurebot: (\a \b \r)

16:22 samaaron: so you have to deal with the fact that you'll get a seq of chars

16:22 ,(apply str (sort "bar"))

16:22 clojurebot: "abr"

16:22 alfborge: I don't really need to :)

16:22 I don't mind a seq of chars

16:23 mfex: ,(group-by sort ["foo" "bar" "baz" "zab"])

16:23 clojurebot: {(\f \o \o) ["foo"], (\a \b \r) ["bar"], (\a \b \z) ["baz" "zab"]}

16:23 mfex: handles doubles as well

16:24 alfborge: mfex: nice

16:24 samaaron: mfex: oh awesome

16:24 hadn't thought of group-by

16:24 pandeiro: ibdknox: any idea what would be causing weird reader errors (map literal requires even number of forms) from noir.cljs.watcher/start or thereabouts? off-hand? (i have skip aot)

16:24 alfborge: mfex: But I'd love to know how I'd make my naive attempt work as well.

16:24 mfex: As that paints a picture of a hole in my understanding. :)

16:24 samaaron: ,(into {} (map (fn [s] [(apply str (sort s)) s]) ["foo" "bar" "baz"]))

16:24 clojurebot: {"foo" "foo", "abr" "bar", "abz" "baz"}

16:24 ibdknox: pandeiro: gist of server.clj?

16:25 what version noir-cljs?

16:25 samaaron: alfborge: that's more like your solution

16:25 gtrak: ugh, I needed group-by last night, thanks mfex :-)

16:25 samaaron: but group-by is far more elegant

16:25 gtrak: this is why I hang out with you guys

16:25 alfborge: samaaron: thanks, and I totally agree

16:26 pandeiro: ibdknox: http://sprunge.us/MhbO

16:27 ibdknox: pandeiro: which version of noir-cljs?

16:27 pandeiro: 0.3.0

16:28 ibdknox: not sure

16:29 Raynes: ibdknox: Howdy friend.

16:29 pandeiro: i tried to build the cljs-template scaffolding in an existing project by copying stuff over manually

16:29 i guess i can eventually create the template and migrate my work over

16:29 mattmitchell: i have a ring/compojure app here, and I want to test that one of my handlers properly sets a session value... anyone know how i can do that?

16:30 ibdknox: Raynes: hola

16:30 pandeiro: can you put up the full stack trace?

16:31 TimMc: devn: What are you on about.

16:34 pandeiro: ibdknox: son of a bitch is working now, i am completely baffled... sorry...

16:34 ibdknox: haha

16:34 yay!

16:34 :)

16:34 weavejester: mattmitchell: You can just check the :session key on the response

16:34 alfborge: #(do [(sort %) %]) <- Is this right or is this atrocious?

16:35 As opposed to (fn [s] [(sort s) s])

16:35 samaaron: i much prefer the latter

16:35 alfborge: Any rules or style guides saying what's more apropriate?

16:35 mfex: alfborge, that do thing is imho nasty and for golf only

16:36 alfborge: golf?

16:36 samaaron: alfborge: golf - writing the shortest program possible

16:36 TimMc: alfborge: (juxt sort identity)

16:37 mfex: when you want #() to return a vector use #(vector key value) or instead of map use (for [i items] [key value])

16:37 mattmitchell: weavejester: that's what I thought, but it's not there. I must be doing something wrong hmm.

16:37 alfborge: TimMc: interesting, thanks. :)

16:37 * alfborge is learning

16:37 * Raynes gives alfborge his juxt badge.

16:37 TimMc: oy, that's mine!

16:38 Somelauw: goldcode?

16:38 Raynes: gloldcode.

16:38 weavejester: mattmitchell: I'm not sure how it can not be there if you're setting the session on the response...

16:38 johnkpaul: using clojurescript, is there a way to use the closure compiler to give type warnings for unimplemented protocols?

16:38 zamaterian: le

16:38 weavejester: mattmitchell: I mean, you've added a :session key to the response map you're returning, right?

16:39 mattmitchell: And you're then saying that the response map you've added the :session key to doesn't have the :session key?

16:39 mattmitchell: weavejester: yes. It must be the app test helper I'm using

16:39 TimMc: Raynes: Well, I guess xe's been juxted. Close enough.

16:39 weavejester: mattmitchell: Hm… Are you testing before or after the standard middleware?

16:40 mattmitchell: weavejester: i believe its after, but clearly i'm needing to dig a bit on this one

16:41 weavejester: mattmitchell: If it's after, then the session middleware will have already consumed the :session key.

16:41 mattmitchell: weavejester: ahh ok

16:41 weavejester: mattmitchell: If you're using an in-memory session, you can supply your own atom and look inside it.

16:42 beffbernard: Anyone know if nth on a string is constant time?

16:43 weavejester: On a completely different topic, I really hate how Google documents things sometimes. Or rather doesn't. :(

16:43 mattmitchell: weavejester: hey thanks for your help!

16:43 maio: how should I write InputStream to file?

16:44 weavejester: maio: clojure.java.io/copy

16:44 maio: weavejester: thanks

16:47 alfborge: I'm off. Thanks a lot for all the help. Wish I'd come here sooner :)

16:48 pandeiro: what do most of you use for use/require substitutes at the cljs repl?

16:49 ibdknox: pandeiro: just re-evaluate the ns form

16:50 pandeiro: ibdknox: that's what i figured, thanks

16:51 espringe: I have a clojure.lang.Cons of characters, and I'd like to create a string. How is this possible?

16:51 I can't find a 'flatmap' style function, and flatten doesn't do anything

16:52 eggsby: flatmap... catmap?

16:52 mapcat

16:52 or (apply str [\a \b \c \d \e \f \g])

16:53 &(apply str '(\a \b \c \d \e \f \g))

16:53 lazybot: ⇒ "abcdefg"

16:53 espringe: Ah, great. Thanks eggsby

16:53 mapcat is really what im after

16:53 thanks again

16:54 eggsby: np espringe

17:00 dnolen: samaaron: cool!

17:00 samaaron: dnolen: it's beautifully written

17:00 i'm only at p20 though

17:00 it takes a lot of brain power to push through

17:00 dnolen: ibdknox: not my own stuff, but it's great for presentations - the no-distraction mode is great for focusing on code during presentation.

17:01 samaaron: it is beautiful written and incredibly deep. I had to read it 4 or 5 times I think.

17:02 samaaron: dnolen: I have the feeling I'll have to do the same

17:03 dnolen: samaaron: it's a radically different way of thinking about programs - you have to unlearn quite a bit I think. Once you do it seems obvious and simple :)

17:03 samaaron: yep, i get that feeling already

17:05 dnolen: samaaron: I think we'll be able to get a lot of mileage out of core.logic - jim duey's work on getting it to work under fork/join is still blowing my mind.

17:05 samaaron: what's he up to?

17:06 eggsby: what are you guys discussing? the reasoned schemer?

17:06 jaen: Huh, I just googled for st2 not realizing you mean sublime text and found a REPL plugin for it, how cool is that ; D

17:06 samaaron: eggsby: yup :-)

17:06 dnolen: samaaron: he figured out how to make core.logic run it's goal in parallel. Will & Dan et al have been working on that problem for a long time. jim duey got it working well enough for most tests to pass and not cause zebrao to take a perf hit - which is insane IMO.

17:06 samaaron: woah

17:06 eggsby: ah, I am just reading 'The Seasoned Schemer', only just finished The Little Schemer last month

17:07 samaaron: is he seeing any performance improvements?

17:08 dnolen: samaaron: no, I think he's taking a break I think it required a lot of hammock time - even though in the end the modifications seem simple.

17:08 samaaron: there's a fork-join branch on the main repo so anyone can take a look and he has a good blog post on it - http://www.clojure.net/2012/03/26/Messin-with-core.logic/

17:09 samaaron: i guess it's a granularity problem

17:10 dnolen: samaaron: probably - but it's promising that perf didn't decrease which is usually the case.

17:14 samaaron: dnolen: for sure :-)

17:29 jsabeaudry: What is the appropriate way to access /dev/mem from clojure?

17:29 From what I have read you can't mmap device files

17:30 pandeiro: would it be possible to run a browser repl and a noir server in the same java process?

17:33 TimMc: Does this still represent a sane way of using Clojure in a Jetty + Maven context? http://cemerick.com/2010/01/08/sane-web-development-with-compojure-jetty-and-maven/

17:34 cemerick: TimMc: not really

17:34 Lajla: Chousuke, mitä perkeleen vittua on ##(let [some-datum (list (symbol "Minä palvon Hänen Varjoansa"))] (= some-datum (read-string (print-str some-datum))))?

17:34 lazybot: ⇒ false

17:35 TimMc: What has changed?

17:35 Raynes: Everything.

17:35 TimMc: *Other* than that.

17:35 &"ping"

17:35 lazybot: ⇒ "ping"

17:36 mk: what are the various notations for the bots?

17:36 weavejester: & and ,

17:36 lazybot: java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and

17:36 weavejester: &(+ 1 1)

17:36 lazybot: ⇒ 2

17:36 weavejester: ,(+ 1 1)

17:36 amalloy: and also ##(inc 1)

17:36 lazybot: ⇒ 2

17:36 clojurebot: 2

17:37 mk: ~help

17:37 clojurebot: http://www.khanacademy.org/

17:37 TimMc: hahaha

17:37 cemerick: TimMc: depends on what your environment is

17:37 amalloy: (inc clojurebot)

17:37 lazybot: ⇒ 9

17:38 mk: that does not seem functional

17:38 cemerick: if you are starting maven from the command-line, then it's pretty straightforward to ensure that your webapp starts an nREPL or swank server when it is loaded, whichyou can then connect to using emacs+SLIME or Counterclockwise or leiningen or repl-y or vimclojure, etc.

17:38 TimMc: oooh, nREPL, right

17:39 I'd basically like to be able to stand up a noir instance and hack on it live, but also have a Maven-y way of packaging it up for use with a launcher, in this case Tanuki

17:40 mk: so &atstart and # #anywhere trigger the 1.3 bot, while ,atstart triggers the older one. ~ is the dictionary, and (inc name) does something inappropriate with usernames

17:40 is that all?

17:41 TimMc: mk: And $ is the command trigger for lazybot

17:41 $fire

17:41 mk: $isthatlike~

17:41 TimMc: $kill

17:41 lazybot: KILL IT WITH FIRE!

17:42 mk: $google clojure

17:42 lazybot: [Clojure - home] http://clojure.org/

17:42 mk: so not just a string-string map

17:42 cemerick: TimMc: Any ring app is amenable to packaging as necessary; I wouldn't let those requirements impact your interactive development objectives

17:43 i.e. if you like hacking with SLIME, keep doing that, and leave the packaging bits off to the side

17:43 TimMc: I think I've some homework and archaeology to do.

17:44 (to learn about how this stuff is done in the standard Java case)

17:47 wei_: is there a "time" function that returns the time elapsed instead of printing it out? (I'm writing an http load test client)

17:47 Iceland_jack: (time (def a (printing-function))?

17:48 s/printing-//

17:50 amalloy: wei_: http://groups.google.com/group/clojure/browse_thread/thread/47b2cf43e404c906/876d8f439b3a8334?show_docid=876d8f439b3a8334

17:53 wei_: amalloy: ty! exactly what i needed

17:56 prasad: guys, is there semantic difference between (first (filter #(not (bit-test 2r000000000 %)) [4 3 1 5 7 0 2 6 8])) and replacing a vector with one defined earlier in the code

18:01 chouser: no

18:02 prasad: &((first (filter #(not (bit-test 2r000000000 %)) [4 3 1 5 7 0 2 6 8])))

18:02 lazybot: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn

18:02 chouser: &(first (filter #(not (bit-test 2r000000000 %)) [4 3 1 5 7 0 2 6 8]))

18:02 lazybot: ⇒ 4

18:02 prasad: &(first (filter #(not (bit-test 2r000000000 %)) [4 3 1 5 7 0 2 6 8]))

18:02 lazybot: ⇒ 4

18:03 prasad: chouser, if I replace the vector with one defined before as (def moves [4 3 1 5 7 0 2 6 8])

18:03 it returns 0

18:03 instead of 4

18:03 m I going wrong somewhere

18:04 chouser: yeah, the problem must be elsewhere, or 'moves' doesn't have the value you think it does.

18:05 prasad: chouser, i think i got it, i had changed some stuff, and forgot to recompile things

18:05 working with counterclockwise

18:05 thnkx

18:06 chouser, is there any way to display the binary value upto 8 bits for number returned by this expr ?

18:08 chouser: what do you mean?

18:08 &[1 0 0 1 1 0 1 0]

18:08 lazybot: ⇒ [1 0 0 1 1 0 1 0]

18:09 chouser: &(apply str [1 0 0 1 1 0 1 0])

18:09 lazybot: ⇒ "10011010"

18:09 chouser: sorry, gotta run.

18:14 prasad: chouser, i mean from 4 get 100

18:15 chouser, ok c ya l8r

18:26 jblomo: if you try to add metadata to an object not implementing IMeta, it'll be silently ignored?

18:28 amalloy: it'll explode violently

18:28 but surely it's easier to just try it than to ask

18:29 jblomo: ,^:has-meta Class

18:29 clojurebot: java.lang.Class

18:29 jblomo: ,(meta ^:has-meta Class)

18:29 clojurebot: nil

18:29 jblomo: ,(meta ^:has-meta [])

18:29 clojurebot: {:has-meta true}

18:29 jblomo: fair enough

18:31 ipostelnik: will code like this (doseq [n (take 1000000 (iterate inc 0))] ....) actually create an internal list 1M entries while doseq runs?

18:35 technomancy: Zoka: hey, having some fun with ringmon; thanks

18:35 do you know why I'd periodically get org.codehaus.jackson.JsonGenerationException: Cannot JSON encode object of class: class javax.management.ObjectName: java.lang:type=OperatingSystem?

18:35 ipostelnik: apparently the answer is yes

18:35 technomancy: ipostelnik: it will create a lazy seq

18:35 ipostelnik: why can't leading entries of of lazy-seq get gc'ed?

18:36 technomancy: they will get GC'ed if no references exist to them

18:36 you must be holding on to the head of the seq

18:39 amalloy: jblomo: you're not attaching metadata to the object java.lang.Class, you're attaching it to the symbol Class

18:40 &(meta (with-meta Class {:has-meta true}))

18:40 lazybot: java.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IObj

18:41 ipostelnik: technomancy, the simple case does work as expected

18:41 what qualifies as holding onto the head?

18:42 jblomo: amalloy: oh interesting. so why is the return value java.lang.Class in the first example?

18:42 amalloy: because that's what the symbol Class resolves to once you eval it

18:42 &Class

18:42 lazybot: ⇒ java.lang.Class

18:42 jblomo: aah

18:42 cool, thanks

18:42 arohner: ipostelnik: that means you have a reference to the beginning of an infinite seq

18:43 technomancy: ipostelnik: http://stackoverflow.com/questions/5698122/explanation-of-lose-your-head-in-lazy-sequences

18:43 amalloy: &' ^:has-meta Class

18:43 lazybot: ⇒ Class

18:43 amalloy: &(meta (quote ^:has-meta Class))

18:43 lazybot: ⇒ {:has-meta true}

18:47 samaaron: technomancy: so this is what i ended up with w.r.t. binary file slurping: https://gist.github.com/2231226

18:48 technomancy: samaaron: man... that sucks

18:49 samaaron: I think at my last job we ended up copying to-byte-array out of clojure.contrib.io

18:49 samaaron: technomancy: i'm not proud of it - but it does work

18:49 i just ended up translating an java algorithm

18:49 technomancy: is it worth opening a bug re: c.j.io/copy?

18:50 seems reasonable to expect it to work with an input-stream arg

18:50 samaaron: good question

18:50 do you have any idea how i might go about that - i've not used any of the jira nonsense

18:50 perhaps an email do the dev mailing list might be a good start?

18:51 technomancy: just opening a bug is not too horrible

18:52 but yeah, probably emailing clojure-dev first would be good

18:59 slyrus: technomancy: fwiw, trying to do java interop from abcl makes me appreciate lein :)

19:01 technomancy: slyrus: heh; cool

19:17 is passing :join? false in the opts map of run-jetty supported by other ring handlers?

19:17 or is it specific to ring?

19:18 weavejester: It's not part of a standard, but other adapters might implement it.

19:18 technomancy: weavejester: thanks; good to know

19:18 better not rely on it here then

19:29 ForSpareParts: Could anyone answer a noob question?

19:30 aperiodic: only if you ask it

19:30 ForSpareParts: fair enough

19:30 I'm working through some simple exercises to get a handle on Clojure

19:30 and I want to try storing some functions in a map

19:31 I'm not exactly sure what the right syntax is to pull them out (or to store them, I guess)

19:31 I've tried something like

19:31 {"a" (+) "b" (-)}

19:31 and various similar things

19:32 I'd like to be able to look up a function in the map and apply it to args somewhere else. How should I do that?

19:32 arohner: ForSpareParts: + refers to the fn itself. (+) tries to call the fn with no args

19:32 if you have the fn, you can call (apply + [1 2 3])

19:32 ,(apply + [1 2 3])

19:32 clojurebot: 6

19:32 arohner: apply takes a fn, and a seq of args to use

19:33 ForSpareParts: arohner: brilliant, thanks!

19:34 I'm still a little confused about apply, though -- why would I use that instead of just invoking the function?

19:34 eggsby: sometimes you need to because the context demands it

19:35 what if a function generates something that you want to use as parameters for a function?

19:36 ForSpareParts: OK. So I'd use if, say, a function returned a sequence, and I wanted to feed that sequence into another function?

19:36 eggsby: (apply custom-fn (gen-params my-data))

19:36 yes

19:36 ForSpareParts: cool

19:36 thanks again, guys

19:36 eggsby: if you have a list like [1 2 3 4] and you want to sum them you couldn't sum [1 2 3 4] since summing a vector with nothing makes no sense

19:36 however, (apply sum [1 2 3 4]) makes perfect sense

19:37 toodles ForSpareParts

19:37 ForSpareParts: later!

19:40 mk: incidentally, summing a vector with anything makes no sense as well

19:41 qbg: mk: Unless it is a vector sum function

19:41 mk: qbg: right, or the map function

19:42 another way to explain apply is to say that it injects the function into the start of the given list

19:43 qbg: Or tacks on the seq as extra arguments

19:43 mk: yeah, that's the other way to see it

19:43 qbg: Especially the vararg form of apply

19:45 mk: qbg: the vararg form?

19:45 qbg: &(apply + 1 2 [3 4])

19:45 lazybot: ⇒ 10

19:47 mk: I see what you mean, though I'd say (apply + [1 2]) is the 0-vararg form

19:48 anyway, in that case it injects everything on the left into the list on the right

19:58 Lajla: Is there a difference in expensiveness to (apply + [1 2 3]) and (apply + '(1 2 3)) ?

20:00 amalloy: no

20:05 alexyakushev: Meh, this {{set}} thing is not even funny anymore

20:08 emezeske: alexyakushev: Yeah, no kidding

20:08 alexyakushev: I wonder why some people love to complicate things so much

20:09 aperiodic: i haven't followed many mailing lists, but it seems like the clojure mailing list is fairly easy to troll

20:10 technomancy: aperiodic: either that or the trolls who have decided to infest it are just damn good at what they do

20:10 Frozenlock: Is there a way to empty a namespace without restarting slime/swank?

20:10 lynaghk: don't get any big ideas aperiodic, I live right down the street.

20:10 technomancy: Frozenlock: remove-ns, I think

20:10 Frozenlock: Seems like it, thanks!

20:10 emezeske: I lean toward technomancy's idea. The perpetrator on the set thread is, otherwise, very intelligent seeming (from his other posts to the ML)

20:15 aperiodic: I usually just ignore any thread that gets more than five or six replies in a day

20:22 amalloy: "looks like a great idea. don't waste your time discussing it on the mailing list: put together a patch and attach it to a jira issue so core can tell you what they think of it"

20:26 cemerick: aperiodic: that probably describes any group of generally well-meaning folk

20:29 aperiodic: cemerick: good point. the clojure community's general helpfullness and enthusiasm leads to troll-feeding.

20:32 cemerick: that, and the newness of the language leaves open a whole new set of attack vectors

20:33 and lispers are notoriously trollable anyway, it seems

20:39 halarnold2000: does anyone know where one should put certain files using lein's uberjar? I have a configuration file that has def's for vars, the I use with load-file. I put this file at the root of the project and it works fine with lein run. But the file doesn't get into the uberjar. Any help? should I put the configuration file under src, say in the resource dir?

20:39 zakwilson: If I want to spit a string and have it escaped, is there an easy way to do that?

20:40 technomancy: halarnold2000: highly recommend doing config with (read-string (slurp (io/resource "config.clj"))) instead of load-file

20:40 but yeah, it goes in the resource/ dir

20:41 halarnold2000: and the "config.clj" should be in the src/recource somewhere?

20:41 technomancy: right

20:41 halarnold2000: thanks..I'll look at read-string

20:42 any clue as to why (read-string (slurp (io/resource "config.clj"))) is mo betta than load-file? technomancy?

20:43 technomancy: halarnold2000: it's a clearer separation of declarative files vs executable

20:44 halarnold2000: ah..thx

20:44 ivan: this is one of those little things, but the implementation of drop-last surprised me and continues to amuse

20:52 technomancy: Zoka: https://github.com/technomancy/lein-webrepl/blob/webrepl-client/src/leiningen/webrepl_client.clj

20:52 not ready for prime-time yet, but this should allow you to do an inferior-lisp connection to a running heroku dyno

20:56 ibdknox: woah, what?

20:56 technomancy: ibdknox: have you seen ringmon?

20:57 ibdknox: oh, not tcp

20:57 yeah

20:57 technomancy: aye, a CLI client for ringmon basically

21:04 halarnold2000: technomancy: I'm getting a funny exception when trying the io/resource : IllegalArgumentException No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil clojure.core/-cache-protocol-fn (core_deftype.clj:495)

21:04 Can I assume that I have some dependency clash? I'm on 1.3 of core

21:04 hmm "class nil"

21:04 technomancy: if io/resource returns nil it means it couldn't find the file on the classpath

21:04 maybe restart your repl if the resources/ dir is newly-created

21:05 halarnold2000: got this also at the lein compile stage

21:05 but you've gotten me further

21:07 Zoka: technomancy: it looks interesting! By the way I have cheshire embedded, since I had problems with clj-json

21:08 technomancy: so you can get out of the dependevies in project.clj

21:18 technomancy: I am in the middle of adding some new stuff, as soon as I fisnish I will try out webrepl-client with the latest (not yet on github) .

21:20 cemerick: Zoka: I think I found the source of the rogue threads you found

21:22 seancorfield: anyone using lein expectations?

21:22 it seems to "hang" for about a minute at the end of its run before exiting...

21:23 Zoka: cemerick: was it not closin properly?

21:23 amalloy: seancorfield: sounds very much like an agent threadpool problem

21:23 cemerick: Zoka: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/transport.clj#L38 :-P

21:24 Haven't confirmed it, but that expr stinks bad.

21:24 I think I probably intended for the close fn to be wrapped with one that stopped the future.

21:25 amalloy: i don't see anything obvious after a quick scan of the source, but they're probably starting up a future or an agent somewhere

21:34 Frozenlock: I toyed a little with webserver in clojure, enough to send a file to the webserver using the browser (wrap-multipart-params). Now I'm more interested in sending directly to a clojure webserver from a desktop clojure application. Is this relatively straightforward?

21:35 seancorfield: amalloy: thanx, i'll go digging

21:36 xeqi: Frozenlock: have you looked at clj-http or http.async.client?

21:37 Frozenlock: No, will do immediately, thanks!

21:54 http://neotyk.github.com/http.async.client/docs.html looks like an org-mode user :)

22:04 methodmissin: Good evening, friends

22:05 jweiss: I'm trying to do an interviewstreet.com problem in clojure, just for fun. Here is the code, it fails because of slow performance. I tried turning on *warn-on-reflection*, didn't get any warning. Turned on jvisualvm and see clojure.lang.Reflector.getMethods() eating 98% of cpu time. what do i do to narrow it down? https://refheap.com/paste/1466

22:05 echo-area: methodmissin: Good evening. I read that as ``good night'' :-P

22:06 methodmissin: I have a question! I can't figure out Refs, Atoms, and ^:dynamic definitions. I'm working on Land of Lisp and it calls for a *big* and *small* that get updated by (bigger) and (smaller) functions.

22:07 For a binary search, guess-my-number game. The simplest game in the book. :P

22:08 emacsen: methodmissin, That book's written for CL I think

22:09 methodmissin: Yep. I'm doing it in clojure.

22:09 Not easy.

22:09 But very instructive.

22:09 autodidakto: hi method. still working on Land of lisp?

22:09 emacsen: methodmissin, sadly Conrad doesn't come on iRC

22:09 methodmissin: autodidakto, Thanks for remembering me. :) Yeah, It keeps me blogging, even if my blogs aren't very insightful, I need the practice to work up to the insightful stuff.

22:09 autodidakto: emacsen: Do you know why not?

22:10 methodmissin: what's your blog link?

22:10 emacsen: autodidakto, because he has a life?

22:10 methodmissin: http://carlthuringer.com

22:10 autodidakto: emacsen: ahh, the normal excuse for not being on IRC

22:12 methodmissin: SecurityNow fan? :)

22:13 methodmissin: Of course! A PDP8 emulator lies in my future for poking and learning machine code when I get past a couple more practical languages. Clojure's popular among my peers and I've been excited about it since attending SCNA and seeing Aaron Bedra last year.

22:15 autodidakto: methodmissin: gibson keeps saying he's going to retire and write the pdp8 OS from scratch :P

22:15 methodmissin: I think the world needs a secure, open source VoIP solution first though

22:15 methodmissin: autodidakto, I think some months ago he said he'd grown tired of pdp8s after building like 40 of them and programming the blinkenlights. :D

22:16 autodidakto: (another project he once mentioned but put to the side)

22:16 methodmissin: and recently he discovered javascript and was like "oh wow this is easy and fun". Welcome to the 90s, gibson

22:16 downloading the lastest SN as we speak, hehe

22:17 methodmissin: Heh, yep. Javascript is something else I fiddle with a lot but never devote much serious time to.

22:18 At least I try not to write any that I'm embarassed about.

22:18 autodidakto: methodmissin: yeah i've been avoiding it for 10 years... something about crufty languages that should have died a long time ago...

22:18 methodmissin: Looking forward to a talk next week on ClojureScript. The future!

22:18 autodidakto: methodmissin: your magic hat rails app could use some jquery/ajax magic when you add a task, though :)

22:19 Oh, next week?

22:19 methodmissin: Lol, it still works, of course. It has a few outstanding problems.

22:19 Yeah, a co-worker is presenting.

22:20 autodidakto: Cool, where do you guys work at? Presenting where?

22:21 methodmissin: Groupon, Chicago

22:22 autodidakto: Group -> users in this group, no back button. I just removed myself, hehe

22:22 methodmissin: I remembered your name, btw, because me comes from the rubies too

22:22 methodmissin: Yeah, that's one of the issues. Is that so, autodidakto?

22:22 Zomg I'm famous!

22:23 autodidakto: I think rubyist are sympathetic to clojure/lisp in general because of ruby's heritage, and because of our shared quest of Real Ultimate Programming Power (and Happiness)

22:25 methodmissin: Indeed. And learning clojure makes me happy even if it's frustrating. There's a time learning any language when you have to get over the hump of basic syntax and core functions.

22:26 autodidakto: methodmissin: and just stupid basic things like trying to get out of the repl

22:26 methodmissin: Well, I can clj my way out of a paper bag, a wet one.

22:26 autodidakto: I'm typing (quit), (exit), :q, contrl x, control d, heh

22:27 methodmissin: Ctrl-D works for Lein for me, but yeah. Glad my general knowledge of UNIX has grown since I became a full-time mac user and programmer.

22:27 Try all exit-program things

22:28 Ooh, Just thought of Ctrl-z

22:28 That might be useful.

22:28 autodidakto: Also about ruby: we're more tolerate of using primitive data structures (hashes, arrays) and their useful and varied API instead of always jumping to making a class for it.

22:28 methodmissin: ah yeah. mac user here too. power of unix when you need it, but good design for everyday stuff

22:29 methodmissin: Yes. I've read a few cool blog posts that suggest just that. Why use a class when a Hash is just as good? That sort of thing.

22:30 autodidakto: methodmissin: I've even occasionally seen people go crazy and subclass hash and add a method or two. But I don't know about that.

22:32 It's liberating though, to just use powerful primitives. and not think about constructing the perfect noun

22:33 simple, flexible concepts like namespaces make a lot of sense. Using a module to namespace methods, comes with baggage (making sure the methods are in the singleton-class, etc).

22:33 </rant>

22:34 methodmissin: Hah, yes, I'm just starting to figure out module patterns, but getting a lot of exercise with core ruby.

22:35 And Rails, which confounds me daily.

22:35 Did you know that {:foo => "bar"}.first returns [:foo, "bar"]?

22:35 I guess that makes more sense when working with a hash with more than one key, actually, but only slightly more sense.

22:36 autodidakto: hehe, well, I guess it could return a hash

22:37 methodmissin: I'd expect that more than a different type, but anyways, I want to talk about Land of Lisp

22:38 autodidakto: methodmissin: Ok one last thing though while no one is complaining about being offtopic: go grab Metaprogramming in Ruby and earn your name :)

22:39 methodmissin: Good advice.

22:40 I'll see if it's in the library tomorrow

22:40 And if not, request it

22:40 autodidakto: methodmissin: i doubt I can be of much help with LoL, but ask away

22:41 technomancy: Zoka: the webrepl-client is a bit strange because I don't really think it's much use outside the context of something like heroku, so maybe it should be in its own plugin

22:41 methodmissin: Folks, excuse me reposting what I said just before autodidakto arrived. :)

22:41 I can't figure out Refs, Atoms, and ^:dynamic definitions. I'm working on Land of Lisp and it calls for a *big* and *small* that get updated by (bigger) and (smaller) functions.

22:42 I tried a bunch of permutations and read some about each, and dug around in Joy of Clojure for alternatives/explanations, but it's in the later chapters and I can't understand most of what is written there.

22:42 autodidakto: methodmissin: also, there are some other blog/projects about translating lisp into clojure, they might give you clues (there's one on On Lisp, and another that hasnt begun yet, but will try to do SICP)

22:43 methodmissin: oh, you're trying to have a global var hold state for the guessing game

22:43 methodmissin: Yeah

22:43 meiji11: I'm struggling through that book right now. joy of closure.

22:43 autodidakto: Refs and Atoms and dynamic definitions go way beyond that, that's why the explanations are confusing you

22:44 methodmissin: Which, it occurs to me, is kinda un-Clojure, and I also noticed that the guessing game exploits the repl for its functionality, so it's a pretty hard use case to find example code for.

22:44 autodidakto: meiji11: is it your first clojure book?

22:44 meiji11: sure is.

22:45 i read a lisp book by seibel years ago, which I've long since forgotten.

22:45 autodidakto: methodmissin: and to tell you the truth, it's really bad style, the guessing game. Conrad said he had to do messing bad practices to keep the reader's motivation high, and then show the better practices later

22:45 meiji11: Joy of Clojure should be your second or third book

22:45 meiji11: heh, I thought it would be easy to pick up a lisp again.. any recommendations for a first?

22:46 autodidakto: meiji11: Right now there's the partially out of date "practical clojure" the slightly out of date "Clojure in Action", and new editions of the "Programming Clojure" and "Clojure Programing" (or something) are abouth to come out this month

22:46 online vers already out

22:46 meiji11: right, I was thinking of buying the rough cuts of programming closure.. you say the full version's out online?

22:47 autodidakto: I think the (print?) release date is this month, which means it should be finalized or nearly so

22:47 emacsen: autodidakto, will it be more up to date than the other clojure book? For someone like me, I knew clojure pre-1 and now there's a lot that's unfamiliar

22:48 autodidakto: ahh, Programming Clojure is out April 5th. so I think it should be ready to read...

22:48 http://pragprog.com/book/shcloj2/programming-clojure

22:48 emacsen: That's the word

22:48 methodmissin: autodidakto, I'm glad he acknowledged that in the Ruby Rogues podcast that inspired me to pick up the book.

22:49 meiji11: ah, okay. here I thought you were referring to the one by christophe grand or whomever.

22:49 technomancy: emacsen: 90% of the changes since pre-1.0 can be summed up by "don't use monolithic contrib" =)

22:49 autodidakto: meiji11: A, "Clojure Programming" by oreilly

22:50 meiji11: right.

22:50 autodidakto: meiji11: that's about to come out even sooner. this month it says -> http://shop.oreilly.com/product/0636920013754.do

22:50 cemerick: autodidakto: it's at the printers now, AFAIK

22:50 meiji11: I'm feeling a little like mr. burns in the supermarket aisle with bottles of "ketchup" and "catsup" right now..

22:51 methodmissin: meiji11, They both taste the same

22:51 autodidakto: methodmissin: ah, you're way ahead of me then. But yeah, I don't know clojure best practices for setting global state

22:51 methodmissin: How about worst practices? :D

22:51 Another of my goals is to work back through old chapters and revise the projects into better clojure code

22:52 Frozenlock: Oh I can write that!

22:52 autodidakto: meiji11: I think "Programming Clojure" (prag programmers / Stuart Halloway) has been the defacto first book

22:52 technomancy: meiji11: at least you don't have to choose between "Programming Scala", "Programming Scala", and "Programming in Scala" (all different books)

22:52 autodidakto: cemerick: Thanks, good to hear

22:52 meiji11: I'll go with Halloway then. Thanks.

22:53 cemerick: meiji11: just FWIW: http://www.clojurebook.com

22:53 autodidakto: meiji11: np

22:53 * cemerick will stop shilling now :-|

22:54 autodidakto: cemerick: hehe why shilling?

22:54 emacsen: technomancy, keyword args, interfaces, and some function renames

22:54 technomancy: emacsen: renames?

22:55 cemerick: autodidakto: I'm a coauthor of the afore-linked book. Most tech folks are allergic to self-promotion. :-)

22:55 emacsen: technomancy, I would swear some funtions have had a renam

22:55 but what do I know

22:55 technomancy: emacsen: only contrib functions

22:55 oh, and the metadata syntax changed

22:55 emacsen: technomancy, plus, the workflow is different now, lein and friends didn't exist back then :)

22:55 autodidakto: cemerick: ahh. makes sense. Yeah well, tech guys need to get better at marketting :)

22:56 cemerick: I'd agree. I certainly have no problem with it, as you can see.

22:57 technomancy: emacsen: yeah, it's the ecosystem that's changed the most

22:57 we have libraries now =D

22:57 emacsen: the ecosystem?

22:57 autodidakto: cemerick: well, i mentioned that Programming Clojure has been the defacto, but yours (Clojure Programming) is new effort, right? Coming out at the same time, it remains to be seen which will be better (we should all get both of course :P)

22:57 meiji11: eh, I'll support the new book. not often you run across one of the authors.

22:57 oakwise_: cemerick: there's a difference between off topic spam and very relevant references that just happen to be self authored!

22:58 emacsen: technomancy, yeah now we just need a fancy name for serialized clojure and we'll be all set

22:58 autodidakto: yeah, I'm checking out the text on clojurebook.com and it sounds compelling

22:58 cemerick: oakwise_: sure. I never hesitate to toss out the link. I just ask for forgiveness afterwards to cover my social-signaling bases. :-P

23:00 autodidakto: Yeah, we're the new authors on the block. Our focus (i.e. focusing on on-boarding Ruby/Python/Java devs via their existing skills) is unique AFAIK.

23:00 It's either going to flop or fly :-)

23:01 meiji11: that sounds appealing. I'm coming at this from more of a python thing, ie an imperative languages with lispy features..

23:01 eggsby: when you have hard text file dependencies in a lein project, is there any way to get them to bundle with the uberjar it builds?

23:03 autodidakto: cemerick, meiji11: yeah, that's angle i'm coming from too

23:03 *that's the

23:04 cemerick: autodidakto, meiji11: there are direct comparisons between the four languages throughout the book as appropriate, e.g. http://twitpic.com/92nsxr

23:04 technomancy: eggsby: try the resources/ dir

23:04 methodmissin: cemerick, Neato

23:05 eggsby: technomancy: ya, I got it to work a few seconds after I asked the question... :p

23:08 methodmissin: eggsby, The best kind of proactive question asking. :)

23:09 amalloy: seancorfield: is the resultset-seq created by with-query-results lazy/dynamically-scoped? i'm trying to transition from clojureql and i can't tell if i can do something like (do-stuff-with (with-query-results rows ["SELECT ..."] rows)), or if i have to do all my processing inside the dynamic scope of with-query-results (like with with-open

23:09 )

23:09 autodidakto: I've noticed that articulating my question often leads me right to the thing i've overlooked

23:13 methodmissin: Have you tried Atoms for your global var hack thingie? (def *high-guess* (atom 100), @*high-guess*, (reset! *high-guess* 50)

23:14 methodmissin: autodidakto, I was trying that, gimme a few minutes with that example in the REPL. :)

23:14 Found a stackoverflow on the subject too

23:16 autodidakto: methodmissin: If you do figure it out, be sure to rewrite as a proper functional program (i mean, passing the low and high guess around as parameters :) )

23:17 methodmissin: autodidakto, We'll see. :D

23:18 autodidakto: cemerick: in your twitter avatar, you kind of look like mr bean with that face you're making

23:18 cemerick: heh, yeah

23:18 I've been told multiple times I should update the avatar…

23:22 seancorfield: amalloy: sorry, was away reading stuff... resultset-seq is such that, yes, you need to do all your processing inside with-query-results otherwise you'll get an exception

23:22 it's part of what i really don't like about c.j.jdbc at the moment

23:22 amalloy: thanks. not surprised, was just hoping i wouldn't have to deal with that

23:22 methodmissin: autodidakto, Getting a fn as the return value from (bigger)... Even though the last statement is @*big*

23:22 seancorfield: after using it extensively at world singles, there are lots of changes to the API i plan to add :)

23:23 amalloy: really? given the difficulty of managing resources/scopes in a dynamic context, it seems like you can't do anything much better

23:23 methodmissin: hold on, refheap...

23:24 https://refheap.com/paste/1468

23:24 @*big* is #<ch2$bigger$fn__279 ch2$bigger$fn__279@17a73d30>

23:25 autodidakto: ,(def *big* (atom 50))

23:25 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

23:25 autodidakto: then @*big*

23:25 seancorfield: amalloy: a functional API - SQL operations that take an optional function to apply to the result set or to the rows but whose result is non-lazy is much easier to use

23:25 autodidakto: gives you fn?

23:25 checking refheap..

23:25 methodmissin: I'm using a (fn [] stuff...) to set the new value of *big*

23:25 or try to

23:26 mmm (fn) returns a function, not the return value of the function....

23:26 what to do.

23:28 amalloy: are you trying to learn clojure, or common lisp? all the unnecessary side effects in that code make me want to cry, irrespective of the fact that currently it doesn't work

23:28 autodidakto: amalloy: it's a long story

23:29 amalloy: he's trying to translate some beginner, nonfunctional clisp code into clojure

23:29 amalloy: right, i remember

23:29 autodidakto: (as a translation of the Land of Lisp book, which starts out this way)

23:29 cemerick: seancorfield: You could always ape what I did in clutch to make the dynamic scope optional. It's worked out well, I think.

23:30 amalloy: cemerick: are you talking about the dynamic/optional database-connection var?

23:30 cemerick: amalloy: I think we're talking about the same thing, yes.

23:31 sholva: hey

23:31 amalloy: i don't think that's really germane to the issue of returning a lazy-seq that depends on a result-set, though. yours is about the user needing to establish a dynamic scope, but the jdbc issue is that the db returns a lazy-seq depending on some resources that it needs to somehow clean up "when you're done"

23:31 autodidakto: methodmissin: this is painful lol. can you paste in the LoL clisp code?

23:31 sholva: hi

23:31 methodmissin: autodidakto, Sure! just a moment

23:31 Dead Tree Format, gotta type

23:32 autodidakto: methodmissin: ouch sorry

23:32 amalloy: if you want to fake some common-lisp with lots of setfs, don't try to use any of clojure's advanced concurrency constructs. just use atoms and reset!/deref them

23:32 seancorfield: amalloy: you could always wrap your entire program in with-connection :) :) :)

23:33 amalloy: seancorfield: does that work, though? you're closing the resultSet anyway

23:33 autodidakto: amalloy: yeah that's i'm having him do. (i was just guessing at the time. nice to see your confirm that :) )

23:36 methodmissin: CLISP code: https://refheap.com/paste/1470

23:37 autodidakto: methodmissin: dear god, that ash function... hrm

23:38 methodmissin: I dont think making your own ash counts as a translation

23:38 methodmissin: is more like trying to embed clisp in clojure :P

23:38 methodmissin: ash: https://refheap.com/paste/1471

23:39 I could've just used bit-shift-right instead of ash, since it never shifts left.

23:39 I implemented it because it was fun. :)

23:39 autodidakto: methodmissin: i think he's just using it as a "cleaner" hack to get an average, no?

23:39 methodmissin: Yeah, that too...

23:41 autodidakto: methodmissin: it's BASIC written in clisp... hehe

23:41 methodmissin: lol

23:43 autodidakto: i think ash and the 1- 1+ stuff could be replaced with call to average + rounding/floor/truncate (wutever)

23:44 choffstein: Is it possible to add pre/post conditions to anonymous functions?

23:47 aperiodic: choffstein: not with #(...) syntax, i'd think, but with the (fn [x ..] ..) form, i don't see why not

23:49 methodmissin: I'm stumped.

23:51 mbriggs: methodmissin: still trying to work through that clisp?

23:51 autodidakto: mbriggs: talk some sense into him

23:51 methodmissin: mbriggs, Hahah

23:51 Yes

23:52 choffstein: aperiodic: okay, thanks

23:53 mbriggs: methodmissin: land of lisp is a neat book for learning clisp, but clojure is a bit of a different beast

23:53 methodmissin: you just wouldnt take the same approaches to those kinds of problems

23:54 methodmissin: mbriggs, Yes, I know you're right.

23:54 I was encouraged to see http://www.adrianmouat.com/bit-bucket/2011/02/common-lisp-clojure-and-evolution/ apparently made it though.

23:54 technomancy: clisp is actually a particular implementation of common lisp

23:54 autodidakto: mbriggs: the author uses certain ugly hacks that you can get away with with multiparadigm-swiss-army-knife clisp that clojure just outright rejects

23:54 technomancy: probably not what you meant to say

23:55 mbriggs: yeah s/clisp/common lisp/

23:57 autodidakto: methodmissin: that book is stressing you out, you need to have a little fun. checkout my practicing of multimethods -> https://refheap.com/paste/1473

23:58 mbriggs: methodmissin: the thing is, if your goal is to learn clojure, check out joy of clojure or clojure in action

23:58 methodmissin: both are really good books, and will get you there way easier then land of lisp

23:58 autodidakto: methodmissin: yeah, learn good clojure first, then come back and translate LoL for fun :)

23:59 methodmissin: mbriggs, Joy of clojure is underneath Land of Lisp on my desk right now. ;) I've been poking into it for answers and explanations. I read the first couple of chapters already but it gets heavy, fast. There's a lot of recommendations for books in the scrollback.

Logging service provided by n01se.net