Re: Clojure at JavaOne

2009-05-22 Thread Brian Doyle
I have a one pagish program that you pass in your screen resolution and it randomly picks out a new desktop image from ftp.gnome.org, downloads the image and updates your desktop. This assumes your using Gnome.

Re: HTTP clients in clojure

2009-05-06 Thread Brian Doyle
I wrote clj-web-crawler which wraps the Apache commons client library and made it suck a little bit less. I haven't tested it out with the Clojure 1.0 release just yet, but I'll do that tonight. http://github.com/heyZeus/clj-web-crawler/tree/master On Wed, May 6, 2009 at 7:16 PM, Chris Dean

Clojure Library

2009-04-20 Thread Brian Doyle
I posted this a couple of weeks ago and haven't seen it updated on the clojure website. Maybe it got lost in the shuffle. Name: clj-web-crawler URL: http://github.com/heyZeus/clj-web-crawler/tree/master Author: Brian Doyle Categories: Web, Automation License: MIT Dependencies: clojure, clojure

Re: Got a Clojure library?

2009-04-09 Thread Brian Doyle
Name: clj-web-crawler URL: http://github.com/heyZeus/clj-web-crawler/tree/master Author: Brian Doyle Categories: Web, Automation License: MIT Dependencies: clojure, clojure-contrib, Apache commons-client 3.1 Description: clj-web-crawler is a wrapper around the Apache commons-client Java library

Re: [ANN] clojuredev 0.0.30 released

2009-04-05 Thread Brian Doyle
If I wanted to download and play with clojuredev where would I find it? On Sat, Apr 4, 2009 at 3:58 PM, Laurent PETIT laurent.pe...@gmail.comwrote: New release, with a lot of changes! I would particularly like to thank Stephan Mühlstrasser for his contributions ! The clojure symbols

advice needed converting large files to xml

2009-03-16 Thread Brian Doyle
I've been using Clojure for about 6 months now and really like it. I am somewhat new to multi-threading and using any of the parallel features in Clojure though. I have a situation where I need to convert 7 files from CSV to XML. Each one of these files is about 180MB apiece in size. I have

Re: advice needed converting large files to xml

2009-03-16 Thread Brian Doyle
; process line ; write line ) [input-file1, input-file2, input-file3, ]) Thanks. On Mon, Mar 16, 2009 at 5:56 PM, Brian Doyle brianpdo...@gmail.comwrote: I've been using Clojure for about 6 months now and really like it. I am somewhat new

Re: advice needed converting large files to xml

2009-03-16 Thread Brian Doyle
On Mon, Mar 16, 2009 at 4:29 PM, Mark Volkmann r.mark.volkm...@gmail.comwrote: On Mon, Mar 16, 2009 at 4:56 PM, Brian Doyle brianpdo...@gmail.com wrote: I've been using Clojure for about 6 months now and really like it. I am somewhat new to multi-threading and using any of the parallel

clj-web-crawler

2009-03-09 Thread Brian Doyle
I wrote a Clojure script that wraps the Apache commons-client library for crawling the web. It's a simple 125 line script and I also wrote some test cases for it as well. I was wondering if this is something that could/should be included in clojure.contrib or if it should be a standalone

Re: sequences from Enumerations

