#clojure log - Nov 30 2011

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

0:01 dnolen: ambrosebs: have you tried loading up the compiler and analyzing some forms?

0:01 ambrosebs: Yes, with a REPL

0:01 dnolen: and?

0:02 ambrosebs: I guess the problem is I don't really know where Clojure ends and ClojureScript begins. Can I just jar up the Compiler and add it as a Clojure dep?

0:04 dnolen: I've checked out the AST, and it's perfect for my needs. I just want to use the AST in a prototype type checker from Clojure

0:04 dnolen: not necessarily for Clojure (JVM) code, but just to get a feel for walking/deconstructing the AST

0:09 dnolen: ambrosebs: simplest thing, copy a swank-clojure jar into $CLJS_HOME/lib/dev

0:09 ambrosebs: create a project.clj that looks something like this in $CLJS_HOME, https://gist.github.com/1408092

0:10 ambrosebs: then you can start lein swank as usual, and compile compiler.clj

0:11 ambrosebs: dnolen: ah! that makes sense. Trying..

0:11 devn: dnolen: refresh the gist ;)

0:12 dnolen: ambrosebs: soon as I compiled compiler.clj, I can do nice stuff like (analyze {} '(+ 4 5)) at the REPL

0:12 devn: thx

0:13 ambrosebs: I just realized I can yank out compiler.clj and put it in any leingnen project... right?

0:13 hiredman: man, you should make clojurescript a lein project :)

0:13 devn: i don't see why not ambrosebs

0:14 ambrosebs: LOL that's is all I wanted. That is awesome!

0:14 dnolen: ambrosebs: yeah, I think compiler.clj is all you need :)

0:14 devn: dnolen: what about that require cljs.core in compiler?

0:15 dnolen: devn: oh yeah the compiler macros

0:15 ambrosebs: so I'd need just those two files?

0:16 dnolen: ambrosebs: I think so

0:16 ambrosebs: :D

0:18 devn: dnolen: are you going to clojure/west?

0:18 dnolen: devn: pondering it

0:19 devn: same. a bit more pricey than my typical trip, might need to actually submit a talk this time. :)

0:21 dnolen: hopefully by the time the conference rolls around I'll have built a startup idea generator in core.logic

0:21 dnolen: devn: ha!

0:21 devn: gotta play to those sandhill rd. folks!

0:25 technomancy: amalloy: I was halfway considering doing the base64ing print-method on java.util.Serializables as part of serializable-fn

0:25 but I'm not sure that's where it belongs

0:26 amalloy: nah, i think it's separate

0:27 technomancy: the problem is it's like six lines, so it's just soooo tempting =)

0:27 amalloy: technomancy: what might be more interesting is to use #= to turn your round-trip into pr-str/read-string, without an eval

0:28 seems like it might sorta work?

0:28 devn: glowing endorsement

0:28 amalloy: but i don't know enough about how #= behaves. like, it generally doesn't evaluate its arguments

0:29 technomancy: all I know is if I do that then Rich will use his look of disapproval on me.

0:30 ambrosebs: dnolen: 1001 twitter followers :) nice

0:30 dnolen: ambrosebs: heh, who are all these people?

0:30 devn: dnolen: i've met you. damned fools. I've been trying to tell them.

0:31 ambrosebs: dnolen: must have heard of you somewhere

0:31 amalloy: technomancy: you'd get the same look from me. it'd be one Eye of Disapproval, and one Eye of Awesommmme

0:32 devn: technomancy: think: Adam Sandler "They're all gonna laugh at you!"

0:34 ambrosebs: dnolen: so what happened to fairKanren?

0:34 dnolen: ambrosebs: just didn't work :)

0:34 ambrosebs: :D

0:35 dnolen: I obsessed over it, and had some good results, but it only seemed like it worked.

0:35 I have some other ideas now - but I'm putting it aside for the time being. working on cKanren and core.match.

0:36 * devn does a jig for cKanren

0:36 devn: mind bender, that one (for me anyhow)

0:36 dnolen: cKanren in Clojure will be fun since we have polymorphism … some neat performance tricks we can do I think.

0:36 ambrosebs: dnolen: I've been spending all my time checking out Typed Racket, I'm sure I'll meet you back at core.logic soon :)

0:37 dnolen: ambrosebs: nice! I've always meant to check it out. would be cool to see a blog post from ambrosebs :)

0:38 ambrosebs: dnolen: Implementing a prototype of Typed Clojure with CLJS compiler in Clojure would make an epic blog post xD

0:38 dnolen: seriously

0:39 devn: i've only gotten as far as racket proper -- i'm no ambrosebs

0:39 ambrosebs: devn: LOL, I'm learning racket by browsing the typed racket source code

0:39 some foreign concepts coming from clojure

0:39 devn: ambrosebs: have a decent link handy? docs seem hit or miss w/r/t racket

0:40 ambrosebs: for typed racket?

0:40 devn: *nod*

0:40 ambrosebs: usage or impl?

0:41 devn: either. I haven't looked into it. You'd probably save me 10-15 minutes of hunting if you have some decent docs or links handy

0:41 ambrosebs: checked out the readme? https://github.com/frenchy64/typed-clojure

0:42 that's mostly implementation

0:43 usage: http://docs.racket-lang.org/ts-guide/index.html?q=typed

0:44 devn: oh man, I think I'm watching your project and my chrome suffered a horrible death that killed my tabs

0:45 ambrosebs: devn: :)

0:45 devn: drracket comes with a local copy of the docs which I find useful

0:46 devn: ambrosebs: my experience with racket is damned limited. I'm using drracket but about all I've done is make some ridiculous slideshow stuff :)

0:47 dnolen: CLJS analyzer is pretty neat

0:47 devn: "why yes, I would like 100 smiling blue fish in my repl"

0:51 ambrosebs: devn: the drracket online code analyzer is awesome

0:51 devn: whA?! online code analyzer?

0:51 ambrosebs: devn: use 5.2, click red button on bottom right

0:51 errors as you type

0:51 really, really cool

0:51 so jealous

0:51 dnolen: one day!

0:51 devn: ambrosebs: i really love the way it draws arrows in check syntax

0:51 ambrosebs: supposedly is slightly buggy

0:52 devn: i posted a feature request on clooj

0:52 ambrosebs: devn: yes! that is SO cool that it works with different reader languages

0:52 knowing how diverse they are

0:52 devn: ambrosebs: yes, pretty incredible stuff. racket is a playground. it's fantastic

0:53 +1, Like button, etc.

0:53 ambrosebs: devn: I saw your issue on clooj, I spent a few minutes thinking how to approach it

0:53 not that I know much about the internals of clooj

0:53 devn: ambrosebs: geoffrey's response about it being a scoped search with highlighting...he seems pretty sure about it.

0:54 I don't know better, but that seemed like it might be reductionist

0:55 as in, i would need to be convinced that's all there is to it.

0:55 ambrosebs: devn: right, I didn't post because I didn't have a good enough idea

0:55 devn: it seems go magical, if it's so easy why don't more editors have it?

0:56 i suppose to a lesser degree you could get the same thing by modifying the face of all the words that match the word your point is on in emacs

0:57 i just love the visual of the arrows sort of drawing the path. i'm pretty visual

0:57 ambrosebs: devn: the work I'm going to do with Typed Clojure might be related. At least the inference of local variables

0:57 who knows

0:58 devn: ambrosebs: i didn't get a chance to say much to you other than "nice talk" at the conj, but you guys have been doing awesome work. thanks.

0:59 ambrosebs: devn: thanks!

0:59 devn: and to your point on typed racket providing some clues: definitely looking forward to hearing what you discover there as well

1:00 ambrosebs: devn: choose a cool racket library that Clojure doesn't have, and you can join in too :D

1:00 devn: haha! that's actually not a bad idea!

1:00 G0SUB: ambrosebs: yo!

1:00 devn: that's like a double word score in scrabble

1:00 ambrosebs: hello :)

1:02 devn: yo dawg i herd u liek mudkipz so i put mudkipz in ur mudkipz so u can mudkip while u mudkip

1:03 *swish*

1:05 G0SUB: ambrosebs: is there any type system where I can differentiate between mutable & immutable objects even though they implement the same interfaces?

1:06 devn: I know precious little about scala, but, they don't do that, right?

1:07 i know the interface is damned similar between collection types, but you said "same"

1:07 G0SUB: devn: since you can accidentally pass a mutable object to an Actor in Scala without the compiler warning you, I guess no.

1:07 ambrosebs: G0SUB: I've only really looked at Typed Racket, I'm new to type systems

1:07 G0SUB: typed racket has a type for mutable references

1:08 G0SUB: ambrosebs: I see.

1:08 devn: G0SUB: what is the intended use case for such a type system?

