#clojure log - Mar 21 2011

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

0:00 brehaut: devn: https://github.com/blog/99-popular-languages#comment-362

0:04 devn: it would be interesting to know then, why in the past when ive had a clojure project containing something like jquery-min-1-x-x.js

0:04 it still shows my project as being javascript

0:05 brehaut: curious

0:05 devn: anyway, the language popularity on github is flawed from the start

0:06 brehaut: it does seem like a very difficult thing to get a good measure on

0:06 devn: LoC is a bad measurement, so is file size, what is left?

0:07 brehaut: gz the file, measure the file size then

0:07 its not perfect, but it will get rid of a lot of the noise

0:07 devn: If I can write something in Clojure in 8 lines that'd take me 40 in Java, does that mean Java has more code?

0:07 What about the reusability of the Java code?

0:07 or the clojure code for that matter

0:08 should forks and watchers hold some weight?

0:08 and so on...

0:09 brehaut: https://github.com/abedra look at 'bookjure', take a gander at the source files in there.

0:11 brehaut: i think a better approach would be to give every project an equal weight; forks and watches lower weights respectively (and forks with no commits should count as watches), and then calculate ratio of each languages component of the project and multiple the project, forks and watchers by those ratios.

0:12 something does look very broken with their filtering if it is actually filtering

0:13 i dont think overall quantity of the language matters because once the project has started, the chosen language is fixed.

0:33 devn: *nod*

0:33 good point

0:33 but then you have things which are libraries to interface with another language

0:33 like, is a python generation library written in clojure a clojure project, or is it a python project?

0:34 you could make the argument either way -- yes it is definitely a clojure project, but if im browsing python projects that might be something im interested in as well

0:35 brehaut: yeah thats a good point

0:36 devn: i guess i just find github intensely annoying when it comes to searching

0:37 the thing that would send github over the moon is a way to say: "show me all of the repositories where the project is based around clojure and databases"

0:37 and it should show me a nice list of db-related clojure projects assuming people have tagged their repo accordingly

0:37 brehaut: yeah

0:38 thats the hard part

0:38 devn: i beg to differ -- we're talking about people who wrote something and probably spent some time on it

0:38 they're not going to be so lazy as to not setup the project correctly from the start

0:38 brehaut: getting them to tag it consistently is whats difficult though

0:39 devn: in the long run, though, what i imagine will happen is this: all projects are not tagged, but large projects are most certainly tagged

0:39 brehaut: anyway its dinner time here

0:39 ttyl

0:39 devn: so well-maintained projects are shown

0:39 brehaut: *nod* ciao

1:31 joshua__: Do any of you have a link to some code that shows an algorithm implemented without composition and an algorithm implemented with composition. I'm thinking of a particular article, but don't remember where I saw it.

1:31 I think it had to do with run-length encoding.

1:32 Nevermind, found it.

1:36 ,(doc comp)

1:36 clojurebot: "([f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."

1:38 joshua__: ,(doc partial)

1:38 clojurebot: "([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."

3:52 thorwil: lein appengine-prepare (provided by appengine-magic) fails with java.lang.Exception: No such var: appengine-magic.core/default-war-root (core.clj:64)

3:53 my core.clj:64: (ae/def-appengine-app tlog-app #'tlog-app-handler) is exactly like in the readme and another, functioning project called ackbar

3:57 appengine-magic.core does not contain default-war-root directly, but has (if (in-appengine-interactive-mode?) (load "core_local") (load "core_google"))

3:59 core_local.clj defn's default-war-root, but core_google.clj doesn't

4:00 so why does "lein appengine-prepare" result in the loading of core_google, not core_local? any ideas?

4:20 raek: thorwil: apparently, (in-appengine-interactive-mode?) returns false and only the (load "core_google") expression is evaluated

4:21 thorwil: it looks like this is related to the problem we discovered the other time. (weird for it to happen with their own plugin, though...)

4:28 thorwil: raek: yes. have to be sure it's a bug, not a mistake on my side

4:30 actually, it's true that this can't be called an interactive.mode. but where should the default-war-root come from, then?

4:38 oh, i can get rid of that error by adding ":aot tlog.app_servlet" to my project file

4:42 but of course i get this, then: http://paste.pocoo.org/raw/357039/

4:44 raek: could be something like (defn foo bar [] ...) instead of (defn foo [] ...)

4:45 or a syntax error in some ns form

4:52 thorwil: hmm, but my stuff compiles fine

5:07 Dranik: hi all!

5:17 AWizzArd: Moin Dranik.

5:37 ejackson: hey all

6:03 Dantas: Hi everyone !!! Good morning from GMT ( Lisbon ) :)

6:04 im wondering with the clojure Agent could be something like other languages called Actors?

6:04 ejackson: Dantas: its similar

6:04 Dantas: ejackson: thnax

6:04 ops, thanx

6:04 ejackson: :)

6:05 Dantas: ejackson: message passing concurrency, right ?

6:05 ejackson: no

6:06 hold on, let me bring get you a good link for this

6:06 Dantas: ejackson: nice :)

6:07 ejackson: http://www.dalnefre.com/wp/2010/06/actors-in-clojure-why-not/

6:08 Dantas: ejackson: thanx, ! but look, agents are like actors, and actor use the message passing concurreny model , isn´t ?

6:09 ejackson: actors do use that, but agents are not actors

6:09 they don't hang around waiting for messages

6:10 Dantas: yeah yeah, its not fair call agents as actor, but a subset could be ?

6:10 ejackson: sorry for my english, :(

6:10 ejackson: Dantas: don't worry, my Portuguese is worse

6:11 Dantas: :)

6:11 im from brazil but living here ( lisbon )

6:13 ejackson: I'm not a compsci guy, but as I an agent is just a something that applies a thread to a reference type.

6:13 it can take any function, unlike actors, which only respond to a specific subset of messages

6:13 the key, in Clojure land, is that its asynchronous (unlike refs or atoms)

6:14 Dantas: so, Agent could be translated as a Thread waiting for actions to execute.

6:14 ejackson: again, no.

6:14 that sounds more like a future

6:15 the agent, as I understand it, is just the 'wrapping' around the reference type that controls how it is updated

6:15 Dantas: excelent

6:15 ejackson: it can be backed by a threadpool that will give you a thread to perform the function you apply, or not, but it itself is not a thread

