#clojure log - Sep 29 2012

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

1:41 mpan: technomancy: I seem to have stumbled upon a picture of you wearing keyboard pants

1:41 that's pretty impressive

3:00 kral: namaste

3:01 ThorZaINtedwisp: kral, do you play StarCraft?

3:02 kral: McChousuke: ehmmm... no. :)

3:06 mpan: What's the recommended way to encapsulate concurrent access to something mutable? e.g. instance of java.util.Random

3:08 augustl: mpan: locks afaik

3:09 mpan: like, the ones java has?

3:09 and use them through interop?

3:13 Apage43: you may find locking useful; http://clojuredocs.org/clojure_core/clojure.core/locking

3:15 that is, if the caller actually needs the result. If you just need a thing to have stuff happen to it, but don't synchronously need an answer, and you want to serialize those requests, an agent wraps that up nicely

3:30 ChongLi: king in the north!

7:28 mindbender1: ,(type {"set of members in #clojure})

7:28 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>

7:28 mindbender1: ,(type {"set of members in #clojure"})

7:28 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>

7:28 mindbender1: ,(type #{"set of members in #clojure"})

7:28 clojurebot: clojure.lang.PersistentHashSet

9:58 benny__: is there any special magic involved when parsing xml with clojure data.xml? parsing the HN feed at http://news.ycombinator.com/rss just fails with aclaim that </link> is wrongly positioned

9:58 its perfectly parsable with domdocument in php though for example

10:10 casion: benny__: I have been messing with clojure.data.xml all morning and most of last evening, and it seems to choke on a lot of stuff

10:10 clojure.xml seems to parse most anything fine, clojure.xml/emit is a bit odd though

10:10 benny__: casion, that sucks :( any alternative? there seems to be something clojure.xml/clojure.zip and clojure.zip-filter

10:10 casion: benny__: that's what I'm using

10:11 benny__: is there a good introduction for cloojure.xml? i cant make sense out of clojuredocs.org - very unhelpful imho:(

10:11 casion: clojure.xml/parse, clojure.zip/xml-zip, then clojure.data.zip.xml/xml-> to navigate

10:12 benny__: yeah, I had the same problem, foks here just sorted me out yesterday… maybe I can help you

10:14 how I'm doing things right now is something like (def xml-zipper (clojure.zip/xml-zip (clojure.xml/parse some-input-stream))), then (clojure.data.zip.xml/xml-> xml-zipper :Sometag :someothertag (clojure.data.zip.xml/attr :attrname))

10:15 benny__: will check it out, thanks

10:15 casion: https://github.com/clojure/data.zip/ is the relevant info for clojure.data.zip

10:15 and note, you don't have to navigate the root elemet when using xml->, that tripped me up and it seems to have been a stumbling block for some other people as well

10:15 clojurebot: min people is 5

10:16 benny__: what dependencies do i need in the project.clj?

10:16 casion: just [org.clojure/data.zip "0.1.1"]

10:16 and whatever else is needed for the rest of your project

10:18 I really don't get why clojure.data.xml won't parse some things, if I try stax directly most of them are parsed fine

10:18 but it stilll fails on others that clojure.xml/parse works with

10:24 benny__: i cant seem to find a single rss feed that can be parsed

10:24 hn, cnn, spiegel.de, all throw errors

10:25 casion: give me a feed, I'll try one

10:25 benny__: http://rss.cnn.com/rss/edition.rss

10:26 my sample code is http://pastie.org/4860703

10:26 printing the xml, not sure it shows everything, maybe i dont read the full xml stream

10:27 a feed def would be, (def feed {:id 1 :topic "http://rss.cnn.com/rss/edition.rss"})

10:28 i didnt think that xml parsing would be such a hard, when picking this for my "learn clojure" journey :p

10:30 ah that waas it, (http/await resp) required

10:30 casion: works fine for me here

10:30 benny__: i use the async http client and just stuff only a small percentage of the xml string into the parser

10:30 casion: but I just did (clojure.xml/parse (.openStream (java.net.URL. "http://rss.cnn.com/rss/edition.rss")))

10:30 benny__: stupid :)

10:33 ok now it looks good

10:33 casion, thanks for listending and trying :)

10:33 casion: sure :)

10:37 benny__: its really annoying that the api changed so much, and you only find outdated examples on google :(

10:37 casion: I completely agree

10:37 I'm going to write a blog post on how I dealt with this stuff once I feel I have a proper handle

10:37 on it

10:38 I have reading it down pretty well I think, but right now I'm struggling with writing valid xml now

10:41 benny__: what are you using to print xml?

10:41 prxml is deprecated?

10:42 casion: no clue yet

10:42 I've yet to find something that works correctly

10:42 clojure.xml/emit sort of works… sometimes

10:46 benny__: ah it renders, ole :)

10:46 maybe thats enough for me

11:20 dlitvak: hey guys, i have a noobish question

11:20 im creating a pet project for learning clojure... and i have something i want to refactor but i dont know how

11:21 i'm creating a little templating engine and i have something like the following

11:21 (tag "p" "some content" (list {:name "class" :value "foo"}))

11:22 which renders to: "<p class='foo'>some content</p>

11:22 "

11:22 that works good

11:22 but... i want to be able to change the attribute list to something like...

11:23 (tag "p" "some content" {:class "foo"})

11:23 the following gist is the code im using for rendering

11:24 https://gist.github.com/bd3b8fe4bc3bfe905268

11:27 how can i get the key-value pair?

11:27 edlothiol: ,(map (fn [[k v]] (str k "=" v)) {:class "foo" :id "bar"})

11:27 clojurebot: (":class=foo" ":id=bar")

11:27 dlitvak: awesome!

11:27 thx

11:28 sunkencityryleh: If I use binding to bind some value in a function that then calls a bunch of other functions, is that binding on the stack or in the thread?

11:29 hm, it's per thread I see now

11:49 djanatyn: I've been reading on lisp, and I really liked the first section on closures

11:50 in common lisp, we can do this, because of lexical binding: (let ((x 0)) (defun counter () x) (defun tick () (incf x)))

11:50 then we could get the value with (coutner) and increase the value with (tick). they hada their own tiny little shared state

11:51 I tried to do this is clojure: (let [x (atom 0)] (defn counter [] x) (defn tick [] (swap! x #(+ % 1))))

11:51 but it looks like I can't call (counter) or (tick) outside of that let binding.

11:52 chouser: works for me

11:52 djanatyn: :O

11:52 d'oh -_-

11:52 in my REPL, I wasn't in the right namespace ;)

11:52 chouser: ah :-)

11:52 djanatyn: anyway, cool! I'm learning stuff from "On Lisp" that I can use when I'm writing clojure

11:53 chouser: btw, clojure has a fn named inc that you can use instead of #(+ % 1)

11:53 djanatyn: is there anything I should keep in mind about differences between common lisp's scope and clojure's scope?

11:53 oh, thank you.

11:53 chouser: I love "on lisp", and especially it's treatment of macros carries over pretty well

11:56 casion: chouser: since you seem to have written clojure.data.zip, how would you suggest rendering/writing the xml zipper after mutating it

11:59 clojure.xml/emit seems to be not printing character entities correctly (e.g. &quot is printing as "), and clojure.data.xml seems to choke on most xml

12:10 chouser: djanatyn: the main difference of course is on lisp makes no attempt to avoid mutation

12:13 octagon: hi, i have a record type in cljs, say Foo. if x is an instance of Foo, is it generally correct to test for this by doing (= (type x) my-ns/Foo)

12:13 chouser: casion: that's the main weakness with data.zip

12:14 You can only update one of the results. If you update more than one, you'd have to merge them somehow -- probably not worth it.

12:14 casion: chouser: any suggestions on dealing with it? clojure.data.xml isn't throwing exceptions on most everything I try to emit :(

12:15 with data that clojure.xml/emit returns fine, other than the aforementioned issue

12:19 chouser: I don't think I understand

12:19 you've got input data that clojure.xml/emit accpets, but you haven't yet figured out any way to get data.xml to use it?

12:20 casion: chouser: yes

12:20 TimMc: aaahhhhhhh wtf

12:20 Clearly I don't understand Swing threads.

12:20 chouser: TimMc: the main thing to understand is that There can be only one. :-P

12:22 TimMc: chouser: Yeah, and I'm calling (SwingUtilities/invokeLater #(...)) from another thread, but it's just calling it right away!

12:22 https://gist.github.com/3804489

12:22 chouser: casion: data.xml has changed quite a bit since I last touched it. Looks like there are actual docs now.

12:23 TimMc: I suppose it is possible that the "Game loop" thread has called this fn before the AWT exists or has anything else on it...

12:25 chouser: casion: ignore what I said about mutation. I was thinking of a different lib (data.zip/xml)

12:25 casion: chouser: that comment was useful, since I'm running into an issue there too :|

12:26 chouser: casion: you're mimicking the examples at https://github.com/clojure/data.xml ?

12:26 casion: chouser: yes I am

12:26 chouser: And you're getting NPEs

12:27 heh, yeah, almost none of my code is left in there. Probably just the part that's breaking for you.

12:28 casion: the direct examples there work, but when I start working with my own xml that clojure.xml parses and emits fine, data.xml starts giving XMLStreamExceptions

12:28 chouser: the emit side is just a wrapper around XMLStreamWriter.

12:28 casion: I can probably look at a stack trace, if you have one, before I have to go.

12:29 casion: I don't have one at the moment

12:29 but you've given me some insight

12:29 thank you

12:31 unic0rn: i'm just learning when it comes to clojure, but i want to code a photo processing tool in it, and the question is, what should i be aware of when it comes to number crunching performance? which data structure will be the best for such thing, java arrays?

12:33 casion: unic0rn: you want to write it yourself? ImageJ is a very good library for such things

12:33 unic0rn: casion: yes, i want to write it myself.

12:34 custom thing entirely. local contrast enhancement, with my own tweaks.

12:35 casion: you'll be working with byte[] almost entirely, and in my experience it's best to stay there

12:38 sexpGirl: Wouldn't a Java wrapper around "the real thing" like ImageMagick or GraphicsMagick be better than the "pure Java" ImageJ? (GraphicsMagick is a fork of ImageMagick and is used by sites like Flickr so...)

12:39 * sexpGirl was calling shellscripts from Java calling themselves ImageMagick in the last century ; )

12:40 casion: I found ij very easy to use from clojure

12:40 octagon: is there a way in cljs to have a type that can implement protocols, is immutable like defrecord, but does not provide a persistent map implementation?

12:41 sexpGirl: casion: looks convenient indeed seen that it's 100% Java (not external deps)... The wrappers around ImageMagick / GraphicsMagick are good too but you're "stuck" with the fact that it's non-native so you need to install non Java stuff ; (

12:41 octagon: i am wanting to create a record but provide my own implementation of ICounted, for instance

12:41 casion: only issue was occasionally having to deal with type promotion

12:42 which seems to be unavoidable when using java a/v libs from clojure :(

12:42 unchecked-int everywhere!

13:16 bonega: So what is everybody using for painting in Clojurescript? Just plain gclosure?

13:19 prokii: Is anyone using the clojurescript one method for web development?

13:27 gfredericks: bonega: painting like canvas, not SVG?

13:29 jonasen: cemerick: Where's the best place to ask questions about sjacket? I assume cgrand is the only one who really know how it's suppposed to work.. but he's not on IRC. Maybe the clojure-tools mailing list?

13:31 cemerick: jonasen: Yeah, he's on there.

13:32 jonasen: BTW, I've since discovered that it's possible to get cljx to emit the metadata associated with the munged forms, which includes line numbers. Unfortunately, that line number metadata is squashed by the reader :-x

13:33 Working on a patch to Clojure now that will fix that, but 50/50 shot of it getting in probably.

13:34 xeqi: I'll take the under

13:36 bonega: gfredericks: canvas

13:37 gfredericks: I used one of the cljs libs for a bit; it was somewhat raw but better than gclosure maybe

13:37 I switched to SVG before too long because that's what I really needed anyhow

13:38 jonasen: cemerick: Which issue is that? JIRA link? I ran into http://dev.clojure.org/jira/browse/CLJ-916 while working on kibit which will be fixed in 1.5

13:39 cemerick: jonasen: I haven't filed the ticket yet. In short:

13:39 ,(meta (read (clojure.lang.LineNumberingPushbackReader. (java.io.StringReader. "^{:line 66} ()"))))

13:39 clojurebot: {:line 1}

13:40 cemerick: vs.

13:40 ,(meta (read (java.io.PushbackReader. (java.io.StringReader. "^{:line 66} ()"))))

13:40 clojurebot: {:line 66}

13:41 bonega: gfredericks: ok, thanks

13:42 Thinking of doing it as html instead of fighting with gclosure canvas

14:06 TimMc: reiddraper, alex_baranosky,: I now have a working crosscram GUI! The board size, choice of bot, and who goes first are all hardcoded, but it's a start.

14:06 reiddraper: TimMc: ah, very cool

14:07 need to start playing with that again

14:07 TimMc: It's the gui-demo branch.

14:07 I *may* rebase/squash that branch, so definitely don't build off of it. :-P

14:08 * gfredericks segfaulted emacs

14:13 casion: just when I thought I had this xml thing licked… writing it seems to be another day of IRC log searching

14:16 ibdknox: is there a newer implementation of datalog available somewhere? I know datomic has one, but I assume that can't be used in isolation

14:18 jonasen: ibdknox: It can be used in-memory without the transactor running

14:19 ibdknox: jonasen: is it pretty lightweight that way?

14:22 jonasen: ibdknox: I believe there are quite a lot of dependencies.. but it's been lightweight enough for me to have a lot of fun with it

14:22 ibdknox: jonasen: what have you been doing? :)

14:23 jonasen: ibdknox: but I haven't used it for anything serious.

14:23 ibdknox: https://github.com/jonase/scape

14:23 ibdknox: haha, that's also what I want to do with it ;)

14:25 jonasen: ibdknox: heh.. it works pretty well and I think there are a lot of interesting things you can still do with it

14:29 octagon: i'm looking at https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L184 what does #_(-entry-at ...) mean?

14:29 Bronsa: it is ignored

14:30 Sgeo__: ,#_(blah blah blah)

14:30 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

14:30 Bronsa: ,#_foo (+ 1 2)

14:30 Sgeo__: ,#_(blah)(+ 1 1)

14:30 clojurebot: 3

14:30 2

14:30 Bronsa: dang.

14:30 octagon: Bronsa: thanks, so that's there just as a comment?

14:30 Bronsa: yeah

14:30 SegFaultAX: octagon: Check it http://clojure.org/reader

14:30 Bronsa: probably something that was needed in the early days of clojurescript and got commented out

14:31 octagon: ah ok, so it isn't important, then, af far as implementing the protocol goes

14:31 *as

14:31 thanks!

14:31 SegFaultAX: octagon: That page has a list of the different reader macros (like form commenting #_)

14:32 octagon: SegFaultAX: ah ok i see now. i read that page but i must have missed it

14:33 casion: is there any other way to read/write XML other than clojure.xml/clojure.data.xml ?

14:34 TimMc: casion: Sure, you can serialize it yourself. :-)

14:34 casion: that sounds awful :(

14:35 TimMc: The Java core libs provide some APIs as well.

14:37 michaelr525: hello

15:39 Urthwhyte: Working with the REPL in your text editor is the greatest thing ever. So nice going back to interactive coding

16:01 octagon: does clojure have anything similar to scheme's define-values? like here: http://docs.racket-lang.org/reference/define.html#(form._((quote._~23~25kernel)._define-values))

16:03 TimMc: reiddraper: Any objection to bumping crosscram to 1.4? I'm getting pissed off by RuntimeException-wrapping.

16:04 reiddraper: TimMc: np

16:07 ivan: how do I add a monospace/code block in a comment in JIRA?

16:07 I swear JIRA is designed to make me look like an idiot with its lying documentation

16:19 jcromartie: I took a Java REST API and rewrote it in Clojure to be 1/10 the LoC and 100X faster.

16:19 But they don't want me to use it because it would make somebody look bad.

16:19 and by "100X faster" I mean 100X more request/sec

16:20 octagon: jcromartie: you should use it anyway. you know they want it

16:21 jcromartie: I don't know they want it. It's a big enterprisey Gov't contractor on the other end, and they *want* to waste time, space, and money.

16:21 ivan: now you just need a Clojure program to replace politics

16:21 jcromartie: like, they've explicitly told me they want to use more time than necessary, more code than necessary, make mistakes, etc.

16:21 octagon: jcromartie: you should charge extra for that!

16:22 it's like an option you'd have that costs extra

16:22 jcromartie: what's "that"?

16:22 octagon: "i can guarantee worse running time for a small fee"

16:22 jcromartie: hah hah

16:23 octagon: you could have your REST thing mining bitcoins while it works

16:23 jcromartie: hah

16:23 octagon: another bonus for you

16:23 jcromartie: now that's a good use of public resources

16:24 octagon: or it could be folding proteins or something

16:25 Urthwhyte: jcromartie: time for (.sleep Time)

16:26 if I'm using clojure string's split func, can I just pass it a char to split on or must it be a regex

16:26 ivan: how about a macro that inserts sleeps everywhere?

16:27 defslowfn

16:31 octagon: or just (dotimes [n 100] (process request))

16:31 jcromartie: (defn enterprisey [n f] (fn [& args] (Thread/sleep n) (apply f args)))

16:31 octagon: it could be a ring middleware or whatever

16:31 jcromartie: oh yeah!

16:31 octagon: dotimes has the added benefit of making the machine work harder

16:32 so you'd be spending more money on power and cooling

16:32 actually i recommend mining bitcoins and then deleting them automatically when you get one

16:32 ivan: running it 100 times increases reliability in the face of three cosmic rays hitting your bits at the same time

16:33 jcromartie: (defn wrap-enterprise [handler] (fn [req] (dorun (map str (range 10e8))) (handler req)))

16:33 octagon: throwing away bitcoins is a luxury the government systems need to have installed for sure

16:33 jcromartie: that's too long of course

16:33 10e5 is enough

16:33 ,(time (dorun (map str (range 10e5))))

16:33 clojurebot: "Elapsed time: 567.37274 msecs"

16:33 jcromartie: depends on the server I suppose

16:34 considering my requests take like 4ms

16:34 :P

16:34 octagon: you could compute something really difficult and add it to the response headers

16:34 jcromartie: hah

16:34 how about a bitcoin

16:34 :P

16:35 octagon: dude that's it

16:35 mpan: a full bitcoin?

16:35 octagon: you need to do this

16:35 mpan: how much computation does that cost these days?

16:35 octagon: every so many requests, a bitcoin is returned with the response

16:35 that's great

16:35 jcromartie: 24 hours

16:35 mpan: perhaps use a fractional bitcoin

16:36 jcromartie: oh yah, good idea

16:36 octagon: it's like the 100th customer at the car dealership gets a t shirt

16:36 jcromartie: "this API returns money"

16:36 X-Money: ...

16:36 octagon: undocumented, of course

16:36 mpan: it's a bit hard to "return a bitcoin", though

16:36 octagon: X-Alimony: 0x8723...

16:36 mpan: at best, you could make a wallet with just that amount and send out the private key

16:37 BUT that doesn't stop the service operator from spending it first

16:38 jcromartie: yeah a new wallet would be the way to go

16:38 or, let users specify their wallet

16:38 and just put money into it

16:39 mpan: or actually, just specifically say: we're giving you this wallet; move the funds out within X days or we're reclaiming it

16:39 that prevents some waste

16:40 octagon: mpan: he doesn't want to prevent waste hahaha

16:40 the more waste the better

16:40 this is luxury govt computing here

16:41 mpan: wait, I came in after the backstory

16:41 what did I miss?

16:41 octagon: a mechanism to slow down a clojure program that replaces a java program and is 100x faster

16:42 added bonus for wasting resources

16:43 mpan: wait, why?

16:43 added bonus for parameterizability, right?

16:45 jcromartie: mpan: I improved a Java API by rewriting it in Clojure using 1/10 the code, and it was 100X faster

16:45 mpan: but they don't want it

16:46 mpan: they would rather have more code, and spend more time

16:46 mpan: why?

16:46 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

16:47 mpan: I mean, more time/code isn't the root cause, is it?

16:47 TimMc: clojurebot: lexical scope is <reply>out of scope, out of mind

16:47 clojurebot: Roger.

16:47 mpan: clojurebot: do you have like a command for your maintainer(s) to masquerade as you?

16:47 clojurebot: paredit commands is http://mumble.net/~campbell/emacs/paredit.html

17:05 Urthwhyte: Anyone with time to laugh at some horrible code? (and perhaps help a bit)

17:07 https://gist.github.com/8ec57d16837b2f326874

17:10 My mistake, that last one was private: https://gist.github.com/3805186

17:11 mpan: hm, just curious why you aren't using regular expressions if you're sure about the structure of it

17:12 as in, matching the whole string and pulling out captured groups

17:14 Urthwhyte: Mostly as I'm rather poorly porting it over from Python, so doing foo, bar = s[0:2], s[3:] was easier than /(w){2}(\d){4}/

17:15 Just seemed easier at the time, it was a script I wrote in ~45 minutes, figured it would be a good first "real" clojure project

17:16 algernon: Urthwhyte: the problem is, that -> turns the parse-url call into (parse-url ShowUrl url), which is not what you want. (that is, -> doesn't do what you think it would)

17:16 Urthwhyte: Using macros you don't fully understand is usually a recipe for disaster

17:16 antoineB: into (parse-url rec url)

17:26 Urthwhyte: algernon: is there an alternative I can use - it's very unintuitive to me that -> would expand into that. I had expected it to execute the second arguments before applying? (my terminology is almost certainly all wrong) it to the record type

17:27 oh I see

17:27 mpan: why are you using -> when you have nothing to chain?

17:27 it's usually for when you have multiple forms you want to thread a result through

17:28 Urthwhyte: Largely cargo culting my way through here based off what I've read so far in Programming clojure. I've now checked the API docs and seen that -> feeds each expression as the first argument of the next

17:28 Which makes sense

17:44 ivan: http://blog.fogus.me/2012/09/29/adventures-in-tearing/

18:14 Apage43: Is there something around that would be useful for reading/printing numbers with SI prefixes?

18:14 er

18:14 suffixes

18:14 rather

18:34 ohpauleez: dnolen: I found another bug related to my hashbang adventures yesterday (http://dev.clojure.org/jira/browse/CLJS-385) - I'll have a ticket and a patch sometime this weekend

19:18 gjcourt: can anyone recommend a good resource for learning about agent error recovery

19:20 specifically, say i use (send-off a (fn [a f] (doto a (.upload f)))) and a fails, is there an idiomatic clojure solution?

19:20 for retrying that upload

19:29 Urthwhyte: So I solved the problem I was having earlier

19:29 Records API wasn't stable from 1.2->1.4, and I had the wrong one specified in my project.clj

20:07 nightfly_: 34

20:07 gfredericks: ,(rand-int 100)

20:07 clojurebot: 51

20:40 cjfrisz: Too quiet in here

20:40 What's up, folks?

20:41 alex_baranosky: what's up

20:52 mpan: bit of a weird question, but: how much control does oracle have over java as an ecosystem? how much does that affect clojure as a language? how likely is it to have something dramatic happen down the line?

20:53 cjfrisz: mpan: Interesting question which I'm probably not qualified to fully answer

20:54 From my experience, Oracle makes at least a half-hearted attempt to support languages targeting the JVM

20:55 They seem to be slow about doing things to *help* those languages, but they seem at least somewhat interested in not stifling them

20:55 mpan: what if they decide they want money down the line, like with android?

20:55 SegFaultAX: mpan: Money for what? Usage of the JVM?

20:55 Raynes: mpan: If they do that, then everybody is screwed.

20:55 mpan: Not just Clojure.

20:56 dlitvak: you always have OpenJDK

20:56 Raynes: What if Rich Hickey decided he wanted to charge for parentheses?

20:56 SegFaultAX: mpan: Oracle has no rights to Clojure itself.

20:56 dlitvak: as java has an open standard for the JVM

20:56 Raynes: while clojure is under Eclipse Public License... that cant happen

20:57 SegFaultAX: Whoosh.

20:58 mpan: ok thanks

20:58 Raynes: dlitvak: http://en.wikipedia.org/wiki/Humor

20:58 xeqi: oh, does the epl have a non-commercial clause?

20:58 dlitvak: lol

21:07 SegFaultAX: I wonder how hard it would be to make something like Grape (Ruby) in Clojure... or if someone already has?

21:28 duck1123: SegFaultAX: I have this. https://github.com/duck1123/ciste not quite the same

21:29 I need to write better documentation

21:29 cjfrisz: duck1123: Amen

21:30 duck1123: Although it's hard to find someone without that problem

21:30 I used to have good documentation. Then I continued writing code.

21:30 duck1123: I sit down and try every now and then, but I find I'd rather actually be using it

21:31 cjfrisz: Yeah, I've got a project that I've been intending to take an evening to just go through and update the documentation/audit the code

21:31 But it's so much more fun to add more functionality

21:32 duck1123: I've been meaning to create a write-up on how to create an app with ciste, then I have a demo app I never finished

21:57 cjfrisz: Sometimes I realize that things are legal Clojure syntax and it makes me sad

21:57 ,(fn)

21:57 clojurebot: #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@4e78d10d>

21:57 gfredericks: ,((fn))

21:57 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval55$fn>

21:57 gfredericks: ,((fn) :foo)

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

21:58 gfredericks: it's a function with no arities :)

21:58 cjfrisz: gfredericks: Exactly!

21:58 gfredericks: What the hell does that mean??

21:58 lazybot: cjfrisz: What are you, crazy? Of course not!

21:58 gfredericks: cjfrisz: it means you can't call it :P

21:58 cjfrisz: Then why is it legal syntax??

21:58 lazybot: cjfrisz: What are you, crazy? Of course not!

21:59 gfredericks: cjfrisz: because there isn't a check against it

21:59 cjfrisz: I know...

21:59 gfredericks: ,(macroexpand '(fn))

21:59 clojurebot: (fn*)

21:59 cjfrisz: So if one were to write a source-to-source compiler in Clojure, (s)he would have to handle that case

22:00 gfredericks: for some value of 'have to'

22:00 cjfrisz: Well, what's the point of writing a source-to-source compiler that rejects legal source code?

22:01 gfredericks: to have a source-to-source compiler that accepts all useful code?

22:01 cjfrisz: Just because the original compiler lets you do something stupid doesn't mean you should stop someone from doing it

22:01 gfredericks: I'm just saying you don't have to

22:02 a transpiler would be useful even if it doesn't handle pathological cases

22:02 xeqi: ,(seq (.getPublicMethods (class (fn))))

22:02 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getPublicMethods for class java.lang.Class>

22:02 xeqi: ,(seq (.getDeclaredMethods (class (fn))))

22:02 cjfrisz: Yeah...

22:02 clojurebot: nil

22:02 cjfrisz: I see your point, but it conflicts with my sensibilities

22:02 Not saying that you're wrong; I think your opinion is quite valid

22:03 gfredericks: cjfrisz: wanna see a cool bug in the reader?

22:03 cjfrisz: gfredericks: Uh, yes. Of course

22:03 gfredericks: ,(#(+ %1 %2 #_ %3) 1 2)

22:03 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval196$fn>

22:03 cjfrisz: Oh weird

22:05 That got weirder when I macroexpanded it

22:05 gfredericks: it just adds an extra arg no?

22:05 cjfrisz: ,(macroexpand '(#(+ %1 %2 #_ %3) 1 2))

22:05 clojurebot: ((fn* [p1__224# p2__225# p3__226#] (+ p1__224# p2__225#)) 1 2)

22:05 gfredericks: cjfrisz: you could get basically the same thing with read-string

22:05 xeqi: ,(#(#_%&) 1 2 3)

22:05 clojurebot: ()

22:06 cjfrisz: gfredericks: yikes

22:07 That seems like a ghost story that you tell to your kids about the dangers of using that anonymous fn syntax irresponsibly

22:07 gfredericks: ha

22:08 cjfrisz: And then...the argument was gone!!

22:08 gfredericks: NOOOOO

22:10 cjfrisz: write me a clojure-syntax wrapper for haskell

22:11 * gfredericks can't decide if it'd be better to do such a thing in clojure or haskell

22:13 cjfrisz: gfredericks: hmmm...

22:13 I don't know why I'm the one to do that, particularly because I don't think I ever successfully wrote a Haskell app

22:14 I always got fed up with the type-checker and ended up writing it in Scheme

22:14 gfredericks: I thought it would be fun to use metadata syntax for type annotations, but that won't work for strings and numbers and such

22:15 dnolen: cjfrisz: heh

22:15 gfredericks: though maybe those things get explicitely annotated infrequently enough that it could be a separate thing

22:22 dnolen: cjfrisz: so it sounds like some interesting things are happening to Chez ...

22:23 cjfrisz: dnolen: Oh?

22:25 dnolen: cjfrisz: well it sounds like Chez is now a Cisco product?

22:26 duck1123: could you run clojure on haskell? (wise is a different question)

22:27 cjfrisz: dnolen: Hmm...I don't know. You'd have to ask Kent Dybvig about that.

22:28 xeqi: duck1123: as in build an interpreter in haskell?

22:28 dnolen: cjfrisz: ah ... yeah this impression is based on Rainer Joswig tweet and some mailing list posts I've seen.

22:29 cjfrisz: been hoping that someone will finally put the super high performance free Scheme, related - Dan & Will said that Aziz has resurfaced

22:29 duck1123: basically. like java, javascript, .net, python, etc.

22:30 dnolen: cjfrisz: well inexpensive, if not free is what I meant by the above as far as Chez.

22:30 cjfrisz: dnolen: right

22:30 duck1123: I assume haskell let's you shoot yourself in the foot if you really try hard enough

22:30 cjfrisz: dnolen: I had heard that they got ahold of Aziz again in the Spring

22:32 dnolen: I'm curious, do you have links for what you heard about Chez?

22:32 dnolen: cjfrisz: http://groups.google.com/forum/#!msg/comp.lang.scheme/4AlItE5baRg/Ono4F3ipY_oJ

22:35 cjfrisz: dnolen: Hmm...well I think Kent is the only one managing scheme.com, so that must have come from him

22:36 dnolen: cjfrisz: I'm assuming that's your day job these days - hacking on Chez.

22:37 gfredericks: duck1123: I'm not sure why being able to shoot yourself in the foot is even a requirement

22:38 you would probably have to implement everything within the IO monad I guess? :/

22:38 cjfrisz: dnolen: I'm actually working on the CSO Advanced Development team

22:38 dnolen: It's an arm of the part of Cisco responsible for acquiring other companies

22:39 dnolen: We do speculative programming to assess the utility of other people's software and how to integrate it into our products

22:39 dnolen: Though I'm not yet allowed to speak on the specifics of what I'm working on

22:40 dnolen: cjfrisz: but I'm assuming all Scheme :) Is there a decent sized team at Cisco doing Scheme work?

22:41 cjfrisz: dnolen: it kills me, but I can't really say what we're doing right now

22:41 dnolen: cjfrisz: no worries

22:41 cjfrisz: dnolen: someday I will excitedly tell you all about it

22:43 dnolen: cjfrisz: haha. You and all the people doing really cool stuff w/ core.logic that won't blog about ;)

22:43 cjfrisz: dnolen: I've got a couple ctco blog posts I need to write

22:43 muhoo: i'm glad you guys are using clojure for Important Stuff. me, i was jonesing for an excuse to use clojure, so i had to do this: http://restivo.org/zombies

22:43 cjfrisz: dnolen: If that's any consolation

22:45 dnolen: cjfrisz: looking forward to that! Still hoping we might be able to convince you to do ctco over the CLJS AST once it's sorted.

22:45 cjfrisz: dnolen: I'd be happy to!

22:45 dnolen: it may be after Conj because I've got a lot of work on ctco I want to get done

22:46 dnolen: Plus I'd like to have a little stand-alone compiler for TCO in Clojure that takes care of some whole-program analysis that the ctco macro can't cut

22:49 dnolen: cjfrisz: seeing an approach to whole-program analysis definitely interests me. pondering optimized miniKanren compilation more and more these days ...

22:49 cjfrisz: dnolen: I'm not even sure that what I have in mind is going to make a whole lot of difference

22:49 dnolen: but it's a journey probably worth making

22:55 mpan: &(type (fn))

22:55 lazybot: ⇒ sandbox7657$eval34390$fn__34391

22:56 cjfrisz: Wait, was there more discussion of zero-arity fn expressions when I wasn't paying attention

22:56 ?

22:57 I probably should have asked this ages ago, but what's the difference between clojurebot and lazybot?

22:57 ,(type (fn))

22:57 clojurebot: sandbox$eval27$fn__28

22:58 xeqi: cjfrisz: https://github.com/hiredman/clojurebot and https://github.com/flatland/lazybot

22:59 cjfrisz: xeqi: Thank you much

23:19 Raynes: cjfrisz: lazybot is a totally different project.

23:19 It does more things than clojurebot and overlaps in some places like evaluation, but even the evaluation is entirely different, using a sandbox library that I and amalloy_ developed.

23:19 Though xeqi keeps breaking it.

23:19 cjfrisz: Hehehe

23:19 Raynes: Because he is clever and such.

23:20 cjfrisz: Yeah, I saw that from the github page for lazybot

23:20 Very cool stuff

23:21 * xeqi whistles

23:36 cjfrisz: Ack...I'm very tempted to break my 80-character column rule

23:36 Help me be strong

23:37 xeqi: surely thats more like a guideline

23:38 cjfrisz: xeqi: You're being the little devil on my left shoulder :-P

23:38 I just have to remember that someday I will be working on a screen with less real estate and be very mad at myself

23:49 mpan: what screen will you use that has little width?

23:49 or are you one of those ssh over smartphone folks?

23:50 cjfrisz: mpan: I did a lot of coding on a netbook

23:50 Though I don't anymore

23:50 I upgraded to a big-boy 27" widescreen :-)

23:50 Though I'm thinking of picking up a 14" laptop soon to do work on the go

23:50 mpan: even a netbook has >120 cols?

23:53 cjfrisz: mpan: 90% or more of the time I have my emacs buffer split vertically

23:53 mpan: ah

23:53 that explains it

23:53 cjfrisz: mpan: Indeed

23:54 I think I could reliable do 72 characters before things got bad

23:54 Some idiosyncrasies of Clojure syntax forced me to up that limit to 80 characters

23:55 mpan: how good is emacs at knowing how far to indent?

23:56 cjfrisz: Generally quite good

23:56 And if it doesn't something I don't like I learned the incantation to poke the indent function to do what I want

23:56 *does something I don't like

23:57 mpan: that second part sounds hard, though

23:57 cjfrisz: Eh, it's not too bad

23:58 mpan: also, is the rebind-capslock-to-control thing real?

Logging service provided by n01se.net