Re: Vimclojure and Namespaces

2009-08-17 Thread Meikel Brandmeyer

Hi,

On Aug 17, 6:08 am, Konrad Scorciapino scorciap...@gmail.com wrote:

 I'm new with Clojure, and I'm having a problem with Vimclojure and
 Namespaces. I'm following
 thishttp://java.ociweb.com/mark/clojure/article.htmltutorial,
 currently trying to evaluate the code below. If I evaluate the
 whole file, it works, but not if I do so line-by-line via \et.

Since you are very unspecific about what the problem is
with \et, I can only give some general advice:

1. The file has to be accessible via the classpath.
2. It must be loadable without errors.
3. Open the file in Vim and do a :echo b:vimclojure_namespace
   It should say com.ociweb.demo.
4. Does \et now work? If not, please give a more detailed
   description of the problem.

 What seems to be happpening is that *ns* doesn't really change with (ns). If
 I'm connected to 3 REPLs and def user/foobar to 3 in one of them, it'll be
 defined in all REPLs, however if I try to change *ns*, the change in one
 repl does not affect the others. Why is this happening?

Because the binding of *ns* is local to the current thread.
So when you have three Repls will have three bindings to
*ns*. Changing one does not affect the other.

However there is only one user namespace. So when you
def something in a namespace in one Repl it will also show
up in the others Repls, when access the same namespace.

Hope this helps.

Sincerely
Meikel

--~--~-~--~~~---~--~~
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Vimclojure and Namespaces

2009-08-17 Thread Konrad Scorciapino
Hi Meikel,

It now works. The problem was that the file was not accessible via the
classpath.

Thanks for the help!

On Mon, Aug 17, 2009 at 3:04 AM, Meikel Brandmeyer m...@kotka.de wrote:


 Hi,

 On Aug 17, 6:08 am, Konrad Scorciapino scorciap...@gmail.com wrote:

  I'm new with Clojure, and I'm having a problem with Vimclojure and
  Namespaces. I'm following
  thishttp://java.ociweb.com/mark/clojure/article.htmltutorial,
  currently trying to evaluate the code below. If I evaluate the
  whole file, it works, but not if I do so line-by-line via \et.

 Since you are very unspecific about what the problem is
 with \et, I can only give some general advice:

 1. The file has to be accessible via the classpath.
 2. It must be loadable without errors.
 3. Open the file in Vim and do a :echo b:vimclojure_namespace
   It should say com.ociweb.demo.
 4. Does \et now work? If not, please give a more detailed
   description of the problem.

  What seems to be happpening is that *ns* doesn't really change with (ns).
 If
  I'm connected to 3 REPLs and def user/foobar to 3 in one of them, it'll
 be
  defined in all REPLs, however if I try to change *ns*, the change in one
  repl does not affect the others. Why is this happening?

 Because the binding of *ns* is local to the current thread.
 So when you have three Repls will have three bindings to
 *ns*. Changing one does not affect the other.

 However there is only one user namespace. So when you
 def something in a namespace in one Repl it will also show
 up in the others Repls, when access the same namespace.

 Hope this helps.

 Sincerely
 Meikel

 



-- 
Et Forum delendum est!

--~--~-~--~~~---~--~~
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Vimclojure and Namespaces

2009-08-17 Thread Konrad Scorciapino
Hi Meikel,

It now works. The problem was that the file was not accessible via the
classpath.

Thanks for the help!

On Mon, Aug 17, 2009 at 3:04 AM, Meikel Brandmeyer m...@kotka.de wrote:


 Hi,

 On Aug 17, 6:08 am, Konrad Scorciapino scorciap...@gmail.com wrote:

  I'm new with Clojure, and I'm having a problem with Vimclojure and
  Namespaces. I'm following
  thishttp://java.ociweb.com/mark/clojure/article.htmltutorial,
  currently trying to evaluate the code below. If I evaluate the
  whole file, it works, but not if I do so line-by-line via \et.

 Since you are very unspecific about what the problem is
 with \et, I can only give some general advice:

 1. The file has to be accessible via the classpath.
 2. It must be loadable without errors.
 3. Open the file in Vim and do a :echo b:vimclojure_namespace
   It should say com.ociweb.demo.
 4. Does \et now work? If not, please give a more detailed
   description of the problem.

  What seems to be happpening is that *ns* doesn't really change with (ns).
 If
  I'm connected to 3 REPLs and def user/foobar to 3 in one of them, it'll
 be
  defined in all REPLs, however if I try to change *ns*, the change in one
  repl does not affect the others. Why is this happening?

 Because the binding of *ns* is local to the current thread.
 So when you have three Repls will have three bindings to
 *ns*. Changing one does not affect the other.

 However there is only one user namespace. So when you
 def something in a namespace in one Repl it will also show
 up in the others Repls, when access the same namespace.

 Hope this helps.

 Sincerely
 Meikel

 



-- 
Et Forum delendum est!

--~--~-~--~~~---~--~~
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Vimclojure and Namespaces

2009-08-16 Thread Konrad Scorciapino
Hi there!

I'm new with Clojure, and I'm having a problem with Vimclojure and
Namespaces. I'm following
thishttp://java.ociweb.com/mark/clojure/article.htmltutorial,
currently trying to evaluate the code below. If I evaluate the
whole file, it works, but not if I do so line-by-line via \et.

What seems to be happpening is that *ns* doesn't really change with (ns). If
I'm connected to 3 REPLs and def user/foobar to 3 in one of them, it'll be
defined in all REPLs, however if I try to change *ns*, the change in one
repl does not affect the others. Why is this happening?

Here is the code:

(ns com.ociweb.demo
  (:require [clojure.contrib.str-utils :as su])
  (:use [clojure.contrib.math :only (gcd, sqrt)])
  (:import (java.text NumberFormat) (javax.swing JFrame JLabel)))

(println (su/str-join $ [1 2 3])) ; - 1$2$3
(println (gcd 27 72)) ; - 9
(println (sqrt 5)) ; - 2.236
(println (.format (NumberFormat/getInstance) Math/PI)) ; - 3.142
;
; See the screenshot that follows this code.
(doto (JFrame. Hello)
  (.add (JLabel. Hello, World!))
  (.pack)
  ;(.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) ; doesn't work with
this, for some reason
  (.setVisible true))

Thanks!

-- 
Et Forum delendum est!

--~--~-~--~~~---~--~~
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---