6:15 it is a reference data type

6:16 Dantas: yeahh

6:16 really nice

6:16 ejackson: but take all I say with lots of salt, I'm an eternal noob.

6:18 Dantas: ejackson: :) really nice .. appreciate for ur time

6:18 ejackson: no worries, hope I didn't lead you astray

6:20 Dantas: ejackson: im sure not

6:21 ejackson: u are right

6:21 ejackson: i'm happy to accept that - reference ?

6:25 angerman: can I somehow speed up the emacs swank interaction?

6:25 It always goes: "fontifying"....

6:25 TobiasRaeder: Morning everybody :)

6:25 incandenza: angerman: (setq font-lock-verbose nil)

6:26 ejackson: Dantas: Here's a good discussion of the differences, look about halfway down: http://bc.tech.coop/blog/081201.html

6:27 Dantas: ejackson: im reading the last u sent !

6:27 ejackson: thanx

6:27 ejackson: k

7:09 Dantas: you fixed up ?

7:09 Dantas: ejackson: Yeah ! its clear

7:10 ejackson: ok, cool.

7:10 Dantas: really enjoy the blog article

7:11 ejackson: yeah, both were good as they are from opposite perspectives, and discuss the same statements by Rich

7:26 thorwil: anyone else experiencing hours of delay when posting to the google group?

7:27 Raynes: thorwil: Yup. Thus is the nature of a mailing list reader.

7:29 thorwil: meanwhile, i solved my issue

7:40 "java.lang.NoClassDefFoundError: Could not initialize class tlog.app_servlet" is likely a classpath issue?

8:01 angerman: does anyone use appengine-magic?

8:02 thorwil: angerman: i'm trying to. so far it seems to be a horrible idea

8:03 angerman: Hmm. well it works for me except I can't get the datastore to work.

8:04 mids: angerman: got it working, whats the problem?

8:04 angerman: No API environment is registered for this thread.

8:05 mids: is that from the REPL?

8:05 angerman: yes

8:06 mids: do I need to enable anything special_

8:07 mids: you need to call ae/serve before you can access the DS

8:07 thorwil: i guess my problem could be due to trying to run with appengine-java-sdk-1.4.2, while 1.3.7 in my lib. is a specific version of appengine-magic tied to an sdk version?

8:08 angerman: mids: there's not ae/server.

8:08 "eer serve

8:08 mids: thorwil: try to 0.4.0 branch: https://github.com/gcv/appengine-magic/blob/v0.4.0/project.clj

8:10 angerman: ah yeah, I am using the 0.4.0 branch which has. guess you can also use ae/start

8:10 I have added a repl-init-script to my project.clj; where all the setup stuff takes place when I call 'lein repl'

8:10 angerman: mids: strange. It's already serving.

8:11 mids: hmm. Using swank, but that should be no issue, no?

8:13 mids: I wouldnt think so, although I dont use swank myself

8:13 thorwil: mids: i'd like to that project.clj. all my attempts to streamline the get going failed, except for using durendal-jackin

8:15 Dranik: join #lisp

8:15 sorry

8:16 angerman: mids: do I need anything else except (ds/query :kind Test)?

8:18 mids: angerman: you need to defentity Test first

8:18 angerman: ahh, ok. I guess that the slime thread is just unbound.

8:19 The app apperently can use the datastore. It's just not available from the repl.

8:28 fliebel: &(.nextInt (java.util.Random. 107038380838084))

8:28 sexpbot: java.lang.Exception: EvalReader not allowed when *read-eval* is false.

8:28 fliebel: ,(.nextInt (java.util.Random. 107038380838084))

8:28 clojurebot: java.lang.ExceptionInInitializerError

8:28 fliebel: huh...

8:30 Why does that give 2 different nonsensical errors, and work locally?

8:30 opqdonut: because the bots are sandboxed

8:31 and for some reason the sandboxing doesn't allow those, *shrug*

8:32 fliebel: opqdonut: Yea, weird… It's not doing anything dangerous (on the surface)

8:33 tomoj: ,(long 107038380838084)

8:33 clojurebot: java.lang.ExceptionInInitializerError

8:33 fliebel: &(long 107038380838084)

8:33 sexpbot: java.lang.Exception: EvalReader not allowed when *read-eval* is false.

8:33 tomoj: haha

8:33 magic number?

8:33 opqdonut: &(long 1)

8:33 sexpbot: ⟹ 1

8:34 opqdonut: interesting

8:34 fliebel: huh? I'm not allowed to instantiate longs?

8:34 opqdonut: just not that long :)

8:34 &(long 10703838)

8:34 sexpbot: ⟹ 10703838

8:34 opqdonut: &(long 107038380838)

8:34 sexpbot: java.lang.Exception: EvalReader not allowed when *read-eval* is false.

8:34 opqdonut: &(long 1070383808)

8:34 sexpbot: ⟹ 1070383808

8:34 opqdonut: &(long 10703838083)

8:34 sexpbot: java.lang.Exception: EvalReader not allowed when *read-eval* is false.

8:34 opqdonut: &(int 1070383808)

8:34 sexpbot: ⟹ 1070383808

8:34 opqdonut: &(int 10703838083)

8:34 sexpbot: java.lang.Exception: EvalReader not allowed when *read-eval* is false.

8:35 tomoj: wtf?

8:35 fliebel: So, anything that fits in an integer can be a long? usefull...

8:35 opqdonut: longs that don't fit in an int

8:35 yeah

8:35 probably the reader handles them somehow differently

8:35 and this trips up the EvalReader thing

8:35 raek: ,(read-string "(int 10703838083)")

8:35 clojurebot: (int 10703838083)

8:36 raek: ,(class (second (read-string "(int 10703838083)")))

8:36 clojurebot: java.lang.Long

8:36 raek: ,(class (second (read-string "(int 1070383808)")))

8:36 clojurebot: java.lang.Integer

8:37 tomoj: doesn't seem like EvalReader should be involved

8:37 fliebel: &(long 107038380838084.)

8:37 sexpbot: ⟹ 107038380838084

8:37 tomoj: baffling

8:38 fliebel: ,(str "&" (long 107038380838084.))

8:38 clojurebot: "&107038380838084"

8:38 tomoj: wonder if it's just a coincidence that both bots have the same symptom?

