Re: Clojure ad on StackOverflow.com

2010-02-10 Thread Tchalvak
I'd vote for it. *smiles* On Feb 8, 2:23 am, Baishampayan Ghose b.gh...@ocricket.com wrote: Hi, This is an interesting attempt by the StackOverflow people to promote FOSS projectshttp://meta.stackoverflow.com/questions/31913/open-source-advertising sidebar-1h-2010/31972

newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Aviad R
Hi all. I'm trying to learn clojure with the excellent Programming Clojure and projecteuler.net. I am encountering the java heap space error, and can't find a workaround, nor a smarter way to write my code (which I am certain exist). Trying to solve Problem 14 (some spoilers might be ahead, for

XML problem

2010-02-10 Thread yvan
Hello Clojure group I am testing Clojure and I have an error parsing thix XML excerpt below. Is this a SAX bug ou a Clojure bug .. or my mistake ? thank's for help IN REPL (ns x (:require [clojure.xml :as xml]) ) x= (try (xml/parse exampleSortieXML.xml)(catch Exception e (. e

Re: Newbie question - Functional programming special cases

2010-02-10 Thread ka
Thanks, that answers my questions. -- 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 from new members are moderated - please be patient with your first post. To unsubscribe

Clojure Dev Environment

2010-02-10 Thread abaitam
Hi, There are several blog posts about setting up a development environment for Clojure mostly in Emacs (and on Linux or Mac and not Windows). Is there one place where I can find up-to-date information on how to create a real-world Clojure project (and using Clojure and Java libraries)? Do you

How would I write an emitter/collector?

2010-02-10 Thread Mark Carter
I know that loo exists - and I'm puzzled by what the lazy functions do. What I think would be interesting functionality is to have an emitter/ collector combination, for example: (collect (doseq [ n (range 10)] (when (even? n) (emit n would return the list (0 2 4 6 8). Any ideas how I

Re: Prepping clojure for packaging (was: Re: Clojure for system administration)

2010-02-10 Thread Brian Schlining
That's exactly what Debian does. For every Java package also provide the maven xml file and the jar is discoverable from maven. The installed packages on the local system acts as a local maven repo. http://wiki.debian.org/Java/MavenRepoSpec I see they also solved the problem of not

Clojure binding for Open CL

2010-02-10 Thread ka
Hi, I was just wondering if (by now) Open CL has been 'wrapped' by higher level languages. I came across these from the Khronos site (http:// www.khronos.org/developers/resources/opencl/#timplementations) - 1. http://ruby-opencl.rubyforge.org/ 2.

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Joop Kiefte
(Disclaimer: never tried myself) http://hausheer.osola.com/docs/5 2010/2/10 Aviad R avi@gmail.com Hi all. I'm trying to learn clojure with the excellent Programming Clojure and projecteuler.net. I am encountering the java heap space error, and can't find a workaround, nor a smarter way

Re: Clojure binding for Open CL

2010-02-10 Thread Marc Downie
Not sure about Clojure bindings but the JavaCL bindings (both mid-level and low level) might get you closer: http://code.google.com/p/javacl/ OpenCL's ugly and finicky API is crying out for wrapping in better languages; and the OpenCL language itself would ideally get wrapped as well (see:

Re: clojure gen-class questions

2010-02-10 Thread Аркадий Рост
thanks! -- 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 from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email

Re: Clojure Dev Environment

2010-02-10 Thread Laurent PETIT
2010/2/9 abaitam abai...@gmail.com: Hi, There are several blog posts about setting up a development environment for Clojure mostly in Emacs (and on Linux or Mac and not Windows). Is there one place where I can find up-to-date information on how to create a real-world Clojure project (and

Re: How would I write an emitter/collector?

2010-02-10 Thread Sean Devlin
This type of stuff could be done easily w/ the existing sequence fns You first one is simply (filter even? (range 10)) The second one is a little trickier, but it could be written like this (map (juxt identity #(* 2 %)) (filter even? (range 10))) This is usually considered better form

Re: Prepping clojure for packaging (was: Re: Clojure for system administration)

2010-02-10 Thread Meikel Brandmeyer
Hi, On Feb 10, 12:31 am, Brian Schlining bschlin...@gmail.com wrote: That's exactly what Debian does. For every Java package also provide the maven xml file and the jar is discoverable from maven. The installed packages on the local system acts as a local maven repo.  

Re: XML problem

2010-02-10 Thread Laurent PETIT
Hello Yvan, I guess it's neither a clojure nor java SAX parser problem, but rather a problem in the xml file itself. It is illegal to have ampersands in attributes values. The ampersand should be replaced by amp; everywhere in attribute values. In other case, the xml parser tries to resolve

Re: Clojure binding for Open CL

2010-02-10 Thread atucker
From his todo list (1), it looks as if ztellman (2) might have concrete plans to include it in the (currently OpenGL) wrapper project penumbra (3). 1. http://wiki.github.com/ztellman/penumbra/todo 2. http://ideolalia.com/ 3. http://github.com/ztellman/penumbra On Feb 9, 9:48 pm, ka

Re: XML problem

2010-02-10 Thread Laurent PETIT
Here is the proof I was searching ! http://www.w3.org/TR/xml/#NT-AttValue 2010/2/10 Laurent PETIT laurent.pe...@gmail.com: Hello Yvan, I guess it's neither a clojure nor java SAX parser problem, but rather a problem in the xml file itself. It is illegal to have ampersands in attributes

Re: error reporting for macro expansion

2010-02-10 Thread Jerome Baum
+1 on this. Although of course you could just use the shell for this (e.g. grep or awk). But it's certainly nicer to have that integrated in the compiler (possibly also in the compiled code?) On Feb 9, 12:45 pm, Jeff Rose ros...@gmail.com wrote: I agree, the error reporting from the compiler can

Re: How would I write an emitter/collector?

2010-02-10 Thread Mark Carter
On 10 Feb, 12:23, Mark Carter alt.mcar...@googlemail.com wrote: Any ideas how I could implement this? I've made a stab at it, but I'm not there yet. (import (java.util ArrayList List)) (defn arraylist-list [aList] (let [size (. aList size)] (loop [accum nil index 0]

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Aviad Reich
thank you. I have -server and -Xmx1024m set in my 'swank-clojure-extra-vm-args, but the problem remains. Aviad On 10 February 2010 15:57, Joop Kiefte iko...@gmail.com wrote: (Disclaimer: never tried myself) http://hausheer.osola.com/docs/5 2010/2/10 Aviad R avi@gmail.com Hi all.

Re: How would I write an emitter/collector?

2010-02-10 Thread Meikel Brandmeyer
Hi, On Feb 10, 1:23 pm, Mark Carter alt.mcar...@googlemail.com wrote: I know that loo exists - and I'm puzzled by what the lazy functions do. What I think would be interesting functionality is to have an emitter/ collector combination, for example: (collect   (doseq [ n (range 10)]    

Re: How would I write an emitter/collector?

2010-02-10 Thread CuppoJava
It looks like you want to implement something akin to what other languages call generators. In Clojure, we generally use list comprehensions to get (almost) the same effect, but it's a little cleaner in my opinion. eg. in your first two examples (collect (doseq [ n (range 10)] (when (even?

Problems using clojure.contrib.string

2010-02-10 Thread Matt Culbreth
Hello Group, I'm working on a Clojure project and I'm using Leiningen for the builds. I'm trying to use the most recent clojure and clojure- contrib, but I'm having a problem getting it to compile due to apparent errors in clojure.contrib.string. This works fine on the more stable versions of

Re: How would I write an emitter/collector?

2010-02-10 Thread CuppoJava
There are some bugs with my previous post. Here's a revised version. ;;--USING LIST COMPREHENSIONS--- (for [n (range 10) :when (even? n)] n) (apply concat (for [n (range 10) :when (even? n)] [n (* 2 n)])) ;;EMIT/COLLECT IMPLEMENTATION-- (def -collector) (defn

Re: How would I write an emitter/collector?

2010-02-10 Thread Greg
Patrick, I can't speak for the OP, but I found his question interesting and I'd like to compliment you on your response. You gave alternative Clojure-like ways to do the same thing, but in addition to that you actually answered his question. I find these kinds of responses very instructive

Re: How would I write an emitter/collector?

2010-02-10 Thread Mark Carter
On 10 Feb, 15:57, CuppoJava patrickli_2...@hotmail.com wrote: Here's a revised version. OK. Wow guys. Thanks for your help. I've still a lot to learn, being new to Java, Lisp and Clojure. You are right, generators was the kind of thing I was after. I had come to Clojure after I had given up

Re: How would I write an emitter/collector?

2010-02-10 Thread CuppoJava
It sounds like Clojure might be a good fit for you then. I personally came to Clojure after getting fed up with Java, and experimenting with Ruby, so I can understand your predicament. The most dangerous thing to watch out for, and this really can't be stressed enough, is that learning Clojure is

Re: clojure gen-class questions

2010-02-10 Thread Brian Wolf
yes,thank you, this looks very helpful On Feb 9, 3:44 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, I wrote up a post:http://tr.im/NwCL Hope it helps. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Brenton
Aviad, Welcome to Clojure. I don't want to tell you how to solve it. That's all part of the fun. But my hint to you would be that you don't need to keep all 1 million lists in memory. In fact, you should be able to solve this problem by only keeping three numbers in memory at any one time: The

Re: XML problem

2010-02-10 Thread Alexandre Patry
Hi, yvan wrote: Hello Clojure group I am testing Clojure and I have an error parsing thix XML excerpt below. Is this a SAX bug ou a Clojure bug .. or my mistake ? thank's for help IN REPL (ns x (:require [clojure.xml :as xml]) ) x= (try (xml/parse exampleSortieXML.xml)(catch

Re: Problems using clojure.contrib.string

2010-02-10 Thread Stuart Sierra
Hi Matt, Just pushed a fix, see if that helps. Note that argument order was reversed in most functions from c.c.str- utils2 to c.c.string. -SS On Feb 10, 10:44 am, Matt Culbreth mattculbr...@gmail.com wrote: Hello Group, I'm working on a Clojure project and I'm using Leiningen for the

Noob question: rebinding using def

2010-02-10 Thread chaosprophet
Hi guys, I'm new to both clojure and functional programming and as an exercise in learning Clojure, I decided to write a naive bayes categorizer. I have a piece of code wherein I have a doseq inside which i am calling a function which returns a value. What I would like to do is have the value

Re: How would I write an emitter/collector?

2010-02-10 Thread Mark Carter
On 10 Feb, 16:21, Greg g...@kinostudios.com wrote: Patrick, I can't speak for the OP, but I found his question interesting and I'd like to compliment you on your response. I've been experimenting with Patrick's solution - and it's really quite good. I had a function which collected the

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Greg
Hi Aviad, Disclaimer: I haven't read the book, nor do I know Clojure very well. However, based on your question (which I did read) and Brenton's hint, it seems to me like the solution will involve a lazy sequence, which is a frequent tool to use whenever you're dealing with a problems that

Interesting ICFP slides from Guy Steele -- Organizing Functional Code for Parallel Execution

2010-02-10 Thread Paul Mooser
I ran across this on reddit this morning, and thought people on the group might find it interesting: http://docs.google.com/viewer?url=http%3A%2F%2Fresearch.sun.com%2Fprojects%2Fplrg%2FPublications%2FICFPAugust2009Steele.pdfpli=1 It actually mentions clojure briefly at the end, although I'm not

Re: Noob question: rebinding using def

2010-02-10 Thread Brenton
chaosprophet, Clojure wants you to think in terms of sequences instead to loops. Instead to looping through cat-all and keeping track of the sum, you want to use map and reduce. (reduce + (map #(probability-of-category-given-document % tokens) cat- all)) Brenton On Feb 10, 7:14 am,

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Aviad Reich
Thank you all! your advice were indeed very helpful! I eventually solved it using memoization. and indeed keeping only (http://clojure-euler.wikispaces.com/Problem+014 - lxmonk if you're interested) This indeed is a great community, so let me try another (related) question. Comparing my

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Aviad Reich
אביעד On 10 February 2010 19:54, Aviad Reich avi@gmail.com wrote: Thank you all! your advice were indeed very helpful! I eventually solved it using memoization. and indeed keeping only 3 values in memory. (http://clojure-euler.wikispaces.com/Problem+014 - lxmonk, if you're

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Brenton
Aviad, You don't get a speedup because you are never calling the memoized function with the same arguments. In your code, n is different each time. memoize basically creates a map of arguments to results. When you call the function with args that it has seen before it bypasses actually calling

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Will Hidden
Looking at your post I notice some things that strike me as 'odd'. The use of (def) in a form that is not a top most form. From my experience this leads to trouble in the best of times. I think a better way would be to close over your known-map with a closure. While I don't have high hopes that

Re: Problems using clojure.contrib.string

2010-02-10 Thread Matt Culbreth
Yes that worked very well, thanks Stuart. I'm assuming that this fix will make its way to the nightly build and will be published to http://build.clojure.org/job/clojure-contrib/ as usual? On Feb 10, 12:32 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: Hi Matt, Just pushed a fix, see if

Re: Problems using clojure.contrib.string

2010-02-10 Thread Stuart Sierra
yes On Feb 10, 1:25 pm, Matt Culbreth mattculbr...@gmail.com wrote: Yes that worked very well, thanks Stuart.  I'm assuming that this fix will make its way to the nightly build and will be published tohttp://build.clojure.org/job/clojure-contrib/as usual? On Feb 10, 12:32 pm, Stuart Sierra

Re: Clojure binding for Open CL

2010-02-10 Thread Zach Tellman
A few months back I created very basic bindings for CL4Java (the code for it still exists in Penumbra, under src/opencl). It then subsequently was renamed to JOCL, which was already in use by another OpenCL library, and they started to work on combining their efforts, and I decided to wait until

Re: clojure gen-class questions

2010-02-10 Thread Brian Wolf
Meikel, As a beginner, I tried running the first example,changing namespaces or not, etc ,and I keep getting user= (ns some.Example (gen-class)) nil some.Example= (defn -toString [this] HI !) #'some.Example/-toString some.Example= (ns user) nil

Re: Interesting ICFP slides from Guy Steele -- Organizing Functional Code for Parallel Execution

2010-02-10 Thread André Ferreira
What he said is basically right, only instead of list it's called vector. Not sure if vector branching is 64 or 32. On 10 fev, 15:42, Paul Mooser taron...@gmail.com wrote: I ran across this on reddit this morning, and thought people on the group might find it interesting:

The Detroit Java User Group Looking For a Speaker

2010-02-10 Thread David McKinnon
Hello, I apologize in advance it this is an inappropriate forum for this message. I organize the Detroit Java User Group (www.detroitjug.org) and I'd like to find a knowledgeable speaker who can present Clojure to our JUG. If there are any members of the group in the Michigan or Ohio area that

Re: clojure gen-class questions

2010-02-10 Thread Meikel Brandmeyer
Hi, Am 10.02.2010 um 21:05 schrieb Brian Wolf: As a beginner, I tried running the first example,changing namespaces or not, etc ,and I keep getting user= (ns some.Example (gen-class)) nil some.Example= (defn -toString [this] HI !)

how to determine what implements a protocol?

2010-02-10 Thread Raoul Duke
hi, is there a query to tell me if a datatype implements a particular protocol? i'm guessing there must be some forehead-slapping answer, but i haven't gleaned the clue yet :-{ thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Interesting ICFP slides from Guy Steele -- Organizing Functional Code for Parallel Execution

2010-02-10 Thread Mark Engelberg
2010/2/10 André Ferreira greis...@gmail.com: What he said is basically right, only instead of list it's called vector. Not sure if vector branching is 64 or 32. If you could append two vectors quickly in Clojure, you'd be able to use a lot of the techniques described in those slides. The whole

Re: Dutch Clojure users

2010-02-10 Thread Joost
On 7 feb, 13:09, Hubert Iwaniuk neo...@kungfoo.pl wrote: Great to hear that there is Clojure group around. For ease of finding it:http://groups.google.com/group/amsterdam-clojurians?hl=en Cheers, Hubert Joined as well. I'm in Utrecht. Shame I missed today's meeting. -- You received

Re: how to determine what implements a protocol?

2010-02-10 Thread Stuart Sierra
No need to slap your forehead, but here it is: - clojure.core/extends? ([protocol atype]) Returns true if atype explicitly extends protocol -SS On Feb 10, 4:03 pm, Raoul Duke rao...@gmail.com wrote: hi, is there a query to tell me if a datatype implements a

Re: how to determine what implements a protocol?

2010-02-10 Thread Raoul Duke
On Wed, Feb 10, 2010 at 1:20 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: No need to slap your forehead, but here it is: - clojure.core/extends? ([protocol atype])  Returns true if atype explicitly extends protocol thanks! at least a d'oh will be required.

Re: Interesting ICFP slides from Guy Steele -- Organizing Functional Code for Parallel Execution

2010-02-10 Thread Paul Mooser
Yeah, I'm aware of the tree nature of many clojure data structures, but just wasn't sure that applied to actual lists. On Feb 10, 12:06 pm, André Ferreira greis...@gmail.com wrote: What he said is basically right, only instead of list it's called vector. Not sure if vector branching is 64 or

Re: how to determine what implements a protocol?

2010-02-10 Thread Raoul Duke
clojure.core/extends? doesn't seem to cover all the use cases? or i'm mistyping (er ha ha) something? (ns p) (defprotocol P1 (foo [this])) (ns d) (deftype T1 [f] :as this p/P1 (foo [] (println this))) (deftype T2 [f] :as this) (extend ::T2 p/P1 {:foo (fn [this] (println this))}) (println P1?T1

Re: how to determine what implements a protocol?

2010-02-10 Thread Meikel Brandmeyer
Hi, Am 10.02.2010 um 22:20 schrieb Stuart Sierra: No need to slap your forehead, but here it is: - clojure.core/extends? ([protocol atype]) Returns true if atype explicitly extends protocol This only checks whether extend was explicitly called on atype. What you

defn within defn

2010-02-10 Thread Hozumi
Hi all. Is it not recommended to use defn within defn? Normal function is faster than the function which has inner function which actually doesn't run. -- (defn aaa1 [] (defn bbb [] 1) 1) (defn aaa2 [] 1) user (time

Re: defn within defn

2010-02-10 Thread .Bill Smith
Hozumi, nested defn's are definitely not recommended. I suggest using letfn for the inner function. Bill Smith Austin, TX On Feb 10, 3:28 pm, Hozumi fat...@googlemail.com wrote: Hi all. Is it not recommended to use defn within defn? Normal function is faster than the function which has

Re: defn within defn

2010-02-10 Thread Kevin Downey
scheme's define is scoped inside a function. clojure is not scheme. clojure's def (which defn uses) is not lexical or scoped in anyway, it always operates on global names. if you want lexical scope please use one of clojure's lexical scoping constructs, let or letfn. On Wed, Feb 10, 2010 at 1:28

Re: Contributing to Clojure.Contrib

2010-02-10 Thread Kevin Downey
http://clojure.org/contributing seq-utils was recently renamed: http://groups.google.com/group/clojure-dev/browse_thread/thread/49068754a8c2efb9# On Wed, Feb 10, 2010 at 3:38 PM, Wardrop t...@tomwardrop.com wrote: I've written a function which I think would be a good inclusion into the

Re: Contributing to Clojure.Contrib

2010-02-10 Thread Sean Devlin
Take a look here: http://clojure.org/contributing On Feb 10, 6:38 pm, Wardrop t...@tomwardrop.com wrote: I've written a function which I think would be a good inclusion into the Clojure.Contrib library. I have two questions though, the first is how? How do I go about adding a single function

Re: Dutch Clojure users

2010-02-10 Thread Joop Kiefte
Just at home, 4 of us were there. 1 american, 1 italian, 1 pole and me, a dutchy. I don't think this was the last time for me, and maybe some day I should invite you to Ede :) or arrange something in Utrecht or Rotterdam (I work there nearby). 2010/2/10 Joost jo...@zeekat.nl On 7 feb, 13:09,

Re: defn within defn

2010-02-10 Thread Hozumi
Hi, Bill. oh, letfn is what I wanted ! Thank you. Sorry, I missed preview disqussion. letfn - mutually recursive local functions http://groups.google.com/group/clojure/browse_thread/thread/a7aad1d5b94db748 letfn is pretty good.

Re: Contributing to Clojure.Contrib

2010-02-10 Thread Wardrop
Thanks for the link. As part of my second question, could someone take a look at the code I've posted and tell me if it's a good implementation and follows clojure idioms and standards. By the way, does anyone know of a good resource that specifies common clojure coding and formatting standards,

Re: Contributing to Clojure.Contrib

2010-02-10 Thread Kevin Downey
http://groups.google.com/group/clojure-dev/browse_thread/thread/d090b5599909497c# On Wed, Feb 10, 2010 at 3:57 PM, Wardrop t...@tomwardrop.com wrote: Thanks for the link. As part of my second question, could someone take a look at the code I've posted and tell me if it's a good implementation

Hiring round #6

2010-02-10 Thread dysinger
Hello, We have a very interesting big-data project need more devs. We are looking for our 7th clojure dev on an all work-at-home team. You must live in the US to be on our team.Full-time employees get a MBP 15 3g (for travel backup internet). So far our team consists of (in no particular

Re: Noob question: rebinding using def

2010-02-10 Thread chaosprophet
Ah, I didn't know about the reduce function. I'll give that a try and thanks a lot. On Feb 10, 10:42 pm, Brenton bashw...@gmail.com wrote: chaosprophet, Clojure wants you to think in terms of sequences instead to loops. Instead to looping through cat-all and keeping track of the sum, you

refs, agents and add-watch

2010-02-10 Thread MiltondSilva
I have this code: (def material (ref 2)) (def products-store (ref 2)) (def products (ref 0)) (def artisan (agent idle)) (defn manufacture [state] (dosync (alter material dec) (alter products inc)) (str idle)) (defn ask-material [a-key the-ref

Re: refs, agents and add-watch

2010-02-10 Thread Michał Marczyk
On 11 February 2010 02:50, MiltondSilva shadowtr...@gmail.com wrote: I have this code: [snip] java.lang.RuntimeException: Agent has errors (repl-1:8) Your code works fine for me. To help you debug your problem: you can use (agent-errors artisan) to discover what the exception is about,

Re: refs, agents and add-watch

2010-02-10 Thread MiltondSilva
This solved the problem: (defn ask-material [a-key the-ref old-state new-state] (if (= new-state 0) (dosync (alter material + (int (rand 10) (str asked for materials)) When the function ask-materials is invoked, it updates the state of the agent that caused

Re: Contributing to Clojure.Contrib

2010-02-10 Thread Meikel Brandmeyer
Hi, On Feb 11, 12:57 am, Wardrop t...@tomwardrop.com wrote: As part of my second question, could someone take a look at the code I've posted and tell me if it's a good implementation and follows clojure idioms and standards. I haven't checked the algorithm itself, but just some random notes

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Aviad Reich
Again, your input was incredibly beneficial for me. William: Thank you for your comments. As i wrote, eventually I came up with a different solution altogether. To answer your question concerning the previous code: my initial idea was that since (although unproven) all the different sequences