2009-03-02 Thread Brian Doyle
I had the same issue and ended up having to use enumeration-seq function. Seems strange but it worked. On Mon, Mar 2, 2009 at 4:22 PM, Mark Volkmann r.mark.volkm...@gmail.comwrote: Should I be able to do something like this? (doseq [table-column (- jtable .getColumnModel .getColumns)]

Re: sequences from Enumerations

2009-03-02 Thread Brian Doyle
That makes sense now. Thanks for the link to the thread. On Mon, Mar 2, 2009 at 5:01 PM, Stephen C. Gilardi squee...@mac.com wrote: On Mar 2, 2009, at 6:37 PM, Brian Doyle wrote: I had the same issue and ended up having to use enumeration-seq function. Seems strange but it worked

Re: Importing lots of Java classes at once

2009-02-24 Thread Brian Doyle
I wrote something similar to what you are asking about. My code does not import java class files but calls 'use' on clojure files that live in the clojure-contrib.jar file. I load this when I start the REPL only. (defn name-to-symbol [lib-name] Converts the lib-name to a symbol (-

Re: Newbie: Separating and grouping the elements in a bunch of vectors

2009-02-15 Thread Brian Doyle
From the original question it looked like there was a vector of unknown length of vectors [[a0 a1 a2] [b0 b1 b2] ...] So my solution is something like: 1:12 user= (def vecs [[:a0 :a1 :a2] [:b0 :b1 :b2]]) #'user/vecs 1:13 user= (partition (count vecs) (interleave (flatten vecs))) ((:a0 :a1) (:a2

Re: Denver/Boulder Clojure users

2009-02-05 Thread Brian Doyle
I live in southeast Denver and have been doing some Clojure on my own for a few months now. On Thu, Feb 5, 2009 at 12:39 PM, chris cnuern...@gmail.com wrote: Are there any existing clojure users in the Denver/Boulder area (other than me)?. Chris

Re: symbols, vars and namespaces

2009-01-27 Thread Brian Doyle
On Tue, Jan 27, 2009 at 7:43 AM, Chouser chou...@gmail.com wrote: On Tue, Jan 27, 2009 at 8:51 AM, Mark Volkmann r.mark.volkm...@gmail.com wrote: Are these statements correct? Actually, I know some are correct because I just looked though the source. Hopefully others that haven't will

Re: *1 *2 isn't working properly

2009-01-14 Thread Brian Doyle
Here's an example of *1 *2 *3 1:1 user= (str gavin) gavin 1:2 user= (str teri) teri 1:3 user= (str brian) brian 1:4 user= (str-join [*1 *2 *3]) brian teri gavin On Wed, Jan 14, 2009 at 2:29 AM, Stephen C. Gilardi squee...@mac.comwrote: By the time you evaluated *2, the second most recent

Re: Setting a value inside a map of map of maps...

2009-01-11 Thread Brian Doyle
I think you can just use the update-in function like: 1:1 user= (def m {:a {:b {:c {:d 3) #'user/m 1:2 user= (update-in m [:a :b :c :d] - 5) {:a {:b {:c {:d -2 On Sun, Jan 11, 2009 at 11:08 AM, CuppoJava patrickli_2...@hotmail.comwrote: Hi, I'm just wondering if there's a clever

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread Brian Doyle
Here's one of many ways to do this: (filter #(.endsWith (.getName %1) .clj ) (file-seq (java.io.File. .))) On Thu, Jan 8, 2009 at 5:48 PM, wubbie sunj...@gmail.com wrote: Hi all, I can use file-seq (file-seq (File. .)) But how can I filter out all files ending with .clj? Do we use

writing bytes to a file

2009-01-07 Thread Brian Doyle
I couldn't find anything in core or contrib that wrote out bytes to a file so I wrote something to do it. Is this functionality already implemented and I just couldn't find it? If there isn't anything already, would this be something good to put in contrib somewhere? Thanks. (defn

Re: writing bytes to a file

2009-01-07 Thread Brian Doyle
Looks like spit is for printing just text. On Wed, Jan 7, 2009 at 12:20 PM, Paul Barry pauljbar...@gmail.com wrote: clojure.contrib.duck_streams/spit? On Wed, Jan 7, 2009 at 2:14 PM, Brian Doyle brianpdo...@gmail.com wrote: I couldn't find anything in core or contrib that wrote out bytes

Re: Very noob file reading and printing question

2009-01-06 Thread Brian Doyle
On Tue, Jan 6, 2009 at 4:47 PM, Tom Ayerst tom.aye...@gmail.com wrote: Its not the println, nor getting a reader (duckstreams is fine, I can do that). Its the converting it to a seq and stepping through it printing each element (which should be a line). Its the loopy, steppy bit, just for a

Re: Some code review for clj-record?

2009-01-04 Thread Brian Doyle
Looks good. I didn't know about the *file* var. On Sun, Jan 4, 2009 at 11:22 AM, John D. Hume duelin.mark...@gmail.comwrote: Brian, I incorporated your changes and then made changes to load and run all clj_record/test/*-test.clj files. Thanks again. -hume.

finding all vars starting with *

2009-01-04 Thread Brian Doyle
Today I found out about the var *file*. I looked it up *file* on clojure.com/api and couldn't find anything. Is there some place where all of these vars are defined? Is there some way programatically I can find them all? Thanks. --~--~-~--~~~---~--~~ You

Re: Some code review for clj-record?

2009-01-04 Thread Brian Doyle
. On Sun, Jan 4, 2009 at 2:22 PM, Brian Doyle brianpdo...@gmail.com wrote: Looks good. I didn't know about the *file* var. On Sun, Jan 4, 2009 at 11:22 AM, John D. Hume duelin.mark...@gmail.comwrote: Brian, I incorporated your changes and then made changes to load and run all clj_record/test

Re: Some code review for clj-record?

2009-01-02 Thread Brian Doyle
...@gmail.comwrote: Hi Brian, On Tue, Dec 30, 2008 at 11:41 AM, Brian Doyle brianpdo...@gmail.com wrote: (ns com.example.user) (clj-record.core/init-model) but when I do that I get the error: java.lang.ClassNotFoundException: clj-record.core ... (first (reverse (re-split #\. (name (ns

Re: Some code review for clj-record?

2008-12-30 Thread Brian Doyle
PM, John D. Hume duelin.mark...@gmail.comwrote: On Mon, Dec 29, 2008 at 7:15 PM, Brian Doyle brianpdo...@gmail.com wrote: I noticed that in the init-model macro you are creating a 'defn table [] ...' function in the model namespace and was wondering why you didn't just make it a def

Re: Understanding how to use namespaces

2008-12-30 Thread Brian Doyle
On Tue, Dec 30, 2008 at 11:25 PM, Mark Engelberg mark.engelb...@gmail.comwrote: Thanks, that helps dramatically. It took me a while to figure out how to edit the SLIME startup to include my clojure files directory in the classpath, but I got it working. So it seems like you have to make

Re: making code readable

2008-12-29 Thread Brian Doyle
Looking at this code the uppercase variables stands out. This isn't idiomatic is it? (def GRID_SIZE 10) (def HEIGHT 600) (def MARGIN 50) On Mon, Dec 29, 2008 at 12:19 PM, Mark Volkmann r.mark.volkm...@gmail.comwrote: On Mon, Dec 29, 2008 at 11:11 AM, lpetit laurent.pe...@gmail.com wrote:

Re: Some code review for clj-record?

2008-12-29 Thread Brian Doyle
. You can run clj_record/test/main.clj as a script but not load it from the REPL. Let me see if I can get it to work both ways and push an update. On Sun, Dec 28, 2008 at 6:28 PM, Brian Doyle brianpdo...@gmail.com wrote: Having used Rails myself I wanted to check this out and play

Re: Some code review for clj-record?

2008-12-28 Thread Brian Doyle
Having used Rails myself I wanted to check this out and play with it. I'm having some trouble just loading the clj_record/core.clj file though: 1:1 user= (load-file clj_record/core.clj) java.lang.Exception: Unable to resolve symbol: db in this context (core.clj:19) I'm sure it's something I'm

Re: Exercise: how to print multiplication table?

2008-12-22 Thread Brian Doyle
2008/12/22 J. McConnell jdo...@gmail.com On Mon, Dec 22, 2008 at 10:23 AM, Piotr 'Qertoip' Włodarek qert...@gmail.com wrote: Being new to Clojure, to Lisp and to functional programming in general, I have some trouble wraping my head around it. As the first exercice, I would like to

Re: How to encapsulate local state in closures

2008-12-21 Thread Brian Doyle
I haven't been following the new atom stuff, so I was wondering why atom would be best in this situation, vs a ref? Thanks. On Sun, Dec 21, 2008 at 1:03 PM, Parth Malwankar parth.malwan...@gmail.comwrote: On Dec 21, 11:47 pm, chris cnuern...@gmail.com wrote: I would like to be able to

Re: for FAQ: what are use/require/import/refer?

2008-12-20 Thread Brian Doyle
This would make an excellent FAQ question and answer! On Sat, Dec 20, 2008 at 9:53 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: This might make a good FAQ question: On Dec 20, 11:25 am, chris cnuern...@gmail.com wrote: I am unclear as to the difference between refer, import use, and

Re: multiple sets on one item - is this a good idea?

2008-12-20 Thread Brian Doyle
Instead of require call use and should get you what you want. On Dec 20, 2008 9:15 AM, chris cnuern...@gmail.com wrote: That helped, thanks Christophe. I have one more problem: I put it in a util file, under a util namespace: (ns lambinator.util) (defmacro sets! [vars rest] `(do ~@(map (fn

calling use with a seq of strings

2008-12-15 Thread Brian Doyle
I have a seq of strings that are namespaces like, (clojure.contrib.str-utils, clojure.contrib.duck-streams). I wanted to call the use function on this seq. I can't seem to do that though. Any way I can do this or is this just a bad idea? Thanks.

Re: calling use with a seq of strings

2008-12-15 Thread Brian Doyle
symbol (list clojure.contrib.str-utils clojure.contrib.duck-streams))) -Stuart Sierra On Dec 15, 3:51 pm, Brian Doyle brianpdo...@gmail.com wrote: I have a seq of strings that are namespaces like, (clojure.contrib.str-utils, clojure.contrib.duck-streams). I wanted to call the use function

possible bug with seq and Enumeration?

2008-12-15 Thread Brian Doyle
According to the docs the seq function should be able to take an enumeration, but here is what I see: user= (seq (.elements (doto (java.util.Vector.) (.add hello) (.add world java.lang.IllegalArgumentException: Don't know how to create ISeq from: (NO_SOURCE_FILE:0) SVN 1160, thanks.

Re: possible bug with seq and Enumeration?

2008-12-15 Thread Brian Doyle
Using enumeration-seq does the trick! Thanks. user= (enumeration-seq (.entries (java.util.zip.ZipFile. path to some jar))) On Mon, Dec 15, 2008 at 5:14 PM, Rich Hickey richhic...@gmail.com wrote: On Dec 15, 6:01 pm, Brian Doyle brianpdo...@gmail.com wrote: According to the docs the seq

Re: understanding quoting

2008-12-15 Thread Brian Doyle
On Mon, Dec 15, 2008 at 9:43 PM, Daniel Eklund doekl...@gmail.com wrote: Looks like an if then else version of the map lookup?? ie: (if (%1 %2) (%1 %2) %3) Is this a special feature of maps in general, such that you can look up a key but return something else if it doesn't exist? I

Re: doall and dorun

2008-12-15 Thread Brian Doyle
I'll take a crack at this. It may appear that the doall and dorun return something different with subsequent calls but they don't actually. The doall always returns the sequence (1 2) and dorun always returns nil. The first time (doall x) is called the for loop executes and prints 1 2 (a side

Re: Gorilla: Release of Version 1.1.0

2008-12-13 Thread Brian Doyle
I'm sure I'm doing something stupid but I can't start up gorilla. Exception in thread main java.lang.NoClassDefFoundError: de/kotka/gorilla Caused by: java.lang.ClassNotFoundException: de.kotka.gorilla at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at

Re: Gorilla: Release of Version 1.1.0

2008-12-13 Thread Brian Doyle
Thanks Meikel, removing the ~'s worked. Oh and thanks for vimclojure and gorilla! On Sat, Dec 13, 2008 at 9:28 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 13.12.2008 um 17:17 schrieb Brian Doyle: Here is my script: java -cp ~/share/clojure.jar:~/share/clojure-contrib.jar:~/share

Re: Java interop question

2008-12-11 Thread Brian Doyle
This article has a good example using the proxy function. http://gnuvince.wordpress.com/2008/11/18/fetching-web-comics-with-clojure-part-2/ On Thu, Dec 11, 2008 at 1:22 PM, Randall R Schulz rsch...@sonic.net wrote: On Thursday 11 December 2008 11:31, Mark Engelberg wrote: I understand how

Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Brian Doyle
Stuart, I have a ~/.cljrc file that has this stuff in there and in my bash (clj) script to start clojure I do: $JAVA -cp $CLOJURE_JARS clojure.lang.Repl ~/.cljrc On Tue, Dec 9, 2008 at 1:12 PM, Stuart Halloway [EMAIL PROTECTED]wrote: Why can't I call set! in user.clj? (And what is the

Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Brian Doyle
Steve, Could you post your bash shell script that starts Clojure? I would like to see what you have concerning the new options that can be passed to the updated clojure.jar. Thanks. On Tue, Dec 9, 2008 at 1:59 PM, Stephen C. Gilardi [EMAIL PROTECTED] wrote: user.clj is loaded before

unsupported binding form for cond-let

2008-12-05 Thread Brian Doyle
I started to play with cond-let in the contrib.cond package and got an unexpected error: user= (cond-let [x (zero? 0)] (println hello world)) java.lang.Exception: Unsupported binding form: (zero? 0) (NO_SOURCE_FILE:11) user= (cond-let x (zero? 0) (println hello world)) hello world Maybe it was

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Brian Doyle
Can you include an example usage of this function? Thanks. On Wed, Dec 3, 2008 at 12:51 PM, Meikel Brandmeyer [EMAIL PROTECTED] wrote: Hi Stuart and Rich, Am 03.12.2008 um 19:00 schrieb Stuart Sierra: I'm pretty sure I don't like the sound of that at all. We had a nice discussion about

Re: Bug: recur won't work in tail position within cond

2008-12-03 Thread Brian Doyle
This seems to work for me: (defn sub-til-0 [n] (cond (zero? n) 0 :else (recur (dec 1 I'm not sure what those extra ['s are for in your example. On Wed, Dec 3, 2008 at 9:39 PM, puzzler [EMAIL PROTECTED] wrote: (defn sub-til-0 [n] (if (zero? n) 0 (recur (dec 1 works

Re: randomize a collection?

2008-12-02 Thread Brian Doyle
#0e19ab338452c64f The recommendation was to use java.util.Collections/shuffle and an example was given: (defn shuffle [coll] (let [l (java.util.ArrayList. coll)] (java.util.Collections/shuffle l) (seq l))) user= (shuffle [1 2 3 4 5]) (4 2 1 5 3) On Dec 2, 3:28 pm, Brian Doyle [EMAIL PROTECTED

randomize a collection?

2008-12-01 Thread Brian Doyle
Is there a function that takes a collection and randomizes, or shuffles, the items? --~--~-~--~~~---~--~~ 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 To

Re: Newbie: Flattening any collection

2008-11-30 Thread Brian Doyle
As long as you have the clojure.contrib jar in your path you can do: (use 'clojure.contrib.seq-utils) (flatten [1 2 3 '(4 5 6)]) = (1 2 3 4 5 6) On Sun, Nov 30, 2008 at 9:36 PM, samppi [EMAIL PROTECTED] wrote: For any given collection [3 2 [3 5 1] 1 [3 4 1] 0], how may I get [3 2 3 5 1 1 3

update a ref struct

2008-11-24 Thread Brian Doyle
I am parsing a file and to compare the current line with the previous line of the file. I am using line-seq to go thru the file and I thought I would create a ref to store the previous line. When I want to update the previous line value I can't seem to do it. I've never used refs before so I'm

Re: update a ref struct

2008-11-24 Thread Brian Doyle
reduce to walk the line-seq. the nature of reduce lets you have access to the line-seq, two lines at a time no need for a ref. On Mon, Nov 24, 2008 at 2:17 PM, Brian Doyle [EMAIL PROTECTED] wrote: I am parsing a file and to compare the current line with the previous line of the file. I am using

Re: update a ref struct

2008-11-24 Thread Brian Doyle
Yep, that's just a typo in the email. Something was wrong with my browser and I couldn't just paste the code in :( On Mon, Nov 24, 2008 at 3:33 PM, Shawn Hoover [EMAIL PROTECTED]wrote: On Mon, Nov 24, 2008 at 5:17 PM, Brian Doyle [EMAIL PROTECTED]wrote: I am parsing a file and to compare

Re: offtopic - where are you come from? (poll)

2008-11-21 Thread Brian Doyle
Denver, CO Brian Doyle On Wed, Nov 19, 2008 at 4:09 AM, liu chang [EMAIL PROTECTED] wrote: Singapore +1. On Wed, Nov 19, 2008 at 5:24 PM, walterc [EMAIL PROTECTED] wrote: taipei, taiwan cheers, walter chang --~--~-~--~~~---~--~~ You

Re: multi-method dispatch for structs

2008-11-14 Thread Brian Doyle
I wonder if it would good to have something indicating the struct name put in the metadata when creating a struct? On Fri, Nov 14, 2008 at 1:42 PM, Chouser [EMAIL PROTECTED] wrote: On Fri, Nov 14, 2008 at 2:11 PM, Jeff Rose [EMAIL PROTECTED] wrote: Does my dispatch function have to inspect

Re: Getting a flat sequence from a map (and vice versa)

2008-11-14 Thread Brian Doyle
Another way to create a map is: user= (apply hash-map [:a 1 :b 2 :c 3]) {:a 1, :c 3, :b 2} On Fri, Nov 14, 2008 at 9:42 PM, samppi [EMAIL PROTECTED] wrote: Excellent! I must remember about the apply function. Thank you very much. On Nov 14, 9:35 pm, Kevin Downey [EMAIL PROTECTED] wrote:

Re: (string?) bug

2008-11-11 Thread Brian Doyle
Yep, I'm going that route. Thanks On Tue, Nov 11, 2008 at 2:27 PM, Dave Newton [EMAIL PROTECTED] wrote: --- On Sun, 11/9/08, Brian Doyle wrote: Yes, it is a StringBuilder so technically yes. I guess you since the only thing you ever do with a StringBuilder is produce a string it just

Re: (string?) bug

2008-11-09 Thread Brian Doyle
if this is a repeat; hotel networking is sketchy.) On Nov 9, 12:07 am, Brian Doyle [EMAIL PROTECTED] wrote: This seems like a bug returning false for StringBuilder. user= (string? (new java.lang.String hello)) true user= (string? (new java.lang.StringBuilder hello)) false Wouldn't

slurp accepting an encoding parameter

2008-11-07 Thread Brian Doyle
I had a file that was not encoded using the default file encoding so I modified slurp to accept an optional encoding parameter. (defn slurp Reads the file named by f into a string and returns it. Uses the given encoding when opening the file. ([#^String f encoding] (with-open r (if

Clojure Maven integration

2008-11-06 Thread Brian Doyle
Does anyone know of any Clojure maven integration? What I'd like to see is something that will modify Clojure's classpath updated based upon a given pom.xml file. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: lancet: Clojure controlling Ant

2008-11-06 Thread Brian Doyle
On Thu, Nov 6, 2008 at 11:48 AM, Stuart Halloway [EMAIL PROTECTED]wrote: Hi all, I am playing around with using Clojure to control Ant, something along the lines of Groovy's Gant. I don't know how far I will take this-- right now it is serving as a code example for the book. Two

Re: remainder function

2008-10-15 Thread Brian Doyle
The function is 'rem'. user= (rem 5 2) 1 On Wed, Oct 15, 2008 at 3:35 PM, Islon [EMAIL PROTECTED] wrote: Is there a remainder (rest of the division) function in closure? (as java '%' operator). I browse the docs but couldn't find one.

Re: equality and struct inheritance

2008-10-07 Thread Brian Doyle
On Tue, Oct 7, 2008 at 2:32 PM, Stuart Halloway [EMAIL PROTECTED]wrote: Hi Brian, (1) What does it mean to be equal on id and not equal on the other fields? If two fields claim the same id but a different name, how would you know which one to keep? I guess it could depend on the situation