8:39 fliebel: &(.nextInt (java.util.Random. (long 107038380838084.)))

8:39 sexpbot: ⟹ 0

8:39 fliebel: yay

8:39 opqdonut: ha

8:40 fliebel: I found that on stackoverflow, but I was wondering if there is a way to tell if there are more numbers that generate 0, and what they are.

8:40 opqdonut: exhaustive search :)

8:40 fliebel: opqdonut: You mean the only way to find out is to try them all?

8:40 opqdonut: of course not

8:41 have a look at the implementation, you might be able to work out an equation that narrows down the space considerably

8:44 fliebel: opqdonut: Hm, I'm not sure if my math is capable of that, but I'll try. My end goal is to find a string whose .hashCode produces 0 when used as a seed in a random number.

8:45 tomoj: are string hashcodes predictable?

8:45 &(.hashCode "foo")

8:45 sexpbot: ⟹ 101574

8:45 tomoj: guess so

8:45 opqdonut: yeah they are

8:45 fliebel: tomoj: it seems: http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#hashCode()

8:45 opqdonut: &[(.hashCode "f") (.hashCode "fo") (.hashCode "foo")]

8:45 sexpbot: ⟹ [102 3273 101574]

8:46 fliebel: tomoj: How did you tell it was so from that single command?

8:46 tomoj: I also ran it locally :)

8:46 fliebel: ah

8:46 tomoj: I'm using CRC-32 to get random seeds from strings now

8:47 wonder if I could've just used hashCode

8:49 thorwil: am i doing something wrong with "../appengine-java-sdk-1.4.2/bin/dev_appserver.sh resources/"?

8:50 mids: thorwil: did you run lein appengine-prepare before?

8:51 thorwil: mids: yes.

8:51 mids: sounds good

8:52 thorwil: mids: all i can find for "java.lang.ClassNotFoundException: tlog.app_servlet" suggests a classpath issue, but i would hope that is taken care of?

8:52 tomoj: looks like hashcode has 494 collisions in wamerican-insane, crc32 42

8:53 mids: thorwil: does running from the repl work?

8:54 thorwil: mids: it did before i upgraded appengine-magic, and i had the same issue before

8:54 mids: upgraded to?

8:54 thorwil: 4.0.0-SNAPSHOT

8:55 mids: v040 writes to war/ instead of resources/

8:56 angerman: mids: thanks. Does appengine-magic provide session/cookie support?

8:57 mids: it doesnt provide anything for that

8:57 angerman: mids: damn. Do you know of any support?

8:57 mids: but you can use ring session middleware

8:57 angerman: ahh ok. that comes with compojure, right?

8:58 mids: I believe it comes with ring

8:58 angerman: yea, but ring is pulled as a dependence of compojure I think.

8:58 mids: right

8:58 angerman: that's what I ment.

8:59 mids: ring.middleware.session.cookie

8:59 what do you need to store in sessions though?

8:59 thorwil: mids: should web.xml and appengine-web.xml be moved from resources/WEB-INF to war/WEB-INF, then? or copied?

9:00 mids: thorwil: moved; resources is no longer used

9:00 angerman: sandbar looks nice.

9:01 mids: I need it for a stateful authentication of a user

9:01 mids: angerman: cant you get away using the google user service?

9:01 angerman: no.

9:01 mids: ok :)

9:01 angerman: it's a custom throw away user management.

9:02 generating random id/passwords. that are shortlived (14days)

9:06 thorwil: one issues down, next follows immediately: java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)

9:07 mids: thorwil: are you starting a thread?

9:07 (or using some library that does)

9:08 thorwil: i don't even know how i would do that. it's just ring, moustache, enlive

9:10 mids: the exception makes it sound like there is some threadgroup stuff going on; which GAE doesn't allow

9:11 fliebel: How would javas >>> translate to clojure?

9:11 Is that just bit-shift-right?

9:12 thorwil: mids: it was a :use ring.adapter.jetty, thank you!

9:17 mids: fliebel: no, bit-shift-right uses >>

9:17 fliebel: mids: I know, but what is the triple one then?

9:18 mids: this thread suggests it isnt available: http://groups.google.com/group/clojure/browse_thread/thread/0260fe6f02a5f05d?fwc=1&pli=1

9:19 fliebel: uh,oh

9:27 So Is there any way I can mimic (seed >>> (48 - bits)) in clojure?

9:29 mids: can seed be negative?

9:30 fliebel: mids: yes

9:36 mids: fliebel: "Shifting right by n bits on an unsigned binary number has the effect of dividing it by 2n (rounding towards 0)."

9:38 fliebel: mids: So… 40 >>> 5 is like (/ 40 (* 2 5))?

9:38 mids: 2^n

9:38 pasted from http://en.wikipedia.org/wiki/Logical_shift

9:39 I would create some unit tests for this though :)

9:39 Chousuke_: doesn't clojure have bitshift operators?

9:39 TimMc: fliebel: Shifting negative 2's complement numbers can produce surprising results.

9:40 fliebel: ouch

9:44 TimMc: ,(bit-shift-right 10 2)

9:44 clojurebot: 2

9:44 TimMc: ,(bit-shift-right -10 2)

9:44 clojurebot: -3

9:44 TimMc: ,(bit-shift-right -1 2)

9:45 clojurebot: -1

9:46 mids: javascript: > -10 >>> 3

9:46 536870910

9:47 TimMc: weird

9:47 No idea what's going on there.

9:48 Oh! -10 >> 2 in JS is -3

9:49 mids was using the logical right shift, I was using arithmetic right shift.

9:49 fliebel: Which one do you want, zero-extend or sign-extend?

9:49 Or negate, shift, negate?

9:54 fliebel: TimMc: Logical

9:56 mids: fliebel: https://gist.github.com/879473

9:56 fliebel: mids: thanks

9:56 Tomsik: Hi, http://blog.japila.pl/2011/03/processing-in-clojure/ says to "Run the application with /Applications/Processing.app/Contents/Resources/Java/core.jar in Clojure’s CLASSPATH." What is this classpath and how do I use it?

10:04 * angerman really wishes there was a durendal-reload function.

10:05 gfrlog: having lein installed implies that maven is somewhere on my system too, correct?

10:05 angerman: Tomsik: it means when you run the app script, you need to have clojure as well as core.jar in your classpath.

