can't def m-bind because namespace

2010-09-07 Thread MohanR
java.lang.Exception: Name conflict, can't def m-bind because namespace: user refers to:#'clojure.contrib.monads/m-bind What namespace help doc. should I read to resolve this issue ? Maybe I should not read about monads first. -- You received this message because you are subscribed to the Google

Re: can't def m-bind because namespace

2010-09-08 Thread MohanR
So actually it looks like I need to understand type theory to understand this. Thanks, Mohan On Sep 7, 7:04 pm, Nicolas Oury wrote: > > ...and report your findings here or blog somewhere if you don't mind > > :) I've been reading a lot about monads lately and can't get my head > > around it yet

Basic compilation question

2011-03-31 Thread MohanR
I am using Clojurebox. If I import a Java class like this (import '(com.test.Test)) then C-c C-l ( JIT compilation ) does not work because this statement (let [t (Test/test "Test")]) throws java.lang.Exception: No such namespace: Test (core.clj:23) I should be able to use this non-AOT compilat

Re: Basic compilation question

2011-03-31 Thread MohanR
The correct syntax works. So basically if the swank-clojure-classpath has the required jar I should be able to import it in this way. The classpath seems to be tripping me up again. Thanks, Mohan On Mar 31, 5:12 pm, Meikel Brandmeyer wrote: > Hi, > > On 31 Mrz., 13:20, Moha

Redirection from inferior lisp to clojure

2011-04-06 Thread MohanR
Hi, I use clojure box and I have included (add-hook 'slime-mode-hook 'slime-redirect-inferior-output) in .emacs I open M-x run-lisp and I still see the exception trace in inferior- lisp I though it will be redirected to the slime repl. Will it be ? Thanks, Mohan -- You received this message b

Re: Redirection from inferior lisp to clojure

2011-04-06 Thread MohanR
swank server is started and run-lisp works. I thought I don't need to open it but view all the output in slime itself but it gets redirected internally. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: Redirection from inferior lisp to clojure

2011-04-06 Thread MohanR
I think my question wasn't clearly stated but it has solved itself. Question was : How do I redirect stack traces and Sys out statements which are appearing in the inferior-lisp buffer to my repl so that I can view them there ? This line (add-hook 'slime-mode-hook 'slime-redirect-inferior-output

Simple Clojure/Java interop

2011-04-06 Thread MohanR
This is a beginner's question but I thought I might be missing something. I am setting a System property and testing for it like this. It passes. ( deftest testlogger (System/setProperty "Test" "Test1") (let [ configfile (System/getProperty "Test")] (is (= "Test1" configfile ))

Re: Simple Clojure/Java interop

2011-04-07 Thread MohanR
(let [ test (LogManager/getLogger "Stream")]) This code inside the same clojure function is supposed to call a static method of a Java class and in the Java class there is a static initializer. That initializer calls System.getProperty( "Test" ) This is compiled from within emacs C-c C-l. Not AO

Re: Simple Clojure/Java interop

2011-04-07 Thread MohanR
That was my guess too and when I specify swank-clojure-extra-vm-args it seems to work. -- 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 - pleas

Re: Simple Clojure/Java interop

2011-04-18 Thread MohanR
This method that makes a simple call to the log4j library throws an exception even though the message it written to the file. Not sure if there has something to do with static methods again. user>( defn logtrace[message]( (let [logger (org.apache.log4j.LogManager/getLogger "Stream")]( .log l

Re: Simple Clojure/Java interop

2011-04-18 Thread MohanR
Thanks. There is no NPE now. -- 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 th

Meta

2011-04-21 Thread MohanR
I am just trying to understand the meta data support. What are meta data used for ? Are they similar to the reflective API in Java ? Are they related to any FP theory ? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

Executing Future

2011-04-25 Thread MohanR
( deftest teststream (def service ( Executors/newFixedThreadPool 10 )) (dotimes [x 1] (try (def futures (.submit service ( proxy [Callable][] ( call [] ( println "Test" )

Re: Executing Future

2011-04-28 Thread MohanR
The problem was elsewhere but I realized that Clojure has support for futures at the level of the language even though it relies on java.util.concurrent. So I have this question. I have heard that Clojure's data structures are immutable and it has support for promises, agents, atoms etc. What exa

Re: How to determine a function name at runtime

2011-04-28 Thread MohanR
There should be a way to print the currently executing function and the calling function logging purposes ? I believe Java has StackTraceElement[] to do this. Thanks, Mohan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Equivalent of Cyclic barrier

2011-05-08 Thread MohanR
Is the java.util.concurrent.CyclicBarrier implemented in Clojure using a promise and agents ? I came across some examples like this and I think all threads can use the barrier once using this method. Is there a way to create a reusable Cyclic barrier ? "The barrier is called cyclic because it can

Re: Equivalent of Cyclic barrier

2011-05-08 Thread MohanR
Actually I think it is possible. This is actually based on the Java documentation. public class MyCyclicBarrier { private CyclicBarrier barrier; private boolean done = false; class Task implements Runnable { public void run() { while (!done) {

Import other .clj files

2011-05-11 Thread MohanR
Hi, I am trying to import .clj files. What is the variable( load- path/swank-clojure-classpath) that should point to the directory containing other .clj files with their own namespaces ? I use ClojureBox. I am loading the file using C-c C-l but I see this error Could not locate message

Re: Import other .clj files

2011-05-12 Thread MohanR
I am able to set the swank-clojure-classpath and also verify it using C-h v. It has the current directory "." and also other directories where .clj files are located If a .clj file has a namespace I ensure the classpath points to the root of the namespace folder structure like I do with Java. Wh

Re: Import other .clj files

2011-05-13 Thread MohanR
It is solved but the rules are not clear. If I have (ns test) in both .clj files and the files are in /test then I am able to call one from the other. I am not specifically pointing my classpath to /test at all. What is the link between classpath, ns and the folder structure ? Thanks, Mohan --

Re: Import other .clj files

2011-05-15 Thread MohanR
As mentioned in my previous question I didn't use (ns test.test1) but only (ns test) and it worked. (ns test.test1) throws java.lang.Exception: Unable to resolve symbol when I call a method in the other .clj file Thanks, Mohan -- You received this message because you are subscribed to the G

Re: interest in STM, where can I start to get knowing well about it?

2011-05-19 Thread MohanR
I was perplexed too but I think most( or all ) of the concurrency features in Clojure is based on java.util.concurrent. I might be wrong about this though. So once you start programming java.util.concurrent you can learn clojure STM. Someone who has more expertise can comment about this. Thanks,

Re: interest in STM, where can I start to get knowing well about it?

2011-05-19 Thread MohanR
So I think readng the actual STM source with Java' features might help. Are there actually books on this topic ? Peter Van roy's Data flow concurrency book ? Thanks, Mohan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send e

Help with primer on maps, lists or vectors

2011-06-01 Thread MohanR
How do I retrieve :z from this map? I've tried (val (find (...)) but I am still learning the ropes. Maybe a primer on maps, lists or vectors will help me. I use Java. I know that there is a String[] object. {:x 1, :y {"a" "b"}, :z #} Thanks, Mohan -- You received this message because you are

Re: Help with primer on maps, lists or vectors

2011-06-01 Thread MohanR
Those were useful ideas. I will read up more. But the thread got hijacked. -- 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 patie

Re: Announcement: stockings clojure library for easy access to financial data

2011-06-01 Thread MohanR
Is that something like a mashup ? Thanks, Mohan -- 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

Re: Help with primer on maps, lists or vectors

2011-06-02 Thread MohanR
Atlas is a really useful way to look up information. It even shows the source !! Thanks, Mohan On Jun 1, 4:44 pm, Ambrose Bonnaire-Sergeant wrote: > Hi Mohan, > > If you are exploring the Clojure landscape may I recommend Clojure Atlas. > > http://www.clojureatlas.com/org.clojure:clojure:1.2.0?g

WebSockets server for broadcasting log events

2011-02-28 Thread MohanR
I refer this earlier thread https://groups.google.com/group/clojure/browse_thread/thread/f129d366ded1a3a0 We are trying to develop a WebSocket server in Clojure that can broadcast Log4J messages to browsers. The Log4J code is Java and apart from writing files it will call the Clojure WebSocket s