#clojure log - Nov 20 2011

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

0:14 slyphon: so, with the modularized contrib, is there somewhere still to read the docs for each module?

0:21 devn: where'd try/catch go?

0:23 brehaut: it disappeared?

0:23 devn: it's not in core

0:23 amalloy: &(java.util.Date. 0)

0:23 lazybot: ⇒ #<Date Wed Dec 31 16:00:00 PST 1969>

0:24 brehaut: its a special form isnt it?

0:24 devn: yes

0:24 brehaut: so it wont be in core?

0:24 devn: what do you mean?

0:24 if is a special form.

0:24 brehaut: ,try

0:25 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: try in this context, compiling:(NO_SOURCE_PATH:0)>

0:25 brehaut: ,(try (/ 1 0) (catch Exception e e))

0:25 clojurebot: brehaut: excusez-moi

0:25 brehaut: ,(try (/ 1 0) (catch Exception e :exception-caught))

0:25 clojurebot: brehaut: Pardon?

0:25 brehaut: fail

0:26 i didnt think if was in core either? arent all the special forms implemented magically in the compiler?

0:27 amalloy: brehaut: righto

0:27 though a fair number of the "special forms" are actually macros in core, wrapping around the real special forms

0:28 also, the bots won't let you catch exceptions, because they send you a timeout exception if you take too long

0:28 devn: bah, my bad -- I don't know how that happened

0:28 brehaut: oh yeah i forgot about that

0:28 devn: For some reason I was blowing up on calling try

0:28 It seems to be working fine now

0:31 amalloy: technomancy: i realized something nice just now. in just 300 million years, oracle will have to finally fix/remove j.u.Date due to integer overflow

0:32 devn: read-string is awfully forgiving

0:32 ,(read-string "(+ 1 1))))")

0:32 clojurebot: (+ 1 1)

0:33 devn: ,(read-string "(((((((+ 1 1))")

0:33 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

0:33 devn: ,(read-string "((+ 1 1)))")

0:33 clojurebot: ((+ 1 1))

0:34 devn: ,(read-string "#=(eval (def foo "foo"))")

0:34 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0)>

0:34 devn: ,(read-string "#=3")

0:34 clojurebot: #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>

0:35 devn: ,(binding [*read-eval* true] (read-string "#=3"))

0:35 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Unsupported #= form>

0:35 devn: oh well, worth a try :)

0:35 alandipert: devn, gotta quote that puppy

0:35 devn: which'un?

0:35 brehaut: ,'puppy

0:35 clojurebot: puppy

0:35 alandipert: (eval '(def foo ...

0:36 devn: ,(binding [*read-eval* true] (read-string "#=(eval (def x 10))"))

0:36 clojurebot: #'sandbox/x

0:36 devn: x

0:36 ,x

0:36 clojurebot: 10

0:36 brehaut: nope, its because the string "foo" is not escaped

0:36 devn: brehaut: good catch

0:37 ,(binding [*read-eval* true] (read-string "#=(eval (def x \"10\"))"))

0:37 clojurebot: #'sandbox/x

0:37 devn: ,x

0:37 clojurebot: "10"

0:37 brehaut: im very in tune with the parser atm ;)

0:37 devn: align your chakras

0:38 brehaut: i align my chakras left with the second child of the list

0:39 devn: ,(binding [*read-eval* true] (read-string "#=(eval (defn hm [] (System/getProperty \"user.home\")))"))

0:39 clojurebot: #'sandbox/hm

0:39 devn: ,(hm)

0:39 clojurebot: #<AccessControlException java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)>

0:39 * devn promises to quit spamming the channel now

0:42 devn: ,(ns-publics (symbol (str *ns*)))

0:42 clojurebot: {hm #'sandbox/hm, x #'sandbox/x}

0:43 devn: ,(map first (ns-refers (symbol (str *ns*))))

0:43 clojurebot: (sorted-map read-line re-pattern keyword? unchecked-inc-int ...)

0:45 brehaut: (keys (ns-refers (.name *ns*)))

0:45 ,(keys (ns-refers (.name *ns*)))

0:45 clojurebot: (sorted-map read-line re-pattern keyword? unchecked-inc-int ...)

0:47 devn: much prettier

0:47 brehaut: its how we learn right?

0:47 devn: i hope so, else I've been doing it very, very wrong

0:48 brehaut: yeah me too ;)

0:48 devn: I've defaulted to using too much map I think

0:48 brehaut: ive defaulted to too much comp and partial

0:49 devn: ha, I can share in that feeling

0:50 it's clever and sometimes exactly what I need, but often times I'm just like "yeah! I can use juxt here!" when there's no need

0:50 brehaut: hehe yeah :)

0:50 devn: "playing with your data"

0:55 slyphon: so, if i need to implement an interface for something i'm handing into java (a lightweight instance that only has one method) a good choice for that is...?

0:56 brehaut: reify

0:57 * slyphon goes to look that up

0:57 scottj: slyphon: https://github.com/cemerick/clojure-type-selection-flowchart

0:57 slyphon: i did a project about a year and a half ago when 1.2 was coming out soon, coming back to clojure now i'm a little lost

0:57 scottj: awesome

1:00 brehaut: ,(let [named (reify clojure.lang.Named (getName [this] "hello, world"))] (name named))

1:00 clojurebot: "hello, world"

1:00 slyphon: hah

1:00 man, i totally forgot how to structure things

1:00 brehaut: i cant think of a simpler example ;)

1:00 slyphon: that was a good one

1:08 hrm, wasn't there a clojure version of a BlockingQueue ?

1:09 brehaut: java.util.concurrent.BlockingQueue

1:09 clojure.lang.PersistentQueue is not a replacement for it

1:09 slyphon: ah

1:10 * slyphon nods

1:13 jblomo: how do I call a super's method from within a gen-class function?

1:14 amalloy: brehaut: i usually use ##(.size (reify java.util.List (size [this] 10)))

1:14 lazybot: ⇒ 10

1:14 brehaut: amalloy: aha thats much better

1:18 amalloy: jblomo: you seem to be doing an enormous genclass. are you sure you really need all that?

1:21 jblomo: amalloy: gen-class is not too large, but I am overriding a Hadoop class

1:21 extending

2:11 brehaut: huh. you cant put an expontent on a hex number

2:11 i guess that shouldnt be surprising

2:59 Raynes: dakrone: Ping.

3:16 devn: brehaut: we need a #tag or something in irc for "huh." moments

3:16 brehaut: devn: yeah?

3:16 oh yeah, heh

3:16 devn: ./topic Concise '(huh moment) explained like this #huh_moment

3:17 IRC is such a gold mine of information.

3:17 brehaut: yeah totally

3:17 i wrote a log tagger for a bot i maintain on another channel

3:18 devn: brehaut: I need your help.

3:18 brehaut: its got some user interface crevases that needs work

3:18 yeah?

3:18 devn: I've seen your posts on parsers-- what I need is a clojure parser

3:19 It doesn't have to be perfect-- all I'm looking for is a way to extract "correct" s-expressions

3:19 brehaut: a parser for clojure or a parser in clojure?

3:19 devn: for

3:19 brehaut: funny you should mention that; i wrote one just this week (in javascript)

3:20 by correct you mean it fixes up unbalanced parens?

3:20 or only finds balanced expressions?

3:23 devn: brehaut: blah! sorry about that. my other keyboard is a model M clone and it is REALLY loud. My girlfriend is working on serious business.

3:23 I had to switch and couldn't find the right cable.

3:24 brehaut: All I care about is efficient checking to make sure something is a balanced expression.

3:24 brehaut: ok that should be pretty straight forward

3:24 devn: brehaut: Icing on the cake is being able to look at the N most recent expressions and make an educated guess as to whether they are a logical group

3:25 brehaut: i have something like written for lazybot (that has since been canned) let me find the commits

3:26 devn: brehaut: This is great. I feel like building this specific library for others to use and putting out on clojars or getting accepted as a core lib would be a nice addition.

3:26 putting *it out

3:26 getting *it accepted

3:26 *sigh*

3:26 clojurebot: Cool story bro.

3:26 devn: Brool story co.

3:27 brehaut: if you can ignore the expression prefixes, and atom specifics, it should be pretty simpl

3:27 devn: brehaut: could you elaborate?

3:27 example, please.

3:28 brehaut: so the prefixes are things like ^ @ ' ` ~ ~@ #

3:28 devn: reader macros.

3:28 brehaut: atoms are the non list,vector,map,set things

3:28 yeah pretty much

3:28 devn: okay, understood

3:28 brehaut: parsing all of clojure's legit number literals is a moderately large piece of work

3:29 (for example

3:29 )

3:29 if you just care about balanced expressions you can ignore all those fiddly details

3:29 https://github.com/brehaut/lazybot/blob/ce26d56fb1ebef2d7a5adadc611bc6c49f8e11de/src/sexpbot/plugins/clojure.clj#L61-90

3:29 devn: so, based on what you're saying, and what I was thinking earlier-- handling ^:dynamic

3:30 brehaut: right, so handling that substantially increases the complexity of the parser

3:30 * devn boggles at that regex

3:30 * devn re-reads

3:31 brehaut: oh thats simple; it just produces a stream of tokens for parsing