10:05 Tomsik: CLASSPATH is the environemnt variable …

10:06 Tomsik: Okay, but it seems to be empty

10:09 locate only gives something called lucene-core.jar, it's not that thing I guess?

10:10 angerman: no. it's not.

10:10 according to that blogpost it's somewhere in the Processing.app

10:11 basically what you want to do is: $ java -cp clojure.jar:/Path/to/processing/core.jar clojure.main

10:11 and from the REPL you wan "(load "script.from.website.clj")

10:11 pjstadig: gfrlog: i believe it means some maven related jars for dependency resolution, but maybe not the actual `mvn` script

10:13 gfrlog: pjstadig: cause my next question was how to install maven given lein :)

10:13 pjstadig: I guess I'll try it the normal way

10:13 Tomsik: Thanks!

10:13 pjstadig: gfrlog: yeah that's probably what i'd suggest :)

10:14 gfrlog: pjstadig: thx

10:14 TimMc: gfrlog: THe other day you were joking about writing a language where data was code...

10:14 I just realized that's the lambda calculus. :-)

10:15 Tomsik: Yeah, in System-F etc. you can encode datatype constructors

10:15 and destructors etc. etc.

10:15 gfrlog: TimMc: hmmm

10:15 TimMc: I could accept that

10:16 TimMc: every time I make a joke it turns out I was just talking about the lambda calculus.

10:17 Tomsik: Think about this way, if universe is just Turing-complete then you are the lambda calculus

10:18 jaspervdj: Any Clojure adapt in Belgium/Ghent who would be willing to give a talk at a Ghent Functional Programming Group meeting?

10:19 *adept

10:37 Raynes: http://raynes.me/hfiles/cat.jpg I and my cutest coder friend during our pair programming session a few minutes ago.

10:37 pdk: does she pair program when you write perl

10:38 Raynes: pdk: Only when we write LOLCODE.

10:39 And Clojure of course. She pronounces it Clopurr.

10:39 Would Clojurrrrr had been cleverer?

10:49 rhickey: so, I have a version of Clojure here where _none_ of the Clojure interfaces are declared to throw checked exceptions, and all tests pass. A fn can call code that throws a checked exception and it will not be wrapped (i.e. the declarations are lies). Any interest?

10:51 * rhickey has always hated the checked exception mismatch with HOFs and its poisoning effect on Clojure's API

10:51 cemerick: rhickey: that was fast :-P

10:52 rhickey: cemerick: long on the agenda, and much more than you asked for

10:52 it's a mother of a patch

10:52 cemerick: I'll bet.

10:53 rhickey: and a breaking change for Java derivees of Clojure interfaces that have declared throws Exception in order to match the old interfaces

10:53 so, it's kind of now-or-never given this next (breaking) release

10:53 cemerick: rhickey: what happens when a checked exception floats up out of an unadorned IFn.invoke call? No negative repercussions at runtime?

10:53 i.e. java.lang.TheSkyIsFallingError?

10:54 rhickey: I'm comfortable with the lie, and no, checked exceptions are a fabrication of javac

10:54 chouser: this would mean less deep-wrapping with Runtime exception?

10:56 rhickey: chouser: also as part of this patch is rigorous use of a new Util.runtimeException which does once-only wrapping

10:56 cemerick: fancy

10:56 rhickey: there is still wrapping, as the Java code needs it in order to satisfy javac

10:56 cemerick: rhickey: This is just going to encourage me to suggest more and more outlandish-sounding things, in the hopes you've already implemented them.

10:56 rhickey: but none built into AFn/IFn or compiled fns

10:57 no exceptions from map fns or any other interfaces either

10:58 patch started with replace "throws Exception" with ""

10:58 globally

10:58 choffstein: Hey all -- what is the 'clojure' way of doing configuration files? Is it using XML? YAML?

10:58 Putting it in the code itself?

11:00 cemerick: choffstein: yeah, a .clj file makes for a pretty good configuration file. :-)

11:00 choffstein: figured :)

11:01 does anyone know of a library that can be used to poll a queue to run background jobs?

11:01 like resque for Ruby?

11:06 rhickey: shall I take the lack of dissent as assent?

11:07 fliebel: rhickey: Go ahead :)

11:07 ejackson: rhickey: above my paygrade :)

11:07 rhickey: I was sure someone would balk at the potential undeclared throwing of checked exceptions

11:08 Raynes: rhickey: Someone isn't awake yet. Someone will be sure to balk for you later.

11:09 fliebel: rhickey: I'm not sure what this means in Java land. Is it that you can declare some function without the throws keyword, and still have it throw stuff?

11:09 rhickey: one only need to look at the new lambda stuff in Java to see the trainwreck of checked exceptions and HOFs

11:09 fliebel: yes, you could call IFn.invoke, which is not declared to throw anything, and it could throw a checked exception

11:10 * fliebel googles checked exception

11:10 rhickey: it could be documented as doing so

11:12 as Brian Goetz and John Rose say in this talk, checked exceptions are among many Java language fictions superimposed on the JVM:

11:12 http://cr.openjdk.java.net/~jrose/pres/201009-OneVMManyLanguages/pres_files/pres.029.jpg

11:12 of course, for people living in that fiction, this still might be considered screwy

11:12 cemerick: rhickey: I think my java.lang.TheSkyIsFallingError thought was as close as you'll get to balking at this. :-)

11:13 fliebel: rhickey: What are the advantages and disadvantages of doing this? (btw, how did you do it? I remember getting "X throws Y but is not declared to be thrown" or something like that)

11:13 rhickey: fliebel: the disadvantages of checked exceptions are too numerous to get into here

11:14 pjstadig`: rhickey: you're saying it would throw a checked exception, or a checked exception wrapped in a runtime exception?

11:15 rhickey: pjstadig`: whatever exceptions are throw will flow through Clojure fns, with no wrapping, so, IFn says no checked exceptions but they could come out of invoke anyway

11:15 wrapping is only required for the Clojure runtime code written in Java

11:16 pjstadig`: right, so checked exceptions are enforced by the compiler not the JVM is what you're saying

11:16 sure

11:16 fliebel: rhickey: So does this make it harder to use Clojure form Java?

11:16 pjstadig`: so it would only matter if you are using Clojure from the Java side, and you just wouldn't know that those exceptions are thrown, even though technically they are "checked" which means the compiler should complain