1:08 ambrosebs: and that's about the extent of my knowledge

1:08 G0SUB: devn: to prevent such mistakes from happening.

1:08 amalloy: technomancy: btw, i don't think you support double-round-tripping, because your ::source is (fn ...). in many evaluation contexts if you eval that you'll get back a clojure.core/fn, which isn't printable. any reason not to have the ::source be (serializable.fn/fn ...)?

1:09 G0SUB: ambrosebs: can you give me a link to a ref?

1:09 ambrosebs: looking for docs in the subject.

1:09 devn: G0SUB: http://docs.racket-lang.org/ts-guide/index.html?q=typed

1:09 G0SUB: thanks

1:09 devn: ambrosebs gave me that. thank him. :)

1:10 ambrosebs: I'll try and find something more specific

1:10 amalloy: btw, can someone tell me how to release to clojars with lein? i've generally used cake but i'm putting together a mini-tutorial

1:10 G0SUB: devn: did we meet at the conj this time?

1:10 devn: https://docs.google.com/viewer?a=v&q=cache:pnKPeSXnUNEJ:www.ccs.neu.edu/racket/pubs/icfp10-thf.pdf+typed+racket+mutable&hl=en&gl=us&pid=bl&srcid=ADGEESjSjOciYCwM9WlXGQFlbhCnfvOo6xfbc2QO6RFihNO0aY9e81jQbkERLdo1fF3TBYCGsE79NHGN9vMKFvIqHhDQcxqxEPIqoe0NHi32Rg3Dp4-76lSk-Xm2kNpGjBaa4-UXurM1&sig=AHIEtbQLLZmNlnI3DBZEiUMtolF-n2hNnQ&pli=1

1:10 yuck. sorry.

1:11 http://bit.ly/sAWbin

1:11 "Logical Types for Untyped Languages*"

1:11 G0SUB: yeah

1:11 looking

1:12 ambrosebs: G0SUB: yes, that's the paper I was going to look for.

1:13 G0SUB: If you want some examples from the source I'm sure I could help

1:13 devn: http://whiley.org/2011/06/03/what-a-racket/

1:13 ^-not a bad overview based on a brief skim

1:14 G0SUB: ambrosebs: nothing specific, looking for some ideas. thank you!

1:14 devn: when the expression (and (number? x) (> x 100)) is true, the type system should know that x is a number, but x might or might not be a number when the expression is false, since it might be 97 or "Hello"

1:14 ^-quote from the above link

1:14 that's cool. "occurrence typing"

1:16 Another one that looks like fun: http://www.ccs.neu.edu/racket/pubs/sfp10-kth.pdf

1:57 jacortinas: are there any real world use cases of Avout, or something like Avout within the Clojure community?

2:04 devn: jacortinas: it was just released today

2:04 amalloy: i think anything that someone's had time to put together can't possibly be real-wolr

2:04 ugh, world. so bad at typing today

2:05 jacortinas: I know that it was just released, but I would like to think that most libraries are built for a purpose, a purpose that exists before the libraries inception.

2:06 devn: jacortinas: give it 5 days.

2:06 jacortinas: Can someone see this replacing anything they already use in their everyday work? Such as zmq or rabbitmq

2:39 scode: I am probably being dense. How do I zip two vectors together? I want to do:

2:39 I mean without implementing the zipping, I'm assuming there is a library function somewhere

2:40 (for [[thing other-thing] (zipvec [vector fo things] [vector of other things])) ... )

2:40 clojure.zip/vector-zip seems to do something entirely different

2:42 I can use zipmap and destructure it, but that's a bit indirect

2:42 alexbaranosky: scode: (map vector [vec1 vec2 vec3 etc]) ??

2:42 lazybot: alexbaranosky: Uh, no. Why would you even ask?

2:42 alexbaranosky: scode, well I zipped 3 vectors

2:43 scode, (map vector [1 2 3] [4 5 6]) ;; that's better

2:43 scode: alexbaranosky: Thanks :)

2:44 alexbaranosky: thus: (def zip (partial apply vector))

2:44 scode: I was being dense after all...

2:44 alexbaranosky: thus: (def zip (partial apply map vector))

2:44 soemthing like that, its late and no repl

2:46 scode: alexbaranosky: Thanks again :)

2:47 G0SUB: Avout shows how simplicity, power & focus can kick a$$ in the real world.

2:50 mytrile: Hey, guys. Anyone tried avout ? I've got this when trying to load 'avout.core https://gist.github.com/51383bd538821881e5fc

2:51 I don't know how and where to configure log4j

2:51 jacortinas: mytrile: I tried it from a repl

2:51 got the same error, but no exception

2:52 mytrile: jacortinas: The warning disappeared when I switch to clojure 1.3.0

2:52 jacortinas: so the easiest use case I can think of is shared configuration across multiple systems

2:53 mytrile: I'm on 1.3.0

2:53 I think it might just be the first time it's used

2:53 mytrile: cool

2:53 jacortinas: a < 1mb config map

2:54 alexbaranosky: man, people are making some badass stuff w Clojurethese days

2:56 jacortinas: could this feasibly be used for a message queue?

2:56 avout being "this"*

2:56 I'm trying to think of a fun example to write, something compelling

3:02 G0SUB: jacortinas: a distributed caching system with DB backed persistence.

3:03 jacortinas: G0SUB: zookeeper is persistent?

3:03 I don't know too much about it

3:04 maybe implementing Avout on redis would be a good idea actually

3:04 pyr: jacortinas: yep, but in the case of avout, persistence is achievied by going to a DB

3:04 G0SUB: jacortinas: not necessarily, but avout refs/atoms can be "backed" by a persistent store.

3:05 pyr: zk is only used for locking

3:05 which is what it's meant for

3:05 jacortinas: I see

3:05 G0SUB: jacortinas: a redis backend will be trivial to write.

3:05 jacortinas: yup

3:05 G0SUB: jacortinas: take a look at the mongo example.

3:06 jacortinas: G0SUB: yeah I'm seeing that, it's very interesting

3:06 G0SUB: protocols FTW!

3:09 jacortinas: the distributed locks provided by Avout could have been their own library release

3:09 amalloy: ~zip

3:09 clojurebot: zip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))

3:10 amalloy: fwiw, scode, this question is so common clojurebot can answer it

3:12 jacortinas: ,(map list '(1 2 3) '(a b c))

3:12 clojurebot: ((1 a) (2 b) (3 c))

