#clojure log - May 27 2011

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

0:12 JulioBarros: I'm trying to :use the webmine jar (not just infer now) but I get the message -- java.lang.IllegalAccessError: silent does not exist (message.clj:1)

0:15 tomoj: did you build a webmine jar manually or something?

0:16 or did you just add webmine to your lein/cake deps

0:16 /maven/whatever

0:16 JulioBarros: Both ways.

0:17 tomoj: do you have "silent" in your message.clj?

0:17 JulioBarros: :) I don't know what that means ... let me check.

0:18 its essentially a blank lein project with a couple of dependencies added so i can play with the repl

0:18 tomoj: well where is message.clj?

0:18 JulioBarros: I don't think I have a message.clj

0:18 tomoj: I don't see one in webmine

0:19 you're using lein?

0:19 oh, yes

0:19 JulioBarros: yes. there were some other deps.. let me remove them.

0:19 tomoj: well, if you leave them you can find which has message.clj

0:20 ls lib/*.jar | xargs -n 1 jar tf | grep message.clj

0:20 seems to work

0:22 amalloy: tomoj: neat, i didn't know about the -n option

0:23 i'd have written it as $ find lib -name '*.jar' -exec jar tf '{}' \; | grep message.clj

0:23 JulioBarros: hmm didn't find anything. But removed the lib dir, did a lein deps and seems to be happy now. Thanks. Did not understand the error message

0:24 tomoj: I never learned find

0:24 amalloy: JulioBarros: that's often the case with Errors. Exceptions usually mean "you should have been ready for this or could have prevented it", while errors are "holy cow wut is going on here"

0:24 tomoj: a nice pair to xargs. i learned xargs because it was useful for find

0:25 but the syntax is arcane and verbose

0:25 find . -name '*.svn' -prune -or -type f -print0 | xargs -0 grep 'testing'

0:26 avoids including files under .svn in your grep results

0:27 (and also works for filenames that have whitespace in them, thanks to -print0 and -0)

7:21 fliebel: Does anyone know if its possible to send a CA via telefax?

7:23 ejackson: what is this telefax of which you speak ?

7:25 fliebel: ejackson: It's like snailmail, only faster. ;)

7:26 But, I just noticed my CA did came through. After over a month, I'm suddenly listed on the contributing page!

7:27 * fliebel goes of contributing

7:27 * manutter wonders if "telefax" is the non-US term for a fax...?

7:27 fliebel: manutter: It's just the full name, like a piano is actually called a piano-forte.

7:28 manutter: Ah, I suspected. Around here the full name is "facsimile"

7:28 which nobody *ever* uses

7:29 * fliebel laughs

7:30 manutter: back to debugging php (sigh)

7:30 fliebel: $mail dnolen wee, I showed up on the CA page. Patch coming soon.

7:30 sexpbot: Message saved.

7:34 fliebel: $mail dnolen You said you had a branch with a project.clj. can haz?

7:34 sexpbot: Message saved.

7:42 jochen: hi, I have a question about jline - it does not work on my mac in console as it always scrambles edits of history values. Any idea how to fix this?

7:45 fliebel: jochen: Install readline?

7:46 I've had the same problem in 3 places now, installing readline solves them all.

7:46 (3 places, Clojure, Python, Ruby)

7:47 jochen: sounds good. I'll give it a try...

7:49 fliebel: Hm, okay, let me see... a protocol. Does I define the 'this' argument? What's up with varargs?

7:52 tsdh: Is it required (or good practice) to line up namespaces with files and directories, or is that arbitrary?

7:53 clgv: fliebel: protocols do not support varargs - I tried unknowingly and failed with strange errors ;)

7:54 fliebel: clgv: That's what I thought, but since varvargs are implemented as an array in java land anyway, I thought maybe the implementations could do it.

7:54 clgv: fliebel: I didnt find the place were I could put a ticket for it, since I thought that error message had to be fixed to be more explicit

7:55 manutter: tsdh: I believe the reader parses the namespace notation to get the file path for loading the file (in use/require), so I'd say yes, it's mandatory

7:55 clgv: the & of the varargs declaration was interpreted as a parameter symbol '&

7:55 tsdh: manutter: Ok, thanks.

7:58 fliebel: clgv: I know, but if you define [x y] and implement [x & y] the java is going to look like [x OBject...] I think.

7:59 clgv: fliebel: you can try. make a blog post in case you succeed ;)

8:00 fliebel: clgv: will do :)

8:00 tsdh: Should namespaces better use _ or - for compound words? It seems that both work...

8:01 fliebel: fail

8:01 tsdh: -, but _ in filenames

8:01 manutter: tsdh: use -- doh, fleibel is too quick

8:01 what he said.

8:01 tsdh: Allright, thanks.

8:02 fliebel: manutter: Practice your ninja skills, even I am to slow most of the time.

8:03 manutter: The dash is good practice in clojure, but Java requires underscores, which is reflected in the file names. So clojure does the dash-to-underscore mapping automatically in namespaces and filenames

8:03 fliebel: :)

8:04 fliebel: manutter: Hehe, the StackOverflow rule also applies here. Deep answers beat quick ones.

8:07 manutter: Well, there's a place for both

8:07 fliebel: :)

8:08 Anyone knows how to get a quick repl in a clojure project using maven?

8:10 hm, seems `rlwrap mvn clojure:repl` works, but... hm, I don't know.

8:12 clgv: rlwrap is great :D

8:15 crystalblue66: www.xxxlivecam.info

8:15 * manutter cheers for idoru

8:19 jochen: yea, just dropped jline and used readline/rlwrap and everything is working greate. thanks!

8:32 manutter: wow, installing readline just made jark repl work for me, cool

8:32 It worked before, but no cursor key functions

8:32 fliebel: manutter: I told you, it makes everything work :)

8:32 manutter: Now if it would just fix this php bug, which unfortunately has nothing whatsoever to do with command histories...

8:38 fliebel: $mail dnolen Done! http://dev.clojure.org/jira/browse/LOGIC-2

8:38 sexpbot: Message saved.

8:39 fliebel: manutter: I bet it's dynamic scope or weak typing :)

8:39 manutter: not a bad bet, under the best of circumstances :)

8:48 * fliebel pondering contributing to clojure itself

8:51 _fogus_: fliebel: You kinda just did. :-)

8:51 fliebel: _fogus_: meh, that's contrib, right?

8:52 _fogus_: Now that you're here. What's up with your Forht? You said something about JVM bytecode.

8:52 _fogus_: fliebel: the core.logic stuff has great potential for eventual inclusion IMHO

8:52 (don't quote me)

8:52 manutter: ,(quote _fogus_)

8:52 clojurebot: _fogus_

8:52 clgv: lol!

8:52 manutter: Hah, couldn't resist

8:53 clgv: &(don't quote me)

8:53 * `fogus syntax-quoted himself

8:53 sexpbot: java.lang.Exception: Unable to resolve symbol: don in this context

8:53 clgv: ;(

8:53 * clgv is wondering to what fogus will resolve ;)

8:54 manutter: So "Forht" -- typo for "Forth"?

8:54 fliebel: _fogus_: Really? For the dispatch and type stuff? Because logic programming is not something everyone in here is using, it seems.

8:54 manutter: yea, I do typos ;)

8:54 manutter: just wondering

8:54 * manutter has fond memories of his Forth programming days

8:54 manutter: on a commodore 64 no less

8:55 `fogus: fliebel: That is a long way off, so it's hard to say exactly how it might fit

8:55 but that is a good bet

8:56 fliebel: `fogus: Okay, cool :) Right now I'm giving IAtom a try. If I remember correctly, rhickey was at least not against the idea.

8:56 `fogus: fliebel: Hmmm, I'm not familiar

8:57 fliebel: `fogus: Basically Atoms does not have an interface, and I found a valid usecase for wanting one.

8:57 `fogus: Oh. Do you have a repo?

8:58 fliebel: `fogus: repo? why? clojure doesn;t do pull request, right?

8:58 `fogus: Oh, I just meant if you had a branch to look at I would like to see. :-)

8:59 fliebel: `fogus: nothing yet. But uhm, did you read my Forth question?

8:59 `fogus: fliebel: I'm sorry I missed it I think

9:00 fliebel: `fogus: You tweeted about JVM bytecode for your Forth. What was that about, I could only find Ruby.

9:00 `fogus: Oh right!

9:01 I was just playing around. Gen'ing JVM bytecode requires you juggle the stack, so I made an awkward parallel to Forth. I guess the joke was not very funny

9:03 fliebel: `fogus: Hm, I thought you where writing a Forth in Java :(

9:03 `fogus: nah

9:04 manutter: too bad, I used to love Forth

9:04 My copy of the Forth Encyclopedia got destroyed by a leaky basement wall :(

9:04 `fogus: I keep playing with the idea of a froth in Clojure, but that is around #1000000 on my priority list

9:05 s/froth/forth/

9:05 sexpbot: <> I keep playing with the idea of a forth in Clojure, but that is around #1000000 on my priority list

9:05 manutter: wow, you've discovered how to anonymize yourself to sexp!

9:06 Forth in clojure, now that would be fun

9:09 fliebel: When I asked the Forht people, they said that wasn't fun at all and assembly was the only fun way to do it :)

9:11 clgv: humm forth seems to be pretty hard to be spelled correctly, as one can observe here ;)

9:11 manutter: Well, yeah, they WOULD say that, they're Forth people

9:11 :)

9:12 tufflax: Hm, what is wrong here? http://pastebin.com/AnuuKxGd

9:12 fliebel: clgv: meh, it's just a few things I keep writing wrong.

9:13 clgv: fliebeL: just noticing, not complaining at all ;)

9:13 fliebel: clgv: it;s true. ;)

9:15 * fliebel just wrote java

9:16 tufflax: eww

9:16 Pisketti: Java pays the rent

9:16 As sad as it may sound

9:17 joly: It's a really annoying tenant though

9:23 abedra: `fogus, Fjorth

9:24 `fogus: cljoy

9:24 raek: tufflax: have you compiled the namespace?

9:24 fliebel: abedra: I love that!

9:25 PostClojure ;)

9:25 We had Lisp machines, but do we have Lisp printers as well?

9:25 jweiss: anyone here use clj-http? looking for a way to get the response body for error statuses like 500. the client just throws Exception

9:31 tufflax: raek yes i think so, anyway it worked when i restarted the repl, don't know exactly what happened :p

9:33 tsdh: If (class x) returns foo.bar.Baz, how is it possible that (Class/forName "foo.bar.Baz") throws a ClassNotFoundException?

9:38 raek: tufflax: gen-class doesn't work well with interactive development in the repl. once the class has been compiled, it can never be changed (due to how the JVM works)

9:39 tufflax: gen-class is designed to be used when you need an interface to your code that a Java program can hook into

9:39 tufflax: raek oh, yeah im noticing more problems now

9:40 raek: tufflax: I would recommend using proxy if you can. it is completely dynamic

9:40 it's built for the reverese situation: when you want clojure code to hook into java code

9:40 tufflax: ok i was about to ask that. but you kind of saw what i was doing, do you think proxy is the right move?

9:41 oh, ok then

9:41 that sounds right

9:41 thank you

9:42 raek: I recall that there are certain things proxy cannot do, but in those cases you can always make a thin wrapper class in java that is more proxy-friendly

9:42 tufflax: ok

9:43 fliebel: I'm sure I wrote down the IAtom problem down somewhere before, but I can't find it. Can someone who understand Jira make sure I don't create a duplicate issue?

9:43 This thing doesn't work for me: http://dev.clojure.org/jira/secure/IssueNavigator.jspa

9:44 manutter: jweiss: I think you can use core/request instead of client/request to get the basic functionality without the built-in error-status->exception stuff.

9:44 you can add in the appropriate client/wrap-X functions if you need them for like redirects and stuff

9:45 raek: tufflax: but yes, I recommend proxy over gen-class in general, unless you are designing a java api to your project

9:45 manutter: should be able to anyway, never tried it myself.

9:45 jweiss: manutter: actually it looks like in the latest ver you can put the entry :throw-exceptions false in the req map

9:45 haven't tried yet, but i see it in the source.

9:45 manutter: sounds promising

9:46 tufflax: raek: thanks again, this made my life much easier :)

9:47 fliebel: ~logs

9:47 clojurebot: logs is http://clojure-log.n01se.net/

9:51 raek: tufflax: just remembered the limitation: proxy can't access protected members of its superclass

9:58 fliebel: IAtom issue created: http://dev.clojure.org/jira/browse/CLJ-803

10:08 tsdh: Argh, how do I call invoke(Object, Object...) on a java.lang.reflect.Method object?

10:08 mefesto: tsdh: i think you need to pass your params as a java array

10:08 tsdh: The signature of the method is foo(String, int, int).

10:09 I've tried (.invoke m receiver "foo" 1 1) ==> No matching method found.

10:09 mefesto: (.invoke method target (into-array [p1 p2]))

10:10 tsdh: (.invoke m receiver (into-array Object ["foo" 1 1])) ==> argument type mismatch

10:16 Oh, it's a static method. So in fact I should call (.invoke m nil (into-array Object ["foo" 1 1])), but that doesn't change anything.

10:17 In Java, the call is graphCreateMethod.invoke(null, "foo", 1, 1) which works fine...

10:20 mefesto: hmmm it seems to work for me using String.indexOf

10:20 i'll gist it

10:22 tsdh: Hm, I'm even not able to get the Method Long.parseLong(String, int).

10:22 mefesto: https://gist.github.com/995339

10:22 tsdh: (.getMethod (class Long) "parseLong" (into-array Class [String Integer/TYPE]))

10:22 ==> NoSuchMethodException

10:22 mefesto: oops

10:23 revised: https://gist.github.com/995339

10:24 tsdh: Ah, yeah. s/(class Long)/Long in my code..

10:26 tufflax: raek: yeah i noticed. Hmm, what if I wanted something like proxy but that could access protected members? Am I out of luck?

10:26 tsdh: mefesto: Hm, but somehow, that doesn't do the trick for static methods...

10:28 mefesto: http://pastebin.com/sWi8VJL4

10:35 Luyt: heh, I was installing SLIME at work today, and wanted to know more of SWANK... If you search WikiPedia for 'swank', you'll get something else than you expect!

10:36 tsdh: Luyt: Haha, but looks good, too. ;-)

10:36 Luyt: My coworkers thought I was browsing porn instead of getting stuff working

10:37 mefesto: tsdh: get static method working?

10:37 Long/valueOf => https://gist.github.com/995369

10:37 tsdh: mefesto: Nope, do you?

10:38 mefesto: Yeah, that works. But not the one with the 2-args signature.

10:38 ilyak: I have a value and I want to do various things depending on that value

10:38 Like java switch, without creep

10:38 What's the best way to do that in clojure?

10:38 mefesto: tsdh: in your example, you should pass the class as the target and not nil

10:39 fliebel: ilyak: creep? there's just switch in clojure as well. or you can do... moment

10:39 ilyak: Can't find switch in http://clojure.org/cheatsheet

10:40 creep is break;

10:40 mefesto: tsdh: (.invoke m Long (into-array Object ["111" 2]))

10:40 tsdh: mefesto: Yes, just checked, same error.

10:40 fliebel: &(case :a :b 1 :c 2 :a 2)

10:40 sexpbot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.MapEntry

10:41 fliebel: ??? works in my repl

10:41 tsdh: &(let [m (.getMethod Long "parseLong" (into-array Class [String Integer/TYPE]))] (.invoke m Long (into-array Object ["111" 2])))

10:41 sexpbot: java.lang.SecurityException: You tripped the alarm! package java.lang.reflect, Java Platform API Specification, version 1.6 is bad!

10:42 ilyak: And I also can't find case in http://clojure.org/cheatsheet

10:43 fliebel: $doc case

10:43 tsdh: mefesto: That's what I get (clojure 1.3) http://pastebin.com/02AmhKFW

10:43 fliebel: &(doc case)

10:43 sexpbot: ⟹ "Macro ([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need no... http://gist.github.com/995384

10:43 mefesto: tsdh: https://gist.github.com/995383

10:44 tsdh: oh, I'm on clojure 1.2

10:44 fliebel: Python-style switch: ##(({:a #(+ 1 %) :b #(* 2 %) :c identity} :b) 3)

10:44 sexpbot: ⟹ 6

10:45 bsteuber: tsdh: try ["111" (Integer. 2)]

10:46 btw. (into-array Object …) == (to-array …)

10:48 tsdh: bsteuber: Oh, that does the trick. Thanks!

10:49 bsteuber: tsdh: yeah, Java-interop got a bit ugly with clojure's new "tread all ints as long" policy

10:50 so you have to explicitly cast everything where java expects an int

10:58 ilyak: case doesn't work on me

10:58 it seems to always invoke the first branch

11:00 Never mind

11:00 I'm an idiot

11:11 tsdh: Is there a way to enable assertions in a repl session?

11:17 dnolen: fliebel: thx for the patch! I'll try to take a closer look at it in the next day or so.

11:17 fliebel: dnolen: cool

11:21 dnolen: I discovered I have the same thing for macros as you have for performance. This makes me vurnerable to amalloy's strategy as well :(

11:22 ilyak: Does clojure have continuations passing in the form of lazy list constructed with yield?

11:22 fliebel: ilyak: It has neither first class continuations nor a yield statement.

11:22 dnolen: ilyak: no, but I wrote something more powerful than that, delimc, https://github.com/swannodette/delimc

11:23 fliebel: amalloy's strategy?

11:23 fliebel: dnolen: Have an idea, and tell you it can be done faster in Java so that you'd write it for him.

11:23 ilyak: fliebel: sad

11:24 dnolen: Any cookbook?

11:24 fliebel: ilyak: Why do you need them?

11:25 dnolen: The same could be done by writing a broken macro for said idea and tell me it can;t be done with functions.

11:25 TimMc: fliebel: Similarly, the fastest way to get help in Linux is to loudly proclaim "$FOO cannot be done in Linux!" :-)

11:28 dnolen: ilyak: cookbook?

11:30 fliebel: ah yes :) yeah it's nice how you got rid of macros.

11:30 fliebel: making fact a function is very useful.

11:31 tsdh: What's the right way to set *print-length* (or any other global var)?

11:32 fliebel: dnolen: Maybe it should return the new set, not the index... And yea, useless macroes in libs annoy me endlessly.

11:34 dnolen: fliebel: heh, I try to keep my macro usage quite low, but I was too busy thinking about other things to see the advantage of using protocols/types here. That's the beauty of open source, other people see things you don't and fix them.

11:41 fliebel: dnolen: What where the args in defrel originally used for?

11:42 dnolen: fliebel: nothing really, was a half-baked step towards allow indexing any element of the rel tuple.

11:43 fliebel: dnolen: Ah, okay. Because, after I was done writing my version, I found nowhere to put them.

11:44 dnolen: fliebel: in hierarchy you'd want to be able to efficiently calculate the reverse direction. you want to index a *and* b.

11:47 tsdh: Hm, I have test/a.clj and test/b.clj, where b has (:use [test.a]) in its ns definition. But I cannot refer to the functions of test.a from b. Why?

11:48 manutter: tsdh: heh, been there

11:48 wait, no I read that wrong

11:48 tsdh: manutter: Argh, in the REPL it works. But not with cake test or lein test.

11:49 manutter: had my "to" and "from" reversed . Yes, you should be able to (:use [test.a]) in test.b and have access to a's functions

11:50 kill your repl and restart? Maybe there's some other problem masquerading as a missing function

11:51 ilyak: dnolen: Examples of doing useful things

11:52 Leonidas: I am using pcalls but the program acts strange: http://paste.pocoo.org/show/396267/

11:52 it displays "running" 3x and 42 which is fine

11:52 but then it just hangs

11:53 dnolen: ilyak: I have no such cookbook, but there is a lot of Scheme literature, FP literature, and much of the descriptions about yield apply.

11:54 tsdh: manutter: I'll try that.

11:55 manutter: Ok, then I get that error there, too.

11:56 * tsdh is an idiot! He had (:use [test.b]) in (ns test.b)!

12:02 dnolen: this would be fun to port to core.logic, http://stackoverflow.com/questions/3702855/typing-the-y-combinator/4962741#4962741

12:19 ilyak: Is it possible to call an anonymous function from itself not from the tail position and without resorting to Y combinator?

12:19 dnolen: hmm 1.3.0 alphas no longer support unsynchronized primitive fields - also transient field support would be nice.

12:19 ilyak: (mistyped "from the fail position")

12:24 hugod: &((fn f [x] (println x) (if x (f false))) true)

12:24 sexpbot: ⟹ true false nil

12:34 jarpiain: woot, my compiler patch was committed :)

12:37 chouser: jarpiain: Congrats! are you going to present your compiler at ClojureConj

12:37 ?

12:38 jarpiain: chouser: (that was the fix for CLJ-671)

12:41 chouser: btw, did you get the reply to the mail you sent some 2 weeks ago?

12:43 jsanda: hi all, is there a way to make one protocol extend another?

12:45 dnolen: jsanda: not really.

12:45 jsanda: ok, thanks. wasn't sure

13:00 robonobo: is there any way using pprint in the main method won't work after you generate an uberjar with lein?

13:00 ataggart: stuarthalloway: anything need working on?

13:02 robonobo: %

13:05 stuarthalloway: ataggart: caught in meeting, may have something shortly, and/or check with redinger

13:09 edw: I feel the need to share: I just built a program to create a Markov model of incoming keywords and then used it to create a list of all (finite) vaguely-human seeming possible keywords. Woot!

13:23 raek: tufflax: the easiest way is probably to write a helper class that can access them and let it have methods that delegate to the protected members

13:43 amalloy: fliebel, ilyak: in 1.2.x, case has a bug that makes (eval (macroexpand `(case ...))) not work

13:47 edw: shamboogle. wzinlcbq

13:48 * amalloy hopes the bot is taking notes

13:49 manutter: ~botsnack

13:49 clojurebot: thanks; that was delicious. (nom nom nom)

13:49 manutter: well, he's taking something anyway...

14:03 edw: amalloy: I hear you.

14:03 tufflax: raek: Yes perhaps. In that case, can I have the java files in a lein project and have lein compile and load them?

14:11 raek: tufflax: yes. if you add :java-source-path "src/" to your project.clj, Leiningen will compile .java files there when you run lein compile

14:11 redinger: ataggart: Any chance you could write a small test case for CLJ-801 that actually demonstrates the problem?

14:11 raek: the generated .class files will also be on the classpath

14:12 tufflax: nice

14:12 technomancy: redinger: heyyyy, could I get the sonian blurb on the clojure wiki fixed?

14:12 redinger: technomancy: yeah

14:12 raek: (loading is done automatically by the JVM when the class is fist used)

14:12 *first

14:12 redinger: technomancy: What's the fix?

14:12 tufflax: oh ok

14:12 ataggart: redinger: I tested it manually by altering MethodImplCahe to accept Objects instead of only Classes, but I didn't want to check in that change. It's fairly difficult to find classes that result in a hash collision.

14:13 redinger: if Rich et al. are okay with MethodImplCache being defined as accepting Objects, then I can write a permanent test case.

14:13 technomancy: redinger: could you replace the second sentence with "Sonian deploys large clusters running Clojure to perform parsing, archival, and indexing of many terabytes of email and other documents."?

14:13 redinger: ataggart: Do you have your manual test hanging around? Even getting that in the ticket would be helpful

14:15 technomancy: done

14:17 ataggart: redinger: I don't. I just used the values from the case tests and called expand-method-impl-cache. I could write the tests, but they wouldn't break if run. I'm open to suggestions.

14:17 technomancy: hmm; that chance appears to have taken confluence down.

14:17 *change

14:17 eep

14:18 ah ok, it's back

14:18 thanks!

14:38 zakwilson: http://correlate.googlelabs.com/search?e=clojure&t=weekly <-- Clojure is evidently correlated with porn (SFW unless you have an overzealous keyword-based web filter)

14:39 manutter: zakwilson: heh, now try that with Compojure

14:40 zakwilson: manutter: the assortment of things is near random

14:40 manutter: yeah, but it's STATISTICALLY SIGNIFICANT!!

14:41 I mean, hey, it's from Google, right?

14:41 :)

14:42 zakwilson: "When machine learning attacks", featuring cancerous neural networks and support hostile-vector machines

14:42 TimMc: zakwilson: And "Python" with "cancerous tumor". :-D

14:43 ataggart: redinger: I'm writing a separate test patch that alters MethodImplCache. It probably shouldn't be committed, though.

14:43 `fogus: ataggart: I will not be. :-)

14:43 It that is

14:44 ataggart: Anything that would shed some light on the problem being addressed would be a huge help

14:45 ataggart: `fogus: ah, I wasn't aware there wasn't clarity on the nature of the bug itself.

14:46 __name__: is writing an alpha-beta pruning AI in clojure sane or will i run into performance issues?

14:48 `fogus: ataggart: The problem makes sense, but when I screen a ticket I like to create regressions. In this case, (as you said) it's tough to find a case to illustrate the problem, especially as some who has not experienced the problem and did not write the patch.

14:48 redinger: ataggart: Yeah, I was just looking for an example rather than necessarily a test we need to commit

14:49 I was hoping we could pull something from Tassilo's code, but it wasn't immediate obvious how to grab something small

14:49 ataggart: can someone remind me of the trick to call a private defn

14:50 from outside that ns

14:50 `fogus: (#'foo)

14:50 ataggart: thx

14:51 edw: Internal DEFNs: Considered harmful or OK?

14:51 dnolen: edw: undiomatic, defs are always top level.

14:52 edw: so no point really.

14:52 manutter: there's always letfn if you need it

14:52 edw: Just trying to group my procs so people understand what's going on.

14:55 manutter: by "internal defn" I'm assuming you mean defining a function inside a function definition?

14:56 edw: Yes. (My native language is Scheme.)

14:56 amalloy: yeah, considered harmful

14:56 raek: edw: in the aspaect of scoping, def in clojure does not work like define in scheme at all

14:57 amalloy: in particular, (defn foo [x] (defn foo* [x y z]...)...) would put both of them in the global scope anyway

14:57 edw: raek: Right, I just picked that up from dnolen.

14:58 DEF is dynamically scoped... That didn't quite sink in when someone wrote that the other day.

14:59 LETFN successfully deployed: thanks manutter.

15:00 manutter: I never used to use letfn, then I started doing the 4clojure exercises :)

15:00 lucian: edw: def being dynamically scoped seems very odd to me

15:00 manutter: very handy there

15:00 lucian: it seems like the entirely wrong and surprising thing to do

15:01 dnolen: lucian: edw: what is meant by dynamically scoped in this context ? certainly not what dynamic scope generally means in Clojure.

15:02 edw: lucian: Yeah, "Never put a DEFx form *anywhere* but the top level of a source file" seems like correct advice to a third or fourth approximation.

15:02 lucian: dnolen: uh, globally scoped it seems, not dynamically

15:02 edw: lucian: I used that word--repeating what I read the other day.

15:03 lucian: i don't get why *anything* in clojure would be dynamically scoped

15:03 edw: Saying "dynamic scoping" just makes it seem more horrible.

15:04 gfrlog: lucian: did you just make a pun out of asterisks?

15:04 lucian: also, i don't get why anything would be global by default. i'd expect the reverse for everything

15:04 gfrlog: uh, not really :)

15:04 gfrlog: lucian: all the more clever then

15:04 dnolen: edw: lucian: even 'global scope' is inaccurate since you have namespaces.

15:04 TimMc: gfrlog: :-D

15:05 raek: also, in 1.3 a re-def will cause recompilation of all functions

15:05 lucian: dnolen: sure. still not lexical & local

15:05 raek: (not at once, but when they are called)

15:05 dnolen: raek: not true, I mistakenly thought that as well. caches get reloaded.

15:05 raek: aha.

15:05 edw: raek: I'm trying to wrap my head around the implications of that.

15:07 raek: my understanding was that if foo v1.0 call bar v1.0, foo v1.0 will have a hardcoded reference to v1.0

15:07 and when bar changes to v2.0, foo v1.0 needs to be recompiled

15:07 dnolen: raek: yeah that's not true.

15:07 raek: but this is probably not quite what happens

15:08 dnolen: raek: there's a lot of implementation details - but the only real difference for 1.3.0 users is that vars are not dynamically rebindable by default.

15:09 raek: I guess I was conflating this with the old :static thing

15:10 edw: dnolen: That doesn't apply to the REPL though, right?

15:11 dnolen: edw: ? why should it not apply? The REPL is really all of Clojure.

15:12 gtrak``: Raynes, know what's up with tryclojure? i get 'Permgen Space'

15:13 Raynes: gtrak``: That's something that happens occassionally when people breakify it. I'll restart it. Thanks for letting me know.

15:13 TimMc: dnolen: Because rebinding in the REPL is... handy.

15:13 edw: dnolen: Umm, I must be misinterpreting what "rebinding vars" means, as the REPL is all about re-defining the same var over and over.

15:13 dnolen: TimMc: do we understand what 'rebinding' means in this context ?

15:13 TimMc: probably nto

15:14 dnolen: you can (def x 1) (def x 2) all you want, just as you always could.

15:14 I'm talking about (binding [foo 1] ...)

15:14 TimMc: arg, right

15:15 dnolen: So (def x 1) (def x 2) would still work in programs, and still be frowned upon.

15:16 dnolen: TimMc: frowned upon in completed programs, not during development.

15:16 TimMc: rigth

15:18 Raynes: gtrak``: Up again.

15:46 ataggart: `fogus redinger: test patch on CLJ-801

15:50 `fogus: ataggart: Thank you sir

16:16 dnolen: When should I see the validation error in your :unsynchronized-mutable example?

16:19 dnolen: `fogus: checking.

16:27 `fogus: blarg, sorry turns out this in fact a issue w/ numerics, but the behavior is as expected.

16:29 `fogus: dnolen: So is this not a bug?

16:30 dnolen: `fogus: 1.3.0 defaults to long, but if you want int you have to remember to coerce.

16:30 `fogus: dnolen: The verify error that you mentioned was not a JVM bytecode verification error ?

16:31 dnolen: `fogus: I had something like (set! x 1) in my code, which was fine. But whenever I set the type of the field, the compiler would complain, so I thought the problem was a mutable field + type hint in 1.3.0. It was a JVM byte code error. Expecting I() on stack.

16:32 `fogus: dnolen: That error could probably stand to be more graceful

16:39 dnolen: Thanks for posting about it.

16:40 dnolen: `fogus: any thoughts about the transient bit?

16:41 `fogus: dnolen: Not at the moment, but I will meditate on it this long weekend. :-)

16:44 hugod: dnolen: is there a pattern matching example for core.logic?

16:45 dnolen: hugod: yes it one of the first examples on the github landing page show that in action.

16:46 hugod: apologies for the state of the documentation. I've created a wiki on the project page, I'll try to flesh it out with some examples.

16:48 hugod: dnolen: thanks for what there is; I know what a headache documentation can be when things are still moving fast

17:25 crowbar: I'm running swank-clojure connected to an emacs session. When I run a evaluate some code that opens a JFrame which has an EXIT_ON_CLOSE associated it ends up killing me slime repl. Is there a way to keep the swank/slime repl alive?

17:37 amalloy: crowbar: don't use System.exit if you don't want the system to exit :P

17:38 DISPOSE_ON_CLOSE is more flexible for an app that might have other threads running that you care about (for example, your swank server)

17:38 crowbar: You win this round.

18:38 Crowb4r: hey the real crowbar

18:38 lol

18:39 well other crowbar

18:51 devn: hello

18:52 hello folks

18:52 whoops -- making the rounds this afternoon and doubled up on #clojure :)

19:44 Null-A: how do I slurp lazily?

19:44 (line-seq (slurp ..)) ?

19:49 nvm

20:51 crowbar: (clojure.core/max (list 1 2 3 4)) I'm getting (1 2 3 4) as a result. I was expecting 4. What should I be doing?

20:52 tomoj: amalloy: how would you write (map (juxt (comp f first) (comp g second)) c)

20:52 crowbar: I see. passing it a list is incorrect. I should break it into atoms.

20:53 offby1: crowbar: if this were #scheme, I'd suggest you use "apply". But I don't know what clojure's equivalent is

20:53 technomancy: offby1: no, that's right for clojure too

20:53 crowbar: offby1: reduce worked, but is apply better?

20:54 offby1: crowbar: dunno if it's better; it's just the first thing that popped into my head :)

20:54 actually, apply _might_ have the disadvantage of not working if the list is very long

20:54 in which case "reduce" would win.

20:54 not sure if clojure has a limit to the number of args a function can take.

20:55 s/not sure/no effing clue/

20:55 sexpbot: <offby1> no effing clue if clojure has a limit to the number of args a function can take.

20:55 offby1: that was ... moderately useless :)

20:55 tomoj: reduce and apply seem to have equal performance to me

20:55 crowbar: great help to me though. thanks.

20:56 offby1: tomoj: it's not a question of performance; it's a question of utter failure. Some lisps -- I forget which -- indeed have a limit to the number of arguments you can pass to a function

20:56 tomoj: not clojure :)

20:56 offby1: there ya go, then.

20:56 crowbar: so apply will break a list into atoms and pass to a function vs reduce which will keep falling first on a list until down to one item as a result?

20:56 tomoj: &(take 10 (apply (fn [& args] args) (range)))

20:56 sexpbot: ⟹ (0 1 2 3 4 5 6 7 8 9)

20:57 tomoj: apply is defined up to [f a b c d & args]

20:57 hmm

20:58 that isn't relevant is it

20:59 * offby1 slowly realizes that tomoj's example was lazy

21:00 offby1: I assume that (range) returns an infinite sequence

21:00 tomoj: yeah

21:01 in 1.2.0 it looks like apply helpers are defined up to 20 arguments

21:02 also (RT/boundedLength seq limit) to return length of a seq up to a limit

21:02 technomancy: reduce involves calling max many times; apply is a single call

21:03 tomoj: huh, I'm confused

21:04 applyToHelper in the default case converts the remaining arguments to an array

21:04 so that must not be called for the above example

21:05 crowbar: hey technomancy, thanks for your help on news.yc today. happily learning clojure now.

21:05 tomoj: ah, because it's the function doing it, and a function with [& args] can know not to bother?

21:06 oh, _that's_ what RestFn is for

21:07 I've seen that in stack traces all the time but never understood what it meant

21:07 technomancy: crowbar: cool

21:13 wastrel: i saw an email about gui stuff

21:14 technomancy: crowbar: the "Let's just use Emacs" thread?

21:14 crowbar: <- parfe here.

21:15 Null-A: is there an easy way to get the index while iterating of a vec? like (for [[k v] (zipmap (range (count my-vec) my-vec ))] ... )

21:15 crowbar: yeah, I was complaining about how too much is broke, but luckily your stuff all works for me now.

21:15 clojure-jack-in works wonders.

21:15 technomancy: sweet

21:15 yeah... too many moving parts before that

21:16 Null-A: ah map-indexed

21:16 technomancy: I contacted tromey to get some deprecation warnings on the old elpa stuff; hopefully that will clear things up.

21:16 crowbar: do you have control of marmalade-repo.org? They're missing a snippet to load package.el

21:17 nevermind. I'll email the guy in the about section.

21:17 technomancy: I've been opening issues at http://code.google.com/p/marmalade/

21:18 he's pretty responsive

21:18 crowbar: even better. thanks.

21:23 tomoj: (defmacro fn-> [& more] `(fn [x#] (-> x# ~@more)))

21:46 cnd_: ~+ 1 2)

21:46 clojurebot: ,(let [testar (fn [x y] (cond (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")), :else("nao eh") )] (testar 10 25))

21:46 cnd_: ~(+ 1 2)

21:46 clojurebot: ,(let [testar (fn [x y] (cond (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 11 25))

21:46 cnd_: ~(or (> 1 java.lang.Double/NaN ) (= 1 java.lang.Double/NaN ))

21:46 clojurebot: <monads> is "yea, though I should walk in the valley of imperative code, I shall fear no evil, for your monad comforts me" - seen in #haskell

21:47 cnd_: ,~(or (> 1 java.lang.Double/NaN ) (= 1 java.lang.Double/NaN ))

21:47 clojurebot: java.lang.IllegalStateException: Var clojure.core/unquote is unbound.

21:47 cnd_: ,(or (> 1 java.lang.Double/NaN ) (= 1 java.lang.Double/NaN ))

21:47 clojurebot: false

21:47 cnd_: ,(>= 1 java.lang.Double/NaN )

21:47 clojurebot: true

21:49 cnd_: hello?

21:49 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline cnd_

21:51 tomoj: suppose you use xml/parse to parse an entire document into a tag structmap. then you create an xml-zip and start grabbing references to locs

21:51 the zippers along the way will share lots of structure with your original tag structmap, right?

21:54 devn: tomoj: my gut tells me yes since structmaps are simply maps

21:55 tomoj: interesting

21:55 devn: my gut or my answer?

21:55 or that it can talk?

21:55 tomoj: the answer

21:55 that too is interesting

21:55 devn: :)

21:56 tomoj: unfortunately since clojure.zip implements zippers as 2-vectors, they don't work with cascalog

21:56 devn: tomoj: although maybe not

21:56 since "most uses of structmaps would not be better served by records"

21:57 tomoj: shoot, I need record zippers

21:57 devn: i've been casually following the changes in 1.3 to defrecord -- but in general i've heard generalizations like: "records are fast"

21:57 which would lead my gut to tap me on the shoulder and suggested shared structure might be one benefit of records over structmaps

21:58 tomoj: I don't really need fast here, just need to not use tooo much memory

21:58 devn: reading the documentation on clojure.org i see that "The only restriction is that you cannot dissociate a struct map from one of its base keys. A struct map will retain its base keys in order."

21:58 on the other hand: "StructMaps are in all ways maps, supporting the same set of functions, are interoperable with all other maps, and are persistently extensible (i.e. struct maps are not limited to their base keys)."

21:58 * devn walks the line

21:59 devn: tomoj: I believe you are just fine with structmaps in this case -- but profile if you're writing this code to support a life support mechanism of some kind before trusting some fool on irc. ;)

22:00 tomoj: I don't plan to change the xml structmaps

22:01 devn: tomoj: the end goal is always good to know when discussing this sort of thing

22:01 do you have a problem statement that is beyond implementation details?

22:02 tomoj: crawl and process markup

22:02 but I'd really like to do it with cascalog and zippers

22:02 devn: mmm

22:03 that would be cool

22:03 clojurebot: Huh?

22:03 devn: clojurebot: that

22:03 clojurebot: Pardon?

22:03 devn: clojurebot: what tomoj said... it would be cool.

22:03 clojurebot: I don't understand.

22:03 devn: bots...

22:03 tomoj: clojurebot: botsnack

22:03 clojurebot: Thanks, but I prefer chocolate

22:04 devn: see -- not only is he ignorant, he's picky!

22:08 tomoj: I can just macro my way out of boilerplate for dealing with 2-vectors and not have to rewrite clojure.zip :)

22:11 gfrlog: I would like to see a saturday morning cartoon where every week the characters have to macro their way out of some crazy situation.

23:03 zakwilson: Are there open source web apps of significant size written in Clojure that I can read? I'm trying to get a feel for how best to structure things.

23:09 gfrlog: zakwilson: I take no responsibility for the following suggestion:

23:09 https://github.com/dbyrne/4clojure

23:10 zakwilson: gfrlog: thanks

23:10 bpr: is there a way to get lein to load your project into a running repl?

23:11 or do you have to load all the files and dependencies yourself?

23:11 I was thinking of common lisp's asdf as a model for this

23:15 crowbar: is there an issue with using hyphens in namespaces?

23:21 looks like by renaming my namespace to explude a hyphen my problem is resolved. perhaps because the file system was using an underscore?

Logging service provided by n01se.net