#clojure log - Dec 19 2008

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

2:42 Lau_of_DK: Morning gents

2:56 Im having a little highlighting difficulity with the latest clojure-mode, is it just me?

4:34 tsdh: Moin.

4:35 Is it possible to download the screencasts from blip.tv?

4:36 When run inside the browser window it's too small and with fullscreen mode it eventually freezes my browser.

4:45 hoeck: tsdh: there used to be a download link on blip.tv, i did this 2 times, but apparently i can't find it yet

4:45 leafw: about the move to google code: I guess the svn repos remains in the same place?

4:45 jdz: leafw: no, they are now on google

4:45 tsdh: hoeck: Ok, I couldn't, too. Never mind...

4:46 jdz: leafw: http://groups.google.com/group/clojure/browse_thread/thread/6b4a5284d61a682a/92e764e8790d5835#92e764e8790d5835

4:46 leafw: I saw the google page--neer used them before. I've seen the "source" tab, it has an svn link in it. Thanks jdz

4:48 hoeck: tsdh: ah, found it, you need to select a video in the archive and then a different player page opens where you can select quicktime format and it has a "download playing" link on the bottom

4:48 Chousuke: leafw: the source tab has the url, but it's not a link. you can click on "browse" to browse the repository

4:49 tsdh: hoeck: Ok, nice. Thanks a lot!

4:49 hoeck: tsdh: np :)

4:49 leafw: Chousuke: there is a printed link. Good enough for my git mirror.

