Re: Basic questions

2009-10-08 Thread Baishampayan Ghose
vishy wrote: Hi, How can I find out all the namespaces in a library like clojure.contrib.Also, how to find all the functions defined in a namespace? Are there any commands which I can use on commandline? http://richhickey.github.com/clojure-contrib/ Hope that helps. Regards, BG --

Re: ANN: scriptjure, a library for generating javascript

2009-10-08 Thread Meikel Brandmeyer
Hi, On Oct 8, 7:50 am, Jarkko Oranen chous...@gmail.com wrote: I took a quick look, and that looks really neat. One thing though: Instead of the clj form to escape back to clojure, why not just use unquote (and possibly unquote-splicing)? that would allow you to use the ~ reader macro as a

Re: swap! and dosync

2009-10-08 Thread Krukow
On Oct 8, 3:43 am, Timothy Pratley timothyprat...@gmail.com wrote: Atoms can't do this, as they are synchronous (called and returned immediately) - hence the warning about potentially being called multiple times. The reason that swap! may fail is that it is performing a compare- and-swap

Re: Basic questions

2009-10-08 Thread Miron Brezuleanu
Hello, On Thu, Oct 8, 2009 at 8:49 AM, vishy vishalsod...@gmail.com wrote: How can I find out all the namespaces in a library like clojure.contrib.Also, how to find all the functions defined in a namespace? Are there any commands which I can use on commandline? You can use

Re: Basic questions

2009-10-08 Thread Alex Osborne
vishy wrote: How can I find out all the namespaces in a library like clojure.contrib. I assume you mean doing this at the REPL or OS shell. I don't know how to do it for non-loaded libs, aside from manually walking the classpath, but (all-ns) might be what you want for loaded namespaces.

Re: swap! and dosync

2009-10-08 Thread Timothy Pratley
Quite right that is an important distinction. On Oct 8, 5:21 pm, Krukow karl.kru...@gmail.com wrote: On Oct 8, 3:43 am, Timothy Pratley timothyprat...@gmail.com wrote: Atoms can't do this, as they are synchronous (called and returned immediately) - hence the warning about potentially

New list for the clojure-maven-plugin

2009-10-08 Thread Mark Derricutt
'lo all, Just to let you all know I've created a list specifically for the clojure-maven-plugin project at: http://groups.google.com/group/clojure-maven-plugin Mark -- Pull me down under... --~--~-~--~~~---~--~~ You received this message because you are

Re: ANN: scriptjure, a library for generating javascript

2009-10-08 Thread Emeka
Allen, Great job! Did you try (defmulti emit class) ? Regards, Emeka On Thu, Oct 8, 2009 at 7:18 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Oct 8, 7:50 am, Jarkko Oranen chous...@gmail.com wrote: I took a quick look, and that looks really neat. One thing though: Instead of the

Re: read-line in emacs slime on windows problem

2009-10-08 Thread DanL
On 7 Okt., 20:34, Phil Hagelberg p...@hagelb.org wrote: [...] it's simply not supported [...] I'm pretty sure that it used to work some time ago. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To

Re: Mutating state in java super classes

2009-10-08 Thread C. Florian Ebeling
Neither gen-class nor proxy seem to mention how one can access or mutate member variables.  I would have thought instance variables would be accessible and mutatable within some kind of binding... gen-class has an :exposes option that allows you to create getter and setter methods for super

Pleas help me fix my code which retrieves the web page. It is running out of memory space.