11:17 rhickey: fliebel: fewer checked exceptions is usually easier, but if you rely on the declarations in order to write Java code, then this will seem deceptive

11:18 pjstadig`: rhickey: as a former java programmer...meh, i've got no balking

11:20 * rhickey pushes

11:21 rhickey: https://github.com/clojure/clojure/commit/8fda34e4c77cac079b711da59d5fe49b74605553

11:28 TimMc: I assume .class integrity verification does not check for throws declarations.

11:31 rhickey: TimMc: as the slide I posted earlier states, they are a fiction of javac, so no, not involved in verification

11:40 dnolen: hmm, does type-hints on def make a difference ?

11:41 fliebel: dnolen: difference on what?

11:41 dnolen: fliebel: does it help avoid reflective calls.

11:42 fliebel: dnolen: depends… Did you try *warn-on-reflection*?

11:42 dnolen: fliebel: btw, disequality constraints are going to be pretty simple to implement- go metadata!

11:43 fliebel: dnolen: yay! love metadata!

11:43 dnolen: fliebel: of course, but I have to say I'm not convinced *warn-on-reflection* catches all cases...

11:44 fliebel: I'll add all-different as well as a shortcut.

11:44 fliebel: planning on an adding an N Queens example that shows it off.

11:44 fliebel: oh… idk, I don't know. I am under the impression that Clojure infers, or at least remembers types sometimes. So depending on what is def'd, I think it should help.

11:44 dnolen: Yea, queens is great fr that

11:46 dnolen: fliebel: basic tabling is already done.

11:47 fliebel: dnolen: ooh! and is the pattern matching finished as well? and cond-a? *exited*

11:47 jweiss: will unquote-splicing consume a lazy seq (of forms)?

11:48 fliebel: jweiss: how would you tell it to do so?

11:49 jweiss: oh, wait, splicing is not limited to a simple macro. hmmm...

11:49 dnolen: fliebel: pattern matching is done, cond-a/u fixed.

11:49 chouser: , `(do ~@(map inc [2 3 4]))

11:49 clojurebot: (do 3 4 5)

11:49 chouser: jweiss: like that?

11:49 jweiss: chouser: ah nice example, thx

11:50 i guess my (doall (for ... )) i don't need the wrapped doall

11:50 fliebel: dnolen: cool, so only negation, and I can make my super terse and fast sudoku :)

11:51 dnolen: You said that while the stack overflow is fixed for arithmetic, there are still duplicate results. Is that still the case?

11:53 dnolen: fliebel: adding a couple of type-hints brought zebra down to ~5ms w/o occurs-check. So now faster than SWI on that bench.

11:54 fliebel: yay

11:54 dnolen: fliebel: duplicate results as far as I can tell is a result of the miniKanren changes. I haven't seen any evidence otherwise, and it only seems to afflict the arithmetic stuff, not any other programs. Could be wrong, but I'm not going to investigate further at the moment.

11:55 fliebel: dnolen: I understand. So this stuff has to be rewritten?

11:57 dnolen: fliebel: what has to be rewritten?

11:57 fliebel: dnolen: the arithemtic stuff

11:59 dnolen: fliebel: I don't think so. arithmetic stuff is interesting as a fleshed out example of something that's easy to do in miniKanren that's harder in Prolog. I'm not going to spend anytime on making it better since it's not useful beyond a learning tool.

12:00 fliebel: dnolen: Why would it not be useful? Is it to slow to define useful numeric relations?

12:01 dnolen: fliebel: it's too slow to be generally useful. Oleg has said as much himself.

12:01 fliebel: dnolen: Prolog does have arithmetic implemented, is this at another level?

12:02 dnolen: fliebel: I believe Prolog has implicit projection. X is X+1, will project X and add 1 to it.

12:03 fliebel: dnolen: So the same can be done in Logos, but it's not a real relation.

12:03 dnolen: fliebel: for useful declarative programming with numbers, you'll have to wait for me work out constraint solving library - which is planned.

12:04 it won't be miniKanren (though it might use it internally)

12:05 fliebel: dnolen: Okay, good luck with that then :)

12:13 technomancy: angerman: C-c C-l is force-reload in recent swank-clojure.

12:13 angerman: technomancy: does that reload the classpath as well?

12:14 e.g. adding a dependence to the project.clj, running lein deps, and then C-c C-l?

12:17 technomancy: angerman: no; that's more involved

12:18 scottj: technomancy: oh so if you don't want force reload just C-c C-k ?

12:19 technomancy: scottj: yeah, C-c C-k has always been "normal compile"

12:22 scottj: ok I somehow missed that response on arohner's ticket

12:34 choffstein: If I have a library where I need the library user to set their API key, should I have the library read a config file or use a ref and create a setter method?

12:38 tomoj: certainly not the latter

12:46 "Bindings created with binding can be assigned to, which provides a means for a nested context to communicate with code before it on the call stack." -- huh?

12:47 oh

12:48 "nested context" doesn't mean "nested bindings" but just the regular old kind of nesting through functions, I guess?

12:49 fliebel: tomoj: I guess so to.

12:49 This kind of stuff could happen anywhere in the stack: (binding [a 1] (set! a 3))

12:49 Lulu58e2:

12:50 tomoj: I thought for a bit it meant that the assignment could espace the innermost binding

12:59 fliebel: dnolen: Is it me, or do pattern matching and other features not go together? Tabling and cond-a, to name a few.

13:00 dnolen: fliebel: ? they should work together just fine.

13:00 fliebel: dnolen: Then why did you write path-o in the regular style?

13:02 dnolen: fliebel: what is there to pattern match in path-o?

13:02 fliebel: dnolen: x, y and z?

13:03 dnolen: fliebel: and what are we matching them against?

13:03 * fliebel grinding gears

13:05 fliebel: okay… nothing, but I… assume there are cases where you want to use tabling in a defn-e?

13:05 And there isn't defn-a, right? Okay, that is probably a macro away though.

13:06 dnolen: fliebel: oh I see what you're asking. Just haven't gotten that far. defn-a, defn-u, deftabled are on the list of todos.

13:07 fliebel: dnolen: But that way you keep going… what about deftabled-a? oh well, probably not useful in any way, since cond-a… or.. well, dunno.