3:12 jacortinas: ,(map list '(1 2 3) '(a b c) '(z y x))

3:12 clojurebot: ((1 a z) (2 b y) (3 c x))

3:13 jacortinas: ,(map str '(1 2 3) '(a b c) '(z y x))

3:13 clojurebot: ("1az" "2by" "3cx")

3:15 robbe-: ,(map #(map list %) '((1 2 3) (a b c) (z y x)))

3:15 clojurebot: (((1) (2) (3)) ((a) (b) (c)) ((z) (y) (x)))

3:15 robbe-: hm .. of course

3:16 ,(map #(map list %) '(((1 2 3) (a b c) (z y x))))

3:16 clojurebot: ((((1 2 3)) ((a b c)) ((z y x))))

3:17 jacortinas: lists all the way down

3:34 sunng: I like the idea behind avout. It could be a clojure abstraction to all centralized data management solution.

3:35 Maybe someday, our clojurians don't have know about mongodb/redis/mysql, we just (dosync!!) and (alter!!).

4:02 Bahman: Hi all!

4:06 Is is possible to mass :import java classes? Like javax.swing.* ?

4:07 clgv: Bahman: not with standard clojure - maybe someone wrote a custom 'ns or 'import, yet?

4:07 Bahman: Thanks clgv.

4:07 Does anyone know a good and almost comprehensive tutorial for Swing?

4:08 clgv: the one from sun/oracle: http://docs.oracle.com/javase/tutorial/uiswing/

4:09 Bahman: I'd seen that but since normally Sun/Oracle is not good at documentation I forgot about it.

4:09 Thanks again.

4:10 clgv: it's a start.

4:10 I usually fell back to it for a quick overview before googling specifics...

4:33 tolstoy: When I have an agent and set :handler-fn and also :error-mode :continue, how come the handler-fn never gets invoked on an error?

4:33 The docs seem to imply that handler-fn will be called regardless.

4:44 Ah. I'm using :handler-fn rather than :error-handler. Duoup!

4:50 lucian: heh, Crockford uses explicit recur in javascript for memoization

4:50 http://www.youtube.com/watch?NR=1&v=ya4UHuXNygM

4:51 he doesn't mention it, but it's constant space as well

5:09 olambo: Hi 320 Clojure people

5:29 clgv: why does java -jar -cp lib/clojure-1.2.1.jar MyJar.jar give me a "Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn"?

5:30 raek: clgv: you shouldn't have -jar in there

5:30 clgv: huh?

5:31 raek: java -cp lib/clojure-1.2.1.jar MyJar.jar clojure.main

5:31 clgv: but I want to start the main method of MyJar.jar

5:31 raek: you cannot use -jar and -cp at the same time, unfortunately

5:32 if -jar is used, -cp is silently ignored

5:32 clgv: have you looked at lein uberjar?

5:32 clgv: raek: yeah, for testing I wanted to run the jar standalone

5:33 raek: anyway, "-jar -cp" tells java to use the jar file called "-cp"

5:33 clgv: that works now: jar -cp ... Main

5:34 ups again: java -cp lib/clojure-1.2.1.jar:MyJar.jar Main

5:35 raek: oops, seems like -jar does not take the following word as its argument, but the first non-option argument

5:35 clgv: yep

5:36 raek: so your syntax makes perfect sense, but java's interpretation of it does not... :-)

5:37 clgv: humm, I am still struggling with the question "how to determine if my code is running in a jar or not?" - I need it since the "recursive" search for config files has to have a different implementation when run in a jar

5:38 notostraca: I have compiled a clojure file to several .class files using (compile), but now I don't know the correct way to put them into a jar for use from a java project

5:38 clgv: these or not "normal" configs more like persistent setups that are included in the jar

5:38 s/or/are/

5:39 notostraca: I am using Maven, although I am very unfamiliar with the tool

5:39 clgv: notostraca: use "lein jar"

5:39 notostraca: clgv, so... create a lein project?

5:39 clgv: yes

5:39 raek: why does the search for config files has to have different implementations?

5:40 clgv: raek: you cant use file abstraction for it in the jar

5:40 raek: I guess thats due to that there are no real folders in it

5:40 notostraca: ok, I am even less familiar with lein. how should I create a new project inside the existing Eclipse project?

5:41 raek: ah, so your use case is more complex than just "open a file on the classpath"?

5:41 clgv: raek: yes. it is "find files in a subdirectory". brb

5:46 notostraca: woah, leiningen is not working at all, weird

5:47 I get an NPE double-clicking the standalone jar , and running with java -jar

5:48 oh, and when I run the .bat, "wget: unrecognized option `--no-check-certificate'"

5:50 vijaykiran: Hello all .. noob question here : is there a better way to do this https://gist.github.com/1408604 ?

5:54 Wild_Cat: vijaykiran: if I were you, I'd make two separate functions: one that calculates the average of any number of numbers (supplied as a vector), and one that asks the user to input their numbers

5:54 samaaron: Wild_Cat: I was going to say exactly the same thing :-)

5:55 vijaykiran: :) thanks guys. I was just trying to "translate" examples from "How to solve it LISP" using clojure - one-to-one..

5:55 Agree that the function is indeed doing two things :)

5:56 Wild_Cat: plus, it makes the program easier to test because the "average" function is stateless, and the stateful one is smaller.

5:57 Fossi: and then the loop/recur won't make much sense

5:57 at least i wouldn't code entering n numbers that way

5:57 vijaykiran: is there a simpler way of reading numbers from "command line" ?

6:00 raek: vijaykiran: clojure does not come with many functions for that, but you could use (read)

6:00 notostraca: vijaykiran, Scanner?

6:01 raek: then the numbers will be read using the clojure reader

6:02 vijaykiran: you can also use the various Java classes (eg. Scanner, as notostraca suggested)

6:03 vijaykiran: when you test code by hand it's more common to do it in the repl

6:04 notostraca: has anyone encountered the issues I described with leiningen? technomancy_, are you available if it isn't too much trouble?

6:04 raek: say your average function takes a sequence of number and returns a number. then you can just invoke it like (average [1 2 3]) in the repl

6:05 you get reading and printing of value for free from the REPL

6:06 notostraca: did you execute the lein script? I don't think you're supposed to run the jar.

6:06 notostraca: lein.bat self-install

6:06 wget: unrecognized option `--no-check-certificate'

6:07 and I can run wget, and that is not an option

6:07 raek: notostraca: ok. my guess is that you have an old version of wget installed.

6:07 notostraca: I just installed it with the GNUWin32 installer, could be a path thing

6:07 pyr: found myself writing deep-merge

6:08 with a recursive merge-with

6:08 i was a bit surprised it didn't exist elsewhere

6:08 did i miss it or does it just not exist ?

6:08 (there used to be a deep merge with in contrib but it's gone and didn't solve the easiest case)

6:15 clgv: raek: so, do you have an idea to determine if the code is running within a jar?

6:16 notostraca: raek, hey, it works. path didn't update when I installed wget

6:16 now lein is self-installing, thanks

6:16 raek++

6:21 clgv: $inc raek

6:21 lazybot: ⇒ 12

6:21 clgv: ;)

6:22 ejackson: (inc lazybot)

6:22 lazybot: ⇒ 1

6:22 clgv: (dec ejackson)

6:22 lazybot: ⇒ -1

6:23 clgv: uuh that works as well

6:23 ejackson: no then.... what's all this about

6:23 clgv: (inc 1)

6:23 lazybot: ⇒ 3

6:23 clgv: muhaha

6:23 ejackson: (inc ejackson)

6:23 lazybot: You can't adjust your own karma.

6:23 ejackson: bah !

6:24 it was worth a try

6:24 clgv: ,(println "(inc clgv)")

6:24 clojurebot: (inc clgv)

6:24 lazybot: ⇒ 1

6:24 clgv: ;)

6:24 ejackson: nice one

6:25 clgv: (+ 1 1)

6:25 clojurebot: 2

6:25 clgv: hmm interesting to see when which bot answers^^

6:29 G0SUB: ejackson: yo!

6:29 ejackson: howy

6:29 howdy

6:29 G0SUB: ejackson: BG here (in case you didn't know)

6:29 ejackson: !!!!!

6:29 G0SUB: ejackson: how's life?

6:29 ejackson: I did not

6:29 life is cracking !

6:30 how about yours

6:30 G0SUB: ejackson: good :-) Did you see Avout?

6:30 ejackson: oh yeah, its stunning

6:30 if it lives up to my expectations we've got a crazy weapon in our hands

6:31 G0SUB: I remember David telling me about it at the Conj. Didn't expect it to be production ready, but it is!

6:31 ejackson: looks good to me. I am going to play with it today.

6:32 samaaron: I'm interested to know how it interacts with zookeeper

6:33 G0SUB: it seems zookeeper provides all the coordination mechanism for avout. especially in the form of distributed locks.

6:33 samaaron: G0SUB: so the two are therefore inseparable?

6:33 clgv: I am still wondering if there is any *pure java* lib for doing the distributed job dispatch

6:33 G0SUB: samaaron: indeed, yes.

6:34 samaaron: G0SUB: is zk a jar?

6:34 G0SUB: samaaron: yes, just a simple jar, but it has start/stop scripts, etc.

6:35 samaaron: ZK is inherently distributed. you can have 5K clojure nodes and 100 ZK nodes all playing together :-)

6:35 samaaron: G0SUB: so the start/stop scripts are separate ways of firing up a zk server, but i'm asuming that there is also a java api for firing up servers

6:35 G0SUB: samaaron: possibly, but I haven't explored those possibilities.

6:36 samaaron: however, single node, embedded ZK is not the usual use-case.

6:36 samaaron: ZK is a distributed orchestrator, it's designed to be run separately from your app.

6:37 samaaron: ah ok

6:37 i like the idea of a distributed orchestra better though

6:37 ;-)

6:37 G0SUB: :-)

6:38 samaaron: G0SUB: how's india today?

6:38 G0SUB: samaaron: sunny right now.

6:38 samaaron: super :-)

6:38 G0SUB: :-)

6:39 Good day for Clojure. Not so much for Scala unfortunately.

6:40 samaaron: yeah, i'm reading Coda's email right now

6:40 G0SUB: samaaron: read it. it's interesting.

6:41 samaaron: "comic buffoonery"

6:41 "The first guy and the second guy seem to hate each other"

6:44 G0SUB: cemerick

6:45 ejackson: CEMERICK !

6:45 samaaron: CEMERICK!!!!

6:46 darq: hello. has someone experience putting maps into a tree (using zippers)... similar to a family tree ... the map holds the keys and values and can have children (a map)...

6:50 G0SUB: holy sh!t. Avout works!

6:50 samaaron: G0SUB: you're surprised?

6:51 G0SUB: samaaron: elated, actually.

6:51 ejackson: can you share your use case ?

6:51 samaaron: are you going to do a BeeGee jig about the room?

6:52 "staying alive"

6:52 G0SUB: building a PoC distributed caching system on top of avout.

6:52 ejackson: PoC ?

6:52 Principles of Clojure

6:52 G0SUB: Proof of Concept

6:53 ejackson: aaah

6:53 G0SUB: imagine extending clache/unk to use avout which in turn persists the cache in Redis.

6:53 clgv: "but at some point a best practice emerged: ignore the community entirely." :O

6:53 ejackson: i'm smelling killer app

6:53 G0SUB: :-)

6:54 I am setting up a few nodes in the office for some testing.

6:56 it's amazing how Clojure's design principles lend themselves to such elegant solutions to incredibly complex problems.

6:56 it almost feels like cheating.

6:57 samaaron: G0SUB: i know how that feels

6:57 G0SUB: yeah

6:58 samaaron: one thing that interested me about the ant-scala email was the focus on optimising code

6:58 you rarely see that being used as an argument against clojure

6:58 i wonder if that's because we're tryign to solve tricky problems rather than trying to replace stuff which works well in Java already?

7:00 G0SUB: samaaron: I for one, don't understand how a statically typed language like Scala can need InvokeDynamic.

7:00 I feel they are doing something too clever, whereas Clojure sidesteps such needs entirely.

7:00 samaaron: or why a statically typed langauge needs to rely on conventions to avoid library collision issues

7:01 G0SUB: Scala, FWIW has a turing complete type system.

7:01 or so they say.

7:01 samaaron: G0SUB: yes, exactly - I see this kind of thing in the labs all the time - people focussing on efficiency far too easily and in my opinion needlessly

7:02 using an On^3 algorithm is *find* for small values of n

7:02 s/find/fine/

7:02 hiredman: right, but some people have big ns

7:02 G0SUB: samaaron: I don't think it's just algorithmic. Scala is trying to marry Haskell & Java semantics. imagine that!

7:02 hiredman: a lot of people these days actually

7:02 samaaron: hiredman: sure, so then you worry about it

7:03 but worryign about it all the time for everything seems non-sensical to me

7:04 and probably contributes to super complicated codebases

7:04 cemerick: eh, usually the simplest things are the fastest

7:04 samaaron: also, I remember having a chat with Joe Armstrong about this matter

7:04 he said one of the core Erlang contributors wrote a super fast XML parser using all his knowledge of Erlang internals

7:04 tricks and special moves everywhichway

7:05 it was pretty fast

7:05 the next year, he wrote a different XML parser

7:05 this time he focussed on making the code readable and simple - purely with the intention of making something people could learn from

7:05 it turned out to be more effecient

7:05 efficient

7:06 fasterer

7:06 so there's a super smart, crazy knowledgeable hacker using a language he has deep knowledge about - and still surprising himself about efficiency

7:07 notostraca: ok, I have lein working, but I want to rename core.clj

7:07 and it can't find utils.clj when I rename it and the namespace

7:07 *when I rename the file

7:07 samaaron: notostraca: what can't find utils.clj?

7:07 notostraca: lein compile

7:08 samaaron: notostraca: ah ok, i've never needed that so i'm unlikely to be able to help :-)

7:08 notostraca: I have :aot set to vc.utils , which is the ns declared in utils.clj

7:09 clgv: notostraca: like in java your namespaces have to reflect the path to the file. so vc.utils has to be in vs/utils.clj

7:09 notostraca: it is

7:10 clgv: no typo?

7:10 notostraca: if project.clj is in vc/ , utils.clj is in vc/src/vc/utils.clj

7:10 algal: possibly a dumb question, in clojure 1.3 what's the canonical way to check if one string contains another? I notice "substring?" was in contrib and it doesn't live in clojure.string.

7:11 clgv: notostraca: sounds fine

7:11 notostraca: lein compile throws a file not found exception

7:12 Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundExcep

7:12 tion: Could not locate vc/utils__init.class or vc/utils.clj on classpath:

7:12 does it need to look in src?

7:12 AWizzArd|work: OMG, what a troll: http://scottlocklin.wordpress.com/2011/11/30/only-fast-languages-are-interesting/

7:12 notostraca: and how would I set it to look in there?

7:13 hey, it works

7:13 I had set :source-path "src/vc"

7:13 which apparently screwed it up

7:14 clgv: notostraca: yeah. skip it (default is "src") or set it to "src"

7:14 notostraca: ah

7:14 well, it works

7:14 now to call it from java

7:25 OK, now it doesn't seem to export any class

7:25 do I need an init function?

7:27 raek: notostraca: you need to add something like :aot [your-ns] to tell Leiningen to emit class files for that namespace

7:27 notostraca: yes, I have that

7:28 but "lein jar" generated something weird

7:28 raek: ok. then you need a :gen-class in the ns form of that namespace

7:28 notostraca: it has, for example, a vc.lib package in the jar

7:28 yes

7:28 I have thar

7:28 *that

7:30 http://pastebin.com/5F4heU6b

7:31 I am prefixing my function names with -

7:31 I don't quite know what that does

7:33 I am just typing "lein jar" -- do I need an argument?

7:33 raek: notostraca: check the documentation for 'gen-class'. you need to list each method you want to have in the generated class

7:33 notostraca: oh?

7:34 raek: notostraca: also, nesting def forms probably don't do what you think

7:34 use 'let'

7:34 clgv: raek: the "-" prefix should work afair

7:34 notostraca: http://clojure.org/compilation doesn't seem to be a problem?

7:34 yeah that's why I used -

7:34 raek: def mutates *global variables*

7:35 notostraca: I will refactor once I have something working

7:35 clgv: notostraca: looking at your code you should definitely take the time to read some introductory material ;)

7:35 notostraca: and I should use "defn -read-obj" instead of "defn- read-obj" right?

7:36 clgv, yeah I was going off of memory

7:36 raek: notostraca: if you just need an object that a java program can interact with (and not a named class), it is probably easier to just write an interface in java and then implement it with proxy

7:36 notostraca: I learned a bit of clojure a long time ago

7:36 raek: defn- means private defn

7:36 the - prefix is the default prefix of gen-class

7:36 notostraca: raek, I think I need a named class

7:37 raek: http://clojuredocs.org/clojure_core/clojure.core/gen-class

7:38 sorry, you don't need to list all methods. that's what the prefix is for.

7:39 notostraca: your file should generate a class called "vc.utils" with the methods load_tsv, read_obj and write_obj

7:40 don't forget the this parameter

7:40 notostraca: which parameter?

7:40 :name ?

7:40 raek: if a method is not static, it will take an additional argument corresponding to "this" in java

7:41 notostraca: ah

7:41 ok

7:42 raek: I'm not sure what happens when a method is not listed in :methods and does not appear in an interface the class implements

7:42 maybe it is not included

7:43 a simple call to "javap" with the generated class file should answer the question

7:46 notostraca: huh

7:47 the file it generates only has a method static {} and a constructor, plus some auto-generated stuff like a hashCode() and equals()

7:47 (from javap TSVReader)

7:49 raek: try :methods [^{:static true} [load-tsv [string] Object]] ...]

7:50 the clojure compiler needs to know the type signatures of the methods, so it makes sense that only inherited and explicitly declared methods are included

7:52 * clgv learned more on :gen-class now :)

7:53 notostraca: ah OK

7:53 they should be typed now

7:54 huh, compiling I get: Not a valid method name: load-tsv

7:54 raek: also I'm not sure how thne hyphens in the method names end up

7:54 maybe they are translated to underscores

7:54 notostraca: well how do I rename them?

7:54 raek: heh

7:55 clgv: raek: I solved the "running in jar" issue by examining the property "sun.java.command"

7:55 raek: I think you have to name the function loadTsv instead...

7:55 I'm not aware of any renaming mechanism in gen-class

7:55 notostraca: raek, syntax for that?

7:55 or do I rename the actual methods?

7:56 raek: notostraca: i.e. write (:gen-class :methods [^{:static true} [loadTsv ...] ...]) and (defn loadTsv ...)

7:56 notostraca: ah OK

7:57 raek: it looks like the clojure compiler receives the name directly as it is, which means that you cannot use hyphens since those are not allowed by the JVM

7:57 (but they are ok in the prefix)

8:09 notostraca: raek, it only seems to generate the first function in the file

8:10 or rather, in the list

8:11 http://pastebin.com/ftnQ5r5E I am sure I have some syntax wrong somewhere

8:13 raek: notostraca: yes. there should be one vector for each method, and each one needs the :static metadata

8:13 cemerick: OT: is there an equivalent to with-open in ruby?

8:13 raek: notostraca: :methods [^{:static true} [loadTSV ...] ^{:static true} [readObj ...] ^{:static true} [writeObj ...]]

8:13 notostraca: got it

8:14 hiredman: cemerick: a lot of things take blocks for iterariting

8:14 notostraca: thanks raek

8:15 cemerick: hiredman: oh, open a file for reading, pass it a proc or something, and it manages itself after the proc has consumed its lines, etc?

8:15 hiredman: IO.readlines

8:15 broadly

8:18 francisl: Hi guys!

8:18 I'm starting with clojure and I want to create a jetty context handler, is gen-class the way to go?

8:21 notostraca: raek, if I want to have the functions return Java collections instead of just Objects, how would I do that? I actually can't be certain of the types of the values in the map...

8:21 pyr: francisl: if you want to handle http queries with clojure

8:21 francisl: use ring

8:22 francisl: (or anything built on top of ring)

8:22 fdaoud: love ring & friends

8:22 notostraca: eh, I will puzzle this out later, it is 5:13 AM here

8:22 now for the sleeping times

8:23 francisl: ok, I already made a prototype with scala and jetty, so I tried to follow the same path

8:23 fdaoud: shee, notostraca you're going to bed 45 mins before I wake up..

8:23 ejackson: fdaoud: you're sleeptyping ?

8:23 notostraca: hahaha

8:23 fdaoud: lol

8:23 francisl: thank you, I'll take a look at ring

8:24 fdaoud: ejackson: yes, I just hope I save whatever I write, my best work is done by my subconcious

8:51 jweiss: amalloy_: saw you did more commits on serializable.fn last night, tried it this morning, looks better! thanks. It works fine w clojure 1.3, just had to change ^Writer to ^java.io.Writer. maybe the project.clj shouldn't depend on 1.2.1 (that would pull it into any project that uses serializable.fn, right)?

9:48 paulK_: hello, I have a question concerning type hinting of anonymous functions

9:48 Raynes: jweiss: No.

9:48 jweiss: Whatever version that your project depends on wins.

9:49 jweiss: Raynes: ah good

9:49 paulK_: Can I pass a type hinted (primitives) anonymous to another function and call the type-hinted version?

9:51 ejackson: I’d rather suck a dog’s nose dry than lend a hand to the nerd slapfights on Hacker News

9:51 LOL

9:51 http://codahale.com/the-rest-of-the-story/

9:51 cemerick: It seems to have gotten rather slapfightesque.

9:52 ckirkendall`: word of the day slapfightesque

9:52 cemerick: "of, or pertaining to a slapfight"

9:53 hiredman: yesterday's was idioglossi

9:53 ejackson: and tomorrow; idioglossesque

9:54 pareidolia: Hi all ! Can anyone hint me with Noir/Ring ? Or point me to another channel? I would like to let the wrap-multipart-params middleware use a byte-array-store. But just adding the function doesn't work, I need to replace the old one (I think). Thanks!

10:07 fdaoud: ejackson: that was quite interesting, thanks

10:08 "The essence of it is that the friction and complexity that comes with using Scala instead of Java isn't offset by enough productivity benefit or reduction of maintenance burden for it to make sense as our default language."

10:09 lucian: i was just disgusted by the syntax

10:10 fdaoud: lucian: +1

10:10 lucian: and then scared a little by the overly complex type system

10:10 fdaoud: and it's all at the other end of the spectrum with clojure

10:10 Wild_Cat: what little I saw of Scala made Haskell's type system look trivial.

10:10 lucian: they had the chance to at at least do Ruby-like syntax, or even better, Python-like

10:10 fdaoud: very little syntax, very consistent, few types, lots of functions to get things done

10:11 lucian: Wild_Cat: it's not trivial, just less complex (because it works around nothing)

10:12 lnostdal: is there some verbose mode or something for lein? .. lein deps is taking ages, and i have no idea why

10:13 Wild_Cat: lucian: well, I remember reading a blog post by... I think it was Steve Yegge, that mentioned Scala's type system had something called "complexity complexity<T>"

10:14 at that point, I really felt like it was a parody of a type system.

10:14 lucian: Wild_Cat: yeah, it's pretty terrible

10:14 Chousuke: Haskell's type system is interesting, but it gets more interesting once you read all the papers about possible extensions to it

10:15 TimMc: ejackson: Wow, small internet. Two clicks from that article and I see the name of a friend of a friend from a non-programming context.

10:15 Chousuke: eg. that one about typed kinds and whatnot :P

10:15 lucian: Chousuke: the main plus is that it's not 1) useless (like java's) or 2) insane (like Scala's)

10:15 Chousuke: yeah. It has its limitations though

10:15 ejackson: TimMc: weird.

10:16 Chousuke: lucian: To be honest though, Scala's type system is only made insane by its requirement to be JVM-compatible.

10:16 Wild_Cat: Haskell's type system looks really badass, but I feel the rest of the language and its ecosystem suffer from a distinct lack of pragmaticism

10:16 (see: docs where they dedicate 10 pages to proving stuff about their lib, but don't even give you a 1-line "how to use it")

10:17 Chousuke: Wild_Cat: That may just be because Haskell is the favourite of most programming language researchers

10:17 cemerick: ~scala

10:17 clojurebot: {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}

10:17 OlegYch: steve yegge is a comedian

10:17 Wild_Cat: Chousuke: likely. If anything, I agree with the statement that before designing a new language, one should look at Haskell, because that's where the new cutting-edge stuff happens

10:17 Chousuke: Wild_Cat: A lot of the research subjects have surprisingly real applications though. It's just hard to see.

10:18 functional reactive programming seems really interesting for example.

10:18 fdaoud: I love clojure

10:18 TimMc: ejackson: Also, I don't think I needed the mental image of sucking on a dog's nose this early in the morning. :-(

10:18 fdaoud: to those who are afraid of parens, amit does a neat trick in clojure in action book where he turns xml into scheme

10:18 Wild_Cat: Chousuke: yeah, for network programming, right?

10:18 Chousuke: Wild_Cat: UIs

10:18 Wild_Cat: UIs?

10:18 interesting.

10:18 cemerick: TimMc: there are a *lot* of other metaphors he could have gone with :-P

10:18 ejackson: TimMc: It was rather creative....

10:18 Chousuke: Wild_Cat: but it seems usable for anything with non-pure interactions.

10:19 Not that I understand it very well yet.

10:19 I'm not well versed in haskell at all, just a casual observer

10:20 Wild_Cat: I'm deferring attempting to learn Haskell again until I've become proficient in Clojure

10:20 Chousuke: One big problem for functional languages nowadays is that they're pretty bad at frontend stuff... user interaction.

10:20 Wild_Cat: yeah... That's a problem with purity: UIs and i18n are anything but.

10:20 Chousuke: since most UI paradigms are completely at odds with functional programming

10:21 gtrak: isn't it kinda hard to run out of things to learn in lisp?

10:21 Chousuke: Wild_Cat: That's not really the problem. You can describe an UI and its interconnections perfectly in a declarative manner.

10:21 Wild_Cat: Chousuke: yeah, but i18n, for example, requires runtime decisions and I/O.

10:22 Chousuke: Wild_Cat: think eg. interface builder generating XIBs

10:22 Wild_Cat: that's not really an issue for functional programming. You can do IO using monads and you can in principle write a declarative description of how the UI reacts to varying input lengths

10:23 Wild_Cat: the main thing is that most UI toolkits just assume you have, and can't avoid, shared mutable state everywhere in your UI

10:23 Wild_Cat: Chousuke: actually, I'm thinking of the simpler stuff: the static strings you have in your UIs -- those can be described declaratively, but which string to display is a runtime decision based on a config variable

10:23 yeah, that too.

10:24 Chousuke: Wild_Cat: in the UI description you can use a that config variable. The UI rendering engine can then do the IO

10:24 hiredman: I've been sort of fiddling around with rules engines, and uis seem like the killer feature for them

10:25 or I should say, plumbing uis together with the rest of the code

10:25 Chousuke: Wild_Cat: the rendering of UIs will always be a side-effect (obviously). The formation of the UI doesn't have to be.

10:25 fdaoud: hiredman: which rules engines did you try out?

10:25 Chousuke: it's similar to how the IO monad works

10:25 an IO monad value is just a description of the IO that is performed. it's a pure, non-side-effecty value.

10:25 hiredman: fdaoud: :) I haven't actually got that far, reading and looking through drools code to see if I can get it to let me write rules in clojure

10:25 Chousuke: and as such, perfectly composable

10:26 gtrak: hiredman, core.logic?

10:26 Chousuke: the side-effect happens when you do the run, but that's the point where you know you're exiting the pure functional world :)

10:26 hiredman: gtrak: no, I don't want to implement a rules engine

10:27 gtrak: i mean, i thought we already had one, wondering if you've looked at it

10:28 hiredman: core.logic has the pieces you could use to implement one, I think

10:28 gtrak: ah ok

10:30 fdaoud: for ui programming, couldn't you use clojure's state mgt facilities to use a simple event-based/pub-sub system to update the ui?

10:31 Chousuke: fdaoud: that only handles one part of the issue.

10:31 hiredman: uis tend to result in a lot of complex conditionals throughout the code

10:31 Chousuke: fdaoud: you still need to work with UI toolkits designed for OO programming

10:31 fdaoud: right, right

10:31 Chousuke: and it's ugly. you don't get fully composable UIs

10:32 fdaoud: if (admin) { showDeleteUserButton() } and so on

10:32 gtrak: ah, that would be awesome with a rules engine

10:32 fdaoud: at some point you'll need some glue code to your ui toolkit, I guess

10:32 hiredman: I think straight up clojure code is pretty nice for creating uis, it's the logic of the interactions that is a pain

10:32 Chousuke: there was this cool haskell paper that was about a declarative UI API, it allowed you to do things like write an UI, then transform it with a "mirror" function, and then render the UIs side-by-side

10:33 and they'd update in sync, and respond correctly to user input

10:33 except the other half was mirrored, while the other wasn't.

10:33 how easy is that to do with eg. Qt?

10:33 gtrak: you could do it if the ui descriptions were a layer separate from the rendering, like a MVVM

10:34 Chousuke: yeah, the description part is key. If you're working with descriptions, it's perfect for functional programming.

10:35 since descriptions can be transformed and copied and in general treated as immutable as values without affecting other descriptions

10:35 gtrak: declarative views, and a data binding glue

10:37 hiredman: is oop a bad thing for guis?

10:37 Chousuke: probably not.

10:37 I tend to think inheritance is though.

10:37 gtrak: you guys ever used Mate framework on flex?

10:37 hiredman: sure, the bad bits of oop are bad everywhere :)