3:31 tokens in that case are [ ] ( ) { } and anything else

3:31 Raynes: devn: Sorry I missed you earlier.

3:31 brehaut: so "((foo bar) baz)" becomes ["(" "(" "foo bar" ")" "baz" ")"]

3:31 Raynes: I wasn't at home at the time.

3:31 devn: i had to parse the \\[\[\] brehaut

3:31 Raynes: no worries

3:32 brehaut: *nod*

3:32 brehaut: devn: ah right, escaped squares in a character class? hmm. damn unreadable regexps :S

3:32 devn: I've seen this before in trying to parse ruby, which is much, much uglier :)

3:32 brehaut: much :)

3:33 devn: 1.9.3 makes a little more palatable, but not much

3:33 RubyParser.new.parse "1+1"

3:33 # => s(:call, s(:lit, 1), :+, s(:array, s(:lit, 1)))

3:33 * devn shrieks

3:33 brehaut: so parsing meta data in my javascript imp is https://github.com/brehaut/inc-clojure-brush/blob/master/shBrushClojure.js#L107-116 and #L360-365

3:34 oh right, its given you an AST

3:34 devn: brehaut: what if multiple passes were made

3:35 brehaut: devn on clojure?

3:35 devn: so there is a core that is generalized

3:35 but you go back over everything with a "static/dynamic" augmentation

3:35 brehaut: devn: if you can leverage the reader then you are going to win

3:36 devn: im not actually sure i quite understand what it is you are building

3:39 devn: brehaut: skynet

3:39 brehaut: devn: oh

3:40 devn: brehaut: semi-kidding there

3:40 brehaut: hah :)

3:40 devn: I want to be able to hunt all over the place for clojure gists, pastes, irc, the lists, github projects, etc.

3:40 brehaut: oh man

3:41 thats a surprisingly tricky proposition

3:41 devn: Yes, I know.

3:41 I've been thinking about it for 2 years, and that hasn't increased my confidence.

3:41 brehaut: if i were to make uninformed assertions,

3:41 devn: But there is a poor solution out there.

3:41 brehaut: i wouldnt write a parser

3:41 id gather together a big corpus of code

3:41 devn: train it?

3:41 brehaut: yeah

3:41 devn: restricted boltzman or something?

3:42 brehaut: way out of my field of knowledge

3:42 cemerick is probably a better person to talk to

3:42 amalloy: devn: does the code contain the string "(defn "? that's a pretty good filter already

3:42 tada, now you can tell if any input file has some clojure code in it :P

3:42 brehaut: :)

3:43 devn: heh, that's great, but now what if you want to make a guess about whether 3-5 segments are a logical group

3:43 amalloy: probably less than a 0.1% false-positive rate

3:43 devn: if you choose yes and someone missed a ), you wind up with garbage

3:44 amalloy: yeah, you're probably right

3:44 brehaut: garbage + read-string

3:44 devn: amalloy: little is published that doesnt actually run

3:44 yeah i was looking at read string -- pretty encouraging how liberal it lets you be

3:44 amalloy: identifying "logical groups" is (more or less) impossible

3:44 devn: ,(read-string "((hm)))))")

3:44 clojurebot: ((hm))

3:45 devn: amalloy: you could be stupid about it though

3:45 amalloy: devn: it just stops when it gets to the end of a single valid expression

3:45 brehaut: devn: sure, but its still found a valid string :)

3:45 devn: short pastes reuse the same vars and string together an idea in general

3:45 hiredman: https://github.com/dakrone/clojure-opennlp/blob/master/TRAINING.markdown

3:45 brehaut: devn: re:published that run: http://brehaut.net/blog/2011/ring_introduction search for ":only [app delegate]])"

3:46 devn: hiredman: thanks

3:47 brehaut: no thanks! ;)

3:47 brehaut: lol

3:47 tl;dr: apparently the code i was really fussy with ensuring would run has some really dumb errors in it that ive only found now that i have syntax highlighting

3:48 devn: amalloy: *nod* -- that is simple, but does not allow for enough precision I don't think

3:48 maybe it does, just don't know...

3:48 brehaut: i need to head to bed; good luck devn

3:49 devn: brehaut: so before you go, last thing i promise

3:49 brehaut: ok shoot

3:49 devn: we've been dancing around this, but I think the real idea here is to identify possible candidates and then have real people sort them out.

3:49 so, I don't need the most precise thing, but I also don't know if the simplest thing will work

3:50 I'm not convinced of that anyway

3:50 brehaut: ok

3:50 so the problem with a straight forward deterministic parser

3:51 is that the clojure grammer (being a lisp) is really quite broad

3:51 devn: I think the fact that I used the word "candidate" and then suggested real people would review them is reason enough to assume what I need is some AI juice

3:51 brehaut: my previous sentence is frinstance valid clojure sexps

3:51 devn: *nod* -- I've run into this already

3:52 brehaut: sure

3:52 devn: I had years of #clojure logs and parsed them all -- ran them in a sandbox

3:52 but the sandbox can only do so much

3:52 and many of these expressions are part of a logical group of expressions

3:52 which is why they hold value

3:53 brehaut: yup

3:53 devn: IDK, at the end of the day it makes me think that all I really need to do is chunk it up and make it a game like amalloy and 4clojure

3:53 brehaut: hehe :)

3:53 amalloy: hah

3:53 devn: "mark the expressions in a logical group."

3:53 amalloy: i won't enslave my users to parse your sexprs!

3:53 devn: :D

3:53 amalloy: it's for the good of the land!

3:53 brehaut: the IRC logs are a particulary tricky set i think; a lot of bad code is fed to the bots that never executes properly

3:54 amalloy: they're already busy writing my utility libraries

3:54 devn: brehaut: it's also the most abused system in terms of hackery

3:54 which is actually a net win

3:54 brehaut: haha sure

3:54 devn: the sandboxes are good about being very selective

3:54 but that's also what makes them weak

3:55 perhaps the sandbox just needs to get broader

3:55 so you can perform "filesystem operations" in a virtual environment

3:55 amalloy: devn: that's easy to add. just add a jvm permission for ~/sandboxfs

3:55 brehaut: if i were to guess at an approach, i'd look at the NLP tool hiredman linked, and then group the found expressions by the nick and timestamp

3:56 amalloy: mount something there with a filesystem quota

3:56 brehaut: and use similarity of expressions to determine if two nicks are collaborating on one thing

3:56 * devn saves this buffer

3:57 devn: thanks amalloy brehaut hiredman

3:57 brehaut: keep in mind that im speaking only from the perspective of knowing of statistical techniques but not the details, and having some experience writing simple parsers

3:57 devn: brehaut: keep in mind i'm speaking from heavy idealistic ignorance

3:58 I just want the best documentation and example code known to man-- automatically

3:58 brehaut: lol :)

3:58 :)

3:58 devn: we talk about code as data

3:58 let's use it

3:59 brehaut: i really need to head to bed. gnite

4:00 devn: brehaut: thanks for the help, night

4:01 wow. inc-clojure-brush is great.

4:39 michaelr525: heu

5:31 guesy: I am new to clojure. I was trying to setum a working environment for the first time. with NetBeans(7.0.1) and eClojure. But maven clean install never succedes.. I am not even able to install it from the plugin editor in NetBeans. Any suggestions ?

5:32 I keep getting this error: The plugin Lucene Integration is requested in version >= (release version 1) but only 3.2.1 (of release version different from 1) was found.