13:09 dnolen: fliebel: yes, supporting a and u variants for tabled goals would be useful as well. will probably be more like (defn-e ^:tabled path-o [] ...) (defn-a ...) (defn-u ...).

13:12 fliebel: dnolen: great :) I assume tabling is optional because it comes at a memory cost?

13:13 (couldn't this be all? https://github.com/swannodette/logos/blob/master/src/logos/tabled.clj#L152 )

13:15 (similarly, (not (=)) could be (not=))

13:17 dnolen: fliebel: all just becomes exist so not much advantage. but yeah not= is better.

13:17 fliebel: dnolen: I thought it was the other way around, with exist containing an all.

13:20 dnolen: fliebel: that's true, tho not currently implemented that way. exist is just an all that introduces logic vars.

13:20 fliebel: I see

13:20 Licenser: hi people

13:21 dnolen: fliebel: always willing to take patches :) you can just run lein test now to make you didn't break anything.

13:21 fliebel: 143 tests currently.

13:21 Licenser: I wonder is there some kind of clojure benchmark by now?

13:21 fliebel: dnolen: I'll keep that in mind.

13:43 symbole: Regarding Clojure's notions of identity, state, and values, is there any computer science literature that talks about it more in depth? Perhaps comparing these notions with respect to OOP and functional programming.

13:45 To put it in another way, is there any reading material that would help in understanding the difference between what Clojure's attempt at concurrency, and other's.

13:51 dnolen: symbole: Concept Techniques Models of Computer Programming. Java Concurrency in Practice. Armstrong Erlang book.

14:51 joly: Having recently run into the problem of holding the head of a (long) lazy seq, is there a good way to name a subexpression (primarily for understanding/documentation) that doesn't hold onto the head in a local binding?

14:54 So I could have something like (let [2d-points (repeatedly #(vector (Math/random) (Math/random)))] (... (... (... 2d-points)))), not be holding the head, but not have to just substitute the subexpression?

14:59 pjstadig: joly: i believe you can factor out a function that you can call, and have a handle to a lazy seq that will not hold the head

15:01 joly: and for understanding/documentation that's probably best anyway :)

15:02 joly: pjstadig: Hmm, sounds obvious now that you mention it. :) Thanks!

15:05 symbole: dnolen: Thanks. I'll check them out.

16:38 Cozey: Good day. what happened to clojure.contrib.duck-streams/file-str in 1.3.0? A lot of duck-streams moved to clojure.java.io but i can't find this one

16:39 technomancy: Cozey: clojure.java.io/file should suffice

16:39 Cozey: oh, mhm. thanks. will try this out

16:43 Does anyone know what's the status of ClojureScript? Is it usable to write a fairly simple site with jquery? or perhaps is using jquery with CS a bad idea? (or just missing the point)

16:55 chouser: Cozey: It's just really old

16:55 Cozey: ? abandoned

16:55 ?

16:55 chouser: Cozey: ClojureScript works, but implementes a pre-1.0 version of Clojure

16:55 Cozey: mhmm

16:56 so now CoffeScript is all the rage?

16:56 chouser: Cozey: Essentially abandoned until Clojure-in-Clojure is ready, which will make keeping it up to date much batter.

16:57 Cozey: You might like Scriptjure too, but neither of those implement Clojure semantics, which was the point of ClojureScript.

16:58 Cozey: mhm

17:00 just read about Clj-in-Clj. Sounds really cool :-) when it's going to happen?

17:01 chouser: I think the next step is to rewrite the Clojure compiler in Clojure. The language now has everything needed to do that, it just needs to be done.

17:02 Someone already did it, actually, but without any communication with the core team, so I'm not sure what will become of that.

17:02 Cozey: I guess it probably just needs a champion. Got some free time?

17:02 fliebel: chouser: Well, if someone did it already, that is a champion, right?

17:03 chouser: fliebel: He has made no effort I've noticed to have it adopted as the official Clojure compiler

17:03 ataggart: anyone know an easy way to fix a git "does not apply" issue? Rich took a machete to Exceptions in clojure.lang and now no patches will apply.

17:04 fliebel: ataggart: Maybe you could apply them to the previous commit, and then apply his patch?

17:04 Cozey: chouser: Would need much more skill than i have

17:04 cemerick: fliebel: independent spikes don't make it very far in terms of being folded into core

17:04 Cozey: but isn't this effort lead by RHickney?

17:04 ataggart: fliebel: yep tried that with rebase. doesn't work. Maybe I'm doing it wrong

17:05 chouser: Cozey: He seems, so far, to have chosen not to lead this particular part.

17:05 Cozey: mhm

17:05 cemerick: I'll open a ticket for it tomorrow. Then a patch for it will appear ~3 hours later. :-P

17:06 chouser: Part of the work, perhaps the next part, is to choose the internal tree format to use, a format which should be attractive to IDEs, code generators (to produce JVM bytecode, CLR bytecode, JavaScript, etc.) as well as any other analysis or other tools.

17:06 fliebel: what is the name of that clojure in clojure implementation again?

17:07 chouser: The thought of trying to get buy-in from all the people interested in those topics sounds very unattractive to me personally.

17:07 Actually, it sounds like the kind of thing cemerick chooses to do, for reasons that must be altruistic rather than personal. :-)

17:07 cemerick: bikeshed city

17:07 jweiss: I'm noticing that you can make keywords with the keyword fn that you can't use as a literal:

17:08 ,(keyword "can't")

17:08 clojurebot: :can't

17:08 chouser: jweiss: yes

17:08 jweiss: hm. i guess that is ok. just weird

17:08 chouser: jweiss: either the printer and reader should be changed to allow such things to work, or the keyword function should prevent it.

17:08 cemerick: chouser: I want tools that don't suck. It spurs me on to do strange things.

17:08 brehaut: chouser: is this mysterious unofficial cinc developer you?

17:09 chouser: brehaut: not even close. :-)

17:09 Cozey: How about real debugger support? (with breakpoints etc, and not macro trickery like break/trace)

17:09 cemerick: That, and I actually enjoy politics.

17:09 Cozey: is it happening anytime soon?

17:09 fliebel: chouser: So the main problem with it is that he designed it on its own?

17:09 dnolen: Cozey: there's cdt

17:10 chouser: I had an plan and the beginnings of some code, but the whole thing got shot down quite definitively at Clojure Conj 2010, and I haven't tried to pick up the pieces yet.