10:38 gtrak: http://mate.asfusion.com/assets/content/diagrams/two_way_view_injection.png

10:40 fdaoud: say, what is the best way in clojure to have a queue of "things to be done"? on one end, A puts in a request to "do something" (like insert a record into a database), returns immediately, and on the other end, B takes that request and executes it?

10:40 lnostdal: clj-http can't send cookies? O_o

10:40 fdaoud: not really publish subscribe I guess, since only one guy should execute the action

10:41 gtrak: fdaoud, agents?

10:41 hiredman: fdaoud: a queue

10:41 fdaoud: there are a number of different ones to choose from

10:41 fdaoud: gtrak: that's what I'm thinking, but I'm not sure.. agents have this state.. I don't need to update a state

10:41 hiredman: java.util.concurrent.LinkedBlockingQueue is my go to

10:42 gtrak: fdaoud, queues have a state as well

10:42 fdaoud: hiredman: yes, a basic queue, certainly not rabbitmq or activemq

10:42 gtrak: true

10:42 gtrak: fdaoud, although agents don't guarantee in-order execution

10:42 hiredman: gtrak: agents are state + a queue of actions

10:43 gtrak: what's on a queue is also a lot like state, no?

10:44 hiredman: how so?

10:44 clgv: gtrak: agents dont guarantee order? that would be new, wouldnt it?