2009-10-08 Thread kunjaan
(ns Trial (:use queries) (:import (java.io BufferedReader IOException InputStreamReader) java.net.URL javafiles.Porter)) ;; (def *server*

What does this error mean?

2009-10-08 Thread kunjaan
java.lang.ClassFormatError: Unknown constant tag 52 in class file queries__init (Trial.clj:0) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Another defmult VS defn query

2009-10-08 Thread Robert Stehwien
Here is another question on when you would use a multi-method. I want the mv function to accept a java.io.File or a String for either of the two parameters and here are the options I came up with: -(defmulti mv (fn [from to] [(class from) (class to)])) (defmethod mv [String String] [from to]

Re: Another defmult VS defn query

2009-10-08 Thread Laurent PETIT
Suggestion : move and generalize the problem by creating an as-file multifn that may take String, File , and maybe other things later ... (defmulti as-file type) (defmethod as-file String [from] (File. from)) (defmethod as-file File [from] from) (defn mv [from to] (let [ [from to] (map

Re: Another defmult VS defn query

2009-10-08 Thread lpetit
Oh, maybe this as-file method already exists in clojure.contrib, honestly I don't know and don't have the time to search right now, regards, -- laurent On 8 oct, 16:41, Laurent PETIT laurent.pe...@gmail.com wrote: Suggestion : move and generalize the problem by creating an as-file multifn

Re: What does this error mean?

2009-10-08 Thread Mark Tomko
Can you give some more context? On Oct 8, 6:38 am, kunjaan kunj...@gmail.com wrote: java.lang.ClassFormatError: Unknown constant tag 52 in class file queries__init (Trial.clj:0) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Another defmult VS defn query

2009-10-08 Thread Tom Faulhaber
Check out clojure.contrib.duck-streams/reader and clojure.contrib.duck- streams/writer (http://richhickey.github.com/clojure-contrib/duck- streams-api.html). They'll give you a java.io.BufferedReader or a java.io.PrintWriter which is usually what you want with a file. If you have some other use,

Re: Another defmult VS defn query

2009-10-08 Thread Robert Stehwien
On Thu, Oct 8, 2009 at 9:45 AM, Tom Faulhaber tomfaulha...@gmail.comwrote: Check out clojure.contrib.duck-streams/reader and clojure.contrib.duck- streams/writer (http://richhickey.github.com/clojure-contrib/duck- streams-api.html). They'll give you a java.io.BufferedReader or a

Agents for managing threads

2009-10-08 Thread Garth Sheldon-Coulson
Hi All, This is a question about whether I can use agents or some other Clojure concurrency feature to manage a multithreaded process elegantly and extensibly. The following is a thought I had for how to do it, but I would appreciate additional suggestions. I have an application that needs to

Re: Agents for managing threads

2009-10-08 Thread Laurent PETIT
I'm not an expert on asynchronicity with clojure, but I'll benefit from the fact i'll be the first to answer :-) But please take this with a grain of salt. As I see agents, in their generality, they are a generic way to handle a state asynchronously (commands from multiple non organized sources -

Re: What does this error mean?

2009-10-08 Thread eyeris
What JDK/JRE version? On Oct 8, 8:38 am, kunjaan kunj...@gmail.com wrote: java.lang.ClassFormatError: Unknown constant tag 52 in class file queries__init (Trial.clj:0) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Basic questions

2009-10-08 Thread Stuart Sierra
On Oct 8, 1:49 am, vishy vishalsod...@gmail.com wrote: How can I find out all the namespaces in a library like clojure.contrib.find-namespaces has functions to discover namespaces on the classpath. -SS --~--~-~--~~~---~--~~ You received this message because you

Re: Another defmult VS defn query

2009-10-08 Thread John Harrop
On Thu, Oct 8, 2009 at 10:25 AM, Robert Stehwien rstehw...@gmail.comwrote: (defn mv2 [from to] (let [f (if (= (class from) File) from (File. from)) t (if (= (class to) File) from (File. to))] (println transformed to File))) ITYM t (if (= (class to) File) to (File.

Re: What does this error mean?

2009-10-08 Thread John Harrop
On Thu, Oct 8, 2009 at 11:09 AM, Mark Tomko mjt0...@gmail.com wrote: Can you give some more context? The pesky thing about that particular error is that there IS no more context; it fingers no specific line of code, function definition, or whatever as culprit.

Re: Agents for managing threads

2009-10-08 Thread John Harrop
On Thu, Oct 8, 2009 at 1:06 PM, Laurent PETIT laurent.pe...@gmail.comwrote: So I don't think you need this message-queue at all (or maybe I haven't understood what it is or I'm mislead by its name), send directly your order to the agent as what you want to change in its state. You might be

Re: Agents for managing threads

2009-10-08 Thread John Harrop
On Thu, Oct 8, 2009 at 7:49 PM, John Harrop jharrop...@gmail.com wrote: You might be able to do better than that, and dispense entirely with the separate polling thread. Confirmed: (def x (agent {:polling false :message foo})) (defn poll [m] (when (:polling m) (prn (:message m))

Data structure design question

2009-10-08 Thread Robert Luo
Hi, I am working on a server project, which requires thousands records of data stored in memory, and they will be accessed by thousands of threads simultaneously. I intend to use datalog to store all my data, sharing the whole database by a reference. However, I am afraid of concurrency of this

Re: ANN: scriptjure, a library for generating javascript

2009-10-08 Thread Allen Rohner
It was a minor thing actually, I didn't like having to quote user code, and AFAIK, it's not possible to add a quasiquote as part of a macro. i.e. in my code, there is a function (_js) that does the heavy lifting, and the macro (js). I couldn't write: (defmacro js [forms] (quasiquote (_js

Re: ANN: scriptjure, a library for generating javascript

2009-10-08 Thread Allen Rohner
Did you try (defmulti emit class) ? That is a good point. I'm actually not sure why I used type there. It's probably a bug. Thanks for pointing it out. Allen On Oct 8, 4:38 am, Emeka emekami...@gmail.com wrote: Allen, Great job! Regards, Emeka On Thu, Oct 8, 2009 at 7:18 AM, Meikel