17:10 dnolen: chouser: https://github.com/GeorgeJahad/cdt

17:10 cemerick: Cozey: FWIW, I'm going to be bashing at proper debugging support in ccw sometime after the book is done.

17:10 dnolen: chouser: shot down by who?

17:10 cemerick: Unless Laurent and Christophe get to it first…

17:10 Cozey: will give it a shot

17:11 kotarak: Hasn't someone used jswat with clojure?

17:11 dnolen: oops, the cdt was for Cozey.

17:11 fliebel: Where does this mystical cinc implementation live?

17:11 ataggart: cemerick: the breakpoint support in ccw is nice, the only pain point is not being able to see the let-bound values.

17:11 chouser: fliebel: that may not actually be a problem. If someone were to look at that code, maybe document it, and pitch it to Rich as the right solution, it might go somewhere.

17:12 dnolen: kotarak: I have used it before, it's OK.

17:12 cemerick: kotarak: yeah, all the java debuggers work just fine with Clojure. The trick is to get decent UI over locals and vars, clojure data structures, and in-place eval of code.

17:12 ataggart: they're there, just mangled beyond recognition in the default variables view.

17:12 fliebel: chouser: The guy who wrote it seems to be in a perfect situation to do so :)

17:12 kotarak: dnolen, cemerick Yeah. Just remembering something in the dark. (for Cozey) I use mainly prn and log. :P

17:12 fliebel: (but I still don;t know who he is and where it lives)

17:13 chouser: fliebel: I agree! He's even been in the channel here talking about the code, but I've seen no indication he intends to pitch it to anyone.

17:13 * dnolen sadly has coded Clojure long enough to internalize even the most cryptic errors.

17:13 Cozey: with Clojures immutable structures, it could be possible to write a reverse (go back in time) debugger. perhaps

17:14 chouser: dnolen: shot down by our BDFL

17:14 cemerick: Cozey: there are general-purpose time-traveling debuggers for the JVM. Don't remember the name(s) at the moment.

17:14 dnolen: chouser: darn. As in, he didn't like the approach?

17:14 fliebel: chouser: Who is he? Where is the implementation? The tension is killing me!

17:14 kotarak: Cozey: someone kind of did. He called it stepl or so

17:14 chouser: dnolen: right

17:14 fliebel: sorry, I'm looking for a link.

17:15 kotarak: dnolen: The crypticity of clojure's stack traces is overrated.

17:15 dnolen: kotarak: I actually don't have a problem with 1.3s cleaned up traces.

17:16 ataggart: cemerick: jumping back in the stack might be sufficient if we could somehow disable the nullifying of values immediately prior to a call.

17:18 chouser: fliebel: ah, here it is: https://github.com/jarpiain/cljc

17:18 fliebel: chouser: Ah, I knew his name started with a j! thanks

17:18 chouser: when all else fails, grep the log. :-/

17:20 cemerick: chouser: if only we all had the log ;-)

17:20 chouser: wget -R

17:20 or ... something

17:20 cemerick: I figured that would be impolite.

17:21 You could be running that thing on a wizard palmtop or something.

17:21 chouser: Nah, I screwed myself with gmapez, so unless *everyone* starts pulling the whole log all the time, I should be fine.

17:21 brehaut: you can always use the google site: prefix

17:26 cemerick: chouser: a friend of mine is behind http://www.plugandplaymaps.com, if you're interested in easy-ish google map trickery.

17:45 hiredman: clojurebot: ping?

17:45 clojurebot: PONG!

17:46 danlarkin: cemerick and hiredman should get on the phone to talk about nrepl :)

17:48 hiredman: danlarkin: I've decided not to bother with nrepl anymore, instead looking at a rewrite of swank-clojure to be less odd

17:49 or differently odd I guess

17:49 I mean, replacing the authors oddness with mine

17:51 danlarkin: that seems like a shame

17:54 hiredman: danlarkin: the protocol is bad, I have not interest in writing clients for it unless it's fixed

18:04 TimMc: clojurebot plays a mean game of table tennis

18:17 * angerman just learned that (-> 1 inc) and (-> 1 (inc)) are identical

18:18 angerman: somethings I really feel retarded.

18:18 brehaut: angerman: as long as you know its also identical to (inc 1) ;)

18:19 angerman: O_O

18:19 :D

18:19 danlarkin: the's the ever popular ((comp inc) 1)

18:19 brehaut: im quite fond of ((comp first (juxt inc)) 1)

18:22 lancepantz: i think this is how obfuscated code contests begin :)

18:22 brehaut: lancepantz: that sounds like a challenge :P

18:24 danlarkin: bam ((comp first ((partial juxt inc))) 1)