10:44 fdaoud: hiredman: how do you use j.u.c.LBQ in clojure?

10:44 just make calls to it?

10:44 hiredman: fdaoud: same way you use any bits of java

10:44 fdaoud: ok

10:45 gtrak: clgv, it's executed in a thread-pool, transactionally, within the transaction you'll get order

10:45 hiredman: gtrak: no

10:45 clgv: gtrak: the agent has only one thread afaik

10:45 hiredman: gtrak: agent actions are queued up, so from a single thread actions are executed in order

10:45 fdaoud: hiredman: I just want a basic way of saying "I want this to get done, but I don't want to know who does it, and I don't want to wait." does LBQ sound good for that?

10:45 gtrak: ah, I thought it was concurrent

10:46 hiredman: fdaoud: no, sounds like you want an executor

10:46 clojure has two

10:46 most likely you just want to use future

10:46 clgv: fdaoud: FixedThreadPoolExecutor should fit

10:46 hiredman: clgv: but you don't want to create new executors

10:47 fdaoud: I see now your question about queues was a red herring

10:47 clgv: hiredman: actuall I already wanted and did create them ;)

10:47 fdaoud: hiredman: I'm sorry, it was not intentional

10:47 clgv: I wanted a producer-consumer-scenario with limited thread number

10:48 hiredman: clgv: right, and so did every other framework you use, and now you have 10 threadpools sized to n+2 cores

