Re: REPL vs Script + Regex Problem!

2010-02-02 Thread Meikel Brandmeyer
Hi, On Feb 3, 1:54 am, Michał Marczyk wrote: > Something I wanted to mention is that this could provide a use case > for an Scheme style cond macro, especially if the processing logic got > more involved -- have a look at my scond if you'd like: > > http://gist.github.com/293212 > > Basically th

Re: building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-02 Thread Ramakrishnan Muthukrishnan
On Wed, Feb 3, 2010 at 1:12 AM, Rob Wolfe wrote: > there are needed two things: > > 1. maven profile, which will be activated by "-Denv=local" > 2. dependency defined with "system" scope and "systemPath" > > I can not find anything like that in clojure-contrib pom.xml. > So I added this part to or

Re: The Best Way to Accomplish This...

2010-02-02 Thread ataggart
On Feb 2, 7:53 pm, Wardrop wrote: > I feel like I'm over-staying my welcome by posting yet another topic, > so please only answer if you get some form of enjoyment out of solving > such problems as this one. > > I've given this problem a fair bit of my time, and it's been good so > far as it's f

Re: Request for advice on java interop namespace hunting

2010-02-02 Thread ataggart
Any half-way decent IDE should have a shortcut for resolving wildcard imports to be fully-qualified. On Feb 2, 7:31 pm, Timothy Pratley wrote: > Hi, > > I've found myself a few times in a situation where I'm banging some > java code into clojure, and the java source uses import foo.* blah.* > bar

Re: The Best Way to Accomplish This...

2010-02-02 Thread Michał Marczyk
Ouch, just noticed that the counts get accumulated by extension... In this case it's probably best to add the current size to a counter stored in the map entry when there's a duplicate. It's a minor tweak, though. Sincerely, Michał -- You received this message because you are subscribed to the G

Re: The Best Way to Accomplish This...