4:51 Chousuke: remember to clone with --stdlayout if you also want the branch and tag information and not just the trunk (and don't include the /trunk in the url)... though that leaves out the wiki

4:51 leafw: thanks, I know.

5:57 philscotted: Anyone about?

5:58 dhaya: hi

7:43 slangan: would it be possible to add infix +-/* to clojure?

3:31 Lau_of_DK: Dont know if you worked it out, but Infix was posted on the Googlegroup some weeks ago

3:57 slangan: anyone have a good example of a Clojure-app using miglayout?

4:19 rdd: %r

4:19 _

4:22 slangan: how do i force replicate?

4:25 rhickey: slangan: doall

4:26 there's also repeatedly

4:30 gnuvince: (doc dorun)

4:30 clojurebot: When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive rests of the seq, does not retain the head and returns nil.; arglists ([coll] [n coll])

4:35 slangan: is it possible to interface to R?

4:41 RSchulz: slangan: R is written in C, no? Maybe C++? It won't be easy to interface Clojure, I don't think.

4:42 I've heard people talking about JNA, which is meant to simplify creating JNI interfaces, I guess. That might help.

5:51 Chouser: power outages in fort wayne

5:52 Smerdyakov: Chouser, are there other people here who live near Fort Wayne?

5:58 slangan: ok I installed colt. when I have done: set CLASSPATH=c:\colt\lib\colt.jar;

5:59 how should I import from it then?

5:59 and will that set the classpath forever or I have to do each time I start windows?

5:59 Smerdyakov: slangan, you're running Windows? O_o

5:59 RSchulz: slangan: Use Clojure's (import ...) directive, of course.

5:59 That "set" command is in effect only in the instance of CMD.exe to which use issued it.

6:00 And yes, if you're serious about Java and Clojure programming, Windows cannot be considered advisable...

6:00 slangan: Smerdyakov: yeah i cant get wireless to wrok on ubuntu

6:00 RSchulz: Use openSUSE. It's distinctly superior in hardware support and coverage to Ubuntu.

6:00 Smerdyakov: slangan, strange. I got it to work on my laptop with the stock Debian kernel and little poking around on the web.

6:01 RSchulz, and Debian is distinctly superior in software support. :)

6:01 RSchulz: Anyway, in Windows you can set environment variables permanently (system- or user-wide) in the Environment control panel.

6:04 slangan: ok iadd ed to the CLASSPATH instead

6:04 but still doesnt work

6:04 RSchulz: slangan: What is your general programming background? How many years? Which languages?

6:06 And if you're stuck on Windows, Cygwin is extremely helpful.

6:07 slangan: package colt does not exist

6:09 RSchulz: python(know it pretty much inside out), programming since february. a little C, some Haskell, very little Java. know a little from each langauge, have tried most of them a little. decent knwoeldge of algorithms an datastructures.

6:09 RSchulz: And you're using Windows CMD.exe? Which editor for you Clojure and Java coding?

6:10 slangan: package cern.colt does not exist

6:10 emacs+clojure-mode, do i have to restart emacs perhaps?

6:11 hiredman: uh

6:11 slangan: nah didnt help

6:12 i changed classpath by adding to it in the win advanced settings CLASSPATH

6:13 RSchulz: slangan: After you change the global (or per-user) CLASSPATH environment you have to start a new CMD.exe or other shell.

6:13 They're still inherited at the time of process creation, as in Unix / Linux.

6:15 * Smerdyakov notices RSchulz's interesting company.

6:15 RSchulz: Which one? I have so many!

6:15 slangan: RSchulz: i dont do it with cmd.exe, I just added to the CLASSPATH. I restarted emacs too.

6:15 mchurch: In Clojure, LET seems to have the power of Lisp's LET*, so why is there a LET* in Clojure? What's the difference between Clojure's LET and LET*?

6:16 Smerdyakov: RSchulz, really? O_o I meant H&S.

6:16 hiredman: the * stuff tends to be more primitive

6:16 RSchulz: That was a joke. There's only H&S. I'm S.

6:16 Clojure doesn't have let*, does it?

6:17 duck1123: it's private

6:17 Smerdyakov: mchurch, are you Mike Church?

6:17 RSchulz: He's the Church-Turing Church!

6:17 Yeah. It has fn*, too, whatever that does. I don't need to know...

6:18 Except, I suppose, when it shows up in a macro expansion...

6:19 hiredman: e.g., let* does not support destructuring

6:19 Smerdyakov: RSchulz, how is H&S doing in this economic environment?

6:20 RSchulz: Well, we're alive. It's never been flush, but we have one government research contract that probably won't go away next year.

6:20 hiredman: if you look at core.clj, let is defined in terms of let*

6:20 Smerdyakov: RSchulz, can you say what the research is?

6:21 RSchulz: Application of first-order theorem provers and other logic tools to problems in the Process Specification Language. It's funded by NIST through SJSU.

6:22 Chouser: Smerdyakov: I'm the only one here from my city, as far as I know.

6:22 Smerdyakov: RSchulz, "process specification language".... that sounds like some dodgy XML-influenced thing. :D

6:22 Er, UML-influenced

6:22 RSchulz: It has nothing whatsoever to do with XML.

6:23 Smerdyakov: See correction. :)

6:23 RSchulz: It's written entirely in frist-order logica which has many surface notational forms. We use CLIF, which is part of the Common Logic specification.

6:23 Both PSL and Common Logic are ISO standards.

6:23 It is also not related to UML, though our funder works closely with OMG.

6:26 Smerdyakov: I'm always dubious of logical systems that aren't higher-order.

6:27 Maybe this domain is simple enough that the usual gains wouldn't matter much.

6:29 Chouser: stuarthalloway: you meant assert returning it's expression's value on success, right? not on failure.

6:30 slangan: but seriously, how retarded is the java claspath, how can it not be possible to just add a new path to it?

6:31 stuarthalloway: chouser: right

6:32 I want to embed asserts inside Fact

6:32 so that I get a "point of failure" message from the assert, and a more general message from Fact

6:33 RSchulz: slangan: For one thing, there are security issues surrounding what is and is not in the classpath.

6:33 stuarthalloway: I could embed test-is's "is", but that drags along the whole reporting mechanism

6:33 RSchulz: Secondly, there is the ability to dynamically alter it from Clojure.

6:33 Have you made at least one pass through the on-line documentation to familiarize yourself with what's built in?

6:35 Chouser: stuarthalloway: seems reasonable, especially in a testing framework.

6:35 I think I'd be a bit annoyed to find asserts mixed in with logic in regular code (rather than just at the beginning of the function)

6:36 but that's not an argument against changing assert.

6:36 RSchulz: Chouser: I tend to agree. At the top of a function, you're verifying that your caller satisified the function's contract.

6:37 If you have asserts in the middle, you're verfying that the functions you call have verified their postconditions.

6:37 I guess one is not more inherently valid than the other, but it somehow seems that the caller validation makes more sense than the callee validation.

6:37 Chouser: or if you're using assert in a tail position, I suppose it may be verifying your own postcondition.

6:38 RSchulz: Which is reasonable, too, at least early on.

6:38 Chouser: ...but only verifying that it's non-nil or not-false. Not much of an assertion.

6:38 stuarthalloway: I just want to report the form that broke, so maybe something like "expect" is better

6:39 it's just that assert doesn't care about its return value for any other reason, so it is a freebie to repurpose for my needs

6:39 Chouser: I'd be curious to see if anyone has a reasoned objection. It seems like a harmless change to me.

6:39 RSchulz: I think the Java setup is reasonable. You give the formula that is to be "true" and an expression to use in the exception thrown when the assertion fails.

6:40 And by "formula" I mean "expression," of course. I get my logic mixed up with my programming.

6:40 stuarthalloway: chouser: I thought so too, but I haven't found any functional language that works the way I am proposing

6:42 Chouser: yet another innovative feature for Clojure!

6:48 slangan: #java is a buncof retards, but what to expect form people using such a language. the CLASSPATH is so fakking dumb. can't I just set it to look for .jars somewhere always? I have my .jar ina specific place, I dont want to fakking re-add it to the classpath every single time i restart windows

6:49 hiredman: slangan: chill

6:49 Smerdyakov: slangan, it's trivial to do. You're making some very basic mistake.

6:50 Chouser: I've also been frustrated with the Java classpath, but once I got past the denial and bargaining, acceptance hasn't been too bad.

6:50 Smerdyakov: slangan, check the value of the environment variable, in the context where you expect something to be happening differently.

6:51 slangan: so the relevant jars are in the path

6:51 Chouser: I would actually recommend not using an environment variable -- I just have a script that I use to start clojure, and it has the java command line with the -cp option that I need.

6:51 slangan: but calling them doesnt work

6:51 hiredman: clojurebot: do you know anything about a jar directory?

6:51 clojurebot: jar directory is -Djava.ext.dirs=$LIBS

6:51 Chouser: slangan: each .jar must be individually named on the classpath

6:52 unless you use the -Djava.ext.dirs route

6:52 stuarthalloway: ext.dirs also have different security characteristics

6:52 it's unwise to stick things there just to simplify classpath setup

6:53 hiredman: unless you have a policy file allowing everything anyway

6:53 * hiredman whistles

6:56 slangan: so it works in Java now but I cant import from Clojure

6:57 import cern.colt.Arrays;

6:57 (import '(cern.colt Arrays))

6:59 if it works with my java shouldnt it automatically wor with clojure?

7:00 Chouser: slangan: yes

7:01 slangan: import cern.colt.matrix.*;

7:01 DoubleMatrix2D dm;

7:01 compiles

7:01 (import '(cern.colt.matrix DoubleMatrix2D))

7:01 java.lang.ClassNotFoundException: cern.colt.matrix.DoubleMatrix2D

7:02 Chouser: slangan: what is your java command line?

7:02 aperotte: slangan: have you tried starting a repl from the command prompt setting the classpath manually

7:02 slangan: no idea

7:02 mchurch: Smerdyakov: I am Mike Church. How do you know of me?

7:02 I'm not the Church-Turing Church. He's a very distant relative (11 up, 9 down).

7:02 We're related through some wealthy CT family, not that the wealth ever traveled down to my node of the tree.

7:03 Smerdyakov: mchurch, I'm Adam Chlipala.

7:03 mchurch: Ah!

7:03 Good to hear from you! How's life post-JSC?

7:03 Smerdyakov: mchurch, you're not authenticated to services, so we can't take this to a private conversation, which we probably should. :(

7:04 drewr: Can I not create a var from a lexical variable returned by a function?

7:04 slangan: http://hpaste.org/13190

7:04 mchurch: Do you Skype?

7:05 Did you hear that I left JSC?

7:05 slangan: ^^ classpath problem, contains my .emacs, perhaps i need to specify tp clojrue as well where it should look?

7:05 mchurch: Around the same time you did (4/24) and some other good people are exiting as well.

7:05 Smerdyakov: mchurch, I think it's inappropriate to talk about that here.

7:05 Chouser: drewr: the function is returning what? A Var? A Symbol?

7:05 mchurch: on Skpye: michael.o.church

7:05 Smerdyakov: mchurch, I'm not on Skype, but can you just register with Nickserv?

7:05 mchurch: how do I do that?

7:05 drewr: Chouser: This works, (def *foo* (let [foo :foo] foo)).

7:05 aperotte: slangan: try importing from a repl started like this: java -classpath "location of clojure";"location of colt" clojure.lang.Repl

7:05 Smerdyakov: /msg nickserv help

7:06 mchurch: I'll tell you what... send me an email : michael.o.church@gmail.com

7:06 My morning is chaotic. I have plates spinning in multiple spheres of life.

7:07 drewr: Chouser: But for some reason, make-foo in (def *foo* (make-foo ...)) returning a lexical value does not actually bind *foo*.

7:07 Let me do some more digging. I'm not sure what I'm doing is right.

7:07 Chouser: drewr: your def/let example is just the same as (def *foo* :foo)

7:08 aperotte: slangan: your emacs is setting the classpath for your instance of clojure while in emacs and because it over-rides the one you set externally you can't import colt

7:08 Chouser: that is, interning a Var named '*foo*' with a root value being the keyword :foo

7:08 RSchulz: mchurch: Yeah, I knew that. Alonzo is 13 years dead.

7:08 drewr: Chouser: True. (def *foo* ((fn [] (let [foo :foo] foo)))) still works however.

7:09 Chouser: drewr: that's still the same thing.

7:09 Smerdyakov: Alonzo Church is my great-great-great-great-great-grand-PhD-advisor, or something like that.

7:09 drewr: Chouser: But it's closer to what I'm actually doing.

7:09 slangan: aperotte: should the paths be quoted?

7:09 drewr: I'm trying to return a socket that I bind lexically in the fn's let.

7:09 Chouser: drewr: there you're creating a function that returns :foo, calling it and binding the result (still just ':foo') to *foo*

7:10 aperotte: slangan: at the command prompt, no

7:10 drewr: But my trivial examples are working, so I must be doing something different in the fn.

7:10 aperotte: slangan: but if you choose to put it in your .emacs file then you will need to quote it

7:11 Chouser: if you run the function by itself at the repl (or use 'prn' on it) you should see it return the socket object.

7:13 drewr: Chouser: Yeah, that ain't happening. Interesting...

7:13 It never returns, which means the var never gets bound. :-)

7:13 Chouser: that'll do it

7:14 slangan: import cern.colt.matrix.*;

7:14 DoubleMatrix2D dm;

7:14 is then: (import '(cern.colt.matrix DoubleMatrix2D))

7:14 correct?

7:15 aperotte: slangan: yes

7:15 slangan: aperotte: I started it from command prompt and it stillc ant find the class

7:16 http://hpaste.org/13191

7:17 oh im so dumb

7:17 drewr: line-seq on a socket may not be a great idea because I can't break out of the lazy-cons, and I don't know beforehand how many lines to take.

7:18 slangan: now it works from the command prompt

7:18 so how do I fix it so emacs looks there every time?

7:18 drewr: My macro has the same problem though because line is never nil.

7:18 slangan: or what is the preferred way to do it?

7:18 drewr: Because the input stream keeps returning data even if they're empty strings.

7:19 Actually, no, it's just blocking until it gets more I guess.

7:21 aperotte: slangan: I'm not an expert, but my preferred way to do it is have a shell script that starts clojure to include all of the relevant libraries (that way it's consistent wherever I start it), but if you look at the class-path part of the first let* in your .emacs file you can follow how clojure.jar was added to add colt.jar

7:30 RSchulz: aperotte, slangan: The launcher I wrote includes the necessary JARs (Clojure core and contrib), allows explicit additions via repeatable +cp=... options and additionally if there is a CLASSPATH incorproates that, as well.

7:30 It also has an option to choose the Contrib REPL instead of the core REPL.

7:30 aperotte: RSchulz: is it in the google group repository?

7:31 RSchulz: No, though I did post a slightly older (and, I discovered bugged) version to the mailing list as an attachment.

7:31 aperotte: RSchulz: where might I be able to find it?

7:32 RSchulz: Let me check to see what the Subject and date were...

7:33 Subject: Re: why can't I set! stuff in user.clj? Date: 2008-12-09@18:10 (PST); Sender: Randall R Schulz

7:33 aperotte: RSchulz: Thanks!

7:33 RSchulz: That version will fail if you _don't_ give the --crepl option.

7:33 --crepl requests the Contrib REPL.

7:34 Are there restrictions (CA, e.g.) on uploading to the Google Groups file area?

7:34 Also, you'll need to edit the variable setting at the top of that script to reflect where you installed Clojure Core and Contrib.

7:36 Also, I never wrote a --help option and some of it's not entirely obvious.

7:36 If you put a -- option somewhere in the argument list, everything before will be interpreated as JVM opts and everything after as Clojure arguments.

7:41 duck1123: has anyone noticed enclojure not shutting down the repl when netbeans is shut down?

7:41 I opened netbeans earlier today, and I just noticed that the repl was still running

7:44 aperotte: RSchulz: are there many differences between the clojure repl and the contrib repl?

7:44 RSchulz: The Contrib REPL is nicer. Try it.

7:45 aperotte: ok, I'll give a try

7:45 duck1123: isn't the contrib repl the one that does the line numbers

7:45 RSchulz: duck1123: I made the mistake of updating to the latest Enclojure. Now I have nothing.

7:45 duck1123, aperotte: Yes, that's one thing. It actually has a configurable prompt the way Unix shells do.

8:28 slangan: is (apply vector coll) O(n) or by some clever trick O(1)?

8:31 RSchulz: That would go beyond being clever, wouldn't it?

8:32 Besides, you're going to get a vector of one element, the collection, not a vector containing all the elements of the collection.

8:32 For the latter, use (into ...)

8:32 Actually, it seems I'm wrong.

8:33 But not about the O(n) vs. O(1) part.

8:33 kotarak: slangan: (apply vector coll) <=> (vec coll), not sure about the O part

8:33 RSchulz: The vector is a collection, not a lazy sequence.

8:33 For it to contain all the elements from the collection they (references to them) must each be copied to the vector.

8:34 kotarak: RSchulz: (vector coll) gives one-element vector, (apply vector coll) or (vec coll) gives a vector containing the elements of coll

8:34 RSchulz: Yes. I was confused about that.

8:34 danm_: good morning

8:34 Chouser: But correct about O(n)

8:37 RSchulz: It sure is nice to be able to verify things you say so quickly. Very useful learning tool, even when you're trying to play teacher...

8:42 slangan: aperotte,RSchulz:thanks it works now, i figured out how to do it.

8:43 aperotte: slangan: no problem, I'd be interested to hear how you like working with colt within clojure. I plan on using it sometime in the next few months

8:44 slangan: i mainly need SVD havent actually checked how it works yet

8:50 RSchulz: What's SVD?

8:51 whidden_: RShulz: SVD = Single Value Decomposition

8:53 slangan: im confused

8:53 file:///C:/colt/doc/api/index.html

8:53 oh oops

8:53 hmm

8:54 anyway I have a class with seeminglyno constructors, just method

8:54 whidden_: RShulz s/Single/Signular/

8:54 http://en.wikipedia.org/wiki/Singular_value_decomposition

8:55 RSchulz: slangan: All Java classes have constructors. If none are explicit, a public default constructor is supplied by the compiler.

8:56 slangan: (import '(cern.colt.matrix.DoubleMatrix2D DenseDoubleMatrix2D))

8:56 got it

8:57 RSchulz: That class has two constructors accoding to the documentation on the Web.

8:57 whidden_: Thanks. I've heard of it by the long name, but don't do a lot of math, so the acronym wasn't familiar.

8:58 slangan: how do I pass a double[][] ?

8:58 RSchulz: Check the array creation capabilities on the Java Interop page.

8:58 slangan: Really, I don't mean to be rude, but it seems you ask a lot of questions that are answered by the doucmentation.

8:58 slangan: lol waity

9:04 RSchulz: One thing I like to do before asking or posting a question is try to find an example of what I'm using in the Core or Contrib source. Since so much of Core (and all of Contrib, at least so far) is written in Clojure, there are ample examples of many of its built-in functions and macros.

9:05 arbscht_: is there any way of passing Pattern flags when instantiating a regex pattern from clojure?

9:06 Chouser: arbscht_: you can specify flags within the regex pattern itself.

9:06 arbscht_: oh

9:06 gnuvince: arbscht_: #"(:i)..."

9:06 arbscht_: #"(?i)..."

9:07 Chouser: I still have to look it up. (re-seq #"(?i)zz" "ZZ")

9:11 danlarkin: RSchulz: heh I do the same

9:11 RSchulz: but sometimes I ask all the same

9:14 stuarthalloway: here's a question that cannot be answered by reading core or contrib source:

9:14 In Common Lisp, code that generates macroexpansion should be purely functional

9:14 i.e. the compiler might call macroexpansions more often than you think

9:15 should the same assumption be made in Clojure?

9:15 I think so, but I haven't seen it documented anywhere

9:15 RSchulz: It couldn't hurt... And it's probably a lot easier in Clojure, anyway.

9:16 danlarkin: stuarthalloway: as convention? or are you asking if the clojure compiler could indeed macroexpand more than once

9:16 stuarthalloway: RSchulz: you bet

9:16 danlarkin: not "could" as in what the compiler currently does

9:16 for that I could read the source

9:16 RSchulz: One thing you surely can count on is that name# will be consistently substituted across any given expansion.

9:17 stuarthalloway: but if I find that the compiler currently expands macros only once in all cases, that proves nothing

9:17 the example PG gives in On Lisp is a macro that counts how many times it occurs be incrementing a global

9:18 RSchulz: stuarthalloway: I'm glad at least some people are cautious about inferring the language definition from currently observable compiler behavior.

9:18 stuarthalloway: ...I admit this is arcana, but people expect book authors to know things :-)

9:18 RSchulz: Can't you just fake that??

9:19 danlarkin: RSchulz: do you have a better place to gather language spec from? :) if so please do share

9:19 Chouser: danlarkin: rhickey

9:19 stuarthalloway: danlarkin: right here on this forum, by starting a conversation interesting enough that rhickey joins in :-)

9:19 RSchulz: In this case, the creator. And the documentation. If it doesn't say one way or the other, then you shouldn't assume that an empirical behavior will remain unchanged.

9:20 But when in doubt, Rich should be consulted. He's clearly thought about things carefully, but that doesn't mean he hasn't overlooked some detail and would probably want to know what sort of questions are arising.

9:20 danlarkin: a resounding answer!

9:21 stuarthalloway: I'll post a question to the mailing list

9:21 Chouser: it's not particularly uncommon for him to say that a particular current behavior isn't guaranteed.

9:21 RSchulz: Which is definitely something you want to know!

9:21 danlarkin: that is true

9:22 Chouser: but it seems to me there are already macros with side effects

9:22 ah, got it: proxy

9:24 the proxy macro generates a class (and may save it to disk) when it expands.

9:24 stuarthalloway: Chouser: I think that is different

9:25 Chouser: oh?

9:25 stuarthalloway: proxy generates code that has side effects

9:25 but does calling macroexpand-1 on proxy have side effects?

9:25 Chouser: From looking at the code, I think so. But let me check...

9:26 it does.

9:27 lisppaste8: Chouser pasted "side-effect of expanding 'proxy'" at http://paste.lisp.org/display/72406

9:28 Chouser: that still doesn't necessarily mean it's recommended for the rest of us, but it is a data point.

9:29 stuarthalloway: Chouser: eeeeew

9:30 Now I will definitely post a question on the list

9:31 Chouser: now that I think about it, a macro without side-effects seems kinda puny and weak

9:36 stuarthalloway: Chouser: your example notwithstanding, most Clojure macro expansions do not have side effects

9:36 Chouser: sure, the puny ones don't.

9:37 * stuarthalloway feels puny

9:39 Chouser: I want more bold, strong macros that go around at compile time, sending off agents, blocking on IO...

9:39 pfft, nevermind.

9:43 gnuvince: (doc io!)

9:43 clojurebot: If an io! block occurs in a transaction, throws an IllegalStateException, else runs body in an implicit do. If the first expression in body is a literal string, will use that as the exception message.; arglists ([& body])

9:44 gnuvince: Is that form just for making sure you don't have side effects in your transactions?

9:44 Chouser: gnuvince: yes

9:45 gnuvince: kk

9:45 thanks

9:45 Chouser: gnuvince: you can use 'io!' as a sort of assert, in any function that you know for sure should not be put in a dosync.

9:46 clojure.core currently only uses it in 'await'

9:57 gradda: colt seems very good! (java linear algebra+more package)

9:58 has svd and all kinds of matrix-stuff

9:58 aperotte: gradda: it is pretty fantastic. I was looking for something as close to numpy/scipy as possible and this is I think as good as java has

9:58 (so far)

10:02 gradda: yes

10:03 but it doesnt seem to have any plotting

10:23 dreish: ,(+ 1 1)

10:23 clojurebot: 2

10:23 Smerdyakov: ,(+ ,(+ 1 1) 1)

10:23 clojurebot: 3

10:24 dreish: ,(def google (-> (java.net.URL. "http://google.com") .getContent reader line-seq doall))

10:26 I think -> is my favorite macro right now.

10:27 AWizzArd: clojurebot: max people

10:27 clojurebot: max people is 116

10:34 dreish: Oh, wow, this works too: (def google (-> "http://google.com" reader line-seq doall))

10:35 gradda: if a java-method returns [D@167c6fd, a double-array, how do I solve that? do i need to import java array? how, where is it?

10:36 dreish: Is it just my imagination, or should clojure.contrib.duck-streams really be rewritten with defmulti?

10:36 gradda: You can just wrap it in seq and treat it like any other Clojure sequence.

10:50 aperotte: gradda: There is plotting in colt. It's car includes aida (I haven't actually used any of this yet though)

10:50 gradda: car = jar

10:50 gradda: http://aida.freehep.org/

10:57 gradda: ah

17:20 Lau_of_DK: Evening gents

17:25 mibu: chouser: are you here?

17:25 Chouser: mibu: yes

17:26 mibu: chouser: I saw you and RH were editing the docs on clojure.org, which is great. just wanted to tell you that your additions of the Related Functions section in some areas are great.

17:26 Chouser: mibu: thanks, glad you like it.

17:26 mibu: chouser: it gives the exact quick overview one needs to get one's head around what goes where.

17:27 chouser: anyway, just wanted to drop by and say what a wonderful work you guys are doing...

17:28 Chouser: I appreciate it.

17:28 mibu: g'night.

18:06 triddell: Does clojure have any special support for string literals or does it just follow java syntax for \ escapes? Some languages have the """ this is a " mark """ concept.

18:08 danlarkin: triddell: clojure currently has no """syntax"""

18:08 although I'm working on a patch to add it

18:08 it's not going very well though :)

18:10 triddell: ok, thanks, I'm initially using clojure for xml/html code generation so it could be handy but no big deal... I mostly didn't want to realize I missed a cool feature later :-)

18:13 duck1123: triddell: there have been several good attempts at allowing xml generation with clojure data structures

18:13 ie. compojure.html and clojure.xml

18:14 triddell: I'm using the vector-based support in compojure right now

18:15 it's working well... albeit slow as I get up to speed on clojure

18:17 duck1123: there's a language that lets you define a multi character delimiter and everything between the first occurrence and the next is input. I wanted to propose something like that, but I can't remember what language I saw it in.

18:18 triddell: I think Ruby allows that

18:20 duck1123: that's what I was thinking, but I couldn't find an example of it to see if it even looked like a good idea before bringing it up on the list

18:20 I have a feeling though that it wouldn't be. It would probably introduse too much complexity in parsing to be worth it

18:21 durka: like heredocs?

18:21 php has a version

18:21 Nafai: Is this pretty up to date? http://clojure.org/compilation

18:23 whidden: durka: I just about to say Here docs, ala Bash, right?

18:23 durka: i don't really know bash

18:23 but php has $var = <<<EOF

18:23 input input input

18:23 EOF;

18:24 i think there's variable sbustitution in there too though

18:24 duck1123: That's exactly what I was thinking of, I knew several languages had them, I just didn't know that term

18:24 whidden: that's basicly what bash does.

18:25 you can do here docs in the lisp reader, because you can reprogram the reader syntax.

18:27 duck1123: I'm not terribly convinced it would be something to look into any more. It was just something I was mulling over last week.

18:29 lambdatronic: Howdy folks

18:30 Got a macro question fer ya

18:30 anyone game?

18:30 duck1123: ask

18:31 lambdatronic: alright, I'm working on a DSL for Bayesian Logic Programming

18:31 I would like to say the following:

18:31 (defrandom climate-change [Location x] (... body stuff here ...))

18:32 I need to maintain a type hierarchy matching input ontologies

18:32 so I'm using the hierarchy system for that, no prob

18:32 however, these random functions need to specify their input "types"

18:32 In this case, x is a Location

18:33 so...here's the macro

18:33 (defmacro defrandom [fn-name args & body]

18:33 (let [[arg-types# arg-names#] (uninterleave args)]

18:33 `(defn #^{:randomfn true :arg-types ~arg-types#} ~fn-name ~arg-names# ~@body)))

18:33 duck1123: lisppaste8: url

18:33 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

18:34 lambdatronic: uninterleave is my function. pretty simple. (uninterleave [a b c d]) => [[a c] [b d]]

18:34 opposite of interleave

18:34 so here's my question

18:35 when I attempt to enter this macro at the REPL, I get an error telling me that Metadata can only be applied to IObjs

18:35 what gives?

18:36 Typing the (defn #^{:randomfn true ...} foo [x] (... body junk ...)) reads and evals correctly

18:36 but the macro is incapable of constructing that statement based on my spec.

18:36 Any thoughts?

18:38 danlarkin: clojurebot: project euler

18:38 clojurebot: project euler is http://ProjectEuler.net

18:38 danlarkin: clojurebot: brain dump

18:38 clojurebot: brain dump is http://clj.thelastcitadel.com/clojurebot

18:38 duck1123: seems like a quoting issue, but that's just a guess

18:39 have you tried expanding it to see what it produces?

18:40 lambdatronic: like I said, I can't get the repl to accept the defmacro form in the first place

18:40 so I can't expand any uses of it.

18:40 ;(

18:41 lisppaste8: lambdatronic pasted "defrandom macro" at http://paste.lisp.org/display/72424

18:41 lambdatronic: just in case that helps

18:51 danlarkin: http://www.mikeperham.com/2008/12/13/clojure-vs-ruby/

18:53 duck1123: Has anyone tried mixing (j)ruby and clojure?

18:54 I just ported my ruby code from ruby to jruby today as a first step towards eventually replacing it with clojure

18:54 Nafai: When doing :gen-class, how do I call a superclass method on an overriden method?

18:56 from an overriden method, rather

19:00 whidden: lambdatronic: it maybe that you are using a reader short cut in your defmacro. I believe that is not allowed. Isn't the long hand of #^ '(meta'?

19:07 RSchulz: #^ yields (with-meta ...)

19:08 ^form yields (meta form)

19:08 lambdatronic: ththanks for the suggestion, whidden

19:08 I'll try it

19:20 mehrheit: #^ doesn't directly yield with-meta, I think

19:20 lambdatronic: no, it has to be something more comlplex

19:22 zakwilson: Has anybody done any work on genetic algorithms in Clojure?

19:23 Chouser: lambdatronic: http://groups.google.com/group/clojure/msg/919455504c57659e

19:23 mehrheit: lambdatronic: don't use #^ there

19:24 lambdatronic: it applies metadata to the source code symbols and structures for the compiler

19:24 lambdatronic: doesn't work there, because there's syntax-unquote after the map, which is a special object

19:25 lambdatronic: rather use (defn name ([args] ...) {metadata-map})

19:26 lambdatronic: hmm...

19:28 Hey that works!

19:28 why?

19:28 It's not in the API or online macro spec for defn, the metadata page, or the special forms def description

19:28 mehrheit: it should be in the arglists

19:29 [name doc-string? attr-map? ([params*] body) + attr-map?]

19:29 (this it from (doc defn))

19:30 lambdatronic: wild

19:30 mehrheit: it's the attr-map?, not very well documented though

19:32 lambdatronic: okay, so the final solution looks like this:

19:33 (defmacro defrandom [fn-name args & body]

19:33 (let [[arg-types# arg-names#] (uninterleave args)]

19:33 `(defn ~fn-name (~arg-names# ~@body) {:randomfn true :arg-types ~arg-types#})))

19:33 Sweet

19:33 and (defrandom climate-change ['Location x] (println x)) works perfectly

19:33 thanks, mehrheit

20:31 danlarkin: phew

20:31 back from shoveling out in front of my house and digging out my car

20:31 I'd say there's about 8 inches so far

20:39 RSchulz: danlarkin: I just talked to my parents in Wisconsin. They said they'd gotten about 10 inches. Yowsa!

20:40 * danlarkin wishes he were skiing this weekend instead of working

20:41 RSchulz: Whereabouts are you?

21:03 danlarkin: Albany, ny

21:17 RSchulz: My sympathies...

21:17 Maybe you can ski to the market?

21:22 danlarkin: Actually when I was digging out my car I contemplated it

21:22 there's enough snow on the roads that they'd be a fantastic xcountry skiing course

21:30 RSchulz: 'Cept for the snowplows...

21:31 Best to hunker down. Or strike out into the back country. ... Does Albany have a back country??

21:35 danlarkin: it does

22:01 Nafai: How do I call a super class method when using gen-class?

22:02 :gen-class, I mean

22:05 Chouser: a method you've overridden, I assume?

22:07 Nafai: Chouser: Correct

22:07 I want to re-write this in Clojure: http://paste.lisp.org/display/72422

22:15 Chouser: (defmacro super [methname instance & args] `(binding [~methname nil] (. ~instance ~methname ~@args)))

22:16 Nafai: I haven't tried that in ages, but it used to work.

22:17 * Nafai will try that

22:19 Chouser: please let me know if it still does -- the question comes up now and then.

22:19 Nafai: Sure thing

22:19 I'm trying this and the AOT compiler

22:19 Chouser: yes, great.

22:20 I'm afraid you'll have trouble at runtime with Android, though.

22:22 Nafai: :(

22:22 What will the problems be?

22:22 Chouser: Clojure still creates a dynamic classloader during start up.

22:24 Nafai: Dang, didn't realize that

22:24 Chouser: That prevents unsigned applets from working at the moment, for example.

22:24 * Nafai nods

22:27 triddell: From a java library function I'm getting a java.util.ArrayList which contains java.util.HashMaps... I'm trying to get a seq of just the Maps... I've tried vals and into {} combinations but can't find the right way... anyone have any ideas?

22:29 Nafai: I was trying to avoid Java coding, but I guess not

22:30 Chouser: Nafai: well, you could help fix Clojure.

22:30 Nafai: 20:20 < Chouser> I'm afraid you'll have trouble at runtime with Android, though.

22:30 20:22 < Nafai> :(

22:30 Whoops

22:30 20:22 < Nafai> What will the problems be?

22:30 20:22 < Chouser> Clojure still creates a dynamic classloader during start up.

22:30 Sorry for the paste

22:30 What needs to be fixed?

22:31 I'm assuming the classloader is for the proxy classes?

22:31 Chouser: I think it's really close -- the dynamic classloader ought to no longer be needed for fully AOT-compiled code.

22:32 without AOT compilation, each top-level form is compiled to bytecode and dynamically loaded

22:33 Nafai: So if the Clojure jar itself can be compiled with dalvik, we should be good

22:34 Chouser: not quite. the dynamic classloader is currently created at runtime regardless

22:35 that's enough to make applet containers mad, and I assume will fail in dalvik as well.

22:35 Nafai: Hrm

22:36 Chouser: so it needs to be created only when needed and/or when possible.

22:36 albino: Chouser: do you know if there are plans in the future to fix that?

22:36 * Nafai nods

22:36 Chouser: http://code.google.com/p/clojure/issues/detail?id=14

22:37 Nafai: Nice, just a couple days ago

22:38 Chouser: I took a crack at it a couple days ago, but it's ... tricky. :-)

22:38 Nafai: Hrm.

22:39 dalvik fails at compiling clojure.jar

22:39 Chouser: that issue tracker has only been used for a couple days.

22:39 oh, really? does it say which .class file?

22:39 Nafai: http://paste.lisp.org/display/72433

22:41 Interesting error message

22:45 Chouser: it is.

22:45 Nafai: This is from clojure svn trunk

22:46 * Nafai tries with the android r2 sdk

22:47 Chouser: I think it's complaining about this line: http://code.google.com/p/clojure/source/browse/trunk/src/clj/clojure/core.clj?r=1160#2124

22:50 Nafai: Possibley

22:52 triddell: I now have a list of java.util.HashMaps and I want to transform them using map to clojure maps.... what do I use to basically cast a java.util.HashMap to a clojure map?

22:53 anyone? ... bueller?

22:54 Chouser: triddell: are you sure you can't just leave it as a java.util.HashMap?

22:54 'get', 'seq', and such work

22:55 otherwise (into {} my-hash-map) should do it

22:55 mmcgrana: ,(let [h (doto (java.util.HashMap.) (.put "foo" "bar") (.put "bat" "biz"))] (into {} h))

22:56 o is clojure bot not 'evaling anymore

22:56 Chouser: ,(+ 1 2)

22:56 clojurebot: 3

22:56 triddell: well, I'm passing is as the sequence in a reduce function... maybe that's the problem... getting java.util.HashMap cannot be cash to clojure.lang.IFn

22:56 cast

22:57 mmcgrana: ,(let [n (+ 1 2)] n)

22:57 clojurebot: 3

22:57 Chouser: it should work as the input collection

22:57 ,(into {} (java.util.HashMap. {:a 1 :b 2}))

22:57 ,(java.util.HashMap. {:a 1 :b 2})

22:58 mmcgrana: ,(String.)

22:58 triddell: I have a collection (list) of HashMaps right now

22:59 mmcgrana: if you want a list of clojure maps use "map" and the fns given above

22:59 triddell: I'll try that... thanks to you both

23:03 mmcgrana: np

Logging service provided by n01se.net