#clojure logs

2008-12-19

02:42Lau_of_DKMorning gents
02:56Lau_of_DKIm having a little highlighting difficulity with the latest clojure-mode, is it just me?
04:34tsdhMoin.
04:35tsdhIs it possible to download the screencasts from blip.tv?
04:36tsdhWhen run inside the browser window it's too small and with fullscreen mode it eventually freezes my browser.
04:45hoecktsdh: there used to be a download link on blip.tv, i did this 2 times, but apparently i can't find it yet
04:45leafwabout the move to google code: I guess the svn repos remains in the same place?
04:45jdzleafw: no, they are now on google
04:45tsdhhoeck: Ok, I couldn't, too. Never mind...
04:46jdzleafw: http://groups.google.com/group/clojure/browse_thread/thread/6b4a5284d61a682a/92e764e8790d5835#92e764e8790d5835
04:46leafwI saw the google page--neer used them before. I've seen the "source" tab, it has an svn link in it. Thanks jdz
04:48hoecktsdh: 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
04:48Chousukeleafw: the source tab has the url, but it's not a link. you can click on "browse" to browse the repository
04:49tsdhhoeck: Ok, nice. Thanks a lot!
04:49hoecktsdh: np :)
04:49leafwChousuke: there is a printed link. Good enough for my git mirror.
04:51Chousukeremember 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
04:51leafwthanks, I know.
05:57philscottedAnyone about?
05:58dhayahi
07:43slanganwould it be possible to add infix +-/* to clojure?
03:31Lau_of_DKDont know if you worked it out, but Infix was posted on the Googlegroup some weeks ago
03:57slangananyone have a good example of a Clojure-app using miglayout?
04:19rdd%r
04:19rdd_
04:22slanganhow do i force replicate?
04:25rhickeyslangan: doall
04:26rhickeythere's also repeatedly
04:30gnuvince(doc dorun)
04:30clojurebotWhen 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])
04:35slanganis it possible to interface to R?
04:41RSchulzslangan: R is written in C, no? Maybe C++? It won't be easy to interface Clojure, I don't think.
04:42RSchulzI've heard people talking about JNA, which is meant to simplify creating JNI interfaces, I guess. That might help.
05:51Chouserpower outages in fort wayne
05:52SmerdyakovChouser, are there other people here who live near Fort Wayne?
05:58slanganok I installed colt. when I have done: set CLASSPATH=c:\colt\lib\colt.jar;
05:59slanganhow should I import from it then?
05:59slanganand will that set the classpath forever or I have to do each time I start windows?
05:59Smerdyakovslangan, you're running Windows? O_o
05:59RSchulzslangan: Use Clojure's (import ...) directive, of course.
05:59RSchulzThat "set" command is in effect only in the instance of CMD.exe to which use issued it.
06:00RSchulzAnd yes, if you're serious about Java and Clojure programming, Windows cannot be considered advisable...
06:00slanganSmerdyakov: yeah i cant get wireless to wrok on ubuntu
06:00RSchulzUse openSUSE. It's distinctly superior in hardware support and coverage to Ubuntu.
06:00Smerdyakovslangan, strange. I got it to work on my laptop with the stock Debian kernel and little poking around on the web.
06:01SmerdyakovRSchulz, and Debian is distinctly superior in software support. :)
06:01RSchulzAnyway, in Windows you can set environment variables permanently (system- or user-wide) in the Environment control panel.
06:04slanganok iadd ed to the CLASSPATH instead
06:04slanganbut still doesnt work
06:04RSchulzslangan: What is your general programming background? How many years? Which languages?
06:06RSchulzAnd if you're stuck on Windows, Cygwin is extremely helpful.
06:07slanganpackage colt does not exist
06:09slanganRSchulz: 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.
06:09RSchulzAnd you're using Windows CMD.exe? Which editor for you Clojure and Java coding?
06:10slanganpackage cern.colt does not exist
06:10slanganemacs+clojure-mode, do i have to restart emacs perhaps?
06:11hiredmanuh
06:11slangannah didnt help
06:12slangani changed classpath by adding to it in the win advanced settings CLASSPATH
06:13RSchulzslangan: After you change the global (or per-user) CLASSPATH environment you have to start a new CMD.exe or other shell.
06:13RSchulzThey're still inherited at the time of process creation, as in Unix / Linux.
06:15RSchulzWhich one? I have so many!
06:15slanganRSchulz: i dont do it with cmd.exe, I just added to the CLASSPATH. I restarted emacs too.
06:15mchurchIn 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*?
06:16SmerdyakovRSchulz, really? O_o I meant H&S.
06:16hiredmanthe * stuff tends to be more primitive
06:16RSchulzThat was a joke. There's only H&S. I'm S.
06:16RSchulzClojure doesn't have let*, does it?
06:17duck1123it's private
06:17Smerdyakovmchurch, are you Mike Church?
06:17RSchulzHe's the Church-Turing Church!
06:17RSchulzYeah. It has fn*, too, whatever that does. I don't need to know...
06:18RSchulzExcept, I suppose, when it shows up in a macro expansion...
06:19hiredmane.g., let* does not support destructuring
06:19SmerdyakovRSchulz, how is H&S doing in this economic environment?
06:20RSchulzWell, we're alive. It's never been flush, but we have one government research contract that probably won't go away next year.
06:20hiredmanif you look at core.clj, let is defined in terms of let*
06:20SmerdyakovRSchulz, can you say what the research is?
06:21RSchulzApplication of first-order theorem provers and other logic tools to problems in the Process Specification Language. It's funded by NIST through SJSU.
06:22ChouserSmerdyakov: I'm the only one here from my city, as far as I know.
06:22SmerdyakovRSchulz, "process specification language".... that sounds like some dodgy XML-influenced thing. :D
06:22SmerdyakovEr, UML-influenced
06:22RSchulzIt has nothing whatsoever to do with XML.
06:23SmerdyakovSee correction. :)
06:23RSchulzIt's written entirely in frist-order logica which has many surface notational forms. We use CLIF, which is part of the Common Logic specification.
06:23RSchulzBoth PSL and Common Logic are ISO standards.
06:23RSchulzIt is also not related to UML, though our funder works closely with OMG.
06:26SmerdyakovI'm always dubious of logical systems that aren't higher-order.
06:27SmerdyakovMaybe this domain is simple enough that the usual gains wouldn't matter much.
06:29Chouserstuarthalloway: you meant assert returning it's expression's value on success, right? not on failure.
06:30slanganbut seriously, how retarded is the java claspath, how can it not be possible to just add a new path to it?
06:31stuarthallowaychouser: right
06:32stuarthallowayI want to embed asserts inside Fact
06:32stuarthallowayso that I get a "point of failure" message from the assert, and a more general message from Fact
06:33RSchulzslangan: For one thing, there are security issues surrounding what is and is not in the classpath.
06:33stuarthallowayI could embed test-is's "is", but that drags along the whole reporting mechanism
06:33RSchulzSecondly, there is the ability to dynamically alter it from Clojure.
06:33RSchulzHave you made at least one pass through the on-line documentation to familiarize yourself with what's built in?
06:35Chouserstuarthalloway: seems reasonable, especially in a testing framework.
06:35ChouserI 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)
06:36Chouserbut that's not an argument against changing assert.
06:36RSchulzChouser: I tend to agree. At the top of a function, you're verifying that your caller satisified the function's contract.
06:37RSchulzIf you have asserts in the middle, you're verfying that the functions you call have verified their postconditions.
06:37RSchulzI 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.
06:37Chouseror if you're using assert in a tail position, I suppose it may be verifying your own postcondition.
06:38RSchulzWhich is reasonable, too, at least early on.
06:38Chouser...but only verifying that it's non-nil or not-false. Not much of an assertion.
06:38stuarthallowayI just want to report the form that broke, so maybe something like "expect" is better
06:39stuarthallowayit'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
06:39ChouserI'd be curious to see if anyone has a reasoned objection. It seems like a harmless change to me.
06:39RSchulzI 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.
06:40RSchulzAnd by "formula" I mean "expression," of course. I get my logic mixed up with my programming.
06:40stuarthallowaychouser: I thought so too, but I haven't found any functional language that works the way I am proposing
06:42Chouseryet another innovative feature for Clojure!
06:48slangan#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
06:49hiredmanslangan: chill
06:49Smerdyakovslangan, it's trivial to do. You're making some very basic mistake.
06:50ChouserI've also been frustrated with the Java classpath, but once I got past the denial and bargaining, acceptance hasn't been too bad.
06:50Smerdyakovslangan, check the value of the environment variable, in the context where you expect something to be happening differently.
06:51slanganso the relevant jars are in the path
06:51ChouserI 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.
06:51slanganbut calling them doesnt work
06:51hiredmanclojurebot: do you know anything about a jar directory?
06:51clojurebotjar directory is -Djava.ext.dirs=$LIBS
06:51Chouserslangan: each .jar must be individually named on the classpath
06:52Chouserunless you use the -Djava.ext.dirs route
06:52stuarthallowayext.dirs also have different security characteristics
06:52stuarthallowayit's unwise to stick things there just to simplify classpath setup
06:53hiredmanunless you have a policy file allowing everything anyway
06:56slanganso it works in Java now but I cant import from Clojure
06:57slanganimport cern.colt.Arrays;
06:57slangan(import '(cern.colt Arrays))
06:59slanganif it works with my java shouldnt it automatically wor with clojure?
07:00Chouserslangan: yes
07:01slanganimport cern.colt.matrix.*;
07:01slanganDoubleMatrix2D dm;
07:01slangancompiles
07:01slangan(import '(cern.colt.matrix DoubleMatrix2D))
07:01slanganjava.lang.ClassNotFoundException: cern.colt.matrix.DoubleMatrix2D
07:02Chouserslangan: what is your java command line?
07:02aperotteslangan: have you tried starting a repl from the command prompt setting the classpath manually
07:02slanganno idea
07:02mchurchSmerdyakov: I am Mike Church. How do you know of me?
07:02mchurchI'm not the Church-Turing Church. He's a very distant relative (11 up, 9 down).
07:02mchurchWe're related through some wealthy CT family, not that the wealth ever traveled down to my node of the tree.
07:03Smerdyakovmchurch, I'm Adam Chlipala.
07:03mchurchAh!
07:03mchurchGood to hear from you! How's life post-JSC?
07:03Smerdyakovmchurch, you're not authenticated to services, so we can't take this to a private conversation, which we probably should. :(
07:04drewrCan I not create a var from a lexical variable returned by a function?
07:04slanganhttp://hpaste.org/13190
07:04mchurchDo you Skype?
07:05mchurchDid you hear that I left JSC?
07:05slangan^^ classpath problem, contains my .emacs, perhaps i need to specify tp clojrue as well where it should look?
07:05mchurchAround the same time you did (4/24) and some other good people are exiting as well.
07:05Smerdyakovmchurch, I think it's inappropriate to talk about that here.
07:05Chouserdrewr: the function is returning what? A Var? A Symbol?
07:05mchurchon Skpye: michael.o.church
07:05Smerdyakovmchurch, I'm not on Skype, but can you just register with Nickserv?
07:05mchurchhow do I do that?
07:05drewrChouser: This works, (def *foo* (let [foo :foo] foo)).
07:05aperotteslangan: try importing from a repl started like this: java -classpath "location of clojure";"location of colt" clojure.lang.Repl
07:05Smerdyakov/msg nickserv help
07:06mchurchI'll tell you what... send me an email : michael.o.church@gmail.com
07:06mchurchMy morning is chaotic. I have plates spinning in multiple spheres of life.
07:07drewrChouser: But for some reason, make-foo in (def *foo* (make-foo ...)) returning a lexical value does not actually bind *foo*.
07:07drewrLet me do some more digging. I'm not sure what I'm doing is right.
07:07Chouserdrewr: your def/let example is just the same as (def *foo* :foo)
07:08aperotteslangan: 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
07:08Chouserthat is, interning a Var named '*foo*' with a root value being the keyword :foo
07:08RSchulzmchurch: Yeah, I knew that. Alonzo is 13 years dead.
07:08drewrChouser: True. (def *foo* ((fn [] (let [foo :foo] foo)))) still works however.
07:09Chouserdrewr: that's still the same thing.
07:09SmerdyakovAlonzo Church is my great-great-great-great-great-grand-PhD-advisor, or something like that.
07:09drewrChouser: But it's closer to what I'm actually doing.
07:09slanganaperotte: should the paths be quoted?
07:09drewrI'm trying to return a socket that I bind lexically in the fn's let.
07:09Chouserdrewr: there you're creating a function that returns :foo, calling it and binding the result (still just ':foo') to *foo*
07:10aperotteslangan: at the command prompt, no
07:10drewrBut my trivial examples are working, so I must be doing something different in the fn.
07:10aperotteslangan: but if you choose to put it in your .emacs file then you will need to quote it
07:11Chouserif you run the function by itself at the repl (or use 'prn' on it) you should see it return the socket object.
07:13drewrChouser: Yeah, that ain't happening. Interesting...
07:13drewrIt never returns, which means the var never gets bound. :-)
07:13Chouserthat'll do it
07:14slanganimport cern.colt.matrix.*;
07:14slanganDoubleMatrix2D dm;
07:14slanganis then: (import '(cern.colt.matrix DoubleMatrix2D))
07:14slangancorrect?
07:15aperotteslangan: yes
07:15slanganaperotte: I started it from command prompt and it stillc ant find the class
07:16slanganhttp://hpaste.org/13191
07:17slanganoh im so dumb
07:17drewrline-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.
07:18slangannow it works from the command prompt
07:18slanganso how do I fix it so emacs looks there every time?
07:18drewrMy macro has the same problem though because line is never nil.
07:18slanganor what is the preferred way to do it?
07:18drewrBecause the input stream keeps returning data even if they're empty strings.
07:19drewrActually, no, it's just blocking until it gets more I guess.
07:21aperotteslangan: 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
07:30RSchulzaperotte, 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.
07:30RSchulzIt also has an option to choose the Contrib REPL instead of the core REPL.
07:30aperotteRSchulz: is it in the google group repository?
07:31RSchulzNo, though I did post a slightly older (and, I discovered bugged) version to the mailing list as an attachment.
07:31aperotteRSchulz: where might I be able to find it?
07:32RSchulzLet me check to see what the Subject and date were...
07:33RSchulzSubject: Re: why can't I set! stuff in user.clj? Date: 2008-12-09@18:10 (PST); Sender: Randall R Schulz
07:33aperotteRSchulz: Thanks!
07:33RSchulzThat version will fail if you _don't_ give the --crepl option.
07:33RSchulz--crepl requests the Contrib REPL.
07:34RSchulzAre there restrictions (CA, e.g.) on uploading to the Google Groups file area?
07:34RSchulzAlso, you'll need to edit the variable setting at the top of that script to reflect where you installed Clojure Core and Contrib.
07:36RSchulzAlso, I never wrote a --help option and some of it's not entirely obvious.
07:36RSchulzIf you put a -- option somewhere in the argument list, everything before will be interpreated as JVM opts and everything after as Clojure arguments.
07:41duck1123has anyone noticed enclojure not shutting down the repl when netbeans is shut down?
07:41duck1123I opened netbeans earlier today, and I just noticed that the repl was still running
07:44aperotteRSchulz: are there many differences between the clojure repl and the contrib repl?
07:44RSchulzThe Contrib REPL is nicer. Try it.
07:45aperotteok, I'll give a try
07:45duck1123isn't the contrib repl the one that does the line numbers
07:45RSchulzduck1123: I made the mistake of updating to the latest Enclojure. Now I have nothing.
07:45RSchulzduck1123, aperotte: Yes, that's one thing. It actually has a configurable prompt the way Unix shells do.
08:28slanganis (apply vector coll) O(n) or by some clever trick O(1)?
08:31RSchulzThat would go beyond being clever, wouldn't it?
08:32RSchulzBesides, you're going to get a vector of one element, the collection, not a vector containing all the elements of the collection.
08:32RSchulzFor the latter, use (into ...)
08:32RSchulzActually, it seems I'm wrong.
08:33RSchulzBut not about the O(n) vs. O(1) part.
08:33kotarakslangan: (apply vector coll) <=> (vec coll), not sure about the O part
08:33RSchulzThe vector is a collection, not a lazy sequence.
08:33RSchulzFor it to contain all the elements from the collection they (references to them) must each be copied to the vector.
08:34kotarakRSchulz: (vector coll) gives one-element vector, (apply vector coll) or (vec coll) gives a vector containing the elements of coll
08:34RSchulzYes. I was confused about that.
08:34danm_good morning
08:34ChouserBut correct about O(n)
08:37RSchulzIt 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...
08:42slanganaperotte,RSchulz:thanks it works now, i figured out how to do it.
08:43aperotteslangan: 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
08:44slangani mainly need SVD havent actually checked how it works yet
08:50RSchulzWhat's SVD?
08:51whidden_RShulz: SVD = Single Value Decomposition
08:53slanganim confused
08:53slanganfile:///C:/colt/doc/api/index.html
08:53slanganoh oops
08:53slanganhmm
08:54slangananyway I have a class with seeminglyno constructors, just method
08:54whidden_RShulz s/Single/Signular/
08:54whidden_http://en.wikipedia.org/wiki/Singular_value_decomposition
08:55RSchulzslangan: All Java classes have constructors. If none are explicit, a public default constructor is supplied by the compiler.
08:56slangan(import '(cern.colt.matrix.DoubleMatrix2D DenseDoubleMatrix2D))
08:56slangangot it
08:57RSchulzThat class has two constructors accoding to the documentation on the Web.
08:57RSchulzwhidden_: Thanks. I've heard of it by the long name, but don't do a lot of math, so the acronym wasn't familiar.
08:58slanganhow do I pass a double[][] ?
08:58RSchulzCheck the array creation capabilities on the Java Interop page.
08:58RSchulzslangan: Really, I don't mean to be rude, but it seems you ask a lot of questions that are answered by the doucmentation.
08:58slanganlol waity
09:04RSchulzOne 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.
09:05arbscht_is there any way of passing Pattern flags when instantiating a regex pattern from clojure?
09:06Chouserarbscht_: you can specify flags within the regex pattern itself.
09:06arbscht_oh
09:06gnuvincearbscht_: #"(:i)..."
09:06gnuvincearbscht_: #"(?i)..."
09:07ChouserI still have to look it up. (re-seq #"(?i)zz" "ZZ")
09:11danlarkinRSchulz: heh I do the same
09:11danlarkinRSchulz: but sometimes I ask all the same
09:14stuarthallowayhere's a question that cannot be answered by reading core or contrib source:
09:14stuarthallowayIn Common Lisp, code that generates macroexpansion should be purely functional
09:14stuarthallowayi.e. the compiler might call macroexpansions more often than you think
09:15stuarthallowayshould the same assumption be made in Clojure?
09:15stuarthallowayI think so, but I haven't seen it documented anywhere
09:15RSchulzIt couldn't hurt... And it's probably a lot easier in Clojure, anyway.
09:16danlarkinstuarthalloway: as convention? or are you asking if the clojure compiler could indeed macroexpand more than once
09:16stuarthallowayRSchulz: you bet
09:16stuarthallowaydanlarkin: not "could" as in what the compiler currently does
09:16stuarthallowayfor that I could read the source
09:16RSchulzOne thing you surely can count on is that name# will be consistently substituted across any given expansion.
09:17stuarthallowaybut if I find that the compiler currently expands macros only once in all cases, that proves nothing
09:17stuarthallowaythe example PG gives in On Lisp is a macro that counts how many times it occurs be incrementing a global
09:18RSchulzstuarthalloway: I'm glad at least some people are cautious about inferring the language definition from currently observable compiler behavior.
09:18stuarthalloway...I admit this is arcana, but people expect book authors to know things :-)
09:18RSchulzCan't you just fake that??
09:19danlarkinRSchulz: do you have a better place to gather language spec from? :) if so please do share
09:19Chouserdanlarkin: rhickey
09:19stuarthallowaydanlarkin: right here on this forum, by starting a conversation interesting enough that rhickey joins in :-)
09:19RSchulzIn 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.
09:20RSchulzBut 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.
09:20danlarkina resounding answer!
09:21stuarthallowayI'll post a question to the mailing list
09:21Chouserit's not particularly uncommon for him to say that a particular current behavior isn't guaranteed.
09:21RSchulzWhich is definitely something you want to know!
09:21danlarkinthat is true
09:22Chouserbut it seems to me there are already macros with side effects
09:22Chouserah, got it: proxy
09:24Chouserthe proxy macro generates a class (and may save it to disk) when it expands.
09:24stuarthallowayChouser: I think that is different
09:25Chouseroh?
09:25stuarthallowayproxy generates code that has side effects
09:25stuarthallowaybut does calling macroexpand-1 on proxy have side effects?
09:25ChouserFrom looking at the code, I think so. But let me check...
09:26Chouserit does.
09:27lisppaste8Chouser pasted "side-effect of expanding 'proxy'" at http://paste.lisp.org/display/72406
09:28Chouserthat still doesn't necessarily mean it's recommended for the rest of us, but it is a data point.
09:29stuarthallowayChouser: eeeeew
09:30stuarthallowayNow I will definitely post a question on the list
09:31Chousernow that I think about it, a macro without side-effects seems kinda puny and weak
09:36stuarthallowayChouser: your example notwithstanding, most Clojure macro expansions do not have side effects
09:36Chousersure, the puny ones don't.
09:39ChouserI want more bold, strong macros that go around at compile time, sending off agents, blocking on IO...
09:39Chouserpfft, nevermind.
09:43gnuvince(doc io!)
09:43clojurebotIf 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])
09:44gnuvinceIs that form just for making sure you don't have side effects in your transactions?
09:44Chousergnuvince: yes
09:45gnuvincekk
09:45gnuvincethanks
09:45Chousergnuvince: you can use 'io!' as a sort of assert, in any function that you know for sure should not be put in a dosync.
09:46Chouserclojure.core currently only uses it in 'await'
09:57graddacolt seems very good! (java linear algebra+more package)
09:58graddahas svd and all kinds of matrix-stuff
09:58aperottegradda: 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
09:58aperotte(so far)
10:02graddayes
10:03graddabut it doesnt seem to have any plotting
10:23dreish,(+ 1 1)
10:23clojurebot2
10:23Smerdyakov,(+ ,(+ 1 1) 1)
10:23clojurebot3
10:24dreish,(def google (-> (java.net.URL. "http://google.com&quot;) .getContent reader line-seq doall))
10:26dreishI think -> is my favorite macro right now.
10:27AWizzArdclojurebot: max people
10:27clojurebotmax people is 116
10:34dreishOh, wow, this works too: (def google (-> "http://google.com&quot; reader line-seq doall))
10:35graddaif 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:36dreishIs it just my imagination, or should clojure.contrib.duck-streams really be rewritten with defmulti?
10:36dreishgradda: You can just wrap it in seq and treat it like any other Clojure sequence.
10:50aperottegradda: There is plotting in colt. It's car includes aida (I haven't actually used any of this yet though)
10:50aperottegradda: car = jar
10:50aperottegradda: http://aida.freehep.org/
10:57graddaah
17:20Lau_of_DKEvening gents
17:25mibuchouser: are you here?
17:25Chousermibu: yes
17:26mibuchouser: 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:26Chousermibu: thanks, glad you like it.
17:26mibuchouser: it gives the exact quick overview one needs to get one's head around what goes where.
17:27mibuchouser: anyway, just wanted to drop by and say what a wonderful work you guys are doing...
17:28ChouserI appreciate it.
17:28mibug'night.
18:06triddellDoes 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:08danlarkintriddell: clojure currently has no """syntax"""
18:08danlarkinalthough I'm working on a patch to add it
18:08danlarkinit's not going very well though :)
18:10triddellok, 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:13duck1123triddell: there have been several good attempts at allowing xml generation with clojure data structures
18:13duck1123ie. compojure.html and clojure.xml
18:14triddellI'm using the vector-based support in compojure right now
18:15triddellit's working well... albeit slow as I get up to speed on clojure
18:17duck1123there'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:18triddellI think Ruby allows that
18:20duck1123that'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:20duck1123I have a feeling though that it wouldn't be. It would probably introduse too much complexity in parsing to be worth it
18:21durkalike heredocs?
18:21durkaphp has a version
18:21NafaiIs this pretty up to date? http://clojure.org/compilation
18:23whiddendurka: I just about to say Here docs, ala Bash, right?
18:23durkai don't really know bash
18:23durkabut php has $var = <<<EOF
18:23durkainput input input
18:23durkaEOF;
18:24durkai think there's variable sbustitution in there too though
18:24duck1123That's exactly what I was thinking of, I knew several languages had them, I just didn't know that term
18:24whiddenthat's basicly what bash does.
18:25whiddenyou can do here docs in the lisp reader, because you can reprogram the reader syntax.
18:27duck1123I'm not terribly convinced it would be something to look into any more. It was just something I was mulling over last week.
18:29lambdatronicHowdy folks
18:30lambdatronicGot a macro question fer ya
18:30lambdatronicanyone game?
18:30duck1123ask
18:31lambdatronicalright, I'm working on a DSL for Bayesian Logic Programming
18:31lambdatronicI would like to say the following:
18:31lambdatronic(defrandom climate-change [Location x] (... body stuff here ...))
18:32lambdatronicI need to maintain a type hierarchy matching input ontologies
18:32lambdatronicso I'm using the hierarchy system for that, no prob
18:32lambdatronichowever, these random functions need to specify their input "types"
18:32lambdatronicIn this case, x is a Location
18:33lambdatronicso...here's the macro
18:33lambdatronic(defmacro defrandom [fn-name args & body]
18:33lambdatronic (let [[arg-types# arg-names#] (uninterleave args)]
18:33lambdatronic `(defn #^{:randomfn true :arg-types ~arg-types#} ~fn-name ~arg-names# ~@body)))
18:33duck1123lisppaste8: url
18:33lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
18:34lambdatronicuninterleave is my function. pretty simple. (uninterleave [a b c d]) => [[a c] [b d]]
18:34lambdatronicopposite of interleave
18:34lambdatronicso here's my question
18:35lambdatronicwhen I attempt to enter this macro at the REPL, I get an error telling me that Metadata can only be applied to IObjs
18:35lambdatronicwhat gives?
18:36lambdatronicTyping the (defn #^{:randomfn true ...} foo [x] (... body junk ...)) reads and evals correctly
18:36lambdatronicbut the macro is incapable of constructing that statement based on my spec.
18:36lambdatronicAny thoughts?
18:38danlarkinclojurebot: project euler
18:38clojurebotproject euler is http://ProjectEuler.net
18:38danlarkinclojurebot: brain dump
18:38clojurebotbrain dump is http://clj.thelastcitadel.com/clojurebot
18:38duck1123seems like a quoting issue, but that's just a guess
18:39duck1123have you tried expanding it to see what it produces?
18:40lambdatroniclike I said, I can't get the repl to accept the defmacro form in the first place
18:40lambdatronicso I can't expand any uses of it.
18:40lambdatronic;(
18:41lisppaste8lambdatronic pasted "defrandom macro" at http://paste.lisp.org/display/72424
18:41lambdatronicjust in case that helps
18:51danlarkinhttp://www.mikeperham.com/2008/12/13/clojure-vs-ruby/
18:53duck1123Has anyone tried mixing (j)ruby and clojure?
18:54duck1123I just ported my ruby code from ruby to jruby today as a first step towards eventually replacing it with clojure
18:54NafaiWhen doing :gen-class, how do I call a superclass method on an overriden method?
18:56Nafaifrom an overriden method, rather
19:00whiddenlambdatronic: 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:07RSchulz#^ yields (with-meta ...)
19:08RSchulz^form yields (meta form)
19:08lambdatronicththanks for the suggestion, whidden
19:08lambdatronicI'll try it
19:20mehrheit#^ doesn't directly yield with-meta, I think
19:20lambdatronicno, it has to be something more comlplex
19:22zakwilsonHas anybody done any work on genetic algorithms in Clojure?
19:23Chouserlambdatronic: http://groups.google.com/group/clojure/msg/919455504c57659e
19:23mehrheitlambdatronic: don't use #^ there
19:24mehrheitlambdatronic: it applies metadata to the source code symbols and structures for the compiler
19:24mehrheitlambdatronic: doesn't work there, because there's syntax-unquote after the map, which is a special object
19:25mehrheitlambdatronic: rather use (defn name ([args] ...) {metadata-map})
19:26lambdatronichmm...
19:28lambdatronicHey that works!
19:28lambdatronicwhy?
19:28lambdatronicIt's not in the API or online macro spec for defn, the metadata page, or the special forms def description
19:28mehrheitit should be in the arglists
19:29mehrheit[name doc-string? attr-map? ([params*] body) + attr-map?]
19:29mehrheit(this it from (doc defn))
19:30lambdatronicwild
19:30mehrheitit's the attr-map?, not very well documented though
19:32lambdatronicokay, so the final solution looks like this:
19:33lambdatronic(defmacro defrandom [fn-name args & body]
19:33lambdatronic (let [[arg-types# arg-names#] (uninterleave args)]
19:33lambdatronic `(defn ~fn-name (~arg-names# ~@body) {:randomfn true :arg-types ~arg-types#})))
19:33lambdatronicSweet
19:33lambdatronicand (defrandom climate-change ['Location x] (println x)) works perfectly
19:33lambdatronicthanks, mehrheit
20:31danlarkinphew
20:31danlarkinback from shoveling out in front of my house and digging out my car
20:31danlarkinI'd say there's about 8 inches so far
20:39RSchulzdanlarkin: I just talked to my parents in Wisconsin. They said they'd gotten about 10 inches. Yowsa!
20:41RSchulzWhereabouts are you?
21:03danlarkinAlbany, ny
21:17RSchulzMy sympathies...
21:17RSchulzMaybe you can ski to the market?
21:22danlarkinActually when I was digging out my car I contemplated it
21:22danlarkinthere's enough snow on the roads that they'd be a fantastic xcountry skiing course
21:30RSchulz'Cept for the snowplows...
21:31RSchulzBest to hunker down. Or strike out into the back country. ... Does Albany have a back country??
21:35danlarkinit does
22:01NafaiHow do I call a super class method when using gen-class?
22:02Nafai:gen-class, I mean
22:05Chousera method you've overridden, I assume?
22:07NafaiChouser: Correct
22:07NafaiI want to re-write this in Clojure: http://paste.lisp.org/display/72422
22:15Chouser(defmacro super [methname instance & args] `(binding [~methname nil] (. ~instance ~methname ~@args)))
22:16ChouserNafai: I haven't tried that in ages, but it used to work.
22:19Chouserplease let me know if it still does -- the question comes up now and then.
22:19NafaiSure thing
22:19NafaiI'm trying this and the AOT compiler
22:19Chouseryes, great.
22:20ChouserI'm afraid you'll have trouble at runtime with Android, though.
22:22Nafai:(
22:22NafaiWhat will the problems be?
22:22ChouserClojure still creates a dynamic classloader during start up.
22:24NafaiDang, didn't realize that
22:24ChouserThat prevents unsigned applets from working at the moment, for example.
22:27triddellFrom 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:29NafaiI was trying to avoid Java coding, but I guess not
22:30ChouserNafai: well, you could help fix Clojure.
22:30Nafai20:20 < Chouser> I'm afraid you'll have trouble at runtime with Android, though.
22:30Nafai20:22 < Nafai> :(
22:30NafaiWhoops
22:30Nafai20:22 < Nafai> What will the problems be?
22:30Nafai20:22 < Chouser> Clojure still creates a dynamic classloader during start up.
22:30NafaiSorry for the paste
22:30NafaiWhat needs to be fixed?
22:31NafaiI'm assuming the classloader is for the proxy classes?
22:31ChouserI think it's really close -- the dynamic classloader ought to no longer be needed for fully AOT-compiled code.
22:32Chouserwithout AOT compilation, each top-level form is compiled to bytecode and dynamically loaded
22:33NafaiSo if the Clojure jar itself can be compiled with dalvik, we should be good
22:34Chousernot quite. the dynamic classloader is currently created at runtime regardless
22:35Chouserthat's enough to make applet containers mad, and I assume will fail in dalvik as well.
22:35NafaiHrm
22:36Chouserso it needs to be created only when needed and/or when possible.
22:36albinoChouser: do you know if there are plans in the future to fix that?
22:36Chouserhttp://code.google.com/p/clojure/issues/detail?id=14
22:37NafaiNice, just a couple days ago
22:38ChouserI took a crack at it a couple days ago, but it's ... tricky. :-)
22:38NafaiHrm.
22:39Nafaidalvik fails at compiling clojure.jar
22:39Chouserthat issue tracker has only been used for a couple days.
22:39Chouseroh, really? does it say which .class file?
22:39Nafaihttp://paste.lisp.org/display/72433
22:41NafaiInteresting error message
22:45Chouserit is.
22:45NafaiThis is from clojure svn trunk
22:47ChouserI 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:50NafaiPossibley
22:52triddellI 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:53triddellanyone? ... bueller?
22:54Chousertriddell: are you sure you can't just leave it as a java.util.HashMap?
22:54Chouser'get', 'seq', and such work
22:55Chouserotherwise (into {} my-hash-map) should do it
22:55mmcgrana,(let [h (doto (java.util.HashMap.) (.put "foo" "bar") (.put "bat" "biz"))] (into {} h))
22:56mmcgranao is clojure bot not 'evaling anymore
22:56Chouser,(+ 1 2)
22:56clojurebot3
22:56triddellwell, 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:56triddellcast
22:57mmcgrana,(let [n (+ 1 2)] n)
22:57clojurebot3
22:57Chouserit should work as the input collection
22:57Chouser,(into {} (java.util.HashMap. {:a 1 :b 2}))
22:57Chouser,(java.util.HashMap. {:a 1 :b 2})
22:58mmcgrana,(String.)
22:58triddellI have a collection (list) of HashMaps right now
22:59mmcgranaif you want a list of clojure maps use "map" and the fns given above
22:59triddellI'll try that... thanks to you both
23:03mmcgrananp