2010-02-02 Thread Michał Marczyk
How about this for a start? (reduce (fn [m line] (if (empty? line) m (if-let [size (get (re-matches #"([0-9]+) byte\(null\)each:" line) 1)] (merge m {:size size}) (if-let [file (get (re-matches #".*(\.[0-9a-zA-Z]+)" line) 1)]

The Best Way to Accomplish This...

2010-02-02 Thread Wardrop
I feel like I'm over-staying my welcome by posting yet another topic, so please only answer if you get some form of enjoyment out of solving such problems as this one. I've given this problem a fair bit of my time, and it's been good so far as it's forced me to learn new things and challenge my ra

Re: Request for advice on java interop namespace hunting

2010-02-02 Thread Wilson MacGyver
Whenever I had to do this, I put the java code in a separate java file in IntelliJ, and let it figure out the list of imports. I then paste them into clojure. Works well since I also use IntelliJ for clojure anyway. On Tue, Feb 2, 2010 at 10:31 PM, Timothy Pratley wrote: > Hi, > > I've found my

Re: Request for advice on java interop namespace hunting

2010-02-02 Thread Richard Newman
I've found myself a few times in a situation where I'm banging some java code into clojure, and the java source uses import foo.* blah.* bar.* Now Clojure requires explicit class naming (which I fully support) so I end up spending a good slice of time googling "java SomeWierdClass someapi" to ge

Request for advice on java interop namespace hunting

2010-02-02 Thread Timothy Pratley
Hi, I've found myself a few times in a situation where I'm banging some java code into clojure, and the java source uses import foo.* blah.* bar.* Now Clojure requires explicit class naming (which I fully support) so I end up spending a good slice of time googling "java SomeWierdClass someapi" t

require macro/function [was clojure.contrib.[duck-streams io]]

2010-02-02 Thread Stuart Halloway
In teaching people Clojure, non-intuitive behavior with use/require is the #1 problem for beginners, by a mile. I believe we need both ordinary function and macro versions, and I am pretty sure that a well- considered patch implementing this would be accepted. SS: is require* an acceptable n

Re: REPL vs Script + Regex Problem!

2010-02-02 Thread Michał Marczyk
Something I wanted to mention is that this could provide a use case for an Scheme style cond macro, especially if the processing logic got more involved -- have a look at my scond if you'd like: http://gist.github.com/293212 Basically this would allow you to write things like (scond [(re-matches

Re: REPL vs Script + Regex Problem!

2010-02-02 Thread Wardrop
(some) definitely seems like the way to go. Now I've got to move onto my next problem, which is totally the number of duplicate files and the bytes they take up. I'm guessing at this point that something like (reduce) will be the way to go. Thanks for all your help. This won't be the last time you

Re: REPL vs Script + Regex Problem!

2010-02-02 Thread Michał Marczyk
On 3 February 2010 00:50, ataggart wrote: > It occurs to me you could use 'some instead of nested if-lets: > > (some identity >  [(first (re-matches #"([0-9]+) byte\(null\)each:" line)) >   (first (re-matches #".*(\.[0-9a-zA-Z]+)" line))]) A simplified version: (some #(first (re-matches % line))

Re: REPL vs Script + Regex Problem!

2010-02-02 Thread ataggart
It occurs to me you could use 'some instead of nested if-lets: (some identity [(first (re-matches #"([0-9]+) byte\(null\)each:" line)) (first (re-matches #".*(\.[0-9a-zA-Z]+)" line))]) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

Re: REPL vs Script + Regex Problem!

2010-02-02 Thread ataggart
On Feb 2, 3:02 pm, Wardrop wrote: > The problem is, the only output I get is "Finished!". If however, I > run this on the command line, I get a long list of nil's in amongst > the strings "Byte pattern!" and "File pattern!". I expect the nil's > not to show when this is run as a script, but why

Re: REPL vs Script + Regex Problem!

2010-02-02 Thread Meikel Brandmeyer
Hi, Am 02.02.2010 um 23:48 schrieb Wardrop: > (for [line (line-seq (reader "C:\\filedupes.txt"))] > (cond >((complement nil?) (re-matches #"([0-9]+) byte\(null\)each:" > line)) > (println "Byte pattern!") >((complement nil?) (re-matches #".*(\.[0-9a-zA-Z]+)" line)) > (println "

Re: REPL vs Script + Regex Problem!

2010-02-02 Thread Wardrop
Haha, I was just trying out traditional formatting with clojure and had left it that way without noticing. As for the lazy thing, I should have known that as it wasn't long ago I was ready about laziness in the book I'm reading. Wrapping (dorun) around the (for) loop has fixed it. Could someone n

Re: REPL vs Script + Regex Problem!

2010-02-02 Thread Kevin Downey
for is lazy, and your code formatting is horrible. On Tue, Feb 2, 2010 at 2:48 PM, Wardrop wrote: > I've noticed that the output of a script, is often different to the > output of the same commands if run on the REPL. This makes sense, but > here's a situation which has got me a little confused.

REPL vs Script + Regex Problem!

2010-02-02 Thread Wardrop
I've noticed that the output of a script, is often different to the output of the same commands if run on the REPL. This makes sense, but here's a situation which has got me a little confused. I'm trying to run this code as a script... (use '[clojure.contrib.duck-streams]) (for [line (line-seq (r

Re: Transients question/feedback

2010-02-02 Thread Moss Prescott
> > My guess is that the resulting ephemeral garbage would have only a > > small effect on performance > > An interesting data point on ephemeral garbage that was quite > eye-opening: Somewhere in the talk below, Cliff Click says that the > problem with high-volume ephemeral garbage lies in the cac

Re: Transients question/feedback

2010-02-02 Thread Moss Prescott
On Feb 1, 6:39 pm, Richard Newman wrote: > If you're adding a new TransientVector instance on every call to   > conj!, you might as well just use conj. I think not. The reason building a huge transient vector is faster than building a huge persistent vector isn't the Vector instance created by ea

Re: Rich's "Clojure in Clojure" talk at the NYC group

2010-02-02 Thread Aaron Cohen
This email was cut-off from what I intended to send, sorry. What I meant to say, was that, unfortunately the video cuts off after 10 minutes. Are the slides for this talk available somewhere? Thanks, Aaron On Feb 2, 3:44 pm, Aaron Cohen wrote: > Hi guys, >   I was watching the "Clojure in Cloju

Re: building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-02 Thread Stuart Sierra
On Feb 2, 2:42 pm, Rob Wolfe wrote: > In order to use command like this: > > mvn -Denv=local -Dclojure.jar=/path/to/clojure.jar package > > there are needed two things: > > 1. maven profile, which will be activated by "-Denv=local" > 2. dependency defined with "system" scope and "systemPath" Whoo

Re: Clojars question

2010-02-02 Thread Alex Osborne
Hey Konrad, Konrad Hinsen writes: > I would like to deposit a small library on clojars.org. Is it possible > to do this without using either Maven or Leiningen? Neither of these > tools seems to be appropriate for my library. Sure, you can just write the POM by hand. The reason the POM is nece

Clojure Libraries page out of date

2010-02-02 Thread John "Z-Bo" Zabroski
http://clojure.org/libraries is out of date Gorilla was merged with VimClojure, and I think I saw other problems... Also, the organization of this page is messy and could use some taxonomy help. Reminds me too much of the Eclipse plug-ins page: out of control. -- You received this message beca

Rich's "Clojure in Clojure" talk at the NYC group

2010-02-02 Thread Aaron Cohen
Hi guys,   I was watching the "Clojure in Clojure" talk that I saw linked from the "disclojure" blog (very useful to me by the way, thank you nameless to me person who does it -- Aaron -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Re: Heap implementation in Clojure

2010-02-02 Thread ajay gopalakrishnan
What is the time and space complexity for your implementation? Equals the normal non-functional implementation? On Tue, Feb 2, 2010 at 7:31 AM, e wrote: > i was messing around a while back with this: > http://code.google.com/p/jc-pheap/ > > the algorithms work, but it's probably in a between-sta

Re: building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-02 Thread Rob Wolfe
Ramakrishnan Muthukrishnan writes: > Hi, > > I am trying to package clojure-contrib for Debian and one of the > debian java packaging practices is that the build should not download > any external dependencies. All the dependencies should be debian > packages themselves. > > I tried building cloj

Re: Clojars question

2010-02-02 Thread Meikel Brandmeyer
Hi, Am 02.02.2010 um 19:11 schrieb Konrad Hinsen: > I would like to deposit a small library on clojars.org. Is it possible to do > this without using either Maven or Leiningen? Neither of these tools seems to > be appropriate for my library. > > My library consists of just a few very small sou

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread Michał Marczyk
On 2 February 2010 16:05, Stuart Sierra wrote: > On Feb 2, 2:46 am, ataggart wrote: >> On a related note, it is my sincere hope that we get a version of >> require and use which no longer require (ha!) the use of quoted >> parens. > > Absolutely not!  Having 'require' as an ordinary function (not

Clojure offline documentation (clojure.org, Core API, Contrib API) in CHM / Microsoft HTML Help format

2010-02-02 Thread Axel Kollmorgen
hi all, i am new to clojure (and new to this list). i find clojure.org and the api documentation at github a great resource for learning. however, i am missing a comprehensive, compact and searchable offline version (and i did look around). so i did what i always do in this case [1]: make * a com

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread ataggart
And of course, that *does* work, thus my complaint was moot, and the symbol non-resolution was probably what Stuart was so aghast about (even though it wasn't my point). As Michael said: I wish I'd realised that just before posting rather than just after :) On Feb 2, 10:50 am, ataggart wrote:

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread ataggart
And of course that should be (require '[clojure.contrib string io]) or (require ['clojure.contrib 'string 'io]) so the symbols don't try to get resolved. On Feb 2, 10:41 am, ataggart wrote: > On Feb 2, 7:05 am, Stuart Sierra wrote: > > > On Feb 2, 2:46 am, ataggart wrote: > > > > On a related n

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread ataggart
On Feb 2, 7:05 am, Stuart Sierra wrote: > On Feb 2, 2:46 am, ataggart wrote: > > > On a related note, it is my sincere hope that we get a version of > > require and use which no longer require (ha!) the use of quoted > > parens. > > Absolutely not!  Having 'require' as an ordinary function (not

Clojars question

2010-02-02 Thread Konrad Hinsen
I would like to deposit a small library on clojars.org. Is it possible to do this without using either Maven or Leiningen? Neither of these tools seems to be appropriate for my library. My library consists of just a few very small source code files. It doesn't need to be AOT compiled, and b

Re: Alternate Javadocs?

2010-02-02 Thread Christopher Petrilli
On Tue, Feb 2, 2010 at 11:42 AM, Sean Devlin wrote: > As most of you know, Oracle is rapidly rebranding the sun website. > It's a matter of time before they get to the Javadocs.  Given the > following: > > 1.  Oracle doesn't play nice (putting it lightly) > 2.  Oracle documentation is the WORST on

Re: Alternate Javadocs?

2010-02-02 Thread Stuart Sierra
On Feb 2, 11:42 am, Sean Devlin wrote: > Does someone know of an alternate place to find Javadocs? You can (or could) download all the JDK docs as a ZIP. And lots of places, like university CS departments, mirror the JDK docs. There are several meta-javadoc search engines, but I find them annoy

Alternate Javadocs?

2010-02-02 Thread Sean Devlin
Hey everyone, As most of you know, Oracle is rapidly rebranding the sun website. It's a matter of time before they get to the Javadocs. Given the following: 1. Oracle doesn't play nice (putting it lightly) 2. Oracle documentation is the WORST on the planet (again, putting it lightly) Does som

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread Michael Wood
On 2 February 2010 17:36, Michael Wood wrote: > On 2 February 2010 17:05, Stuart Sierra wrote: >> On Feb 2, 2:46 am, ataggart wrote: >>> On a related note, it is my sincere hope that we get a version of >>> require and use which no longer require (ha!) the use of quoted >>> parens. >> >> Absolut

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread Michael Wood
On 2 February 2010 17:05, Stuart Sierra wrote: > On Feb 2, 2:46 am, ataggart wrote: >> On a related note, it is my sincere hope that we get a version of >> require and use which no longer require (ha!) the use of quoted >> parens. > > Absolutely not!  Having 'require' as an ordinary function (not

Re: Trouble implementing Dijkstra algorithm in Clojure

2010-02-02 Thread e
folks may be interested in this thing I was working on a while back for Dijkstra and Branch and Bound problems: http://code.google.com/p/jc-pheap/. ... I know this was a while ago :) On Tue, Dec 8, 2009 at 11:26 PM, David Brown wrote: > On Tue, Dec 08, 2009 at 03:22:47PM -0800, ataggart wrote:

Re: Heap implementation in Clojure

2010-02-02 Thread e
i was messing around a while back with this: http://code.google.com/p/jc-pheap/ the algorithms work, but it's probably in a between-state. I wasn't sure what the interface should look like exactly, and I was recently adding support for duplicate keys (but I wasn't sure if I should have two struct

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread Stuart Sierra
On Feb 1, 9:23 pm, OGINO Masanori wrote: > Can I write a code on both 1.1 and master using duck-streams/io? For now, yes, as ataggart showed. But I expect names in contrib will be in flux for the next few weeks, so you should probably pick a release and stick with it. -SS -- You received this

Re: building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-02 Thread Stuart Sierra
Try adding the "-o" (for offline) option to the Maven command line. -SS On Feb 2, 6:20 am, Ramakrishnan Muthukrishnan wrote: > Hi, > > I am trying to package clojure-contrib for Debian and one of the > debian java packaging practices is that the build should not download > any external dependenc

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread Stuart Sierra
On Feb 2, 2:46 am, ataggart wrote: > On a related note, it is my sincere hope that we get a version of > require and use which no longer require (ha!) the use of quoted > parens. Absolutely not! Having 'require' as an ordinary function (not a macro) is important for code-generating code. -SS -

Re: idiomatic question about reader macro

2010-02-02 Thread A.Rost
2 ataggart Ok. I don't explain coorect why I want to have build-in ability to create reader macro. In my study and job I very often use different spesific data structures. It's very useful to have reader macro to work with them, because it makes my code easilier to perception: work with data struc

Re: update-in and get-in why no default?

2010-02-02 Thread Meikel Brandmeyer
Hi, On Feb 2, 2:31 pm, Timothy Pratley wrote: > > Hmm.. I thought of get-in as a recursive application of get. get-in > > now diverges from get. Maybe this version should be called "unwrap" > > instead? > > Zero applications of get to a map might be thought of as the map itself. > Are you thinki

Re: update-in and get-in why no default?

2010-02-02 Thread Timothy Pratley
On 2 February 2010 17:41, Meikel Brandmeyer wrote: > I would get rid of the if-let. Ah yes! Ok patch updated to: + ([m ks not-found] + (if (seq ks) + (get (reduce get m (butlast ks)) (last ks) not-found) + m))) Note that (seq ks) will throw an illegal argument exception if ks is 5 fo

Re: update-in and get-in why no default?

2010-02-02 Thread Meikel Brandmeyer
Hi, On Feb 2, 1:48 pm, Timothy Pratley wrote: > > If you view 'get-in' as an unwrapping operation, unwrapping by zero steps > > should return the existing collection, no? > > Thanks for that description I completely agree. Hmm.. I thought of get-in as a recursive application of get. get-in now

Re: update-in and get-in why no default?

2010-02-02 Thread Timothy Pratley
On 2 February 2010 17:55, Richard Newman wrote: > If you view 'get-in' as an unwrapping operation, unwrapping by zero steps > should return the existing collection, no? Thanks for that description I completely agree. > Can you explain why you think the result should be nil? I was not thinking

Re: Line directive in Clojure

2010-02-02 Thread Timothy Pratley
On 2 February 2010 15:39, Praki wrote: > Does Clojure have a notion of #line directive a la C/C++? This works for me: (println "file:" *file* " line:" @(clojure.lang.Compiler/LINE)) > If there is any built-in support in Clojure for ignoring blocks > delimited by special tags, as in GHC, that wo

RE: How to Initiate Clojure Application

2010-02-02 Thread Clive Tong
I was looking at this aspect of Clojure at the weekend and tried to blog a couple of simple examples here (http://clivetong.spaces.live.com/blog/cns!3F21DF299C355E7F!330.entry) -Original Message- From: clojure@googlegroups.com [mailto:cloj...@googlegroups.com] On Behalf Of Wardrop Sent:

Re: clojure unicode on Windows

2010-02-02 Thread Duc Nguyen
The only two lines needed (at least for me) are: (setq current-language-environment "UTF-8") (setq slime-net-coding-system 'utf-8-unix) On Jan 20, 1:13 am, Lukas Lehner wrote: > Hi > > using directly (not jline or others) > although pure REPL would be still fine, I have found how to make it work

Line directive in Clojure

2010-02-02 Thread Praki
Greetings, Does Clojure have a notion of #line directive a la C/C++? The reason for my asking is, I am generating Clojure code which is embedded in TeX and I would like to see Clojure source code references mapped to that original file. If there is any built-in support in Clojure for ignoring b

Re: idiomatic question about reader macro

2010-02-02 Thread ataggart
On Feb 2, 3:23 am, ataggart wrote: > On Feb 2, 12:19 am, "A.Rost" wrote: > > > I would like to have them available, simply because I > > like concise, purpose-built languages. > > That seems to presuppose you cannot have concise, purpose-built > languages with functions and macros.  That may be

Re: clojure.contrib.[duck-streams io]

2010-02-02 Thread OGINO Masanori
Thank you. I try to use use function and it works, too. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@gmail.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts

Re: idiomatic question about reader macro

2010-02-02 Thread ataggart
On Feb 2, 12:19 am, "A.Rost" wrote: > I would like to have them available, simply because I > like concise, purpose-built languages. That seems to presuppose you cannot have concise, purpose-built languages with functions and macros. That may be the case, but I'd like to see some rationale beh

building clojure-contrib without downloading clojure.jar from elsewhere

2010-02-02 Thread Ramakrishnan Muthukrishnan
Hi, I am trying to package clojure-contrib for Debian and one of the debian java packaging practices is that the build should not download any external dependencies. All the dependencies should be debian packages themselves. I tried building clojure-contrib with mvn -Dclojure.jar= as detailed in

Re: file-seq and recursive directories

2010-02-02 Thread Michał Marczyk
On 2 February 2010 10:27, Michael Wood wrote: > Of course the above is Unix-centric.  On Windows you might not have > inode numbers (VFAT.  Not sure if ntfs has an inode number > equivalent.)  Also, I think I've heard that in Windows you can create > hard links to directories, so I don't know how

Re: idiomatic question about reader macro

2010-02-02 Thread Timothy Pratley
http://briancarper.net/blog/clojure-reader-macros might interest you. On 2 February 2010 19:19, A.Rost wrote: > I would like to have them available, simply because I -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: clojure.contrib.test-contrib.test-jmx build error

2010-02-02 Thread Michał Marczyk
On 1 February 2010 15:39, Stuart Halloway wrote: > The official JMX API is a programmer-usability disaster (IMO), and I wrote > the contrib jmx wrapper by trial-and-error to get minimal functionality > working. A few thoughts: > > * I will take a look at this (but won't be able to get to it today)

Re: more lazy "fun"

2010-02-02 Thread Michael Wood
Hi On 2 February 2010 01:20, rzeze...@gmail.com wrote: [...] > user> (doc and) > - > clojure.core/and > ([] [x] [x & next]) > Macro >  Evaluates exprs one at a time, from left to right. If a form >  returns logical false (nil or false), and returns that value and >  doesn'

Re: file-seq and recursive directories

2010-02-02 Thread Michael Wood
On 2 February 2010 10:08, Jeff Rose wrote: > So what would that look like?  Is it sufficient to throw every > canonical directory path in a set and test for membership before > traversing down any directory? Yes, I think so, as long as you can fit all of them in memory. The other thing you could

Re: idiomatic question about reader macro

2010-02-02 Thread A.Rost
Well, clojure provides a variety of reader macro. In fact I don't think that I would need different ones, but I would like to have them available, simply because I like concise, purpose-built languages. Besides I don't think that user created reader macro would damage because there is practically

Re: file-seq and recursive directories

2010-02-02 Thread Jeff Rose
So what would that look like? Is it sufficient to throw every canonical directory path in a set and test for membership before traversing down any directory? Or is that even sufficient because you could arrive at the same location through different paths... I wonder if you can get something more