10:48 :(

10:48 gtrak: hmm, what does this mean? " Actions dispatched to an agent from another single agent or thread will occur in the order they were sent, potentially interleaved with actions dispatched to the same agent from other sources."

10:48 clgv: hiredman: no! I have the threadpool with the desired number of threads,

10:48 gtrak: they still will be executed serially I guess

10:49 hiredman: gtrak: it means actions are FIFE (first in first executed)

10:49 fdaoud: hiredman: in my mind, I visualized a queue of things to get done, with people putting stuff on it on one end and others taking them and executing them on the other

10:49 sorry if that was misleading

10:50 I just want to decouple "add a user" from "how that gets done", and I also want the caller to return immediately

10:50 hiredman: future

10:50 fdaoud: thanks hiredman

10:51 hiredman: so what do you use LBQ for?

10:51 gtrak: future uses the unbounded agent thread pool, right?

10:51 hiredman: fdaoud: if I want to shuttle data around

10:52 gtrak: yes

10:52 gtrak: fdaoud, you don't actually care about the order of execution, so you don't need to manage the details of a queue

10:53 hiredman: you just want fire and forget

10:53 gtrak: like for multiple requests, i mean

10:53 fdaoud: gtrak: good point

10:53 yes, fire and forget

10:53 but also not know too many details of "fire"

10:53 i.e. the guy who fires "add a user" should have no idea of databases etc.

10:54 gtrak: the OS already has a thread scheduler, that's your queue

11:03 Kototama: hi, can somebody help me two combines two handlers into one with compojure? tried with (routes) without success

11:04 gtrak: ckirkendall`, why'd you cincyfp guys go with wordpress over meetup? do you think meetup would be worth the cost?

11:12 kevin_8019: Rich Hickey mentioned a paper in one of his presentations about state and identity. Does anyone know the paper?

11:13 Fossi: meetup actually costs money?

11:13 gtrak: yea

11:14 Fossi: wow. the damn thing annoys me to death even without having to pay

11:14 gtrak: yea, it does have critical mass though

11:15 i think maybe i'll spring for it if I can get something regular established first

11:15 I don't want to responsible for entertaining tons of people without some help :-)

11:16 i'm a total newb at this

11:16 Fossi: point in case: i wanted to check out their registration and it won't let we create a group because i somehow lack topics

11:17 no clue what they want :>

11:17 gtrak: they should make it free up to like 5 people, or ads or something

11:18 Fossi: "75 people dedicated to making this the very best way to get Meetups going" wth

11:18 ambrosebs: clojurebot: why don't you run core.logic? you'd probably be smarter

11:18 clojurebot: chouser: Some high-tech profiling with Activity monitor and println shows that I'm doing 100% of one core and not so much IO, though the number of files being read is huge(I estimate 5 per second).

11:19 gtrak: it's not expensive, it's just the principle of the thing

11:19 Fossi: i didn't even know it's not free

11:20 we've been hacking a homepage for the hamburg.de usergroup for a while now to get rid of the thing

11:20 but since we only meet once a month progress is real slow ;)

11:21 kevin_8019: Rich Hickey mentioned a paper in one of his presentations about state and identity. Does anyone know which paper it was?

11:21 gtrak: kevin_8019, 'Are we there yet?'

11:21 ah, a paper

11:22 kevin_8019: yeah, exactly

11:22 gtrak: Fossi, yea, I'm expecting to take the brunt of the effort until the group gets going

11:23 kevin_8019, you mean the Bagwell paper?

11:24 http://lampwww.epfl.ch/papers/idealhashtrees.pdf

11:25 kevin_8019: maybe that was it...

11:25 I thought he mentioned a paper which defined his point of view on state/identity/time

11:26 gtrak: i think he just reference alfred north whitehead a lot, i just glanced over the slides

11:26 and he referenced this: http://www.amazon.com/Process-Lectures-Delivered-University-Edinburgh/dp/0029345707

11:27 raek: kevin_8019: This could be related too: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.23.9999&rep=rep1&type=pdf

11:27 "Equal rights for functional objects or, the more things change, the more they are the same"

11:28 kevin_8019: Yeah, I'm pretty sure the last one is it

11:28 Thanks!

11:29 raek: there it is argued that an equality operator makes much more sense when value and state are separated

11:33 gfredericks: ,(= (atom nil) (atom nil))

11:33 clojurebot: false

11:41 TimMc: &(= @(atom nil) @(atom nil))

11:41 lazybot: ⇒ true

11:57 jweiss: is there a way to suppress printing of namespaces with pr?

11:57 clojurebot: amespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

11:57 jweiss: gee thanks clojurebot

11:57 cemerick: printing of namespaces?

11:58 hiredman: on symbols and keywords I imagine

11:58 jweiss: no

11:58 jweiss: yeah, like i don't want to see clojure.core/fn* just fn* or whatever

11:59 cemerick: jweiss: what are you trying to do?

11:59 jweiss: cemerick: print out lists in a readable way, but i don't want indentation like pprint

11:59 clgv: why should on not try to use namespaces without a period in it? they work fine as the others do

11:59 raek: be able to read the output of macroexpand for a non-trivial expression? :P

12:00 TimMc: clgv: Single-segment namespaces are allegedly trouble. *shrug*

12:00 clgv: TimMc: why?

12:00 TimMc: I've never seen a good explanation.

12:00 cemerick: jweiss: sounds like lists of macroexpanded code, if you've got 'clojure.core/fn* symbols around

12:00 jweiss: cemerick: that was a bad example, more like clojure.core/deref and the like

12:01 i'm doing data driven testing, so the data used for each test contains not just strings, ints, lists, etc but fn's. i serialize the fn's but i just want to be able to see what it does, generally, not necessarily deserialize it

12:02 so not having ns's is more readable for me

12:02 cemerick: So you're never going to try to load the code back in?

12:03 jweiss: cemerick: no, not if i disable the printing of ns. if i later really decide i want it to be deserializable, i'll switch back. for now i'm just using serialization for readability

12:04 IOW, i want someone to look at the serialization and know what the test *does* but not necessarily copy/paste it and run himself

12:05 cemerick: There's no reasonable way to make symbols print without their namespaces. You could use clojure.walk to replace namespaced symbols with their unqualified equivalents.

12:05 clgv: jweis: cant you walk the forms and replace the symbols by their (name %) ?

12:05 replaca_: jweiss: you could use pretty print with a custom dispatch func

12:06 jweiss: replaca_: i was thinking of using pprint, since it does what i want except for whitespace formatting

12:06 should be able to set right margin to 100000 or something :)

12:06 replaca_: then you can get all the "cleanup" that pprint does, but skip the newlines and whitespace

12:06 jweiss: ok, i'll look into that

12:06 replaca_: yeah, I think you might be able to just set it to nil

12:09 there might be an issue with performance these with very large structures

12:09 but with reasonable stuff you should be OK

12:10 jweiss: replaca_: perf shouldn't be an issue, small structures

12:10 i'll try that, thanks

12:10 replaca_: cool, enjoy

12:11 TimMc: &[*ns* (namespace `x)]