6:20 justin`: /j ##closure-tools

6:20 that's embarrassing

8:08 lobotomy: ugh, why isn't doc working with the slime repl with clojure 1.3.0

8:09 lein new foobar; edit project.clj to have :dependencies [[org.clojure/clojure "1.3.0"]] :dev-dependencies [[swank-clojure "1.3.3"]] then lein swank, from emacs slime-connect, go to repl, "(doc +)" just says "Unable to resolve symbol: doc in this context"

8:09 but "(+ 1 2 3)" etc works just fine

8:10 from "lein repl", doc does work

8:13 fliebel: lobotomy: doc is located in clojure.repl

8:19 ukd1: hi guys, I'm looking at learning clojure and would like to get a book - there are two out on amazon (uk) -- which one is recommeneded? The joy of clojure or the pragmatic programmers book?

8:21 fliebel: ukd1: afaik, joy of clojure is a bit more advanced, so if you're new to clojure, lisp and functional programming, I would not recommend it.

8:21 I'm not sure, but I think there are a couple of new books about to be released, which'll probably cover clojure 1.3

8:22 ukd1: fliebel, I've done a little common lisp, but not for a while. I was mainly worried they'd be out of date

8:22 lobotomy: fliebel: and clojure.repl isn't included by lein-swank by default any longer?

8:23 fliebel: ukd1: Well, I'm not sure, but 1.3 was just released.

8:23 lobotomy: is "(clojure.repl/doc +)" supposed to work then from the emacs slime prompt? that's not working either

8:23 fliebel: lobotomy: try (use 'clojure.repl) and then try again

8:24 lobotomy: ah ok

8:24 so some smart guy decided to omit that use statement from lein-swank, just to piss me off. got it :p

8:25 fliebel: ukd1: have you seen this one? http://www.manning.com/rathore/

8:26 ukd1: or http://pragprog.com/book/shcloj2/programming-clojure

8:28 technomancy: would slamhound + lein repl be a nice idea?

8:28 ukd1: fliebel - nope - just looking!

8:32 Saturnation: ukd1, I just started learning, and Joy of Clojure was a bit more than I needed, though still a good book. I've got the beta of the Pragmatic and picked up Clojure in Action. If I had to recommend one for a first book, I'd recommend Programming Clojure

8:37 ukd1: Saturnation, thanks! I've ordered that one :-)

8:51 fliebel: What is the status of XML in Clojure? I found clojure.data.xml, but it's not ready.

9:15 erluko: fliebel: what are you looking for?

9:16 fliebel: erluko: generating an atom feed. I have written something myself in the past, but it'd need some cleaning up.

9:16 https://github.com/pepijndevos/ArmageDOM

9:19 so there's clojure.xml and clojure.data.xml, neither of which are very active or complete.

9:19 erluko: Would prxml work? http://clojure.github.com/clojure-contrib/prxml-api.html#clojure.contrib.prxml/prxml

9:21 fliebel: erluko: That's old contrib.

9:21 erluko: ah, yes it it

10:17 Sindikat1: hello everyone

10:18 i want to write a game in clojure (as a practice). it will be a roguelike with graphics, and the graphics will be something like this - http://ianwitham.files.wordpress.com/2010/02/screenshot-python-libtcod-tutorial.png - what libraries should i use?

10:18 diptanuc: Hello folks can anyone explain my why does (identical? "foo" "foo") return true on my repl

10:19 aren't these two different objects?

10:19 (= "foo" "foo") can be equal though

10:21 raek: diptanuc: each function (or top level expression) is compiled into a java class. each class has it's own constant pool, so if the same string occurs more than once in a "class" it will still only be stored once

10:21 &(identical? "foo" (str "f" "oo"))

10:21 ,(identical? "foo" (str "f" "oo"))

10:22 clojurebot: false

10:23 raek: diptanuc: so in this case they happened to be the same object (due to this space optimization) but two strings that are equal are not identical in general

10:28 diptanuc: raek: Thanks

10:28 raek: Makes sense now

10:45 technomancy: fliebel: I think slamhound makes more sense with editor integration

10:46 if you don't have the file right in front of you, you really don't want it running off and rewriting forms

11:01 fliebel: technomancy: I was thinking more along the lines of auto-loading stuff you use on the repl.

11:21 Sindikat1: hey, i did everything as it was said in 'getting started with emacs'. i have .clj file on one buffer and slime repl in another. when i try to call some function from .clj file, it throws error as function is unknown, but C-x C-e in the .clj works

11:29 ejackson: Sindikat1: how are you calling the function from the .clj file ?

11:29 do you mean from the repl ?

11:29 in that case have you changed to the correct namespace in the repl ?

11:29 Sindikat1: yeah, say i have function (defn location ...), and i call it (location) in slime

11:30 ejackson: in the .clj file go C-c M-p

11:30 that switches the repl to the namespace of the the file

11:30 devn: ^

11:30 ejackson: you might also want C-l to load the file

11:30 Sindikat1: ha, works!

11:30 ejackson: then you're mustard

11:30 devn: The only problem I have with C-c M-p is that once you've loaded a couple of namespaces for the same project it gets a little less productive

11:31 C-c M-o is handy also

11:31 Sindikat1: hey, C-c C-l itself weren't working before

11:31 ejackson: devn: what does it do ?

11:32 Sindikat1: so i always need to change namespace before working with repl, right?

11:32 devn: It ejackson it'

11:32 fjdisao ejackson nothing fancy -- it just clears your REPL

11:32 ejackson: aaah, cool

11:33 devn: it can be nice when i've made a big mess or forgot to turn on *print-level* 2, *print-length* 10

11:33 ejackson: Sindikat1: no, you can do (use ...) the namespace from the repl and get the functions that way, but C-c M-p is usually easier.

11:33 devn: and have a 450,000 element hash-map in my REPL

11:33 grinding emacs to a halt

11:33 ejackson: as you do...

11:33 devn: :)

12:01 dakrone: you around?

12:05 R4p70r: Anyone's looking for a novice Clojure coder in Canada?

12:05 mindbat: i'm getting a rather nasty exception when trying to compile the hello.cljs example from the clojurescript quick start

12:05 anyone been able to get that quickstart working?

12:08 the error i'm getting is: Exception in thread "main" java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil

12:08 is there some part of the clojurescript example i'm missing?

12:10 ejackson: mindbat: I'll take a quick look for you, no promises though

12:10 mindbat: ejackson: awesome, thanks

12:10 fliebel: when you write (defmulti foo class), you can use defrecord instead, right? What about the default case?

12:11 Just extend Object?

12:11 ejackson: mindbat: works 100% here. Did you do everything in "One-time Setup" ?

12:12 mindbat: ejackson: Where's the One Time Setup? I followed the three steps at the top of the quick start guide, then moved on to Using ClojureScript on a Web Page

12:13 ejackson: its in the README.md or here: https://github.com/clojure/clojurescript/tree/master/samples/hello

12:13 its the minimum you need to get this sample going

12:14 mindbat: ejackson: ah, didn't see that, thanks...was working purely off the hello.cljs example on the Quick Start page. I'll have a look at that example and try that

12:15 ejackson: cool, those samples are great. They go as far as the repl browser, which you definitely want to check out.

12:31 mindbat: ejackson: still get the same error when runnning 'cljsc src > hello.js' from the samples directory

12:31 ejackson: mindbat. ugh

12:31 mindbat: ejackson: (after setting the environment variables and path)

12:31 ejackson: hmm... can you get a repl to come up in the root dir ?

12:33 mindbat: ejackson: from the root clojurescript directory, i can get a clojure repl...but not a clojurescript repl

12:33 ejackson: repljs fails with: Exception in thread "main" java.lang.RuntimeException: java.lang.AssertionError: Assert failed: Can't find goog/base.js in classpath

12:33 ejackson: did you do the bootstrap ?

12:33 mindbat: ejackson: yep

12:34 ejackson: do you have a goog.jar in the lib dir ?

12:34 mindbat: ejackson: nope

12:34 ejackson: your bootstrap must have failed.

12:34 mindbat: ejackson: should i run the bootstrap again?

12:35 ejackson: yeah, from the root ./script/bootstrap

12:35 mindbat: ejackson: says it completed, but: Building lib/goog.jar... jar cf ./lib/goog.jar -C closure/library/closure/ goog ./script/bootstrap: 34: jar: not found

12:36 ejackson: weirdness.

12:36 mindbat: ejackson: can i download the jar manually?

12:36 ejackson: noononono

12:36 more is probably wrong

12:36 kill the whole dir and clone from github again

12:38 mindbat: ejackson: done...same error

12:38 ejackson: windows ?

12:38 mindbat: ejackson: ugh, no...ubuntu 10.10

12:38 ejackson: ubuntu.....

12:38 1 sec I'm going to try over here

12:41 mindbat: you have curl installed ?

12:41 mindbat: ejackson: yes

12:43 TimMc: OK, what are some good Clojure videos to watch, since my arm is being useless?

12:43 ejackson: mindbat: gist up the output of bootstrap please for me to see

12:43 TimMc: consider for a second what you just said....

12:43 TimMc: There's "Simple Made Easy" and I suppose some Conj videos -- what else?

12:44 ejackson: What?

12:44 ejackson: it must just be me....

12:44 TimMc: My right elbow is being all complainy -- Ishould stay away from the keyboard.

12:45 ejackson: mindbat: my bootstrap output looks like this.... https://gist.github.com/1380546

12:45 TimMc: did you see "Are we there yet "

12:45 mindbat: ejackson: and this is mine: https://gist.github.com/1380545

12:46 ejackson: mindbat: I think you're mising the jar command

12:46 try calling jar from the command line

12:47 TimMc: if not, http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey is a cracker !

12:47 TimMc: oooh http://clojure.com/reading.html

12:47 mindbat: ejackson: hmm...yep, it seems to be missing

12:47 ejackson: mindbat, ok, here we delve into javaland... ugly

12:48 you need to install the correct jdk package for ubuntu.... i'm not sure offhand what it is though.

12:48 try this: sudo apt-get install sun-java6-jdk

12:48 mindbat: ejackson: there's the openjdk one, and sun-java...any idea if clojure/clojurescript plays nice with the openjdk?

12:49 ejackson: i think openjdk doesn't work right

12:50 mindbat: ejackson: ok, i'll grab the sun java package

12:51 ejackson: yeah, try that and see if it brings down the jar binary for you, think that'll sort it.

12:54 mindbat: ejackson: hey, that did it! everything works now!

12:54 ejackson: many thanks!

12:54 ejackson: no sweat, happy hacking bro.

12:54 TimMc: ejackson: Thanks.

13:03 devn: Anyone know anything about NLP?

13:08 guesy: I am new to clojure. I was trying to setum a working environment for the first time. with NetBeans(7.0.1) and eClojure. But maven clean install never succedes.. I am not even able to install it from the plugin editor in NetBeans. Any suggestions ? I keep getting this error: The plugin Lucene Integration is requested in version >= (release version 1) but only 3.2.1 (of release version different from 1) was found.

13:13 TimMc: devn: A bit...

13:13 gfredericks: Null Lointer Pexception?

13:14 devn: actually now that I think about it, I took a class on it, if that means anything.

13:14 TimMc: devn: I work at a company that does computational linguistics.

13:16 bbommarito: Good afternoon all.

13:30 dnolen: guesy: if you just want an easy to use environment I suggest taking a look at clooj.

13:32 bbommarito: Wow, I had never heard of clooj.

13:45 klauern: What are some good examples of libraries that limit statefulness in places where it's often required?

13:45 brehaut: dnolen: do you still believe theres only 4 things that need to be changed/fixed in javascipt?

13:45 dnolen: brehaut: heh, what do you mean?

13:46 brehaut: dnolen: http://dosync.posterous.com/fixing-javascript

13:46 thats pre clojurescript right?

13:46 dnolen: brehaut: oh yeah, and clojurescript addresses all of those

13:48 fliebel: dnolen: How hard is it to mess with core.match?

13:49 brehaut: personally i think the biggest thing clojurescript brings to the table is sane collections

13:49 dnolen: brehaut: oh man seriously

13:49 fliebel: not so bad given the utter lack of documentation

13:50 guesy: dnolen: I looked at clooj. That is a usefull suggestion. Thank you.

13:51 fliebel: dnolen: I'm trying to write a ring routing lib based on it. (match req [:get foo "bar"] baz)

13:51 guesy: dnolen: can you help me setup my environment in NetBeans 7.0.1 ?

13:51 I am running Ubuntu 11.10

13:51 devn: TimMc: gfredericks: I'm curious as to how I'd go about building a sentence detector for clojure. Do I need a dictionary first? Where would you start if you wanted to train a program to recognize valid clojure forms?

13:52 TimMc: devn: That's not NLP, that's ALP. :-)

13:52 dnolen: fliebel: oh you're not hacking on it, yeah using it is pretty simple.

13:53 guesy: I don't use Enclojure so I don't think I can be of much help.

13:53 devn: TimMc: give me reading material and stuff! :)

13:53 dnolen: guesy: Enclojure is quite cool, but it's not actively developed now as far as I can tell.

13:54 TimMc: devn: A = Artificial. You don't need statistical models etc., you just need a parser.

13:54 fliebel: dnolen: Well, partially. I want to pass the bindings on to the handler, but the expanded form is just a let, so I'm looking for a way to get them.

13:54 TimMc: devn: You're just trying to match forms?

13:55 dnolen: fliebel: so are you running into trouble? that looks like it should just work to me.

13:56 fliebel: dnolen: Well, say I write [:get foo "bar" baz] handler, I want to pass foo and bar to handler.

13:56 guesy: dnolen: So which IDE is generally used by most of you ? workin with clojure ??

13:57 TimMc: Emacs.

13:57 Then Vim and Eclipse, I think.

13:58 guesy: Whatever you use, it really has to have paren balancing, either in strict mode or just an advisory mode.

13:58 dnolen: fliebel: you can do that

13:58 fliebel: unresolved symbols become "named" wildcards

13:58 Raynes: devn: ping

13:59 dnolen: guesy: I use Emacs

13:59 guesy: but others use Eclipse, IntelliJ

13:59 fliebel: dnolen: I know, they are let'ed in the expanded form, but how do I figure out which variables the user entered?

13:59 dnolen: fliebel: ?

14:00 guesy: TimMc: i've been using emacs and vim all the time. I thought using an ide with a plugin for syntax assist might be helpful to start with.

14:00 TimMc: guesy: The Emacs Starter Kit is pretty good if you don't already have an environment set up. (And use Leiningen for building.)

14:00 dnolen: guesy: ah, SLIME w/ Paredit is pretty nice.

14:00 TimMc: guesy: Well, in Emacs you have paredit-mode (minor) and clojure-mode (major).

14:00 fliebel: dnolen: I and of course write (match foo ["bar" baz] (handler baz)), but I'd like to auto-wire that.

14:02 guesy: TimMC: dnolen: I am setting up my VM now. I guess EMacs as always is the ONE !

14:02 TimMc: yup

14:02 especially for s-expression languages

14:02 dnolen: fliebel: sorry I'm slow today, I don't see what needs to be done :)

14:02 bbommarito: Yea, emacs is pretty much the Lisp editor.

14:02 guesy: Thank you guys. I will be back in a minute as soon as I complete the Environment Setup

14:03 bbommarito: paredit mode is the greatest thing since sliced bread.

14:04 fliebel: dnolen: I want to have a list of all the let'ed symbols, so I can automagically pas them to the handler.

14:04 devn: Raynes: pong

14:06 dnolen: fliebel: ah yeah, there's no way to do that.

14:06 Raynes: devn: Currently writing some marginalia docs in lein-newnew. Once I'm finished, I'll walk you through whatever you want.

14:07 fliebel: dnolen: Not in the match macro, or not at all? I suppose that to let them, you need to have that list.

14:08 That is why I said 'mess', because I think I need to step down a few levels.

14:09 devn: Raynes: that'd be cool

14:10 TimMc: we were talking about this last night -- a parser doesn't seem like the right way to go according to brehaut

14:11 TimMc: devn: What's an example?

14:11 Point me to a timestamp?

14:11 dnolen: fliebel: I don't think you need to change match. Write a route-match macro that analyzes for free symbols and move them over before match handles it.

14:11 devn: TimMc: 1sec

14:12 TimMc: (UTC or EST, or a search string)

14:13 devn: TimMc: http://clojure-log.n01se.net/date/2011-11-20.html#03:18

14:14 TimMc: thx

14:15 devn: TimMc: the problem is knowing it's a balanced expression is one thing, but being able to see if a group of expressions rely on one another would be great

14:15 fliebel: dnolen: Something like (filet symbol? (flatten pattern)) ?

14:15 *filter

14:16 dnolen: fliebel: something like that, just make sure you exclude locals you find in &env

14:17 fliebel: dnolen: Ok, I'll write my macro monster, thanks :)

14:17 dnolen: fliebel: heh should be a pretty simple one.

14:18 devn: TimMc: I don't know -- maybe you're right. Sorry that's so long to read.

14:18 fliebel: dnolen: I hope so. One other problem I ran into is that match seems to require a literal vector for the pattern.

14:19 So I need to do some wrapping and unwrapping as well. Or is that different in head? Because I saw matching on a single value.

14:19 devn: TimMc: I'll be right back

14:19 TimMc: k

14:19 dnolen: fliebel: you can match single things now

14:20 fliebel: dnolen: yay, thanks. This is going to be awesome :)

14:20 dnolen: fliebel: you don't need to change the left hand side anyhow, just the right hand side.

14:20 fliebel: ?

14:20 dnolen: fliebel: you macro does change the patterns, just the right hand side clauses

14:21 fliebel: dnolen: right :)

14:21 dnolen: (route-match x [:get bar] handler) -> (match x [:get bar] (handler bar))

14:21 doesn't change patterns i mean

14:21 fliebel: :)

14:22 TimMc: devn: Arm "broken", gonna be concise: Use reader to extract symbols, match against Bayesian filter. Train hidden Markov Model on known Clojure and other sexp langs.

14:23 devn: You also want clustering of related code in a document? Look up in-doc coref.

14:24 devn: Nothing wrong with doing a little annotation yourself.

14:26 fliebel: What would be needed to make clojure.walk/postwalk retain metadata?

14:26 devn: TimMc: I had planned on some annotating by hand

14:26 TimMc: thanks for the help

14:26 Raynes: fliebel: The tears of children.

14:27 fliebel: Raynes: I think so...

14:38 TimMc: devn: What kind of code do you want to extract, what to ignore, and what to do with it?

14:42 gfredericks: devn: I'm a bit confused as to why clojure.core/read doesn't do what you want

14:44 RazWelles_: Hey what's the status on ClojureCLR atm? Is it maturing?

14:50 TimMc: It had a commit in September, I think.

14:52 Raynes: https://groups.google.com/d/msg/clojure-dev/OUTZC8i_-LI/tkbREu83BNIJ

14:58 bbommarito: Hrmmm, no websockets library for Clojure...might have to write one...

14:59 fliebel: Raynes: How do you get the tears of children? I can't get it to work.

15:00 Raynes: devn: http://raynes.github.com/lein-newnew/

15:01 * Raynes finds it rather strange that marginalia didn't pull the docstring out of his renderer function.

15:02 gfredericks: lein-difftest requires clojure-contrib? Am I supposed to make that a dev-dependency, or does it go somewhere else?

15:02 Raynes: It does?

15:03 gfredericks: it wouldn't run until I added contrib as a dev dep

15:03 Raynes: Oh, they didn't upgrade to the new difform version.

15:03 gfredericks: and then it ran

15:03 Raynes: gfredericks: If you just :exclude difform and then add difform 1.1.2 yourself, your problem will probably cease.

15:04 gfredericks: Raynes: in the project.clj? I just think it's gross that difftest is installed as a global plugin on my machine, instead of being listed in the project.clj, and yet I have to muck with my project.clj to make it work

15:05 Raynes: gfredericks: If you give me a moment, I'll update it myself and release a version to clojars under my own groupid until they release an official version.

15:06 gfredericks: so then I would uninstall the official plugin and install yours?

15:06 Raynes: Yep.

15:06 gfredericks: that sounds like a great solution.

15:07 thanks

15:10 Raynes: gfredericks: lein plugin uninstall lein-difftest 0.3.4 && lein plugin install org.clojars.raynes/lein-difftest 0.3.5

15:10 Shooting Brenton a pull request now, so I imagine an official release isn't too far off.

15:11 gfredericks: 0.3.4? should be 1.3.4?

15:11 Raynes: Eh, probably.

15:11 Yeah

15:11 gfredericks: so then 0.3.5 or 1.3.5 for yours?

15:11 Raynes: 1.3.5

15:12 gfredericks: coo

15:16 Raynes: works great, thanks!

15:21 (inc Raynes)

15:22 (dec lazybot)

15:22 Raynes: Huh.

15:23 tmciver: I'm trying to remember a function that returns an edited version of a nested map.

15:26 gfredericks: tmciver: assoc-in and update-in

15:27 tmciver: gfredericks, yes, thanks. I just saw update-in.

15:31 fliebel: I hate reflection, always takes years before I figured out where to put the type hint. So, reflection is slow, for humans too.

15:34 TimMc: (watching "Simple Made Easy")

15:35 I think Rich is *complecting* the objective/subjective and absolute/relative axes.

15:35 </smug>

15:35 dnolen: woohoo, got printable types for CLJS :)

15:48 Saturnation: dnolen, with they repl in a browser you demoed at the end of the Conj, how hard is it to set up? Is it documented somewhere?

15:49 s/they/teh

15:49 gah

15:50 dnolen: Saturnation: pretty easy w/ Emacs, it's all setup in the CLJS master branch.

15:50 Saturnation: easy for someone with Clojure experience, or just easy in general? :)

15:51 trying to get it set up for my team remotely...

15:51 actually, not trying, but thinking about...

15:51 * Saturnation is hoping that it would make debugging JS in general a lot easier

15:53 brehaut: Saturnation: you do know about the webkit inspector right?

15:54 * Saturnation doesn't do much JS

15:54 Saturnation: so no

15:55 brehaut: Saturnation: its got a repl console, debugger, profiler, resource and network inspector, and dom + css inspector

15:56 dnolen: printable types branch here, https://github.com/clojure/clojurescript/compare/33-type-fn

15:56 Saturnation: I'm more interested in the ClojureScript because I'd hope it'd be a way to get the team interested in Clojure

15:56 dnolen: Saturnation: I don't know if it makes debugging JS easier, but it does make writing code a lot easier.

15:57 Saturnation: it also removes lots of nasty JS corner cases

15:58 brehaut: in chrome its spanner > tools > developer tools, and in safari its develop > show web inspector

15:58 Saturnation: don't see anything obvious, but webkit inspector doesn't work with IE?

15:58 dnolen: Saturnation: no

15:58 Saturnation: to debug IE you need Visual Studio Web

15:58 well for IE < 8, but the IE 8 devs tools aren't that great either

15:59 Saturnation: thanks for the info, something to chew on for a bit :)

15:59 bbommarito: That is why I do not support IE.

16:00 dnolen: Saturnation: one thing I'm excited about is getting the ClojureScript analysis stuff going, I think that could actually make the debugging ClojureScript experience light years beyond JS

16:00 bbommarito: Pain in the butt really

16:00 srid: can this be made any more concise? -- (zero? (mod 6 4))

16:00 brehaut: dnolen, Saturnation: IE has a rubbish inspector hidden behind F12

16:01 but you can still pause and inspect without VS

16:01 dnolen: srid: that's not concise enough for you?

16:01 srid: just wondering if there is any

16:01 i was thinking of something like: (divisible? 6 4)

16:01 that reduces 2 applications to one

16:03 brehaut: (def divisible? (comp zero? mod))

16:03 srid: (min (f1 ...) (f1 ...) (f1 ...)) -- I want the 3rd value to `min` made conditional. what is the best way to do this? (apply min (conj (f1 ..) (f1..) (if condition (f1..))))?

16:11 Raynes: devn: Let me know if the docs aren't sufficient. We can talk about whatever.

16:11 gfredericks: srid: (zero? (mod 6 4)) can be shortened to false :)

16:12 bbommarito: gfredericks: Indeed, I think that would be the shortest way to write that.

16:12 And that is only one form.

16:13 gfredericks: bbommarito: maybe (def f false) somewhere for brevity

16:14 bbommarito: gfredericks: Hrmmm, yes that would work. I don't think you could get much smaller than that.

16:14 Unless...you define a space to be false...

16:17 Okay, how the Detroit Lions managed to do this, I am not entirely sure...

16:23 amalloy: srid: (apply min (into [(f1 ..) (f1..)] (if condition [(f1..)])))

16:24 srid: also: (apply min (remove nil? [a b c ...]))

16:24 (apply min (remove nil? [a b (if condition c) ...]))

16:25 amalloy: yeah. fwiw, that function's actually in useful already

16:25 Bahman: Hi all!

16:26 amalloy: https://github.com/flatland/useful/blob/develop/src/useful/utils.clj#L31 (built on ignoring-nils at https://github.com/flatland/useful/blob/develop/src/useful/fn.clj#L90 )

16:26 Raynes: gfredericks: technomancy just pushed 1.3.5 to clojars officially, fyi.

16:30 gfredericks: Raynes: w00p, thx

16:33 devn: Raynes: cool, ill take a peek

17:09 jblomo: has there been any discussion on extending the object.method calling syntax sugar?

17:10 eg (map .toString [1,2,3,4])

17:11 amalloy: &(map (memfn toString) [1 2 3 4])

17:11 lazybot: ⇒ ("1" "2" "3" "4")

17:12 amalloy: also: no. .toString is not a function, and i doubt it ever will be. it's a method and you have to treat it that way

17:17 devn: ha! so...as an experiment I've decided to rewrite a project we have at work in Clojure

17:18 ejackson: is there a way to get the classpath while in a clojurescript repl ?

17:18 devn: I'm about 4 hours in and I think I have almost all of it done

17:25 jblomo: amalloy: ah cool, i hadn't used memfn before, thanks

17:26 Wild_Cat: &(map #(.toString %1) [1,2,3,4])

17:26 lazybot: ⇒ ("1" "2" "3" "4")

17:27 Wild_Cat: &(map #(.toString %) [1, 2, 3, 4])

17:27 lazybot: ⇒ ("1" "2" "3" "4")

17:30 ejackson: to answer myself: put a call to print it out in the startup script.

17:30 (before you start the cljs repl...)

17:37 spoon16_: I have a vector [ 0 1 2 3 99 0 6 18 3 4 5 ] and a predicate #(< 10 %) how can I get back a sequence of sub-sequences where predicate is true on the original vector… so the result would be ( (0 1 2 3) (0 6) (3 4 5) )

17:37 take-while is close

17:41 lucian: spoon16_: sounds like 4clojure's longest increasing subsequence. you should be able to see other people's solution to it

17:42 brehaut: ,(take-nth 2 (partition-by #(< 10 %) [ 0 1 2 3 99 0 6 18 3 4 5 ]))

17:42 clojurebot: ((0 1 2 3) (0 6) (3 4 5))

17:42 brehaut: spoon16: ^

17:42 spoon16_: nice

17:43 amalloy: brehaut: danger! coll might start with fitting or not-fitting the predicate

17:43 brehaut: amalloy: you are right

17:44 amalloy: just the other day i wrote, yet again, (defn partition-around [pred coll] (filter (comp pred first) (partition-by pred coll)))

17:44 which does what spoon16 wants

17:44 spoon16_: amalloy, thanks

17:44 amalloy: though i actually wanted remove instead of filter for my application, so i wrote that instead :P

17:46 dnolen: cljs.core.IFn, https://github.com/clojure/clojurescript/compare/96-ifn

17:46 ejackson: brehaut: that is cute.

17:46 brehaut: ejackson: and wrong half the time ;)

17:47 amalloy: do you have (partial partial apply) as something in useful?

17:48 amalloy: hah. no, but that does sound useful

17:49 brehaut: incidentally, would that be a third order function?

17:49 amalloy: &(let [ap (partial partial apply)] (map (ap +) [[1 2 3] [4 5 6]])) or something, right?

17:49 lazybot: ⇒ (6 15)

17:49 brehaut: yeah

17:50 amalloy: i don't *think* so, because partial works just fine on first-order functions - that it receives a second-order function is "coincidental" in a way. but i'm not okasaki; maybe he disagrees

17:50 brehaut: yeah i have no idea

17:51 propably it depends on the type signature

17:56 Raynes: devn: We're merging lein-newnew into Leiningen tonight or tomorrow.

17:57 If you have any changes or anything, you might want to wait for that.

18:24 devn: Raynes: noted -- ill still take a look in a moment, doing some chores around the house

19:07 TimMc: Is "Simplicity Ain't Easy" worth watching after "Simple Made Easy"?

19:22 Saturnation: Is there a Clojure function for accessing the methods on a Java object?

19:26 TimMc: Saturnation: listing them?

19:27 scottj: Saturnation: slime? use the inspector

19:29 Saturnation: I've seen it done at the repl before, just not sure if it was Clojure or Java interop

19:30 Raynes: TimMc: Stalk'd https://gist.github.com/1381252

19:31 amalloy: Saturnation: clojure.contrib.repl-utils used to have a show function that does that

19:31 i don't think it's in 1.3 though?

19:31 TimMc: Raynes: Huh, cool.

19:31 Raynes: (.getMethods java.io.File)

19:32 Saturnation: Raynes, that's probably it, thanks :)

19:32 kephale: i always pprint the bean of the class

19:32 TimMc: Raynes: needs to be printable...

19:33 Raynes: (doseq [method (.getMethods java.io.File)] (println method))

19:35 Saturnation: reflect seems to do something close to what I'm looking for...

19:35 TimMc: Raynes: Stalk'd https://gist.github.com/Raynes

19:36 Saturnation: or not...

19:40 amalloy: just call seq on it: then it's printable

19:42 Raynes: TimMc: https://gist.github.com/1381270 too bad I can't edit your bio to say "I <3 Raynes"

19:44 TimMc: Raynes: Check again.

19:45 Raynes: Hahaha

19:45 TimMc: Actually, I should put something a real bio in there. Thanks for reminding me...

19:46 Raynes: TimMc: Dude!

19:46 TimMc: Clone tentacles and do it from your repl. :>

19:46 TimMc: too much typing

19:46 Raynes: Hardly any at all.

19:46 TimMc: to do the writing, I mean.

19:46 also lazy

19:47 Raynes: Clone the repo, lein repl, (use 'tentacles.users), (edit {:auth "login:password" :bio "new bio"})

19:47 That's how Clojurians were meant to use Github.

19:47 TimMc: shouldn't be keyboarding at all

19:48 back to videos -- maybe tomorrow is a hammock day at work

19:49 amalloy: "TimMc went from 'How do you work this dang GitBook thing' to 'I <3 Raynes'"

19:54 devn: Raynes: you should keep the cover of your book like that

19:54 Raynes: Everybody says that.

19:55 devn: I seriously do like it.

19:56 The tentative ToC looks great also

19:56 Yo dawg, I herd u liek data

19:56 :D

20:02 TimMc: Raynes: Bug the github folks to allow SSH access to profiles.

20:03 Raynes: What use would that be?

20:03 devn: a big BBS!

20:03 amalloy: "SSH access to profiles"? i'm not clear on what that would mean

20:09 TimMc: Raynes: Not having to dig out my password and put it on disk.

20:10 amalloy: Like, if they exposed a min-repo for everyone's profile I DON'T KNOW

20:10 :-P

20:20 Raynes: I don't like putting passwords on the command line, even inside a REPL.

20:20 Maybe even more so in a REPL, since I don't know where the history is stored.

20:21 amalloy: TimMc: well, passing them as arguments to a process is clearly worse than giving them to a process on stdin

20:21 TimMc: yes

20:22 Raynes: Also, I'm doing this stuff in SLIME.

20:22 Which isn't really the command-line.

20:22 So there.

20:34 TimMc: Raynes: Does SLIME havew a persistent history?

20:34 amalloy: yes

20:34 Raynes: TimMc: Do you wear a tinfoil hat and sleep under a rock?

20:34 TimMc: Yes!

20:35 amalloy: it syncs your history to wikipedia for cloud persistence

20:35 TimMc: But mostly I am being belligerant.

20:35 I do have an encrypted hard drive, so I should just shut up. :-)

20:36 * amalloy hopes TimMc's login password is "1234"

20:38 TimMc: no, it is ****

20:38 amalloy: TimMc: your password is juxt too???

20:38 lazybot: amalloy: Yes, 100% for sure.

20:38 TimMc: Nope, it is fnil.

20:39 (haven't seen that used much recently)

20:44 scottj: cljs: can you pass a clj map to a gclosure function that expects a javascript object or do you have to convert it first?

20:44 amalloy: scottj: convert it

20:44 well

20:44 brehaut: scottj: i hope so! javascript objects are retarded maps

20:45 amalloy: my understanding is that clojure has array-map and hash-map; cljs has hash-map and object-map

20:45 brehaut: (i hope you have to convert it)

20:45 amalloy: so you could pass an object-map in, i think, but not a hash-map

20:45 scottj: any idea how to convert it?

20:46 amalloy: (into (object-map) the-hash-map)? i dunno

20:47 scottj: I'd tried (into (js-obj) foo) but that didn't work

20:47 amalloy: i hear a lot of people have written a recursive converter, but the above should be fine for a flat map. bear in mind i know nothing about cljs though, aside from what i hear

20:51 TimMc: Does anyone have a public cljs REPL up on the web? That is, a REPL that is in a browser page. (I write CLJS, it is sent to the server for conversion, the resulting JS is executed in the browser, and the result is printed as CLJS in the REPL.)

20:54 lucian: is cljs self-hosted already?

20:55 TimMc: Can't be.

20:55 scottj: there is some clojurescript compiler web service package for the serverside part

20:59 amalloy: scottj: talking about the one announced on the ML last week? it looked atrocious

20:59 TimMc: Is the compiler generally safe to run on arbitrary code?

21:00 amalloy: TimMc: i've pondered that myself, and i can't think of any counterxamples but i'm still not sure

21:00 aside from *read-eval*, of course

21:01 TimMc: This is the first time I've seen a compelling demo of multimethods and hierarchy: http://pragprog.com/magazines/2011-07/growing-a-dsl-with-clojure

21:01 amalloy: TimMc: i wrote another one you might like

21:02 TimMc: shoot

21:02 amalloy: https://github.com/flatland/depot/blob/develop/src/depot/pom.clj

21:02 brehaut: haha xml is the perfect usecase for multis :)

21:03 amalloy: produces a prxml-style vector for a pom.xml, and uses a "list" type that dependency/exclusion lists derive from

21:04 dependency/repository, i guess

21:04 TimMc: no docstrings ಠ_ಠ

21:04 amalloy: TimMc: well, there's only one thing you could put a docstring on, right? xml-tags

21:04 TimMc: yeah

21:04 devn: you're in trouble!

21:04 amalloy: and look, brehaut, it's using partial apply again! that needs to get into useful, stat

21:04 devn: no docstrings!

21:04 brehaut: TimMc: amalloy only needs one docstring; the one on juxt

21:05 TimMc: haha

21:05 amalloy: *chuckle*

21:05 devn: hah

21:05 brehaut: amalloy: awesome :)

21:05 * devn just noticed github has highlighting for ns-qualified keywords

21:05 devn: that's really nice.

21:05 * amalloy submits a pull request to clojure. edit juxt docstring, to add: "actually ask amalloy, he's nuts for this thing"

21:05 amalloy: devn: i added that!

21:06 devn: !!! wha!? That's /awesome/.

21:06 brehaut: devn: the pygments clojure brush is a really nice tool

21:06 devn: brehaut: didn't you just work on that?

21:06 brehaut: devn: nope

21:06 ive been working on the javascript one

21:06 devn: who was that? the ANN about the updated syntax highlighter.

21:06 ah yes

21:07 Raynes: SyntaxHighlighter != pygments.

21:07 amalloy: github's highlighter is pygments, the python thingy

21:07 brehaut: different ends of the toobs

21:07 devn: got my syntaxhighlighter and pygments mixed up

21:07 *nod* I've used them both

21:07 syntaxhighlighter had some semi-crappy defaults when I last used it

21:07 hopefully that's changed a bit?

21:07 brehaut: devn: oh my yes

21:07 the CSS in particular is pretty hoary on syntax highlighter

21:08 amalloy: devn: https://bitbucket.org/amalloy/pygments-main/changeset/6835410c2c6c#chg_pygments/lexers/agile.py_newline1428

21:08 Raynes: syntaxhighlighter is a big ol' bag o' crap.

21:08 devn: brehaut: yeah, i've been through that

21:08 Raynes: brehaut: Why don't you write a syntax highlighter in Clojure?

21:08 brehaut: 4Clojure (and I) could use that.

21:08 TimMc: in cljs

21:08 devn: didnt licenser do that?

21:08 once upon a time?

21:08 Raynes: Man, not everything has to be in cljs just because it exists.

21:08 devn: Yep.

21:08 Would be something to look at.

21:08 amalloy: Raynes: wait, why would we want one in clojure? 4clojure should just use brehaut's js brush

21:08 licenser: devn: what did I do?

21:08 Raynes: Hasn't been updated or worked in in 10 thousand years.

21:09 devn: licenser: you wrote a syntax highlighter for clojure in clojure

21:09 licenser: yes I did :)(

21:09 devn: :)

21:09 Raynes: amalloy: Because why do we want a JS syntax highlighter?

21:09 licenser: and I am happy to support it if anyone actually wants to use it ;)

21:09 brehaut: licenser: the smart choice

21:10 Raynes: Do you not have enough JS to load or something?

21:10 brehaut: Raynes: in that case, whats 700 more lines?

21:10 Raynes: Indeed.

21:10 amalloy: devn: actually, i got highlighting of ::foo keywords wrong; i should fix that

21:10 devn: amalloy: why do you say it is wrong?

21:10 they stand out.

21:11 licenser: if you want the syntax highlighted in js you probably could use clojurescript to convert it :P

21:11 brehaut: licenser: have you got a link to your highlighter handy?

21:11 devn: no! your syntax highlighter needs to be its own node.js app!

21:11 amalloy: devn: well, the fact that other keywords don't stand out is due to github's js

21:11 licenser: brehaut: https://github.com/Licenser/clj-highlight

21:12 amalloy: er, css

21:12 brehaut: licenser: thanks

21:12 licenser: brehaut: if there is something you need from it you can just drop me a query :)

21:12 brehaut: haha mangler.clj ftw

21:12 amalloy: if you look at the page, you can see that `:foo` is marked as a "name, constant" (class=no), and `foo` is marked as a "name, variable" (class=nv). they only look the same because github's css doesn't distinguish

21:13 brehaut: licenser: sure; im mostly curious to see how you wrote it

21:13 amalloy: the highlighted : at the front of ::foo was not something i intended, i think

21:13 licenser: brehaut: sure sure :)

21:13 Raynes: also for you if you want to use the highlighter for 4clojure feel free to bug me with updates ;)

21:14 devn: brehaut: licenser: haha, mangler.clj indeed

21:14 licenser: what where?

21:14 devn: https://github.com/Licenser/clj-highlight/blob/master/src/clj_highlight/mangler.clj

21:15 licenser: I fail to see the fun in that - probably that is the funny part about it

21:15 brehaut: its a fun name

21:15 devn: oh, i rather liked the code

21:15 :)

21:16 * gfredericks had a good time using clojure.core.match for the first time today

21:16 licenser: ah

21:17 * licenser will get that to run with 1.2.1 tomorrow since there seem actually some semi use for that this days ^^

21:18 brehaut: Raynes: re: why i wrote my brush for syntax highlighter: because clojure isnt the only language i want to highlight on my site, and because i didnt want to write all the dom reading and generating nonsense myself

21:19 Raynes: brehaut: I was responding to amalloy when I said "why do we want a JS highlighter". I think your brush is awesome.

21:19 brehaut: Raynes: initially i was just going to use the existing brush to appease technomancy, and then i discovered that i could improve on it by starting from scratch

21:19 Raynes: ah right. thanks :)

21:19 amalloy: Raynes: we already have a js highlighter

21:20 it would be nice to have a less-crappy one instead

21:20 Raynes: Yes, but why would we choose to use it over a decent Clojure highlighter? We wouldn't have to load SyntaxHighlighter or deal with it.

21:20 I can understand why we wouldn't put effort forth to obtain one, but if one already existed and was up to date...

21:21 amalloy: Raynes: i guess rendering it server-side might be nice. i hadn't really thought of doing it

21:22 it might even be simpler, but it's certainly not easier. with JS, you can just dump it on the page with a "plz render this" note

21:22 Raynes: HEH

21:23 brehaut: just whatever you do, dont use the syntaxhighlighter autoloader if you can help it; that thing seems frighteningly inefficent

21:24 amalloy: i wonder if we're doing that

21:24 chouser: amalloy: looking at your macro patches. tricky problem.

21:26 slyphon: so, i'm messing around with apache zookeeper, and one thing you have to do is write an event dispatcher (where you register functions to be called when a node changes), is that something that would be a good fit w/ agents?

21:26 amalloy: thanks! let me know if i can help with something, chouser

21:26 brehaut: amalloy: you arent; the brush is included explicity

21:26 slyphon: i've done it in other languages w/ a threadpool popping off a queue

21:27 chouser: slyphon: an agent only has its own queue. if you want multiple threads pulling from a single queue, you'd be better off with an actual java concurrent queue.

21:28 slyphon: hmm

21:29 mm'kay

21:29 chouser: agents are primarily a way to manage state. they can be forced into other roles, but tend not to give you the flexibility you'll want.

21:29 * slyphon nods

21:31 slyphon: the zookeeper client delivers events on a separate thread, and in my other wrappers I've taken those events and turned them into hashes, then called any number of user-registered callbacks with the data

21:31 i guess that doesn't sound like a great fit

21:33 also, interop question, how do i get at this interface? http://zookeeper.apache.org/doc/r3.3.3/api/index.html

21:33 d'oh

21:33 nvm

21:33 * slyphon googles

21:34 slyphon: ah yes, the nasty '$' weirdness

21:34 Raynes: chouser: You guys have got to accept his patch, man. If he submits even just one more patch without a resulting Clojure commit, the world is going to implode.

21:35 I don't even care if it's correct.

21:35 slyphon: hahaha

21:35 chouser: amalloy: so, I don't fully understand everything that's going on here, but what should this return?

21:35 (binding [*print-meta* true] (prn ^{:foo :bar} (let [] ^{:bing :bang} [1 2 3]))

21:36 Raynes: he's committing directly to data.xml, for whatever that's worth to the structural stability of the universe.

21:37 Raynes: That only saves Jericho.

21:37 amalloy: chouser: certainly it shouldn't include foo/bar. i'm not sure about bing/bang because i don't know if reader meta on collection "code" turns into meta on the collections at runtime

21:37 i'd guess no meta at all

21:38 &(binding [*print-meta* true] (meta ^{:bing :bang} [1 2 3])) ;; that is, it should print the same as this, whatever that is

21:38 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

21:38 amalloy: ,(binding [*print-meta* true] (meta ^{:bing :bang} [1 2 3]))

21:38 clojurebot: {:bing :bang}

21:38 chouser: why shouldn't foo/bar be on the vector? I'm clearly missing something about the point of this change still, sorry.

21:39 amalloy: chouser: because that's putting meta on the form, for the compiler to use in interop or other scenarios

21:39 not putting meta on the value at runtime

21:40 chouser: Mmm. ok.

21:40 * chouser goes to ponder some more.

21:40 amalloy: sounds good. i'll go get dinner now that i've got you busy

21:40 chouser: :-)

21:41 Raynes: amalloy_: I want dinner.

21:42 amalloy_: Raynes: fyi you're a jerk for sending me an irrelevant highlight while i'm trying to leave

21:42 Raynes: I know.

21:54 srid: wouldn't it be nice if I can filter, process, group, ... irc messages in the REPL? "irc log as data"?

21:55 slyphon: sounds like a database of some sort is in your future

21:58 brehaut: srid: raynes has something for you there.

21:59 srid: irclj

21:59 register functions to receive giant maps of irc data

22:00 duck1123: I learned how to use Sphinx by indexing my wife's irc logs

22:00 slyphon: sounds like you're kind of the jealous type

22:01 srid: right. now I need to find a way to "group" conversation. eg: the one between chouser, amalloy_ and Raynes would be one "group"

22:01 gfredericks: I'd be shocked if I found out my wife had an irc log

22:01 slyphon: hah

22:01 duck1123: I didn't look at any of them, but I taught her how to use grep and was looking for a better way

22:02 slyphon: hah, yeah, it's probably a decent dataset

22:04 ajsharp: so i'm trying to extract day / month info out of Date objects -- is the best way to do this to use java's Calendar object?

22:05 duck1123: jodatime

22:06 there's clj-time on top of that

22:07 ajsharp: duck1123: is jodatime an external package?

22:07 duck1123: yes

22:09 brehaut: clj-time is a popular wrapper around joda

22:11 ajsharp: brehaut: does clj-time work for both dates and times?

22:11 brehaut: i think so

22:11 ajsharp: cool

22:11 brehaut: it makes joda more straight forward anyway, and has coercion functions

22:11 ajsharp: gotcha

22:11 o

22:12 i'm pretty new to clojure, is there a documentation site for third-party projects?

22:12 similar to rdoc.info?

22:20 duck1123: not really. It's pretty scattered at this point. usually the docs are linked from the individual github pages

22:21 when all else fails, there's the source and clojure.repl/doc

22:28 devn: yikes: http://pragprog.com/magazines/2011-07/growing-a-dsl-with-clojure

22:28 there are a lot of errors in there.

22:28 lucian: clojure *needs* to ship with better stack traces

22:28 brehaut: lucian: what counts as better?

22:29 lucian: brehaut: almost anything except what it has now?

22:29 brehaut: lucian: constructive

22:29 devn: lucian: so, i don't disagree, but to play devil's advocate, it has been shipping without great stacktraces for quite awhile and people are using it

22:29 they don't actually bother me :X

22:29 lucian: brehaut: more relevant to your clojure code

22:30 accurate line numbers, less java machinery

22:30 it's just so annoying

22:30 * lucian clj-stacktrace stopped working for some reason for me

22:30 brehaut: ive never encounted the line numbers not being accurate except in the repl

22:30 (and then, they probably are, but they dont map to anything meaningful)(

22:30 devn: ajsharp: a lot of the documentation you'll find is in the code.

22:30 lucian: hmm

22:30 devn: ,(doc +)

22:31 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'"

22:31 lucian: brehaut: you can't argue they're not worse than Pythons, though

22:31 brehaut: lucian: basicly, i dont like people complaining about removing information from the stack traces

22:31 devn: ajsharp: http://clojuredocs.org has some third party projects included

22:31 ajsharp: duck1123: cool, thanks

22:31 devn: so i can run (doc whatever) from the repl?

22:32 devn: ajsharp: yes, you can also run (source whatever), as long as you're (use 'clojure.repl)

22:32 lucian: ajsharp: find-doc is also useful

22:32 brehaut: lucian: pythons are simpler for sure, but python is also simpler; using imperative idioms implies smaller stacks

22:32 devn: ,(ns-refers 'clojure.repl)

22:32 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, unchecked-inc-int #'clojure.core/unchecked-inc-int, ...}

22:32 ajsharp: devn: lucian awesome, thanks

22:32 lucian: brehaut: that's not the source of clojure's problem, though

22:32 devn: ,(source juxt)

22:32 clojurebot: Source not found

22:33 devn: oh right

22:33 lucian: brehaut: even strict JS bas better stack traces

22:33 devn: ,(source interleave)

22:33 clojurebot: Source not found

22:33 devn: ,(source #'clojure.core/interleave)

22:33 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol>

22:33 devn: what am I doing wrong on these?

22:34 why wouldn't clojurebot have that source?

22:34 brehaut: lucian: im not sure what 'better' means

22:34 lucian: &(source +)

22:34 lazybot: java.lang.RuntimeException: Unable to resolve symbol: source in this context

22:34 lucian: ,(source +)

22:34 clojurebot: Source not found

22:34 devn: &(use 'clojure.repl)

22:34 lazybot: ⇒ nil

22:34 devn: &(source +)

22:34 lazybot: ⇒ Source not found nil

22:34 lucian: brehaut: you can find the cause, easily

22:34 devn: must be a sandboxing thing

22:34 lucian: brehaut: it's odd that you're defending a flaw in clojure

22:35 devn: ,(meta #'clojure.core/interleave)

22:35 clojurebot: {:ns #<Namespace clojure.core>, :name interleave, :arglists ([c1 c2] [c1 c2 & colls]), :added "1.0", :static true, ...}

22:35 lucian: even some simple formatting would improve things a lot

22:35 devn: ,(:doc (meta #'clojure.core/interleave))

22:35 clojurebot: "Returns a lazy seq of the first item in each coll, then the second etc."

22:35 brehaut: lucian: im not defending them per se; i just get sick of people ranting about the stack traces by saying blanket, empty statements like 'they suck. language X is better'

22:35 devn: ajsharp: the above is a slightly more verbose way of getting the docstring for a function, but (source +) should work for you as long as you are using (use 'clojure.repl)

22:36 err (doc +)

22:36 lucian: brehaut: i only said "language X's stack traces are better"

22:36 ajsharp: devn: so i just need to use 'clojure.repl in my source file, and i'll get all these doc functions?

22:36 lucian: which they are, for almost any language except C/C++

22:36 devn: ajsharp: one more thing for you...

22:36 &(apropos "take")

22:36 lazybot: ⇒ (take-while take-nth take-last take)

22:37 devn: ajsharp: yes

22:37 ajsharp: note that if you're doing it from the ns macro it will be slightly different (ns myproject.core (:use [clojure.repl]))

22:38 ajsharp: vs (use 'clojure.repl)

22:38 ^-(when you're not in the (ns) macro)

22:38 ajsharp: right

22:38 i'm a little confused what's going on with the ns macro...do i have to use :use b/c ns takes a hashmap of options?

22:39 devn: ajsharp: actually i dont think you have to use :use anymore

22:39 (on 1.3)

22:40 you can use (ns foo.core (use [clojure.repl))

22:41 ajsharp: ah

22:41 i see

22:41 devn: ajsharp: but yes, in the past your statement would have held

22:43 daaku: any moustache users around? i'm wondering how to bind a static path component held in a var and prevent moustache from thinking it's the local name of a bound segment

22:44 devn: daaku: post the code?

22:44 brehaut: daaku: ive used moustache a bit. im not quite sure i understand what you are asking though

22:44 devn: (in a gist if it's long please)

22:44 ajsharp: devn: great, thanks for all your help

22:44 devn: ajsharp: np!

22:45 daaku: something like: (defn- routes [mount] (app ["admin" mount &] my-handler))

22:45 devn: daaku: hm, this is old stuff I have but maybe it will help?

22:46 [#".*\.js" {:get [(file-response "resources/public")]}

22:46 err

22:46 [#".*\.js"] {:get [(file-response "resources/public")]}

22:46 daaku: devn: i'm not sure i follow how that helps

22:47 devn: daaku: you said static path component, i thought "file"

22:48 daaku: ["example" mount] {:get [(fn [req] (my-handler req))]} ???

22:48 lazybot: devn: Yes, 100% for sure.

22:49 daaku: oh, no. moustache is treating "mount" as something it'll bind to. what i'd like is instead to have it use the value of mount as is passed into the function "routes". since (app) is a macro, it seems like i need some way to trigger inlining the value of "mount" instead of passing in the symbol mount. i think

22:50 devn: daaku: so, I suppose I should have asked this first, but what are you trying to do?

22:50 brehaut: daaku: the problem you are encountering is that the syntax already has meaning for a symbol. without getting into form mangling, you would probably have to do something like… ["example" [_ #(when (= % mount) %)]] …

22:51 * devn curses brehaut

22:51 brehaut: (ie using a validator function for evil)

22:51 devn: sorry

22:51 daaku: brehaut: that sounds like my problem and solution :)

22:52 devn: you know, there was a time, it didn't last long, but there was a time, when this channel was not as active, and I could sit here and spin around in my chair and answer questions in a leisurely manner

22:52 those days are over

22:52 brehaut: daaku: its a horrible solution

22:52 daaku: agree it's hacky though, isn't this common?

22:52 brehaut: i dont think so

22:53 personally, id probably write a ring handler for the interstitial step

22:53 devn: that's where i was going next

22:53 brehaut: rather than abuse validators

22:53 devn: sounds like middleware

22:53 brehaut: yeah pretty much

22:53 the only trick is to update the request map so that the inner moustache app gets the correctly abbreviated url

22:53 daaku: it's basically gonna do the same thing, extract out the segment, compare, and return nil or invoke the handler

22:54 amalloy: devn: use vs :use has not changed in 1.3 - it's been that way forever, but :use is preferred

22:54 brehaut: daaku: of course

22:55 micrypt: Anyone know of a clojure riak driver?

22:55 devn: amalloy: crazy, i've been cargo culting for so long, and I skimmed a recent post about ns macro changes (:require :refer...) which said something about naked require/use in the ns macro

22:55 * micrypt found clj-riak

22:55 devn: amalloy: thanks for the info

22:56 amalloy: well, that was my groups post

22:56 devn: is there a good reason why we still err on the side of keywordized use/require

22:56 brehaut: daaku: if you do use the abused validator, push it out into a named function

22:59 * devn forgot how much he loves moustache

22:59 brehaut: devn: rich likes it?

23:00 devn: brehaut: ? "John forgot how much he loved moustache"

23:00 brehaut: i did a /me, not sure where you got the idea I was talking about Rich

23:02 amalloy: devn: <devn> is there a good reason why we still err on the side of keywordized use/require

23:02 devn: amalloy: brehaut: ahhh, sorry, thought you were responding to moustache love

23:05 brehaut: yeah sorry

23:05 (got distracted by a dog ralphing on the floor in the office)

23:05 devn: bahaha

23:09 brehaut: it'd be funny if it werent for the smell

23:09 amalloy: brehaut: and the rest of us can't smell it, so...

23:09 brehaut: amalloy: feel free to laught it up

23:09 s/t //

23:09 gfredericks: Huh. Apparently you can even use strings in the use/require expressions.

23:11 amalloy: gfredericks: it's just calling name

23:11 gfredericks: yeah I figured so.

23:12 I'm gonna start sticking strings everywhere just to see what works

23:12 amalloy: that's pretty funny, though. gives you a little creative license in your namespaces

23:12 gfredericks: the namespace name can't be a string

23:12 amalloy: ("use" some-lib-we-dont-really-need)

23:13 gfredericks: haha

23:14 the ironic :use

23:24 ("require" [clojure.string "as if" i-cared])

23:25 amalloy: ("refer" [clojure.xml :only []]) ;; because xml is a buzzword

23:27 gfredericks: :D

23:27 keith_: is there a way to serialize several versions of a map and take advantage of their shared structure?

23:31 amalloy: keith_: probably if you use java serialization it Just Works

23:32 keith_: oh wow thats brilliant, I didn't even think of that

23:42 devn: hm, a lib using clojure.contrib.pprint is blowing up on missing ^:dynamic annotations

23:43 hiredman: old lib

23:43 devn: what's the right course of action here?

23:43 hiredman: clojure.contrib.pprint has been defunct since 1.2

23:43 devn: (to get it to 1.3)

23:43 hiredman: pprint has been clojure.pprint since 1.2

23:44 devn: *nod* -- but it has 26 of the 38 things clojure.contrib.pprint had

23:44 hiredman: yes

23:44 so the library you are trying to use is dead

23:45 (if it wasn't, you'd assume it would have been fixed sometime in the past year)

23:45 devn: I'm trying to fix it.

23:45 hiredman: so, fork and fix or don't use it

23:45 devn: lol, yes.

23:47 hiredman: i'm asking about fixing errors between old pprint and new pprint

23:49 nvm

23:54 seancorfield: and presumably you're relying on some of those missing 12 things?

23:56 ibdknox_: hm, I must've left my IRC at work on... whoops

Logging service provided by n01se.net