18:25 brehaut: ((comp first ((partial juxt (resolve (symbol (apply str (map char '(105 110 99)))))))) 1)

18:25 danlarkin: ooooh that's good

18:25 real good

18:25 brehaut: i think we can do better though

18:25 danlarkin: this is hiredman's specialty

18:25 brehaut: arrows!

18:26 technomancy: clojurebot: arrows!

18:26 clojurebot: arrows is http://ro-che.info/ccc/12.html

18:26 technomancy: ,botsnack

18:26 clojurebot: java.lang.Exception: Unable to resolve symbol: botsnack in this context

18:26 technomancy: ...

18:26 brehaut: dire

18:27 baha that comic is awesome

18:27 danlarkin: one does not simply evaluate botsnack

18:36 cemerick: hiredman: Is your only objection the wire protocol?

18:38 hiredman: cemerick: that was as far as I got implementing it, if there wire protocol stops being a blocker, I may find other things

18:39 but given that the wire protocol opens the door to evaling things, seems like anything else could be worked around

18:40 infact I worked around the wireprotocol by sticking bytebuffers in a blocking queue and extending IOFactory to lbq's and having a thread that just read from there, but I really wasn't happy with it

18:40 cemerick: hiredman: so you're doing this from Java or Clojure already?

18:41 hiredman: clojure

18:41 why would I did this from java?

18:41 cemerick: why not use the nREPL client that's already there?

18:43 hiredman: because I was trying to write a single threaded polling translator between nrepl and slime, and currently reading from nrepl requires blocking, complicated parsing, or a seperate thread

18:43 which if you are trying to forward stuff back and forth between sockets in a single thread is bad

18:44 cemerick: hiredman: OK. Help me fully understand your objection -- so this is not just a matter of protocol design hygiene?

18:45 hiredman: you cannot know how many bytes you need to read from the wire in order to have read the entire message

18:47 cemerick: I got that, I'm just being dense about why that matters. The number of lines (2 * entries) is known, so why isn't that effectively the same thing?

18:47 hiredman: no!

18:47 byte count and number of lines are not the same thing

18:47 cemerick: surely not

18:47 *functionally* the same thing

18:47 hiredman: with line count in order to determinte the number of bytes to read you have to scan through the byte stream as you reading looking for newlines

18:48 cemerick: sure

18:48 why is byte count important?

18:48 * cemerick is trying to understand the use case, not be difficult

18:48 hiredman: you mean my exact use case?

18:49 cemerick: sure

18:49 hiredman: with nio you don't use io streams

18:49 you hand a byte buffer to a channel and say "fill this up with bytes"

18:49 cemerick: oh, NIO!

18:49 See, I missed that in your message from earlier.

18:50 OK, now I see your objection.

18:50 hiredman: newline seperation and line count are only useful if you only plan on implementing on top of line reader type things

18:51 cemerick: which is what I was aiming for. *shrug*

18:51 I've never had any use for NIO.

18:51 hiredman: so you're working on a SLIME/swank <-> nREPL bridge?

18:52 hiredman: I was, just fun, not something to release, standard disclaimers, etc

18:52 cemerick: OK; in that case, do you believe implementing such a thing would require a nonblocking implementation in any case?

18:54 hiredman: cemerick: doesn't require, but I was enjoying writing one until I ran into this issue with nrepl

18:59 cemerick: The fact that there are no CharChannels is unfortunate

19:00 I *really* don't want to start dropping byte counts into a stream that's just UTF-8 all the time, period.

19:02 hiredman: cemerick: a fixed number of utf-8 characters has a fixed byte count

19:02 cemerick: hiredman: not above \u0255

19:02 hiredman: (format "%06x" 10)

19:03 ,(format "%06x" 10)

19:03 clojurebot: "00000a"

19:03 hiredman: numerals are not above that

19:03 the entire thing doesn't need to be fixed, you just need a fixed header that gives you the byte count of the rest

19:04 cemerick: I'm not saying that the numerals are going to be outside the UTF-8 range or byte ordering, I'm saying I don't like mixed-mode representations.

19:04 hiredman: mixed mode in what way?

19:05 cemerick: it's a stream of chars that has a byte-counts in the middle of it

19:06 it's not a functional objection, only a hygenic one.

19:06 reminds me of PDF in an unfortunate way, actually

19:06 hiredman: not functional?

19:07 cemerick: I mean, what you're suggesting will work just fine, I would just consider it warty.

19:07 hiredman: in what sense?

19:08 cemerick: it's no longer a pure text protocol

19:09 anyway, the bigger problem is this would make reader-oriented clients impossible

19:09 hiredman: not true

19:09 oh, maybe true

19:10 cemerick: you'd have to go along counting bytes of each char or string you read

19:10 yack

19:10 I'll have to think about things a bit more.

19:11 hiredman: thank you for the discussion.

20:48 developernotes: I've created a new project with lein and added compojure and ring as dependencies to my project file. Following the example given for compojure (https://github.com/weavejester/compojure), I placed that content in a clj file within the project src, what is the best way to run it?

20:49 brehaut: developernotes: first place to start is 'lein repl' to load an interactive shell

20:49 developernotes: I've also already run lein deps

20:49 brehaut: Okay, I've done that now, but it doesn't seem to have started jetty.

20:49 brehaut: nope

20:49 its just a 'bare' repl

20:50 you need to load your namespace

20:50 assuming you have src/hello_world.clj with hello-world defined as the ns as per the example

20:50 (use 'hello-world)

20:50 developernotes: brehaut: I didn't scope it to a specific namespace, does that default to user ns?

20:51 brehaut: can you put your file onto a gist or a paste site?

20:51 developernotes: brehaut: http://pastie.org/1697996

20:54 brehaut: so there is no way to treat it like a script, where it would just execute upon loading the repl. Is there a prefered way of doing something like this?

20:55 brehaut: developernotes: you could (load-file "path") i guess

20:55 technomancy: lein run would do what you want given the proper -main function

20:55 brehaut: i think pastie.org hates me

20:57 developernotes: clojure isnt well suited to being used as a scripting language

20:58 developernotes: technomancy: ah, cool - I'll check that out.

20:58 brehaut: developernotes: in this instance load-file should work. you'll need to namespace it for a -main anyway

20:59 alternatively if you just want to run code interactively, you could paste it into you repl (though i would add :join? false to the run-jetty options map)

21:06 TimMc: Nothing JVM-based is conducive to scripting. :-(

21:07 brehaut: TimMc: depends how long running your scripts are :P

21:22 developernotes: brehaut: thanks

21:22 technomancy:

21:22 technomancy: thanks

21:23 brehaut: no worries

22:06 d5dq: #(for [i (range 0 2)] (print i))

22:12 phenom_: arghh! what's the plan for leiningen's support for polyglot projects ?

22:12 i want to write a peice of my code in scala :S

22:18 brehaut: phenom_: if its not built in, that sounds like something that belongs in the realm of a plugin

22:28 phenom_: a quick dig through the code seems to imply that javac tasks are farmed out to ant via lancet under the hood. presumably if scalac has ant tasks, you could fairly trivially do the same with a scalac pluggin

22:30 phenom_: and ant does have scala tasks

22:30 phenom_: http://www.scala-lang.org/node/98

22:45 Null-A: "WARNING: to avoid creating extra keys in aws-ec2, use templateOption overrideLoginCredentialWith(id_rsa)" what are extra keys?

23:02 devn: lein-search needs to be included by default in lein

23:56 LuminousMonkey: Does anyone know if it's possible to have a native library working with lein unberjar? I'm using the RxTx library, and I have native deps working fine with a repl/swank. But I have no idea on how to package it up into a single JAR file.

23:56 Whoops, uberjar I mean.

23:57 technomancy: devn: working on it

23:58 devn: the current version only works with clojars though, which is lame. I'm working on a lucene version that can work with standard mvn lucene indices.

Logging service provided by n01se.net