12:11 lazybot: ⇒ [#<Namespace sandbox11845> "clojure.core"]

12:11 TimMc: ,[*ns* (namespace `x)]

12:11 clojurebot: [#<Namespace sandbox> "sandbox"]

12:11 TimMc: I'm having trouble understanding lazybot's response there.

12:12 gfredericks: the former is resolved at compile-time I think, while the latter at read-time

12:12 so who knows what sort of witchcraft-discrepancies lazybot produces between the two

12:12 TimMc: So, what is lazybot doing to make the two different?

12:12 yeah

12:13 gfredericks: I don't even know if it's correct to say *ns* is resolved at compile-time

12:13 probably runtime?

12:14 at compile-time I think the '*ns* gets resolved to #'clojure.core/*ns*

12:14 hiredman: correct

12:14 the var is then deref'ed at runtime producing a value

12:14 gfredericks: woohoo!

12:14 a year of getting corrected by hiredman and finally I know a bit about vars.

12:15 :)

12:16 TimMc: So... (ns) changes the value of *ns*?

12:17 gfredericks: at compile-time I think

12:17 I was just trying to work out where the second value comes from

12:17 TimMc: The reader handles `, yeah?

12:17 gfredericks: yeah

12:17 TimMc: Macros get symbols fully resolved.

12:17 gfredericks: is *ns* rarely used at runtime? I'm not even confident what its value would be...

12:18 hiredman: depends on how you run your code

12:19 via -jar or clojure.main or lein run it'll typically be clojure.core

12:19 gfredericks: okay, so *ns* at runtime isn't very useful

12:20 hiredman: the current ns is the top of a stack, in-ns pushes a new ns on to the stack for compilation

12:21 gfredericks: that makes sense

12:23 TimMc: How do you pop the stack?

12:24 Raynes: Program in Factor. ;)

12:28 TimMc: (And what would that even mean?)

12:29 Raynes: TimMc: It'a a stack-based programming language.

12:30 jamiltron: It's also one of the most awesome languages around, imho.

12:31 TimMc: Raynes: I was referring to my previous statement.

12:31 Raynes: TimMc: lrn2beclear.

12:32 TimMc: How can I speak clearly when my thoughts are muddled?

12:39 dnolen: ambrosebs: how's using the analyzer going?

13:01 leo2007: Can swank-clojure show java functions arglist?

13:02 technomancy_: leo2007: sure, just use C-S-i and enter a java class, it will list all the methods

13:04 rickmode: I'm trying to dispatch to multiple functions based on class. I did it via multimethods. Is there a way via datatypes? defprotocol / deftype?

13:04 leo2007: technomancy_: that's something new to me. Thanks. However, can it show the arglist in the echo area when typing SPC?

13:05 much like what happens to clojure functions.

13:05 technomancy_: rickmode: if multimethods are working for you, keep using them.

13:05 leo2007: no, because generally types aren't known at that point

13:05 jweiss: i wish the inspector would show constructors

13:06 technomancy_: jweiss: I wish constructors were just methods

13:06 jrabbit: Someone whos familiar with clj-processing: can the applet be defined in a function or some how automatedly called? I get a scope problem with the applet if it wrap it all in a defn

13:06 rickmode: technomancy_: it's working fine. I was totally lost on the dispatch fn originally (I wanted to add extra parameters to my functions than the discriminant and it took me a good while to grok the dispatch fn and the isa? check.

13:06 jrabbit: #<CompilerException java.lang.IllegalStateException: Var rosado.processing/*applet* is unbound. (NO_SOURCE_FILE:0)>

13:06 technomancy_: it's so idiotic; they have no excuse for not just cribbing from smalltalk

13:06 leo2007: technomancy_: thanks.

13:06 technomancy_: leo2007: theoretically you could hook into type hints, but those aren't used enough for anyone to have bothered going to the trouble of implementing that

13:07 hiredman: the inspector could show constructors

13:07 whoever wrote it just didn't put them in

13:07 technomancy_: jochu!!!!11

13:07 hiredman: they are available via reflection just like method information

13:09 yeah emacs-inspect :class just gives you fields and methods, constructors could be added

13:09 technomancy: yeah, somebody should go do that

13:09 but not before wiring clj-stacktrace into swank

13:09 because that's way more useful

13:09 hiredman: meh

13:10 technomancy: I should put a bounty on that or something

13:10 one signed leiningen t-shirt

13:10 hiredman: it would take something like 20 minutes to write constructors in

13:10 technomancy: what I really want is argument names in the inspector

13:10 but those aren't reified in the bytecode. ;_;

13:11 hiredman: meh

13:11 they are

13:11 just not via the reflection api

13:11 technomancy: oh?!

13:11 iiiiiinteresting

13:12 you can get them via javap then?

13:12 jrabbit: https://github.com/rosado/clj-processing/blob/master/src/rosado/processing.clj#L18

13:25 fdaoud: hiredman: about futures, "They are a way to get code to run in another thread, and obtain the result." However, I don't need/want to obtain the result. Does that mean there is a solution better-suited to what I am trying to do?

13:25 hiredman: fdaoud: future

13:25 fdaoud: still future, even if I never deref?

13:27 hiredman: so if never doing a deref on the future is not a problem, ok then--thanks

13:33 gtrak: hmm, a future won't get GC'd until it's done executing right?

13:34 TimMc: gtrak: There will still be references to it until it has executed.

13:34 gfredericks: if it could get garbage collected I would think that indicates a deeper problem, i.e. it's been forgotten about

13:34 TimMc: Now I'm imagining a "weak future".

13:34 gtrak: TimMc, in a thread-pool executor or something?

13:34 TimMc: gtrak: That's my guess.

13:35 gfredericks: TimMc: a "forgettable" future :)

13:35 TimMc: If a future falls off the reference graph, does it make a sound?

13:35 gfredericks: not in the present

13:37 gtrak: a weak future seems more functional

13:37 TimMc: gtrak: As in, it can't be used reliably for side-effects?

13:37 gtrak: haha yea

13:39 i guess if you're using a future at all, it should be a side effect

13:41 TimMc: Is that true?

13:44 gtrak: hmm, well at the very least it's a complection of the method of computation with a value

13:44 maybe that's not the same as a side-effect?

13:47 TimMc: I'm trying to think of a scenario where you might want to start computing a value but it's possible that you stop caring at some point.

13:48 ...in a separate thread of execution.

13:48 gtrak: it's a side-effect in the sense of having to be conscious of cpu and mem i/o?

13:48 TimMc: meh

13:49 gtrak: at any rate, it's no longer pure-value functional

13:49 TimMc: why?

13:49 clojurebot: http://clojure.org/rationale

13:49 gtrak: hmm...

13:49 :-)

