Re: namespace what?

2011-12-15 Thread Laurent PETIT
Hello, Jay,

Your email is not precise enough. What did you place in which files,
how were the files named, how were they stored relatively to some
root folder, and how did you start a REPL ?

2011/12/13 jayvandal s...@ida.net:
 I think I understand namespace and then I don't!
 I try to run this example
 (ns examples.core
  (use [clarity.component :as c]))

  (make :button The Button)
  I have programs stored in c:\projects\klarity.clj
 I have clojure stored in c:\clojure-1.2.1\clojure-1.21.
 I am running c:\cljr\clj-installer-jar

 I tried running
 (ns clojure-1.2.1.clojure-1.2.1.src.clojure.core
  (use [clarity.component :as c]))

  (make :button The Button)

 What is namespace suposed to point to or access???

 --
 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

-- 
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: namespace what?

2011-12-15 Thread Stathis Sideris
You can just say:

(ns examples.core
  (:use clarity.component))

This will intern all the symbols in the clarity.component namespace
into examples.core, so you can use them as if they were defined in
examples.core in the first place: (make :button the button)

This has the disadvantage of potential clashes, if a make function
existed in examples.core, it would be overwritten.

You can also say:

(ns examples.core
  (:require clarity.component))

This makes the clarity.component namespace symbols available to you,
but you still have to fully qualify them: (clarity.component/
make :button the button)

This is a bit long-winded, so you can alias the namespace to something
shorter:

(ns examples.core
  (:require [clarity.component :as c]))

In which case your code becomes: (c/make :button the button)

So you manage to be concise, but also you keep your namespaces tidily
separated :-)

Stathis


On Dec 13, 9:50 pm, jayvandal s...@ida.net wrote:
 I think I understand namespace and then I don't!
 I try to run this example
 (ns examples.core
   (use [clarity.component :as c]))

  (make :button The Button)
  I have programs stored in c:\projects\klarity.clj
 I have clojure stored in c:\clojure-1.2.1\clojure-1.21.
 I am running c:\cljr\clj-installer-jar

 I tried running
 (ns clojure-1.2.1.clojure-1.2.1.src.clojure.core
   (use [clarity.component :as c]))

  (make :button The Button)

 What is namespace suposed to point to or access???

-- 
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: namespace what?

2011-12-15 Thread Tassilo Horn
Tassilo Horn tass...@member.fsf.org writes:

 I think I understand namespace and then I don't!
 I try to run this example

 (ns examples.core
   (use [clarity.component :as c]))

 The syntax of ns is

   (ns examples.core
 (:use [clarity.component :as c]))

 Notice the colon preceeding the use.

Oh, and of course Stathis is correct.  `use' has no :as clause, so you
probably want to `require'.

   (ns examples.core
 (:require [clarity.component :as c]))

Bye,
Tassilo

-- 
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: namespace what?

2011-12-15 Thread tonyl
you are mixing up the format for ns. If you want to use an alias for
your library, use require, like this:
(ns examples.core
  (:require [clarity.component :as c]))

;; you can call the function/macro make, by using the alias.
(c/make :button The Button)

but if you don't want to use an alias and just introduce the vars from
the library to your namespace, the use use:
(ns examples.core
  (:use clarity.component))

(make :button The Button)

Notice that while using the form ns the internal calls to library like
use,require,import,... are actually keywords and not actual calls to
the forms use,require,import which you can use outside of the ns form.
I don't know if I explained myself well. It's been a while since I
dive into clojure, but I am coming back again. I would recommend
clojuredocs [http://clojuredocs.org/clojure_core/clojure.core/ns]

On Dec 13, 3:50 pm, jayvandal s...@ida.net wrote:
 I think I understand namespace and then I don't!
 I try to run this example
 (ns examples.core
   (use [clarity.component :as c]))

  (make :button The Button)
  I have programs stored in c:\projects\klarity.clj
 I have clojure stored in c:\clojure-1.2.1\clojure-1.21.
 I am running c:\cljr\clj-installer-jar

 I tried running
 (ns clojure-1.2.1.clojure-1.2.1.src.clojure.core
   (use [clarity.component :as c]))

  (make :button The Button)

 What is namespace suposed to point to or access???

-- 
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: namespace what?

2011-12-14 Thread David Brunell
Do you have a complete program that you are trying to get working, along
with errors?  The examples.core namespace was chosen at random; you could
call it whatever you want.  It refers to the namespace in which your main
program runs.  In order to have clarity.component recognized, you need to
manage your classpath and dependencies.  The easiest way would be to create
a project with lein, edit the project.clj, then run lein deps.  Clarity is
in the clojars repository, so it will pull it in automatically for you and
place it in the classpath.

On Tue, Dec 13, 2011 at 4:50 PM, jayvandal s...@ida.net wrote:

 I think I understand namespace and then I don't!
 I try to run this example
 (ns examples.core
  (use [clarity.component :as c]))

  (make :button The Button)
  I have programs stored in c:\projects\klarity.clj
 I have clojure stored in c:\clojure-1.2.1\clojure-1.21.
 I am running c:\cljr\clj-installer-jar

 I tried running
 (ns clojure-1.2.1.clojure-1.2.1.src.clojure.core
  (use [clarity.component :as c]))

  (make :button The Button)

 What is namespace suposed to point to or access???

 --
 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

-- 
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: namespace what?

2011-12-14 Thread Tassilo Horn
jayvandal s...@ida.net writes:

Hi,

I don't understand your question, but...

 I think I understand namespace and then I don't!
 I try to run this example

 (ns examples.core
   (use [clarity.component :as c]))

The syntax of ns is

  (ns examples.core
(:use [clarity.component :as c]))

Notice the colon preceeding the use.

Bye,
Tassilo

-- 
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


namespace what?

2011-12-13 Thread jayvandal
I think I understand namespace and then I don't!
I try to run this example
(ns examples.core
  (use [clarity.component :as c]))

 (make :button The Button)
 I have programs stored in c:\projects\klarity.clj
I have clojure stored in c:\clojure-1.2.1\clojure-1.21.
I am running c:\cljr\clj-installer-jar

I tried running
(ns clojure-1.2.1.clojure-1.2.1.src.clojure.core
  (use [clarity.component :as c]))

 (make :button The Button)

What is namespace suposed to point to or access???

-- 
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