13:50 nope, i'm wrong, it's still functional, it just has no meaning without thinking in non-pure terms

13:50 TimMc: yeah

13:52 Maybe it would be complecting a calculation's dependency graph with a particular optimization method (explicit calls to the threading API.)

13:52 * TimMc complects "complect" with jargon confusion

13:53 TimMc: (At least Rich has us thinking about that, even if no one is using the term quite the same way.)

13:53 gtrak: yea

14:08 TimMc: Raynes: So... why does lazybot give "clojure.core" for (namespace `x)?

14:09 Raynes: Because it feels like it, I guess.

14:09 TimMc: clever bot

14:10 amalloy: hiredman: really, you can get argnames out of the bytecode? my experience has been that even very-mature products like eclipse don't do that, so i've been assuming it's impossible

14:10 TimMc: "very mature"

14:10 is that euphemism ;-)

14:10 +a, etc.

14:11 hiredman: amalloy: it might just be locals

14:12 no, the localvariable table can hold the names of arguments to methods

14:13 https://gist.github.com/1410334

14:14 "x"

14:19 amalloy: well dangit, now i want to know why eclipse didn't do this for me. would have saved me a lot of time figuring out how to get it to convince it of where javadocs for external libs live

14:22 hiredman: well, who could ever be bothered trying to get anything to do anything with eclipse?

14:23 gtrak: amalloy, eclipse can use maven to download source for deps

14:23 it's pretty slick, actually

14:24 amalloy: gtrak: yeah, during the time i was using much eclipse, maven wasn't around/popular

14:25 gtrak: the integration's improved a lot

14:25 i think I caught it magically downloading source for libs in projects that weren't using maven

14:27 licenser: anyone read the long letter about scala? Chrisshouser posted a link on twitter.

14:27 amalloy: i skimmed in the middle

14:28 gfredericks: apparently @chouser is somebody else, less popular

14:29 licenser: I wonder if clojure will be facing some of the same problems

14:30 gtrak: there's the languages people hate and the languages no one uses?

14:30 licenser: heh

14:30 tensorpudding: http://codahale.com/downloads/email-to-donald.txt

14:31 is what you're talking about right?

14:31 licenser: yap this one

14:31 I found it quite interesting

14:32 ckirkendall`: licenser: I actually switch from scala to clojure because I felt the language complexity itself made it unusable for the average developer. I do not have the same feeling about clojure.

14:32 licenser: so I kind of fear that some of the problems are problems clojure might face too

14:33 * technomancy knew Clojure better after a year then he knew Ruby after 5 years

14:33 licenser: ckirkendall`: that is true clojures code isn't complex

14:33 gtrak: licenser, read alex miller's post yet? http://tech.puredanger.com/2011/11/29/language-criticism/

14:33 ckirkendall`: The culture is a lot more unified in clojure also. Scala suffers from trying straddle the fence so you get zelots on both sides. Clojure just jump the fence so we only have one kind of zelot

14:33 TimMc: licenser, tensorpudding: http://codahale.com/the-rest-of-the-story/ <-- the author's response to his leaked letter

14:33 licenser: oh cool :)

14:34 TimMc: feturing some interesting turns of phrase

14:36 licenser: TimMc: I did not in any way meant to talk against scala I know nothing about the language ;

14:36 0

14:36 TimMc: hmm?

14:36 licenser: I just figured both are 'new' JVM languages so some of the problems might be the same :)

14:37 TimMc: Oh, I know nothing about Scala either.

14:38 Clojure would not have the *same* problems.

14:38 gtrak: clojure could have similar problems in terms of getting people to use it, libraries

14:38 TimMc: I've been meaning to start and curate a "Clojure gotchas" page.

14:39 licenser: well for once the build tool storry reminded me of my trouble with clojure :P even so I think since lein and cake combine forces we might get the perfect one ^^

14:39 TimMc: The lack of Javadoc in clojure.lang is troubling.

14:39 That's a serious impediment to integration from the Java side.

14:39 licenser: Also I wonder if clojure would face the same performance issues that were mentioned

14:39 gtrak: integration's pretty smooth, isn't it?

14:40 licenser: the one time I had code heavy enough to actually optimize it was for once back in 1.0 time and then I probably sucked writing it :P

14:40 gtrak: licenser, I think clojure's persistentMap is faster on reads than java.util.Hashmap up to 3 levels deep, right?

14:42 licenser: gtrak: that is cool

14:42 see that is why I ask things here :) smrt people around!

14:42 gtrak: let me try to find a source for this :-)

14:43 but bagwell invented the thing and he works on scala's data structures too

14:43 amalloy: gtrak: hopefully your source will clarify what "3 levels deep" means :P

14:43 licenser: amalloy: perhaps you can write your code in the third sub level of the basement and it is still faster

14:43 gtrak: three levels of array-mapped lookup

14:43 licenser: only if you go deeper the heat of the earth core crushes the performance

14:43 just a theory so

14:44 amalloy: gtrak: right, but that's not meaningful/sufficient in itself. it tells you how many items are in the map (32^3, ish), but not how the java hashmap is configured

14:44 gtrak: java hashmap performance doesn't change though except for cache misses, right?

14:45 amalloy: no, you can configure how much space it's willing to waste in the interest of avoiding hash collisions

14:45 $google java.util.HashMap loadFactor

14:45 lazybot: [java - Performance of HashMap with different initial capacity and ...] http://stackoverflow.com/questions/1324064/performance-of-hashmap-with-different-initial-capacity-and-load-factor

14:45 gtrak: ah, I wasn't talking about the linked-list traversal

14:46 amalloy, but do you remember where that is? i think it might be in the ants talk

14:46 amalloy: no

14:47 gtrak: i find it ~impossible to believe that clojure hashes that look up three levels deep are faster than java hashes if there's no hash collision. division can't be *that* slow, can it?

14:48 gtrak: division's classically quite slow on a cpu, but I don't know for sure

14:49 i remember a figure like 19x slower than multiply, but it's hazy

14:49 amalloy: oh, i see that j.u.HashMap always uses 2^n buckets, so it doesn't have to divide either

14:51 licenser: ^^

14:55 and for once the clojure community is perhaps the best I've ever seen

14:55 amalloy: gtrak: fwiw, just did a quick benchmark on that and j.u.HashMap is ~3x faster

14:55 gtrak: ah

14:56 amalloy: with, in fact, three lookups. sounds about right

14:56 gtrak: hmm, I'll look around for where i heard that

14:56 pretty sure it was Rich though

14:57 amalloy: https://gist.github.com/1410496 if you're interested in my methodology, though it's not very interesting

15:02 TimMc: tmciver: there you are

15:03 licenser: another rather interesting thing, there was recently a discussion about using clojurescript for shell scripting by running it on node.js

15:04 I believed that to be a totally strange idea, now I stumbled about joynet using node.js to manage kvm on solaris

15:04 gtrak: ha

15:05 licenser: ha?

15:05 gtrak: was it you I was discussing with?

15:05 * licenser can't remember names if his live would depend on it

15:05 gtrak: a couple weeks ago i think yes

15:05 licenser: heh

15:05 gtrak: i was at clojure conj

15:05 TimMc: lucky chump

15:05 * licenser wasn't even so he'd loved to but traveling all the way to the US … expensive

15:05 gtrak: :-D

15:06 licenser: I was browsing their repo and looked at their commands and was just like wtf

15:06 TimMc: licenser: Germany?

15:07 licenser: TimMc: aye

15:07 Berlin to be precise

15:09 TimMc: tmciver: I think I'm going to hit Anna's Tacqueria before heading over to Sprout.

15:10 licenser: I think germans like clojure, there are may of us

15:10 tmciver: TimMc: OK, that's not a bad idea.

15:11 TimMc: licenser: Yeah, I've seen a few .de blog posts.

15:11 lnostdal_: is the author of aleph around here? .. got a quick question

15:12 TimMc: Ask it in case they are.

15:12 amalloy: he's not

15:12 but you could try #aleph, or he's very responsive on the aleph google group

15:12 * amalloy isn't sure if #aleph exists, but there's some dang channel zack hangs out in

15:15 lnostdal_: ok, thanks

Logging service provided by n01se.net