Re: Little namespace question

2012-12-18 Thread Alan Shaw
BG,
The macro doesn't seem to do the trick. The function X is interned in the
target namespace, but:

user= (def image (eval-in (X 400 400)
clevolution.version.version0-1-1))
CompilerException java.lang.RuntimeException: Unable to resolve symbol: X
in this context, compiling:(NO_SOURCE_PATH:1)


On Mon, Dec 17, 2012 at 11:53 PM, Alan Shaw noden...@gmail.com wrote:

 Oh yes, the something.something is fixed so I can just prepend it, thanks.
  (Hadn't noticed your macro takes the ns as a string!)

 -A



 On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose b.gh...@gmail.comwrote:

 Alan,

 What you're asking for is to derive the ns clojure.core given only
 core. Not sure if that's possible.

 The namespace constitutes the whole dotted structure and not just the
 last component, I am afraid.

 If the actual ns is something.something.version-0-1-1, then you need
 the string something.something.version-0-1-1 and not just
 version-0-1-1 [unless of course you have some other way of deriving
 it from info that's embedded in _your_ code or structure thereof].


 -BG

 On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw noden...@gmail.com wrote:
  Thanks BG, I'm trying that.
  But I don't think it addresses how to get from the string
 version-0-1-1 to
  the namespace something.something.version-0-1-1. How can I do that?
 
  -A
 
 
 
  On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose b.gh...@gmail.com
 
  wrote:
 
  Alan,
 
  Something like this might work for you -
 
  (defmacro eval-in
Eval a Clojure form in a different namespace and switch back to
  current namespace.
 
 Args:
 code - Clojure form as string
 ns - Target namespace as string
[code ns]
`(do
   (in-ns '~(symbol ns))
   (let [ret# (eval '~(read-string code))]
 (in-ns '~(ns-name *ns*))
 ret#)))
 
  Warning - I haven't really tested this code.
 
  -BG
 
  On Tue, Dec 18, 2012 at 12:37 PM, Alan Shaw noden...@gmail.com
 wrote:
   Thanks, Las!
  
   Ok say I have a file in which there is string such as
  
   (- (atan (bw-noise 902 2 0.7604615575402431 400 400))
   (read-image-from-file
   \images/Dawn_on_Callipygea.png\))
  
   and another
  
   version-0-0-1
  
   and I have a namespace version-0-0-1 into which functions named atan
   etc.
   are all :referred.  I want to evaluate the expression in that
 particular
   context, and not remain there when I'm done.
  
   -A
  
  
  
   On Mon, Dec 17, 2012 at 11:00 PM, László Török ltoro...@gmail.com
   wrote:
  
   ah, sorry, it's a bit early for me
  
   (in-ns (ns-name user-ns))
  
   if you could post a simple example for the second part of your
 question
   I
   maybe able to help.
  
   Las
  
   Alan Shaw 2012. december 18., kedd napon a következőt írta:
  
   Ah no, that puts me in a new user-ns namespace! Not what I wanted!
  
  
   On Mon, Dec 17, 2012 at 10:51 PM, László Török ltoro...@gmail.com
 
   wrote:
  
   Try (in-ns 'user-ns)
  
   Las
  
   On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com wrote:
  
   user= *ns*
   #Namespace user
   user= (def user-ns *ns*)
   #'user/user-ns
   user= user-ns
   #Namespace user
   user= (in-ns user-ns)
   ClassCastException clojure.lang.Namespace cannot be cast to
   clojure.lang.Symbol  clojure.lang.RT$1.invoke (RT.java:226)
  
   It appears I'm not understanding how namespaces are represented.
  
   Also, is it just wrong of me to want to remember a namespace I
 was
   working in and try to go back to it later?
  
   The slightly larger context is: I'm saving an s-expression with
   unqualified names in it into a file as a string. Also saving a
   string
   indicating the name of the environment in which that string
 should
   be (read
   and) eval'ed so that the names will resolve to the appropriate
   functions.
   Advice on managing this would be appreciated.
  
   -Alan Shaw
  
   --
   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
  
  
   --
   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
   

Re: Little namespace question

2012-12-18 Thread Baishampayan Ghose
Do you have target ns clevolution.version.version0-1-1 required?

-BG

On Tue, Dec 18, 2012 at 1:38 PM, Alan Shaw noden...@gmail.com wrote:
 BG,
 The macro doesn't seem to do the trick. The function X is interned in the
 target namespace, but:

 user= (def image (eval-in (X 400 400)
 clevolution.version.version0-1-1))
 CompilerException java.lang.RuntimeException: Unable to resolve symbol: X in
 this context, compiling:(NO_SOURCE_PATH:1)


 On Mon, Dec 17, 2012 at 11:53 PM, Alan Shaw noden...@gmail.com wrote:

 Oh yes, the something.something is fixed so I can just prepend it, thanks.
 (Hadn't noticed your macro takes the ns as a string!)

 -A



 On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose b.gh...@gmail.com
 wrote:

 Alan,

 What you're asking for is to derive the ns clojure.core given only
 core. Not sure if that's possible.

 The namespace constitutes the whole dotted structure and not just the
 last component, I am afraid.

 If the actual ns is something.something.version-0-1-1, then you need
 the string something.something.version-0-1-1 and not just
 version-0-1-1 [unless of course you have some other way of deriving
 it from info that's embedded in _your_ code or structure thereof].


 -BG

 On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw noden...@gmail.com wrote:
  Thanks BG, I'm trying that.
  But I don't think it addresses how to get from the string
  version-0-1-1 to
  the namespace something.something.version-0-1-1. How can I do that?
 
  -A
 
 
 
  On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose
  b.gh...@gmail.com
  wrote:
 
  Alan,
 
  Something like this might work for you -
 
  (defmacro eval-in
Eval a Clojure form in a different namespace and switch back to
  current namespace.
 
 Args:
 code - Clojure form as string
 ns - Target namespace as string
[code ns]
`(do
   (in-ns '~(symbol ns))
   (let [ret# (eval '~(read-string code))]
 (in-ns '~(ns-name *ns*))
 ret#)))
 
  Warning - I haven't really tested this code.
 
  -BG
 
  On Tue, Dec 18, 2012 at 12:37 PM, Alan Shaw noden...@gmail.com
  wrote:
   Thanks, Las!
  
   Ok say I have a file in which there is string such as
  
   (- (atan (bw-noise 902 2 0.7604615575402431 400 400))
   (read-image-from-file
   \images/Dawn_on_Callipygea.png\))
  
   and another
  
   version-0-0-1
  
   and I have a namespace version-0-0-1 into which functions named atan
   etc.
   are all :referred.  I want to evaluate the expression in that
   particular
   context, and not remain there when I'm done.
  
   -A
  
  
  
   On Mon, Dec 17, 2012 at 11:00 PM, László Török ltoro...@gmail.com
   wrote:
  
   ah, sorry, it's a bit early for me
  
   (in-ns (ns-name user-ns))
  
   if you could post a simple example for the second part of your
   question
   I
   maybe able to help.
  
   Las
  
   Alan Shaw 2012. december 18., kedd napon a következőt írta:
  
   Ah no, that puts me in a new user-ns namespace! Not what I wanted!
  
  
   On Mon, Dec 17, 2012 at 10:51 PM, László Török
   ltoro...@gmail.com
   wrote:
  
   Try (in-ns 'user-ns)
  
   Las
  
   On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com wrote:
  
   user= *ns*
   #Namespace user
   user= (def user-ns *ns*)
   #'user/user-ns
   user= user-ns
   #Namespace user
   user= (in-ns user-ns)
   ClassCastException clojure.lang.Namespace cannot be cast to
   clojure.lang.Symbol  clojure.lang.RT$1.invoke (RT.java:226)
  
   It appears I'm not understanding how namespaces are represented.
  
   Also, is it just wrong of me to want to remember a namespace I
   was
   working in and try to go back to it later?
  
   The slightly larger context is: I'm saving an s-expression with
   unqualified names in it into a file as a string. Also saving a
   string
   indicating the name of the environment in which that string
   should
   be (read
   and) eval'ed so that the names will resolve to the appropriate
   functions.
   Advice on managing this would be appreciated.
  
   -Alan Shaw
  
   --
   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
  
  
   --
   You received this message because you are subscribed to the Google
   

Re: Little namespace question

2012-12-18 Thread Alan Shaw
Now I do, and the macro worked!
I believe I have a problem using the macro from a function, but leaving
that for tomorrow.

Thanks BG!

-A



On Tue, Dec 18, 2012 at 12:19 AM, Baishampayan Ghose b.gh...@gmail.comwrote:

 Do you have target ns clevolution.version.version0-1-1 required?

 -BG

 On Tue, Dec 18, 2012 at 1:38 PM, Alan Shaw noden...@gmail.com wrote:
  BG,
  The macro doesn't seem to do the trick. The function X is interned in the
  target namespace, but:
 
  user= (def image (eval-in (X 400 400)
  clevolution.version.version0-1-1))
  CompilerException java.lang.RuntimeException: Unable to resolve symbol:
 X in
  this context, compiling:(NO_SOURCE_PATH:1)
 
 
  On Mon, Dec 17, 2012 at 11:53 PM, Alan Shaw noden...@gmail.com wrote:
 
  Oh yes, the something.something is fixed so I can just prepend it,
 thanks.
  (Hadn't noticed your macro takes the ns as a string!)
 
  -A
 
 
 
  On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose b.gh...@gmail.com
 
  wrote:
 
  Alan,
 
  What you're asking for is to derive the ns clojure.core given only
  core. Not sure if that's possible.
 
  The namespace constitutes the whole dotted structure and not just the
  last component, I am afraid.
 
  If the actual ns is something.something.version-0-1-1, then you need
  the string something.something.version-0-1-1 and not just
  version-0-1-1 [unless of course you have some other way of deriving
  it from info that's embedded in _your_ code or structure thereof].
 
 
  -BG
 
  On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw noden...@gmail.com wrote:
   Thanks BG, I'm trying that.
   But I don't think it addresses how to get from the string
   version-0-1-1 to
   the namespace something.something.version-0-1-1. How can I do that?
  
   -A
  
  
  
   On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose
   b.gh...@gmail.com
   wrote:
  
   Alan,
  
   Something like this might work for you -
  
   (defmacro eval-in
 Eval a Clojure form in a different namespace and switch back to
   current namespace.
  
  Args:
  code - Clojure form as string
  ns - Target namespace as string
 [code ns]
 `(do
(in-ns '~(symbol ns))
(let [ret# (eval '~(read-string code))]
  (in-ns '~(ns-name *ns*))
  ret#)))
  
   Warning - I haven't really tested this code.
  
   -BG
  
   On Tue, Dec 18, 2012 at 12:37 PM, Alan Shaw noden...@gmail.com
   wrote:
Thanks, Las!
   
Ok say I have a file in which there is string such as
   
(- (atan (bw-noise 902 2 0.7604615575402431 400 400))
(read-image-from-file
\images/Dawn_on_Callipygea.png\))
   
and another
   
version-0-0-1
   
and I have a namespace version-0-0-1 into which functions named
 atan
etc.
are all :referred.  I want to evaluate the expression in that
particular
context, and not remain there when I'm done.
   
-A
   
   
   
On Mon, Dec 17, 2012 at 11:00 PM, László Török 
 ltoro...@gmail.com
wrote:
   
ah, sorry, it's a bit early for me
   
(in-ns (ns-name user-ns))
   
if you could post a simple example for the second part of your
question
I
maybe able to help.
   
Las
   
Alan Shaw 2012. december 18., kedd napon a következőt írta:
   
Ah no, that puts me in a new user-ns namespace! Not what I
 wanted!
   
   
On Mon, Dec 17, 2012 at 10:51 PM, László Török
ltoro...@gmail.com
wrote:
   
Try (in-ns 'user-ns)
   
Las
   
On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com
 wrote:
   
user= *ns*
#Namespace user
user= (def user-ns *ns*)
#'user/user-ns
user= user-ns
#Namespace user
user= (in-ns user-ns)
ClassCastException clojure.lang.Namespace cannot be cast to
clojure.lang.Symbol  clojure.lang.RT$1.invoke (RT.java:226)
   
It appears I'm not understanding how namespaces are
 represented.
   
Also, is it just wrong of me to want to remember a namespace I
was
working in and try to go back to it later?
   
The slightly larger context is: I'm saving an s-expression
 with
unqualified names in it into a file as a string. Also saving a
string
indicating the name of the environment in which that string
should
be (read
and) eval'ed so that the names will resolve to the appropriate
functions.
Advice on managing this would be appreciated.
   
-Alan Shaw
   
--
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 

Re: Clojure Full Syntactical Reference

2012-12-18 Thread Niels van Klaveren
It's a feature of the REPLy NREPL client. See 
https://github.com/trptcolin/reply/blob/master/src/clj/reply/initialization.clj 
how it works so you can emulate it.

On Tuesday, December 18, 2012 5:10:00 AM UTC+1, Karim A. Nassar wrote:

 When using nrepl in emacs (cdoc fn) emits: 

 CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
 cdoc in this context, compiling:(NO_SOURCE_PATH:1) 

 However, in lein repl I see:

 Loading clojuredocs-client...

 How do I make nrepl as smart as lein repl?



 On Fri, Dec 14, 2012 at 10:08 PM, Andy Fingerhut 
 andy.fi...@gmail.comjavascript:
  wrote:

 I would recommend checking out

 http://clojuredocs.org

 If you use Leiningen version 2, you can get similar output with these two 
 commands:

 lein repl
 user= (doc first)
 user= (cdoc first)

 doc gives the doc string built into Clojure.  cdoc gives the examples 
 from ClojureDocs.org for that symbol, as long as you have an Internet 
 connection.

 Andy

 On Dec 14, 2012, at 3:40 PM, lin...@redhandgaming.net javascript:wrote:

  I'm learning Clojure, and I learn best by jumping in. I'm interested in 
 using Noir. Noir has a full API reference, so when I'm reading other 
 people's Noir code, I can just look up the exact function and see what it 
 does.
 
  I can't find a similar thing for Clojure. I'm looking through other 
 people's Clojure code. I see something like (keyword (or (first m) :dev)) 
 and I don't really know where to start understanding this. I know enough to 
 know that keyword, or, and first are all functions - and with a google 
 search or two, I can figure out what 'first' does. But I can't easily find 
 out what 'or' and 'keyword' do, because when I google those things, I get 
 all kinds of screwy results, completely unrelated to what I'm trying to 
 find out.
 
  Where can I find, or does there exist, a place where I can view all 
 Clojure's built in functions with a short description of their arguments 
 and what they do?

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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: Clojure Full Syntactical Reference

2012-12-18 Thread Niels van Klaveren
I wonder if this couldn't have been better implemented as nrepl middleware.

On Tuesday, December 18, 2012 10:34:01 AM UTC+1, Niels van Klaveren wrote:

 It's a feature of the REPLy NREPL client. See 
 https://github.com/trptcolin/reply/blob/master/src/clj/reply/initialization.cljhow
  it works so you can emulate it.

 On Tuesday, December 18, 2012 5:10:00 AM UTC+1, Karim A. Nassar wrote:

 When using nrepl in emacs (cdoc fn) emits: 

 CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
 cdoc in this context, compiling:(NO_SOURCE_PATH:1) 

 However, in lein repl I see:

 Loading clojuredocs-client...

 How do I make nrepl as smart as lein repl?



 On Fri, Dec 14, 2012 at 10:08 PM, Andy Fingerhut andy.fi...@gmail.comwrote:

 I would recommend checking out

 http://clojuredocs.org

 If you use Leiningen version 2, you can get similar output with these 
 two commands:

 lein repl
 user= (doc first)
 user= (cdoc first)

 doc gives the doc string built into Clojure.  cdoc gives the examples 
 from ClojureDocs.org for that symbol, as long as you have an Internet 
 connection.

 Andy

 On Dec 14, 2012, at 3:40 PM, lin...@redhandgaming.net wrote:

  I'm learning Clojure, and I learn best by jumping in. I'm interested 
 in using Noir. Noir has a full API reference, so when I'm reading other 
 people's Noir code, I can just look up the exact function and see what it 
 does.
 
  I can't find a similar thing for Clojure. I'm looking through other 
 people's Clojure code. I see something like (keyword (or (first m) :dev)) 
 and I don't really know where to start understanding this. I know enough to 
 know that keyword, or, and first are all functions - and with a google 
 search or two, I can figure out what 'first' does. But I can't easily find 
 out what 'or' and 'keyword' do, because when I google those things, I get 
 all kinds of screwy results, completely unrelated to what I'm trying to 
 find out.
 
  Where can I find, or does there exist, a place where I can view all 
 Clojure's built in functions with a short description of their arguments 
 and what they do?

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@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+u...@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

Question about re-find

2012-12-18 Thread vernam
Hi, 
I've tinkered with clojures regexes and found a behavior I do not 
understand. 

(def regex a(.*?)b(.*?)c(.*?))   ;; The RE string, a little 
strange but valid 
(def input abbbcc)   ;; The input, should match 
completely

(import '[java.util.regex Pattern Matcher]);; Fst the direct java way 
(def j-pattern (Pattern/compile regex))
(def j-matcher (.matcher j-pattern input))
(.matches j-matcher)   ;; Ok 
(def j-res ;; [abbbcc  bb c]
 (mapv (fn [g] (.group j-matcher g)) 
   (range (inc (.groupCount j-matcher)  

(def clj-pattern (re-pattern regex))   ;; Now clojure 
(def clj-res (re-find clj-pattern input))

(= (.pattern clj-pattern) (.pattern j-pattern)) ;; Do we really use same 
RE? (For me: yes)
(= clj-res j-res)   ;; but the results differ:
;; clj-res [abbbc  bb 
]  is missing the last c

Could someone please explain what I'm missing?

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

Re: Question about re-find

2012-12-18 Thread Andy Fingerhut
Try these at the REPL:

(source re-find)
(source re-matches)

re-matches is closer to what you did in Java than re-find, which does something 
different (find the first match in the string, as opposed to determining 
whether the entire string matches the regex).

Andy

On Dec 18, 2012, at 1:32 AM, vernam wrote:

 Hi, 
 I've tinkered with clojures regexes and found a behavior I do not understand. 
 
 (def regex a(.*?)b(.*?)c(.*?))   ;; The RE string, a little 
 strange but valid 
 (def input abbbcc)   ;; The input, should match 
 completely
 
 (import '[java.util.regex Pattern Matcher]);; Fst the direct java way 
 (def j-pattern (Pattern/compile regex))
 (def j-matcher (.matcher j-pattern input))
 (.matches j-matcher)   ;; Ok 
 (def j-res ;; [abbbcc  bb c]
  (mapv (fn [g] (.group j-matcher g)) 
(range (inc (.groupCount j-matcher)  
 
 (def clj-pattern (re-pattern regex))   ;; Now clojure 
 (def clj-res (re-find clj-pattern input))
 
 (= (.pattern clj-pattern) (.pattern j-pattern)) ;; Do we really use same RE? 
 (For me: yes)
 (= clj-res j-res)   ;; but the results differ:
 ;; clj-res [abbbc  bb 
 ]  is missing the last c
 
 Could someone please explain what I'm missing?

-- 
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: How to structure a Clojure day for noobs?

2012-12-18 Thread ulsa
Good point. 

I really would like themselves to be able to set up their own environment. 
I think it gives them a sense of control. However, as a fallback, it would 
be great with a virtual machine with everything working. I'll consider that.

I believe you can get a similar level of interactivity in both IntelliJ and 
Eclipse, but I agree that Emacs is still the master.

On Tuesday, 18 December 2012 04:31:32 UTC+1, Peter wrote:

 1. install Leiningen and learn the basics
 2. get everyone an editing environment, with the option of using either 
 Emacs, IntelliJ, or Eclipse

 I would have people do this in advance, or provide a canned environment 
 that has a better chance of just working. There's decent odds that these 
 two steps will eat up a bunch of your time and leave people feeling left 
 out when their install/editor/integration is not quite right.

 Personally I found the C-x-e of evaluating an s-exp in emacs to be the 
 magic that makes clojure a bajillionty times better than any other 
 programming language, so I'm partial to something like the emacs starter 
 kit. But something like labrepl or eclipse+counterclockwise might be easier 
 for people to start with. 

 On Mon, Dec 17, 2012 at 3:26 AM, Marko Topolnik 
 marko.t...@gmail.comjavascript:
  wrote:


 I think, however, that there is a risk of a disconnect, where newcomers 
 don't really grasp that there is a JVM running and that code is actually 
 compiled and injected into it, and that it's for real. They are used to 
 mickey mouse interactive tools that don't provide the real thing, and 
 struggle to bridge the apparent gap between running code in the REPL and 
 properly compiling and running files. There is no gap, but one needs to 
 explain that, I think.


 I think this is a pivot point for everything in Clojure. The harder the 
 mental switch, the more important to make it right away. Without 
 understanding that, it will be very hard to maintain a clear picture of how 
 everything fits together, especially when you start changing functions and 
 reloading them. 
  
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




 -- 
 The king’s heart is like a stream of water directed by the Lord; He guides 
 it wherever He pleases.
  

-- 
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: Belgian Clojure base meetup?

2012-12-18 Thread Pierre R
Liege would be not too far

-- 
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: [ANN] tools.namespace 0.2.2 and Flow 0.1.0

2012-12-18 Thread Anthony Grimes
http://dev.clojure.org/jira/browse/TNS-1 is the reason why I did bultitude. 
It was an important bug that was never addressed, and probably still hasn't 
been addressed. Other people have also added relatively complex classpath 
features to it as well, and since it isn't a contrib project you can 
contribute to it without having to sign a CA and do the Jira patch parade. 
Because of these things and especially because of the latter I'll 
definitely continue maintaining bultitude. I'm interested in the new 
features added to tools.namespace, and will definitely look into them and 
maybe take whatever makes sense over to bultitude.

On Tuesday, December 18, 2012 12:02:55 AM UTC-6, Mikera wrote:

 Hi Stuart,

 Re: tools.namespace, I've found some similar functions in the bultitude 
 library (https://github.com/Raynes/bultitude/tree/master/src/bultitude). 
 Apparently it addresses 
 specific needs that clojure.tools.namespace did not provide.

 Is one of these recommended over the other, or is there a plan to merge 
 these so that 
 we get the best of both?

 On Friday, 14 December 2012 21:52:40 UTC+8, Stuart Sierra wrote:


 Changelog  more info:

   https://github.com/clojure/tools.namespace



-- 
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: [ANN] tools.namespace 0.2.2 and Flow 0.1.0

2012-12-18 Thread Anthony Grimes
Actually, scratch that first one. Looks like Stuart did finally apply the 
patch. Other reasons for bultitude's existence still apply.

On Tuesday, December 18, 2012 6:06:40 AM UTC-6, Anthony Grimes wrote:

 http://dev.clojure.org/jira/browse/TNS-1 is the reason why I did 
 bultitude. It was an important bug that was never addressed, and probably 
 still hasn't been addressed. Other people have also added relatively 
 complex classpath features to it as well, and since it isn't a contrib 
 project you can contribute to it without having to sign a CA and do the 
 Jira patch parade. Because of these things and especially because of the 
 latter I'll definitely continue maintaining bultitude. I'm interested in 
 the new features added to tools.namespace, and will definitely look into 
 them and maybe take whatever makes sense over to bultitude.

 On Tuesday, December 18, 2012 12:02:55 AM UTC-6, Mikera wrote:

 Hi Stuart,

 Re: tools.namespace, I've found some similar functions in the bultitude 
 library (https://github.com/Raynes/bultitude/tree/master/src/bultitude). 
 Apparently it addresses 
 specific needs that clojure.tools.namespace did not provide.

 Is one of these recommended over the other, or is there a plan to merge 
 these so that 
 we get the best of both?

 On Friday, 14 December 2012 21:52:40 UTC+8, Stuart Sierra wrote:


 Changelog  more info:

   https://github.com/clojure/tools.namespace



-- 
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: Belgian Clojure base meetup?

2012-12-18 Thread Frederik De Bleser
I'd love to see a Belgian Clojure meetup! I'm from Antwerp.

Kind regards,

Frederik

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

gen-interface and deftype with types, compilation problem

2012-12-18 Thread Vladimir Matveev
Hello,

Consider the following code

(gen-interface
  :name IntStack
  :methods [[stackPeek [] int]
[stackPush [int] void]
[stackPop [] int]
[stackDepth [] int]])

(deftype IntStackImpl
  [^{:tag ints :unsynchronized-mutable true} data
   ^{:tag int :unsynchronized-mutable true} depth]
  IntStack
  (stackPeek [this]
(aget data depth))
  (stackPush [this value]
(when (= (inc depth) (alength data))
  (let [data-length (alength data)
new-data (int-array (* data-length 2))]
(System/arraycopy data 0 new-data 0 data-length)
(set! data new-data)))
(set! depth (inc depth))
(aset data depth value))
  (stackPop [this]
(if ( depth 0)
  (let [value (aget data depth)]
(set! depth (dec depth))
value)
  (throw (IllegalStateException. Stack is already empty!
  (stackDepth [this]
depth))

This is very simple stack implementation over plain java array. It does not 
compile with the following message:
CompilerException java.lang.VerifyError: (class: 
clojure/data/xml/IntStackImpl, method: stackPop signature: ()I) Expecting 
to find integer on stack

However, when I replace the body of stackPop with, say, plain zero literal 
0, the method seems to pass the compilation, because then I'm getting 
similar error on stackPush method instead.
Placing type hints inside stackPop method does not work (in fact, it is 
even an error to place them, say, on value local binding).

What am I doing wrong here? How to make the class compile?

Cheers,
Vladimir.


-- 
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: gen-interface and deftype with types, compilation problem

2012-12-18 Thread David Nolen
I don't think you can type hint a field as a primitive array.

On Tuesday, December 18, 2012, Vladimir Matveev wrote:

 Hello,

 Consider the following code

 (gen-interface
   :name IntStack
   :methods [[stackPeek [] int]
 [stackPush [int] void]
 [stackPop [] int]
 [stackDepth [] int]])

 (deftype IntStackImpl
   [^{:tag ints :unsynchronized-mutable true} data
^{:tag int :unsynchronized-mutable true} depth]
   IntStack
   (stackPeek [this]
 (aget data depth))
   (stackPush [this value]
 (when (= (inc depth) (alength data))
   (let [data-length (alength data)
 new-data (int-array (* data-length 2))]
 (System/arraycopy data 0 new-data 0 data-length)
 (set! data new-data)))
 (set! depth (inc depth))
 (aset data depth value))
   (stackPop [this]
 (if ( depth 0)
   (let [value (aget data depth)]
 (set! depth (dec depth))
 value)
   (throw (IllegalStateException. Stack is already empty!
   (stackDepth [this]
 depth))

 This is very simple stack implementation over plain java array. It does
 not compile with the following message:
 CompilerException java.lang.VerifyError: (class:
 clojure/data/xml/IntStackImpl, method: stackPop signature: ()I) Expecting
 to find integer on stack

 However, when I replace the body of stackPop with, say, plain zero literal
 0, the method seems to pass the compilation, because then I'm getting
 similar error on stackPush method instead.
 Placing type hints inside stackPop method does not work (in fact, it is
 even an error to place them, say, on value local binding).

 What am I doing wrong here? How to make the class compile?

 Cheers,
 Vladimir.


  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to 
 clojure@googlegroups.comjavascript:_e({}, 'cvml', 
 '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 javascript:_e({}, 'cvml',
 'clojure%2bunsubscr...@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

core.logic - explaining transitive relationships

2012-12-18 Thread Stathis Sideris
Hello,

With the code below you can query transitive relationships between entities 
successfully. Is there any way to use core.logic explain the 
relationship? Specifically, is there any way to write a function explain so 
that:

 (explain :pitbull :chordate)

will give you:

[:pitbull :dog]
[:dog :mammal]
[:mammal :chordate]

Thanks,

Stathis


Code:

(ns test.logic
  (:refer-clojure :exclude [==])
  (:use clojure.core.logic))

(defrel is-a Entity Parent)
(fact is-a :pitbull :dog)
(fact is-a :dog :mammal)
(fact is-a :mammal :chordate)
(fact is-a :chordate :animal)

(defn transitive [r]
  (fn t [p1 p2]
(fresh [intermediate]
   (conde
  ((r p1 p2))
  ((r p1 intermediate)
   (t intermediate p2))

(defn iso [entity parent]
  ((transitive is-a) entity parent))

In the REPL:
 (run* [q] (iso :dog :animal))
(_.0)

-- 
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: Belgian Clojure base meetup?

2012-12-18 Thread François
Hello,

I'm from Namur. Such a meeting would be fantastic. Belgium is not very 
large. I can of course get around.

François

Le lundi 17 décembre 2012 19:09:56 UTC+1, Sébastien Wagener a écrit :

 Hi Thomas, 

 I'm from Luxembourg. If the meetup isn't too far away from the border, I 
 would be interested.

 Sébastien


 2012/12/16 Thomas Goossens con...@thomasgoossens.be javascript:

 If you are from Belgium, Don't get too excited - yet - .

 I've been wondering about organising a small meetup somewhere next 
 semester. (I peeked at our northern neighbours: 
 http://www.meetup.com/The-Amsterdam-Clojure-Meetup-Group/events/88386392/
 )

 Though, I have no idea at all how many people here in Belgium are 
 actively using clojure and would be interested in such a thing.

 Its not a plan, just being curious and checking whether it would be worth 
 the time.

 So if you are from Belgium, give me a shout!

 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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: core.logic - explaining transitive relationships

2012-12-18 Thread Tassilo Horn
Stathis Sideris side...@gmail.com writes:

Hi Stathis,

 With the code below you can query transitive relationships between
 entities successfully. Is there any way to use core.logic explain
 the relationship? Specifically, is there any way to write a function
 explain so that:

 (explain :pitbull :chordate)

 will give you:

 [:pitbull :dog]
 [:dog :mammal]
 [:mammal :chordate]

Can't you define `iso` with 3 args, one being a list of intermediates?
E.g., something like

(defn iso [entity is parent]
  (conde
[(is-a entity parent) (== is ())]
[(fresh [i nis]
   (is-a entity i)
   (conso i nis is)
   (iso i nis parent))]))

Then you could run it like:

  test.logic (run* [q] (iso :pitbull q :animal))
  ((:dog :mammal :chordate))

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: core.logic - explaining transitive relationships

2012-12-18 Thread Stathis Sideris
Hello David,

Yes, I wasn't expecting for this to be built-in. Your example is exactly 
what I was looking for, thanks a lot! I'll to need to spend some time to 
figure it out :-)

Stathis


On Tuesday, 18 December 2012 15:52:47 UTC, David Nolen wrote:

 There is no general explain functionality. However the following simple 
 solution should give you some ideas:

 (defrel is-a Entity Parent)
 (fact is-a :pitbull :dog)
 (fact is-a :dog :mammal)
 (fact is-a :mammal :chordate)
 (fact is-a :chordate :animal)

 (defn transitive [r]
   (fn t
 ([x z] (t x z (lvar)))
 ([x z path]
(fresh [y]
  (conde
[(r x z) (== path '())]
[(fresh [a d]
   (r x y)
   (conso a d path)
   (== a [x y])
   (t y z d))])

 (defn iso
   ([entity parent]
  ((transitive is-a) entity parent))
   ([entity parent path]
  ((transitive is-a) entity parent path)))

 (comment
   (run* [q]
 (iso :dog :animal q))
   )


 On Tue, Dec 18, 2012 at 9:06 AM, Stathis Sideris 
 sid...@gmail.comjavascript:
  wrote:

 Hello,

 With the code below you can query transitive relationships between 
 entities successfully. Is there any way to use core.logic explain the 
 relationship? Specifically, is there any way to write a function explain so 
 that:

  (explain :pitbull :chordate)

 will give you:

 [:pitbull :dog]
 [:dog :mammal]
 [:mammal :chordate]

 Thanks,

 Stathis


 Code:

 (ns test.logic
   (:refer-clojure :exclude [==])
   (:use clojure.core.logic))

 (defrel is-a Entity Parent)
 (fact is-a :pitbull :dog)
 (fact is-a :dog :mammal)
 (fact is-a :mammal :chordate)
 (fact is-a :chordate :animal)

 (defn transitive [r]
   (fn t [p1 p2]
 (fresh [intermediate]
(conde
   ((r p1 p2))
   ((r p1 intermediate)
(t intermediate p2))

 (defn iso [entity parent]
   ((transitive is-a) entity parent))

 In the REPL:
  (run* [q] (iso :dog :animal))
 (_.0)

  -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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: core.logic - explaining transitive relationships

2012-12-18 Thread Stathis Sideris
Thanks for this. I didn't think about that!

On Tuesday, 18 December 2012 15:51:55 UTC, Tassilo Horn wrote:

 Stathis Sideris sid...@gmail.com javascript: writes: 

 Hi Stathis, 

  With the code below you can query transitive relationships between 
  entities successfully. Is there any way to use core.logic explain 
  the relationship? Specifically, is there any way to write a function 
  explain so that: 
  
  (explain :pitbull :chordate) 
  
  will give you: 
  
  [:pitbull :dog] 
  [:dog :mammal] 
  [:mammal :chordate] 

 Can't you define `iso` with 3 args, one being a list of intermediates? 
 E.g., something like 

 (defn iso [entity is parent] 
   (conde 
 [(is-a entity parent) (== is ())] 
 [(fresh [i nis] 
(is-a entity i) 
(conso i nis is) 
(iso i nis parent))])) 

 Then you could run it like: 

   test.logic (run* [q] (iso :pitbull q :animal)) 
   ((:dog :mammal :chordate)) 

 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: core.logic - explaining transitive relationships

2012-12-18 Thread David Nolen
;; there is a transitive relationship between x  z if there is a
;; relationship between x  some y and some y  z
(defn transitive [r]
  (fn t
;; if passed only two args create the path logic var
([x z] (t x z (lvar)))
;; take an x, z, and a path from x to z
([x z path]
   (fresh [y]
 (conde
   ;; there is a direct relationship between x  z
   ;; update the path
   [(r x z) (== path (list [x z]))]
   ;; there is not a direct relationship between x  z
   ;; try some y that has a relationship with x, update the path
   [(fresh [a d]
  (r x y)
  (conso a d path)
  (== a [x y])
  ;; prove there is a relationship between y  z
  (t y z d))])

(defn iso
  ([entity parent]
 ((transitive is-a) entity parent))
  ([entity parent path]
 ((transitive is-a) entity parent path)))


On Tue, Dec 18, 2012 at 11:28 AM, Stathis Sideris side...@gmail.com wrote:

 Hello David,

 Yes, I wasn't expecting for this to be built-in. Your example is exactly
 what I was looking for, thanks a lot! I'll to need to spend some time to
 figure it out :-)

 Stathis


 On Tuesday, 18 December 2012 15:52:47 UTC, David Nolen wrote:

 There is no general explain functionality. However the following simple
 solution should give you some ideas:

 (defrel is-a Entity Parent)
 (fact is-a :pitbull :dog)
 (fact is-a :dog :mammal)
 (fact is-a :mammal :chordate)
 (fact is-a :chordate :animal)

 (defn transitive [r]
   (fn t
 ([x z] (t x z (lvar)))
 ([x z path]
(fresh [y]
  (conde
[(r x z) (== path '())]
[(fresh [a d]
   (r x y)
   (conso a d path)
   (== a [x y])
   (t y z d))])

 (defn iso
   ([entity parent]
  ((transitive is-a) entity parent))
   ([entity parent path]
  ((transitive is-a) entity parent path)))

 (comment
   (run* [q]
 (iso :dog :animal q))
   )


 On Tue, Dec 18, 2012 at 9:06 AM, Stathis Sideris sid...@gmail.comwrote:

 Hello,

 With the code below you can query transitive relationships between
 entities successfully. Is there any way to use core.logic explain the
 relationship? Specifically, is there any way to write a function explain so
 that:

  (explain :pitbull :chordate)

 will give you:

 [:pitbull :dog]
 [:dog :mammal]
 [:mammal :chordate]

 Thanks,

 Stathis


 Code:

 (ns test.logic
   (:refer-clojure :exclude [==])
   (:use clojure.core.logic))

 (defrel is-a Entity Parent)
 (fact is-a :pitbull :dog)
 (fact is-a :dog :mammal)
 (fact is-a :mammal :chordate)
 (fact is-a :chordate :animal)

 (defn transitive [r]
   (fn t [p1 p2]
 (fresh [intermediate]
(conde
   ((r p1 p2))
   ((r p1 intermediate)
(t intermediate p2))

 (defn iso [entity parent]
   ((transitive is-a) entity parent))

 In the REPL:
  (run* [q] (iso :dog :animal))
 (_.0)

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@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+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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


-- 
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: gen-interface and deftype with types, compilation problem

2012-12-18 Thread Vladimir Matveev
Well, it is news for me since it is not documented anywhere. Why is this 
so? BTW, typehinting value in '(let [value (aget data depth)]' binding 
gives an error Can't type hint a local with a primitive initializer so I 
think since this value considered primitive then I actually can hint the 
fields to be primitive arrays.
Nonetheless, it does not look like that problem is in the field array: 
wrapping aget form with (int) does not help.

вторник, 18 декабря 2012 г., 17:46:14 UTC+4 пользователь David Nolen 
написал:

 I don't think you can type hint a field as a primitive array.

 On Tuesday, December 18, 2012, Vladimir Matveev wrote:

 Hello,

 Consider the following code

 (gen-interface
   :name IntStack
   :methods [[stackPeek [] int]
 [stackPush [int] void]
 [stackPop [] int]
 [stackDepth [] int]])

 (deftype IntStackImpl
   [^{:tag ints :unsynchronized-mutable true} data
^{:tag int :unsynchronized-mutable true} depth]
   IntStack
   (stackPeek [this]
 (aget data depth))
   (stackPush [this value]
 (when (= (inc depth) (alength data))
   (let [data-length (alength data)
 new-data (int-array (* data-length 2))]
 (System/arraycopy data 0 new-data 0 data-length)
 (set! data new-data)))
 (set! depth (inc depth))
 (aset data depth value))
   (stackPop [this]
 (if ( depth 0)
   (let [value (aget data depth)]
 (set! depth (dec depth))
 value)
   (throw (IllegalStateException. Stack is already empty!
   (stackDepth [this]
 depth))

 This is very simple stack implementation over plain java array. It does 
 not compile with the following message:
 CompilerException java.lang.VerifyError: (class: 
 clojure/data/xml/IntStackImpl, method: stackPop signature: ()I) Expecting 
 to find integer on stack

 However, when I replace the body of stackPop with, say, plain zero 
 literal 0, the method seems to pass the compilation, because then I'm 
 getting similar error on stackPush method instead.
 Placing type hints inside stackPop method does not work (in fact, it is 
 even an error to place them, say, on value local binding).

 What am I doing wrong here? How to make the class compile?

 Cheers,
 Vladimir.


  -- 
 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: gen-interface and deftype with types, compilation problem

2012-12-18 Thread Vladimir Matveev
Just tested it, swapping body of stackPop with (aget data depth) has the 
same effect as swapping it with zero, i.e. it fixes the error, 
unfortunately, not in the correct way.

вторник, 18 декабря 2012 г., 22:46:53 UTC+4 пользователь Vladimir Matveev 
написал:

 Well, it is news for me since it is not documented anywhere. Why is this 
 so? BTW, typehinting value in '(let [value (aget data depth)]' binding 
 gives an error Can't type hint a local with a primitive initializer so I 
 think since this value considered primitive then I actually can hint the 
 fields to be primitive arrays.
 Nonetheless, it does not look like that problem is in the field array: 
 wrapping aget form with (int) does not help.

 вторник, 18 декабря 2012 г., 17:46:14 UTC+4 пользователь David Nolen 
 написал:

 I don't think you can type hint a field as a primitive array.

 On Tuesday, December 18, 2012, Vladimir Matveev wrote:

 Hello,

 Consider the following code

 (gen-interface
   :name IntStack
   :methods [[stackPeek [] int]
 [stackPush [int] void]
 [stackPop [] int]
 [stackDepth [] int]])

 (deftype IntStackImpl
   [^{:tag ints :unsynchronized-mutable true} data
^{:tag int :unsynchronized-mutable true} depth]
   IntStack
   (stackPeek [this]
 (aget data depth))
   (stackPush [this value]
 (when (= (inc depth) (alength data))
   (let [data-length (alength data)
 new-data (int-array (* data-length 2))]
 (System/arraycopy data 0 new-data 0 data-length)
 (set! data new-data)))
 (set! depth (inc depth))
 (aset data depth value))
   (stackPop [this]
 (if ( depth 0)
   (let [value (aget data depth)]
 (set! depth (dec depth))
 value)
   (throw (IllegalStateException. Stack is already empty!
   (stackDepth [this]
 depth))

 This is very simple stack implementation over plain java array. It does 
 not compile with the following message:
 CompilerException java.lang.VerifyError: (class: 
 clojure/data/xml/IntStackImpl, method: stackPop signature: ()I) Expecting 
 to find integer on stack

 However, when I replace the body of stackPop with, say, plain zero 
 literal 0, the method seems to pass the compilation, because then I'm 
 getting similar error on stackPush method instead.
 Placing type hints inside stackPop method does not work (in fact, it is 
 even an error to place them, say, on value local binding).

 What am I doing wrong here? How to make the class compile?

 Cheers,
 Vladimir.


  -- 
 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: gen-interface and deftype with types, compilation problem

2012-12-18 Thread Jim - FooBar();

On 18/12/12 18:46, Vladimir Matveev wrote:
Well, it is news for me since it is not documented anywhere. Why is 
this so? 


it is at least mentioned here in an example...look at line 6

http://clojuredocs.org/clojure_core/clojure.core/definterface

Jim


--
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: gen-interface and deftype with types, compilation problem

2012-12-18 Thread David Nolen
Oops, looking over gvec.clj it looks like I'm wrong about type-hinting
fields. However you may need to type-hint the primitive array with a string
instead of the symbol shorthand allowed by Clojure. Try the following:

^{:tag [I :unsynchronized-mutable true}

David


On Tue, Dec 18, 2012 at 1:46 PM, Vladimir Matveev dpx.infin...@gmail.comwrote:

 Well, it is news for me since it is not documented anywhere. Why is this
 so? BTW, typehinting value in '(let [value (aget data depth)]' binding
 gives an error Can't type hint a local with a primitive initializer so I
 think since this value considered primitive then I actually can hint the
 fields to be primitive arrays.
 Nonetheless, it does not look like that problem is in the field array:
 wrapping aget form with (int) does not help.

 вторник, 18 декабря 2012 г., 17:46:14 UTC+4 пользователь David Nolen
 написал:

 I don't think you can type hint a field as a primitive array.

 On Tuesday, December 18, 2012, Vladimir Matveev wrote:

 Hello,

 Consider the following code

 (gen-interface
   :name IntStack
   :methods [[stackPeek [] int]
 [stackPush [int] void]
 [stackPop [] int]
 [stackDepth [] int]])

 (deftype IntStackImpl
   [^{:tag ints :unsynchronized-mutable true} data
^{:tag int :unsynchronized-mutable true} depth]
   IntStack
   (stackPeek [this]
 (aget data depth))
   (stackPush [this value]
 (when (= (inc depth) (alength data))
   (let [data-length (alength data)
 new-data (int-array (* data-length 2))]
 (System/arraycopy data 0 new-data 0 data-length)
 (set! data new-data)))
 (set! depth (inc depth))
 (aset data depth value))
   (stackPop [this]
 (if ( depth 0)
   (let [value (aget data depth)]
 (set! depth (dec depth))
 value)
   (throw (IllegalStateException. Stack is already empty!
   (stackDepth [this]
 depth))

 This is very simple stack implementation over plain java array. It does
 not compile with the following message:
 CompilerException java.lang.VerifyError: (class:
 clojure/data/xml/IntStackImpl, method: stackPop signature: ()I) Expecting
 to find integer on stack

 However, when I replace the body of stackPop with, say, plain zero
 literal 0, the method seems to pass the compilation, because then I'm
 getting similar error on stackPush method instead.
 Placing type hints inside stackPop method does not work (in fact, it is
 even an error to place them, say, on value local binding).

 What am I doing wrong here? How to make the class compile?

 Cheers,
 Vladimir.


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


-- 
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: gen-interface and deftype with types, compilation problem

2012-12-18 Thread Vladimir Matveev
It is definterface example, I have arrays only in deftype.

вторник, 18 декабря 2012 г., 23:16:09 UTC+4 пользователь Jim foo.bar 
написал:

  On 18/12/12 18:46, Vladimir Matveev wrote:
  
 Well, it is news for me since it is not documented anywhere. Why is this 
 so? 


 it is at least mentioned here in an example...look at line 6

 http://clojuredocs.org/clojure_core/clojure.core/definterface

 Jim


 

-- 
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: gen-interface and deftype with types, compilation problem

2012-12-18 Thread Vladimir Matveev
Thanks, but it seems that I have found the source of problem, though I do 
not know why compiler message is so uninformative and misleading.

The following code does not work (fails with CompilerException 
java.lang.VerifyError: (class: test/Test2Impl, method: fail signature: ()V) 
Expecting to find integer on stack):

(definterface Test2
  (^void fail []))

(deftype Test2Impl
  [^{:unsynchronized-mutable true :tag int} x]
  Test2
  (fail [this]
(set! x (dec x

The following code _does_ work:

(definterface Test2
  (^void fail []))

(deftype Test2Impl
  [^{:unsynchronized-mutable true :tag int} x]
  Test2
  (fail [this]
(set! x (int (dec x)

Note that I have wrapped (dec x) into (int). This compiles and works 
flawlessy.

In fact it is fine that there is an error here because (dec) is defined 
only on objects and longs, so supplying int to it does not work as 
intended. Even my first example in this message will work if you replace 
:tag int with :tag long.
However, error message is absolutely misleading and seems to be a 
consequence of an error in the compiler...



вторник, 18 декабря 2012 г., 23:18:28 UTC+4 пользователь David Nolen 
написал:

 Oops, looking over gvec.clj it looks like I'm wrong about type-hinting 
 fields. However you may need to type-hint the primitive array with a string 
 instead of the symbol shorthand allowed by Clojure. Try the following:

 ^{:tag [I :unsynchronized-mutable true}

 David


 On Tue, Dec 18, 2012 at 1:46 PM, Vladimir Matveev 
 dpx.in...@gmail.comjavascript:
  wrote:

 Well, it is news for me since it is not documented anywhere. Why is this 
 so? BTW, typehinting value in '(let [value (aget data depth)]' binding 
 gives an error Can't type hint a local with a primitive initializer so I 
 think since this value considered primitive then I actually can hint the 
 fields to be primitive arrays.
 Nonetheless, it does not look like that problem is in the field array: 
 wrapping aget form with (int) does not help.

 вторник, 18 декабря 2012 г., 17:46:14 UTC+4 пользователь David Nolen 
 написал:

 I don't think you can type hint a field as a primitive array.

 On Tuesday, December 18, 2012, Vladimir Matveev wrote:

 Hello,

 Consider the following code

 (gen-interface
   :name IntStack
   :methods [[stackPeek [] int]
 [stackPush [int] void]
 [stackPop [] int]
 [stackDepth [] int]])

 (deftype IntStackImpl
   [^{:tag ints :unsynchronized-mutable true} data
^{:tag int :unsynchronized-mutable true} depth]
   IntStack
   (stackPeek [this]
 (aget data depth))
   (stackPush [this value]
 (when (= (inc depth) (alength data))
   (let [data-length (alength data)
 new-data (int-array (* data-length 2))]
 (System/arraycopy data 0 new-data 0 data-length)
 (set! data new-data)))
 (set! depth (inc depth))
 (aset data depth value))
   (stackPop [this]
 (if ( depth 0)
   (let [value (aget data depth)]
 (set! depth (dec depth))
 value)
   (throw (IllegalStateException. Stack is already empty!
   (stackDepth [this]
 depth))

 This is very simple stack implementation over plain java array. It does 
 not compile with the following message:
 CompilerException java.lang.VerifyError: (class: 
 clojure/data/xml/IntStackImpl, method: stackPop signature: ()I) Expecting 
 to find integer on stack

 However, when I replace the body of stackPop with, say, plain zero 
 literal 0, the method seems to pass the compilation, because then I'm 
 getting similar error on stackPush method instead.
 Placing type hints inside stackPop method does not work (in fact, it is 
 even an error to place them, say, on value local binding).

 What am I doing wrong here? How to make the class compile?

 Cheers,
 Vladimir.


  -- 
 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+unsubscribe@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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 clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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 

Re: gen-interface and deftype with types, compilation problem

2012-12-18 Thread David Nolen
Ah right, sorry to mislead.


On Tue, Dec 18, 2012 at 2:26 PM, Vladimir Matveev dpx.infin...@gmail.comwrote:

 Thanks, but it seems that I have found the source of problem, though I do
 not know why compiler message is so uninformative and misleading.

 The following code does not work (fails with CompilerException
 java.lang.VerifyError: (class: test/Test2Impl, method: fail signature: ()V)
 Expecting to find integer on stack):

 (definterface Test2
   (^void fail []))

 (deftype Test2Impl
   [^{:unsynchronized-mutable true :tag int} x]
   Test2
   (fail [this]
 (set! x (dec x

 The following code _does_ work:

 (definterface Test2
   (^void fail []))

 (deftype Test2Impl
   [^{:unsynchronized-mutable true :tag int} x]
   Test2
   (fail [this]
 (set! x (int (dec x)

 Note that I have wrapped (dec x) into (int). This compiles and works
 flawlessy.

 In fact it is fine that there is an error here because (dec) is defined
 only on objects and longs, so supplying int to it does not work as
 intended. Even my first example in this message will work if you replace
 :tag int with :tag long.
 However, error message is absolutely misleading and seems to be a
 consequence of an error in the compiler...



 вторник, 18 декабря 2012 г., 23:18:28 UTC+4 пользователь David Nolen
 написал:

 Oops, looking over gvec.clj it looks like I'm wrong about type-hinting
 fields. However you may need to type-hint the primitive array with a string
 instead of the symbol shorthand allowed by Clojure. Try the following:

 ^{:tag [I :unsynchronized-mutable true}

 David


 On Tue, Dec 18, 2012 at 1:46 PM, Vladimir Matveev dpx.in...@gmail.comwrote:

 Well, it is news for me since it is not documented anywhere. Why is this
 so? BTW, typehinting value in '(let [value (aget data depth)]' binding
 gives an error Can't type hint a local with a primitive initializer so I
 think since this value considered primitive then I actually can hint the
 fields to be primitive arrays.
 Nonetheless, it does not look like that problem is in the field array:
 wrapping aget form with (int) does not help.

 вторник, 18 декабря 2012 г., 17:46:14 UTC+4 пользователь David Nolen
 написал:

 I don't think you can type hint a field as a primitive array.

 On Tuesday, December 18, 2012, Vladimir Matveev wrote:

 Hello,

 Consider the following code

 (gen-interface
   :name IntStack
   :methods [[stackPeek [] int]
 [stackPush [int] void]
 [stackPop [] int]
 [stackDepth [] int]])

 (deftype IntStackImpl
   [^{:tag ints :unsynchronized-mutable true} data
^{:tag int :unsynchronized-mutable true} depth]
   IntStack
   (stackPeek [this]
 (aget data depth))
   (stackPush [this value]
 (when (= (inc depth) (alength data))
   (let [data-length (alength data)
 new-data (int-array (* data-length 2))]
 (System/arraycopy data 0 new-data 0 data-length)
 (set! data new-data)))
 (set! depth (inc depth))
 (aset data depth value))
   (stackPop [this]
 (if ( depth 0)
   (let [value (aget data depth)]
 (set! depth (dec depth))
 value)
   (throw (IllegalStateException. Stack is already empty!
   (stackDepth [this]
 depth))

 This is very simple stack implementation over plain java array. It
 does not compile with the following message:
 CompilerException java.lang.VerifyError: (class:
 clojure/data/xml/IntStackImpl, method: stackPop signature: ()I) Expecting
 to find integer on stack

 However, when I replace the body of stackPop with, say, plain zero
 literal 0, the method seems to pass the compilation, because then I'm
 getting similar error on stackPush method instead.
 Placing type hints inside stackPop method does not work (in fact, it
 is even an error to place them, say, on value local binding).

 What am I doing wrong here? How to make the class compile?

 Cheers,
 Vladimir.


  --
 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+unsubscribe@**googlegrou**ps.com
 For more options, visit this group at
 http://groups.google.com/**group**/clojure?hl=enhttp://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 clo...@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+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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 

Re: gen-interface and deftype with types, compilation problem

2012-12-18 Thread Vladimir Matveev
No, you shouldn't worry about that) In fact it was useful to me to learn 
that Clojure does not support array type hints everywhere. It may be 
possible that I will have to change some of my code because of this.

вторник, 18 декабря 2012 г., 23:30:39 UTC+4 пользователь David Nolen 
написал:

 Ah right, sorry to mislead.


 On Tue, Dec 18, 2012 at 2:26 PM, Vladimir Matveev 
 dpx.in...@gmail.comjavascript:
  wrote:

 Thanks, but it seems that I have found the source of problem, though I do 
 not know why compiler message is so uninformative and misleading.

 The following code does not work (fails with CompilerException 
 java.lang.VerifyError: (class: test/Test2Impl, method: fail signature: ()V) 
 Expecting to find integer on stack):

 (definterface Test2
   (^void fail []))

 (deftype Test2Impl
   [^{:unsynchronized-mutable true :tag int} x]
   Test2
   (fail [this]
 (set! x (dec x

 The following code _does_ work:

 (definterface Test2
   (^void fail []))

 (deftype Test2Impl
   [^{:unsynchronized-mutable true :tag int} x]
   Test2
   (fail [this]
 (set! x (int (dec x)

 Note that I have wrapped (dec x) into (int). This compiles and works 
 flawlessy.

 In fact it is fine that there is an error here because (dec) is defined 
 only on objects and longs, so supplying int to it does not work as 
 intended. Even my first example in this message will work if you replace 
 :tag int with :tag long.
 However, error message is absolutely misleading and seems to be a 
 consequence of an error in the compiler...



 вторник, 18 декабря 2012 г., 23:18:28 UTC+4 пользователь David Nolen 
 написал:

 Oops, looking over gvec.clj it looks like I'm wrong about type-hinting 
 fields. However you may need to type-hint the primitive array with a string 
 instead of the symbol shorthand allowed by Clojure. Try the following:

 ^{:tag [I :unsynchronized-mutable true}

 David


 On Tue, Dec 18, 2012 at 1:46 PM, Vladimir Matveev 
 dpx.in...@gmail.comwrote:

 Well, it is news for me since it is not documented anywhere. Why is 
 this so? BTW, typehinting value in '(let [value (aget data depth)]' 
 binding 
 gives an error Can't type hint a local with a primitive initializer so I 
 think since this value considered primitive then I actually can hint the 
 fields to be primitive arrays.
 Nonetheless, it does not look like that problem is in the field array: 
 wrapping aget form with (int) does not help.

 вторник, 18 декабря 2012 г., 17:46:14 UTC+4 пользователь David Nolen 
 написал:
  
 I don't think you can type hint a field as a primitive array.

 On Tuesday, December 18, 2012, Vladimir Matveev wrote:

 Hello,

 Consider the following code

 (gen-interface
   :name IntStack
   :methods [[stackPeek [] int]
 [stackPush [int] void]
 [stackPop [] int]
 [stackDepth [] int]])

 (deftype IntStackImpl
   [^{:tag ints :unsynchronized-mutable true} data
^{:tag int :unsynchronized-mutable true} depth]
   IntStack
   (stackPeek [this]
 (aget data depth))
   (stackPush [this value]
 (when (= (inc depth) (alength data))
   (let [data-length (alength data)
 new-data (int-array (* data-length 2))]
 (System/arraycopy data 0 new-data 0 data-length)
 (set! data new-data)))
 (set! depth (inc depth))
 (aset data depth value))
   (stackPop [this]
 (if ( depth 0)
   (let [value (aget data depth)]
 (set! depth (dec depth))
 value)
   (throw (IllegalStateException. Stack is already empty!
   (stackDepth [this]
 depth))

 This is very simple stack implementation over plain java array. It 
 does not compile with the following message:
 CompilerException java.lang.VerifyError: (class: 
 clojure/data/xml/IntStackImpl, method: stackPop signature: ()I) 
 Expecting 
 to find integer on stack

 However, when I replace the body of stackPop with, say, plain zero 
 literal 0, the method seems to pass the compilation, because then I'm 
 getting similar error on stackPush method instead.
 Placing type hints inside stackPop method does not work (in fact, it 
 is even an error to place them, say, on value local binding).

 What am I doing wrong here? How to make the class compile?

 Cheers,
 Vladimir.


  -- 
 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+unsubscribe@**googlegrou**ps.com
 For more options, visit this group at
 http://groups.google.com/**group**/clojure?hl=enhttp://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 clo...@googlegroups.com

 Note that posts from new members are moderated - please be patient with 
 your first post.
 To 

[ANN] lein-stencil 0.1.0

2012-12-18 Thread Matthew O. Smith
*It is not in clojars yet as I wanted people to have the opportunity to 
give feedback before making it live*
*
*
*https://github.com/m0smith/lein-stencil
*
*
*

A plugin that can be used to copy files from multiple source directories to 
a target directory while maintaining the sub-directories  Also, each file 
will be transformed using stencil https://github.com/davidsantiago/stencil. 
The map that is passed to stencil contains a combination of:

   - The project map
   - The system properties (with .prop added to the name )
   - Additional values (currently only :timestamp)
   - Values set in the project.clj using :stencil :extra-values

-- 
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: ClojureCLR errors on Mono Linux

2012-12-18 Thread dmiller
Shantanu,

I created an Ubuntu 12.10 VM running in VirtualBox on my Win7 PC.  
I installed Mono 2.10.8.
I downloaded the zip for ClojureCLR 1.4.0 Debug-4.0.
Extracted.
 mono Clojure.Main.exe  
Runs with no problem.

 mono Clojure.Compile.exe test.junk
Runs with no problem.

From the errors you report, I can only guess that some pre-1.4 DLLs are 
being found somehow and loaded.  
For example,  the field clojure.lang.RT.OutVar did not exist in ClojureCLR 
1.3.

I do not know how else to help.

-David
 


On Saturday, December 15, 2012 10:17:59 PM UTC-6, Shantanu Kumar wrote:

 This is when using ClojureCLR 1.4.0 Debug-4.0 version.

 Shantanu

 On Sunday, 16 December 2012 09:45:21 UTC+5:30, Shantanu Kumar wrote:

 Hi,

 I noticed the following ClojureCLR errors using Mono 2.10 on Ubuntu 12.04 
 (they do not happen on Windows using either .NET or Mono):

 1. when running Clojure.Compile.exe:

 Exception: System.MissingFieldException: Field 'clojure.lang.RT.OutVar' 
 not found.

 2. when using Clojure.Main.exe:

 Exception: System.TypeLoadException: Could not load type 
 'Clojure.CljMain' from assembly 'Clojure.Main, Version=1.0.0.0, 
 Culture=neutral, PublicKeyToken=null'.

 It would be great if anybody can let me know what's going on.

 Shantanu



-- 
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: clojure-contrib migrations

2012-12-18 Thread Christopher Meiklejohn
Hi Andy, 

Thanks for the response.  I've signed the CA and mailed it off.  I'm also 
hoping to keep this under the clojure.* namespace.  Would the process moving 
forward be to create a separate repo containing just the components I'll be 
working on moving forward to break it out of the large clojure.contrib package?

- Chris 

-- 
Christopher Meiklejohn


On Tuesday, December 18, 2012 at 1:56 AM, Andy Fingerhut wrote:

 If you want it to remain a Clojure contrib library with a clojure.* 
 namespace, you'll need to sign a Clojure CA to be able to make contributions 
 to it.
 
 http://clojure.org/contributing
 
 If you want to make it a project on Github or somewhere else, you would 
 probably need to keep the existing license, which I'm guessing is the Eclipse 
 public license.
 
 Andy
 
 On Dec 17, 2012, at 3:44 PM, Christopher Meiklejohn wrote:
 
  Hi there,
  
  I'm inquiring regarding the clojure-contrib migration process. I'd like to 
  offer to step up and maintain clojure-contrib.graph, mainly starting with 
  converting the defstructs over to defrecords so I can start playing around 
  in ClojureScript with this library. What's the process moving forward?
  
  - Chris
 
 -- 
 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 
 (mailto: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 
 (mailto: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: clojure-contrib migrations

2012-12-18 Thread Andy Fingerhut
I believe Sean Corfield has helped several of the older contrib libraries get 
migrated to the newer ones, and either knows the process better, or knows who 
to ask.  Sean?

Andy

On Dec 18, 2012, at 1:29 PM, Christopher Meiklejohn wrote:

 Hi Andy, 
 
 Thanks for the response.  I've signed the CA and mailed it off.  I'm also 
 hoping to keep this under the clojure.* namespace.  Would the process moving 
 forward be to create a separate repo containing just the components I'll be 
 working on moving forward to break it out of the large clojure.contrib 
 package?
 
 - Chris 
 
 -- 
 Christopher Meiklejohn
 
 
 On Tuesday, December 18, 2012 at 1:56 AM, Andy Fingerhut wrote:
 
 If you want it to remain a Clojure contrib library with a clojure.* 
 namespace, you'll need to sign a Clojure CA to be able to make contributions 
 to it.
 
 http://clojure.org/contributing
 
 If you want to make it a project on Github or somewhere else, you would 
 probably need to keep the existing license, which I'm guessing is the 
 Eclipse public license.
 
 Andy
 
 On Dec 17, 2012, at 3:44 PM, Christopher Meiklejohn wrote:
 
 Hi there,
 
 I'm inquiring regarding the clojure-contrib migration process. I'd like to 
 offer to step up and maintain clojure-contrib.graph, mainly starting with 
 converting the defstructs over to defrecords so I can start playing around 
 in ClojureScript with this library. What's the process moving forward?
 
 - Chris

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


[ANN] CJD 0.1.0, a documentation technology for Clojure programs

2012-12-18 Thread greenh
 

I'd like to announce the availability of CJD 0.1.0.

CJD is a technology for documenting Clojure programs which I devised to 
satisfy my idiosyncratic documentation-related propensities. It's mostly 
complete, so I thought I'd share it with the community just in case there 
are any fellow travelers with similar inclinations.

CJD makes use of structured comments embedded in Clojure source code in a 
fashion inspired by Javadoc, to which it bears a superficial similarity. 
Like Javadoc, CJD comments support a simple form of markup that not only 
can add formatting detail but also provides a modicum of metadata that 
describes what's being documented. This allows CJD's processing facility to 
extract the documentation content from collections of Clojure namespaces 
and convert it into trees of consistently-formatted HTML documents. Thus, 
CJD comments represent a much more expressive alternative or supplement to 
docstrings.

Ground zero for CJD is its home on GitHub https://github.com/greenh/CJD, 
which includes a FAQ http://greenh.github.com/CJD/doc/FAQ.html that 
provides a reasonably concise overview and rationale for CJD, and a user's 
guide http://greenh.github.com/CJD/doc/User.html that represents a 
first-pass attempt at describing the gory details.

Needless to say, CJD uses CJD for its own program documentation. You can 
see the output of a representative namespace in your choice of 
light-background http://greenh.github.com/CJD/doc/light/cjd.exome.htmland 
dark-background http://greenh.github.com/CJD/doc/dark/cjd.exome.html (my 
favorite!) renderings, and the source from which it was generated 
herehttps://github.com/greenh/CJD/blob/master/src/clojure/cjd/exome.clj
.

Here's a few additional points about CJD. You'll get all these and more 
from the links above, but just in case your interest hasn't already been 
piqued… 

   - Documentation comments generally consist largely of ordinary text, so 
   they're easily readable in source form. Required additions for markup and 
   escape sequences tend to be fairly minimal. 
   - Markup is structured in terms of syntactically valid Clojure forms, 
   allowing Clojure-aware editors to be used to good advantage.
   - A recursively-defined documentation syntax allows Clojure's 
   recursively-defined data structures and functions to be documented to 
   whatever depth is needful.
   - Structure-aware support for documenting core Clojure artifacts (vars, 
   functions, macros, protocols, records, etc.) is available right out of the 
   box. CJD also provides facilities for extensions that allow user-defined 
   artifacts to be compatibly documented. 
   - Recognizing the value of richly-linked documentation, CJD tries to 
   make it easy to link to other artifacts' documentation, both within and 
   external to a project.
   - What does and doesn't get documented, and to what extent, is entirely 
   at the developer's discretion. No pressure, no complaints—CJD happily 
   accepts whatever scraps of documentation you throw its way.

And, it's available from Clojars https://clojars.org/cjd, it includes a 
plugin that works with both the 1.x and 2.x versions Leiningen, it runs 
from the REPL, and there's even support for all you command-line 
enthusiasts out there. 

Enjoy!

--- Howard


-- 
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: [ANN] CJD 0.1.0, a documentation technology for Clojure programs

2012-12-18 Thread Bronsa
Awesome!

2012/12/18 greenh hhgr...@ieee.org

 I'd like to announce the availability of CJD 0.1.0.

 CJD is a technology for documenting Clojure programs which I devised to
 satisfy my idiosyncratic documentation-related propensities. It's mostly
 complete, so I thought I'd share it with the community just in case there
 are any fellow travelers with similar inclinations.

 CJD makes use of structured comments embedded in Clojure source code in a
 fashion inspired by Javadoc, to which it bears a superficial similarity.
 Like Javadoc, CJD comments support a simple form of markup that not only
 can add formatting detail but also provides a modicum of metadata that
 describes what's being documented. This allows CJD's processing facility to
 extract the documentation content from collections of Clojure namespaces
 and convert it into trees of consistently-formatted HTML documents. Thus,
 CJD comments represent a much more expressive alternative or supplement to
 docstrings.

 Ground zero for CJD is its home on GitHub https://github.com/greenh/CJD,
 which includes a FAQ http://greenh.github.com/CJD/doc/FAQ.html that
 provides a reasonably concise overview and rationale for CJD, and a user's
 guide http://greenh.github.com/CJD/doc/User.html that represents a
 first-pass attempt at describing the gory details.

 Needless to say, CJD uses CJD for its own program documentation. You can
 see the output of a representative namespace in your choice of
 light-background http://greenh.github.com/CJD/doc/light/cjd.exome.htmland
 dark-background http://greenh.github.com/CJD/doc/dark/cjd.exome.html(my 
 favorite!) renderings, and the source from which it was generated
 here https://github.com/greenh/CJD/blob/master/src/clojure/cjd/exome.clj
 .

 Here's a few additional points about CJD. You'll get all these and more
 from the links above, but just in case your interest hasn't already been
 piqued…

- Documentation comments generally consist largely of ordinary text,
so they're easily readable in source form. Required additions for markup
and escape sequences tend to be fairly minimal.
- Markup is structured in terms of syntactically valid Clojure forms,
allowing Clojure-aware editors to be used to good advantage.
- A recursively-defined documentation syntax allows Clojure's
recursively-defined data structures and functions to be documented to
whatever depth is needful.
- Structure-aware support for documenting core Clojure artifacts
(vars, functions, macros, protocols, records, etc.) is available right out
of the box. CJD also provides facilities for extensions that allow
user-defined artifacts to be compatibly documented.
- Recognizing the value of richly-linked documentation, CJD tries to
make it easy to link to other artifacts' documentation, both within and
external to a project.
- What does and doesn't get documented, and to what extent, is
entirely at the developer's discretion. No pressure, no complaints—CJD
happily accepts whatever scraps of documentation you throw its way.

 And, it's available from Clojars https://clojars.org/cjd, it includes a
 plugin that works with both the 1.x and 2.x versions Leiningen, it runs
 from the REPL, and there's even support for all you command-line
 enthusiasts out there.

 Enjoy!

 --- Howard


  --
 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: [ANN] CJD 0.1.0, a documentation technology for Clojure programs

2012-12-18 Thread Frank Siebenlist
It sure looks very nice!

… but doesn't your use of #_ preclude us from getting that doc-info in the 
running system?

In other words, how would you enhance the doc facility in the repl to pickup 
your doc-meta-data in real-time?

-FrankS.


On Dec 18, 2012, at 11:10 PM, greenh hhgr...@ieee.org wrote:

 I'd like to announce the availability of CJD 0.1.0.
 
 CJD is a technology for documenting Clojure programs which I devised to 
 satisfy my idiosyncratic documentation-related propensities. It's mostly 
 complete, so I thought I'd share it with the community just in case there are 
 any fellow travelers with similar inclinations.
 
 CJD makes use of structured comments embedded in Clojure source code in a 
 fashion inspired by Javadoc, to which it bears a superficial similarity. Like 
 Javadoc, CJD comments support a simple form of markup that not only can add 
 formatting detail but also provides a modicum of metadata that describes 
 what's being documented. This allows CJD's processing facility to extract the 
 documentation content from collections of Clojure namespaces and convert it 
 into trees of consistently-formatted HTML documents. Thus, CJD comments 
 represent a much more expressive alternative or supplement to docstrings.
 
 Ground zero for CJD is its home on GitHub, which includes a FAQ that provides 
 a reasonably concise overview and rationale for CJD, and a user's guide that 
 represents a first-pass attempt at describing the gory details.
 
 Needless to say, CJD uses CJD for its own program documentation. You can see 
 the output of a representative namespace in your choice of light-background 
 and dark-background (my favorite!) renderings, and the source from which it 
 was generated here.
 
 Here's a few additional points about CJD. You'll get all these and more from 
 the links above, but just in case your interest hasn't already been piqued…
 
   • Documentation comments generally consist largely of ordinary text, so 
 they're easily readable in source form. Required additions for markup and 
 escape sequences tend to be fairly minimal.
   • Markup is structured in terms of syntactically valid Clojure forms, 
 allowing Clojure-aware editors to be used to good advantage.
   • A recursively-defined documentation syntax allows Clojure's 
 recursively-defined data structures and functions to be documented to 
 whatever depth is needful.
   • Structure-aware support for documenting core Clojure artifacts (vars, 
 functions, macros, protocols, records, etc.) is available right out of the 
 box. CJD also provides facilities for extensions that allow user-defined 
 artifacts to be compatibly documented.
   • Recognizing the value of richly-linked documentation, CJD tries to 
 make it easy to link to other artifacts' documentation, both within and 
 external to a project.
   • What does and doesn't get documented, and to what extent, is entirely 
 at the developer's discretion. No pressure, no complaints—CJD happily accepts 
 whatever scraps of documentation you throw its way.
 And, it's available from Clojars, it includes a plugin that works with both 
 the 1.x and 2.x versions Leiningen, it runs from the REPL, and there's even 
 support for all you command-line enthusiasts out there.
 
 Enjoy!
 
 --- Howard
 
 
 
 
 -- 
 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: Little namespace question

2012-12-18 Thread Alan Shaw
From yesterday:

(defmacro eval-in
  Eval a Clojure form in a different namespace and switch back to current
namespace.

   Args:
   code - Clojure form as string
   ns - Target namespace as string
  [code ns]
  `(do
 (in-ns '~(symbol ns))
 (let [ret# (eval '~(read-string code))]
   (in-ns '~(ns-name *ns*))
   ret#)))



user= (def generator (X 400 400))
#'user/generator
user= (def image (eval-in generator clevolution.version.version0-1-1))
CompilerException java.lang.ClassCastException: clojure.lang.Symbol cannot
be cast to java.lang.String, compiling:(NO_SOURCE_PATH:1)

user= (def image (eval-in (X 400 400)
clevolution.version.version0-1-1))
#'user/image

So it's OK to pass the explicit string but not the symbol. What am I not
getting here?

-A


On Tue, Dec 18, 2012 at 12:48 AM, Alan Shaw noden...@gmail.com wrote:

 Now I do, and the macro worked!
 I believe I have a problem using the macro from a function, but leaving
 that for tomorrow.

 Thanks BG!

 -A



 On Tue, Dec 18, 2012 at 12:19 AM, Baishampayan Ghose b.gh...@gmail.comwrote:

 Do you have target ns clevolution.version.version0-1-1 required?

 -BG

 On Tue, Dec 18, 2012 at 1:38 PM, Alan Shaw noden...@gmail.com wrote:
  BG,
  The macro doesn't seem to do the trick. The function X is interned in
 the
  target namespace, but:
 
  user= (def image (eval-in (X 400 400)
  clevolution.version.version0-1-1))
  CompilerException java.lang.RuntimeException: Unable to resolve symbol:
 X in
  this context, compiling:(NO_SOURCE_PATH:1)
 
 
  On Mon, Dec 17, 2012 at 11:53 PM, Alan Shaw noden...@gmail.com wrote:
 
  Oh yes, the something.something is fixed so I can just prepend it,
 thanks.
  (Hadn't noticed your macro takes the ns as a string!)
 
  -A
 
 
 
  On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose 
 b.gh...@gmail.com
  wrote:
 
  Alan,
 
  What you're asking for is to derive the ns clojure.core given only
  core. Not sure if that's possible.
 
  The namespace constitutes the whole dotted structure and not just the
  last component, I am afraid.
 
  If the actual ns is something.something.version-0-1-1, then you need
  the string something.something.version-0-1-1 and not just
  version-0-1-1 [unless of course you have some other way of deriving
  it from info that's embedded in _your_ code or structure thereof].
 
 
  -BG
 
  On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw noden...@gmail.com
 wrote:
   Thanks BG, I'm trying that.
   But I don't think it addresses how to get from the string
   version-0-1-1 to
   the namespace something.something.version-0-1-1. How can I do that?
  
   -A
  
  
  
   On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose
   b.gh...@gmail.com
   wrote:
  
   Alan,
  
   Something like this might work for you -
  
   (defmacro eval-in
 Eval a Clojure form in a different namespace and switch back to
   current namespace.
  
  Args:
  code - Clojure form as string
  ns - Target namespace as string
 [code ns]
 `(do
(in-ns '~(symbol ns))
(let [ret# (eval '~(read-string code))]
  (in-ns '~(ns-name *ns*))
  ret#)))
  
   Warning - I haven't really tested this code.
  
   -BG
  
   On Tue, Dec 18, 2012 at 12:37 PM, Alan Shaw noden...@gmail.com
   wrote:
Thanks, Las!
   
Ok say I have a file in which there is string such as
   
(- (atan (bw-noise 902 2 0.7604615575402431 400 400))
(read-image-from-file
\images/Dawn_on_Callipygea.png\))
   
and another
   
version-0-0-1
   
and I have a namespace version-0-0-1 into which functions named
 atan
etc.
are all :referred.  I want to evaluate the expression in that
particular
context, and not remain there when I'm done.
   
-A
   
   
   
On Mon, Dec 17, 2012 at 11:00 PM, László Török 
 ltoro...@gmail.com
wrote:
   
ah, sorry, it's a bit early for me
   
(in-ns (ns-name user-ns))
   
if you could post a simple example for the second part of your
question
I
maybe able to help.
   
Las
   
Alan Shaw 2012. december 18., kedd napon a következőt írta:
   
Ah no, that puts me in a new user-ns namespace! Not what I
 wanted!
   
   
On Mon, Dec 17, 2012 at 10:51 PM, László Török
ltoro...@gmail.com
wrote:
   
Try (in-ns 'user-ns)
   
Las
   
On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com
 wrote:
   
user= *ns*
#Namespace user
user= (def user-ns *ns*)
#'user/user-ns
user= user-ns
#Namespace user
user= (in-ns user-ns)
ClassCastException clojure.lang.Namespace cannot be cast to
clojure.lang.Symbol  clojure.lang.RT$1.invoke (RT.java:226)
   
It appears I'm not understanding how namespaces are
 represented.
   
Also, is it just wrong of me to want to remember a namespace
 I
was
working in and try to go back to it later?
   
The slightly larger context is: I'm saving an s-expression
 with
unqualified names in it into a file as a string. Also 

Re: Who's using Clojure?

2012-12-18 Thread kinleyd
@Christopher Redinger: Thanks, that's a nice page. Bookmarked and will 
visit from time to time to assess the state of Clojure adoption.

-- 
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: Little namespace question

2012-12-18 Thread juan.facorro
The macro sees it arguments as *symbols* and does not resolve to the 
corresponding *var* until evaluation, so the value for the local *code* var 
in the macro is actually the *symbol** generator.*

The *eval-in* macro uses the *read-string* function to evaluate the code 
you provide, this function expects a string but it's getting the* 
**symbol**generator
* instead, since that's what the macro got as a first argument.

Here's a modified version of the *eval-in* macro, that delays the 
evaluation of the call to *read-string*:

(require '[clojure.pprint :as p])

(defmacro eval-in
  [code ns]
  `(do
 (in-ns '~(symbol ns))
 (let [ret# (eval *(read-string ~code)*)] ; This line was changed
   (in-ns '~(ns-name *ns*))
   ret#)))

(p/pprint (macroexpand '(eval-in generator another-ns)))

Here's the output:

(do
 (clojure.core/in-ns 'another-ns)
 (clojure.core/let
  [ret__1879__auto__
   (clojure.core/eval *(clojure.core/read-string generator)*)] ; The 
unquoting of code resulted in the symbol generator
  (clojure.core/in-ns 'test-eval)
  ret__1879__auto__))

If you want to use a var as an argument for the code, you could resolve the 
var before changing namespaces, delaying the read-string until the forms 
evaluation:

(ns another-ns)

(defn X [w h] [w h])
;---
(ns this-ns
  (:require [clojure.pprint :as p]))

(defmacro eval-in
  [code ns]
  `(let [code# ~code]
 (in-ns '~(symbol ns))
  (let [ret# (eval (read-string code#))]
   (in-ns '~(ns-name *ns*))
   ret#)))

(def generator (X 300 300))
(p/pprint (eval-in generator another-ns))

Hope it helps,

Juan


On Wednesday, December 19, 2012 1:13:00 AM UTC-3, nodename wrote:

 From yesterday:

 (defmacro eval-in
   Eval a Clojure form in a different namespace and switch back to current 
 namespace.

Args:
code - Clojure form as string
ns - Target namespace as string
   [code ns]
   `(do
  (in-ns '~(symbol ns))
  (let [ret# (eval '~(read-string code))]
(in-ns '~(ns-name *ns*))
ret#)))



 user= (def generator (X 400 400))
 #'user/generator
 user= (def image (eval-in generator clevolution.version.version0-1-1))
 CompilerException java.lang.ClassCastException: clojure.lang.Symbol cannot 
 be cast to java.lang.String, compiling:(NO_SOURCE_PATH:1)

 user= (def image (eval-in (X 400 400) 
 clevolution.version.version0-1-1))
 #'user/image

 So it's OK to pass the explicit string but not the symbol. What am I not 
 getting here?

 -A


 On Tue, Dec 18, 2012 at 12:48 AM, Alan Shaw node...@gmail.comjavascript:
  wrote:

 Now I do, and the macro worked!
 I believe I have a problem using the macro from a function, but leaving 
 that for tomorrow.

 Thanks BG!

 -A



 On Tue, Dec 18, 2012 at 12:19 AM, Baishampayan Ghose 
 b.g...@gmail.comjavascript:
  wrote:

 Do you have target ns clevolution.version.version0-1-1 required?

 -BG

 On Tue, Dec 18, 2012 at 1:38 PM, Alan Shaw node...@gmail.comjavascript: 
 wrote:
  BG,
  The macro doesn't seem to do the trick. The function X is interned in 
 the
  target namespace, but:
 
  user= (def image (eval-in (X 400 400)
  clevolution.version.version0-1-1))
  CompilerException java.lang.RuntimeException: Unable to resolve 
 symbol: X in
  this context, compiling:(NO_SOURCE_PATH:1)
 
 
  On Mon, Dec 17, 2012 at 11:53 PM, Alan Shaw 
  node...@gmail.comjavascript: 
 wrote:
 
  Oh yes, the something.something is fixed so I can just prepend it, 
 thanks.
  (Hadn't noticed your macro takes the ns as a string!)
 
  -A
 
 
 
  On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose 
 b.g...@gmail.com javascript:
  wrote:
 
  Alan,
 
  What you're asking for is to derive the ns clojure.core given only
  core. Not sure if that's possible.
 
  The namespace constitutes the whole dotted structure and not just the
  last component, I am afraid.
 
  If the actual ns is something.something.version-0-1-1, then you need
  the string something.something.version-0-1-1 and not just
  version-0-1-1 [unless of course you have some other way of deriving
  it from info that's embedded in _your_ code or structure thereof].
 
 
  -BG
 
  On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw 
  node...@gmail.comjavascript: 
 wrote:
   Thanks BG, I'm trying that.
   But I don't think it addresses how to get from the string
   version-0-1-1 to
   the namespace something.something.version-0-1-1. How can I do that?
  
   -A
  
  
  
   On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose
   b.g...@gmail.com javascript:
   wrote:
  
   Alan,
  
   Something like this might work for you -
  
   (defmacro eval-in
 Eval a Clojure form in a different namespace and switch back to
   current namespace.
  
  Args:
  code - Clojure form as string
  ns - Target namespace as string
 [code ns]
 `(do
(in-ns '~(symbol ns))
(let [ret# (eval '~(read-string code))]
  (in-ns '~(ns-name *ns*))
  ret#)))
  
   Warning - I haven't really tested this code.
  
 

Re: Little namespace question

2012-12-18 Thread Alan Shaw
Thanks very much Juan, that's some good study material for me.

-A
 On Dec 18, 2012 10:45 PM, juan.facorro juan.faco...@gmail.com wrote:

 The macro sees it arguments as *symbols* and does not resolve to the
 corresponding *var* until evaluation, so the value for the local *code* var
 in the macro is actually the *symbol** generator.*

 The *eval-in* macro uses the *read-string* function to evaluate the code
 you provide, this function expects a string but it's getting the* **symbol
 ** generator* instead, since that's what the macro got as a first
 argument.

 Here's a modified version of the *eval-in* macro, that delays the
 evaluation of the call to *read-string*:

 (require '[clojure.pprint :as p])

 (defmacro eval-in
   [code ns]
   `(do
  (in-ns '~(symbol ns))
  (let [ret# (eval *(read-string ~code)*)] ; This line was changed
(in-ns '~(ns-name *ns*))
ret#)))

 (p/pprint (macroexpand '(eval-in generator another-ns)))

 Here's the output:

 (do
  (clojure.core/in-ns 'another-ns)
  (clojure.core/let
   [ret__1879__auto__
(clojure.core/eval *(clojure.core/read-string generator)*)] ; The
 unquoting of code resulted in the symbol generator
   (clojure.core/in-ns 'test-eval)
   ret__1879__auto__))

 If you want to use a var as an argument for the code, you could resolve
 the var before changing namespaces, delaying the read-string until the
 forms evaluation:

 (ns another-ns)

 (defn X [w h] [w h])
 ;---
 (ns this-ns
   (:require [clojure.pprint :as p]))

 (defmacro eval-in
   [code ns]
   `(let [code# ~code]
  (in-ns '~(symbol ns))
   (let [ret# (eval (read-string code#))]
(in-ns '~(ns-name *ns*))
ret#)))

 (def generator (X 300 300))
 (p/pprint (eval-in generator another-ns))

 Hope it helps,

 Juan


 On Wednesday, December 19, 2012 1:13:00 AM UTC-3, nodename wrote:

 From yesterday:

 (defmacro eval-in
   Eval a Clojure form in a different namespace and switch back to
 current namespace.

Args:
code - Clojure form as string
ns - Target namespace as string
   [code ns]
   `(do
  (in-ns '~(symbol ns))
  (let [ret# (eval '~(read-string code))]
(in-ns '~(ns-name *ns*))
ret#)))



 user= (def generator (X 400 400))
 #'user/generator
 user= (def image (eval-in generator clevolution.version.version0-**
 1-1))
 CompilerException java.lang.ClassCastException: clojure.lang.Symbol
 cannot be cast to java.lang.String, compiling:(NO_SOURCE_PATH:1)

 user= (def image (eval-in (X 400 400) clevolution.version.version0-**
 1-1))
 #'user/image

 So it's OK to pass the explicit string but not the symbol. What am I not
 getting here?

 -A


 On Tue, Dec 18, 2012 at 12:48 AM, Alan Shaw node...@gmail.com wrote:

 Now I do, and the macro worked!
 I believe I have a problem using the macro from a function, but leaving
 that for tomorrow.

 Thanks BG!

 -A



 On Tue, Dec 18, 2012 at 12:19 AM, Baishampayan Ghose 
 b.g...@gmail.comwrote:

 Do you have target ns clevolution.version.version0-**1-1 required?

 -BG

 On Tue, Dec 18, 2012 at 1:38 PM, Alan Shaw node...@gmail.com wrote:
  BG,
  The macro doesn't seem to do the trick. The function X is interned in
 the
  target namespace, but:
 
  user= (def image (eval-in (X 400 400)
  clevolution.version.version0-**1-1))
  CompilerException java.lang.RuntimeException: Unable to resolve
 symbol: X in
  this context, compiling:(NO_SOURCE_PATH:1)
 
 
  On Mon, Dec 17, 2012 at 11:53 PM, Alan Shaw node...@gmail.com
 wrote:
 
  Oh yes, the something.something is fixed so I can just prepend it,
 thanks.
  (Hadn't noticed your macro takes the ns as a string!)
 
  -A
 
 
 
  On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose 
 b.g...@gmail.com
  wrote:
 
  Alan,
 
  What you're asking for is to derive the ns clojure.core given only
  core. Not sure if that's possible.
 
  The namespace constitutes the whole dotted structure and not just
 the
  last component, I am afraid.
 
  If the actual ns is something.something.version-0-**1-1, then you
 need
  the string something.something.version-**0-1-1 and not just
  version-0-1-1 [unless of course you have some other way of
 deriving
  it from info that's embedded in _your_ code or structure thereof].
 
 
  -BG
 
  On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw node...@gmail.com
 wrote:
   Thanks BG, I'm trying that.
   But I don't think it addresses how to get from the string
   version-0-1-1 to
   the namespace something.something.version-0-**1-1. How can I do
 that?
  
   -A
  
  
  
   On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose
   b.g...@gmail.com
   wrote:
  
   Alan,
  
   Something like this might work for you -
  
   (defmacro eval-in
 Eval a Clojure form in a different namespace and switch back
 to
   current namespace.
  
  Args:
  code - Clojure form as string
  ns - Target namespace as string
 [code ns]
 `(do
(in-ns '~(symbol ns))
(let [ret# (eval '~(read-string code))]
  

Re: New Clojure user group in Israel

2012-12-18 Thread Haim Ashkenazi
Finally! I'm in :)

On Mon, Dec 17, 2012 at 12:58 PM, Daniel Szmulewicz 
daniel.szmulew...@gmail.com wrote:

 Hi everybody,

 Happy to announce that Israel has its first Clojure user group.

 http://www.meetup.com/Clojure-**Israel/http://www.meetup.com/Clojure-Israel/

 Sincerely,

 Daniel Szmulewicz

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




-- 
Haim

-- 
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: Little namespace question

2012-12-18 Thread Alan Shaw
As an aside, I'm curious about whether this could have been implemented
without a macro.

-A
 On Dec 18, 2012 11:06 PM, Alan Shaw noden...@gmail.com wrote:

 Thanks very much Juan, that's some good study material for me.

 -A
  On Dec 18, 2012 10:45 PM, juan.facorro juan.faco...@gmail.com wrote:

 The macro sees it arguments as *symbols* and does not resolve to the
 corresponding *var* until evaluation, so the value for the local *code* var
 in the macro is actually the *symbol** generator.*

 The *eval-in* macro uses the *read-string* function to evaluate the code
 you provide, this function expects a string but it's getting the* **
 symbol** generator* instead, since that's what the macro got as a first
 argument.

 Here's a modified version of the *eval-in* macro, that delays the
 evaluation of the call to *read-string*:

 (require '[clojure.pprint :as p])

 (defmacro eval-in
   [code ns]
   `(do
  (in-ns '~(symbol ns))
  (let [ret# (eval *(read-string ~code)*)] ; This line was changed
(in-ns '~(ns-name *ns*))
ret#)))

 (p/pprint (macroexpand '(eval-in generator another-ns)))

 Here's the output:

 (do
  (clojure.core/in-ns 'another-ns)
  (clojure.core/let
   [ret__1879__auto__
(clojure.core/eval *(clojure.core/read-string generator)*)] ; The
 unquoting of code resulted in the symbol generator
   (clojure.core/in-ns 'test-eval)
   ret__1879__auto__))

 If you want to use a var as an argument for the code, you could resolve
 the var before changing namespaces, delaying the read-string until the
 forms evaluation:

 (ns another-ns)

 (defn X [w h] [w h])
 ;---
 (ns this-ns
   (:require [clojure.pprint :as p]))

 (defmacro eval-in
   [code ns]
   `(let [code# ~code]
  (in-ns '~(symbol ns))
   (let [ret# (eval (read-string code#))]
(in-ns '~(ns-name *ns*))
ret#)))

 (def generator (X 300 300))
 (p/pprint (eval-in generator another-ns))

 Hope it helps,

 Juan


 On Wednesday, December 19, 2012 1:13:00 AM UTC-3, nodename wrote:

 From yesterday:

 (defmacro eval-in
   Eval a Clojure form in a different namespace and switch back to
 current namespace.

Args:
code - Clojure form as string
ns - Target namespace as string
   [code ns]
   `(do
  (in-ns '~(symbol ns))
  (let [ret# (eval '~(read-string code))]
(in-ns '~(ns-name *ns*))
ret#)))



 user= (def generator (X 400 400))
 #'user/generator
 user= (def image (eval-in generator clevolution.version.version0-**
 1-1))
 CompilerException java.lang.ClassCastException: clojure.lang.Symbol
 cannot be cast to java.lang.String, compiling:(NO_SOURCE_PATH:1)

 user= (def image (eval-in (X 400 400) clevolution.version.version0-*
 *1-1))
 #'user/image

 So it's OK to pass the explicit string but not the symbol. What am I not
 getting here?

 -A


 On Tue, Dec 18, 2012 at 12:48 AM, Alan Shaw node...@gmail.com wrote:

 Now I do, and the macro worked!
 I believe I have a problem using the macro from a function, but leaving
 that for tomorrow.

 Thanks BG!

 -A



 On Tue, Dec 18, 2012 at 12:19 AM, Baishampayan Ghose 
 b.g...@gmail.comwrote:

 Do you have target ns clevolution.version.version0-**1-1 required?

 -BG

 On Tue, Dec 18, 2012 at 1:38 PM, Alan Shaw node...@gmail.com wrote:
  BG,
  The macro doesn't seem to do the trick. The function X is interned
 in the
  target namespace, but:
 
  user= (def image (eval-in (X 400 400)
  clevolution.version.version0-**1-1))
  CompilerException java.lang.RuntimeException: Unable to resolve
 symbol: X in
  this context, compiling:(NO_SOURCE_PATH:1)
 
 
  On Mon, Dec 17, 2012 at 11:53 PM, Alan Shaw node...@gmail.com
 wrote:
 
  Oh yes, the something.something is fixed so I can just prepend it,
 thanks.
  (Hadn't noticed your macro takes the ns as a string!)
 
  -A
 
 
 
  On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose 
 b.g...@gmail.com
  wrote:
 
  Alan,
 
  What you're asking for is to derive the ns clojure.core given
 only
  core. Not sure if that's possible.
 
  The namespace constitutes the whole dotted structure and not just
 the
  last component, I am afraid.
 
  If the actual ns is something.something.version-0-**1-1, then you
 need
  the string something.something.version-**0-1-1 and not just
  version-0-1-1 [unless of course you have some other way of
 deriving
  it from info that's embedded in _your_ code or structure thereof].
 
 
  -BG
 
  On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw node...@gmail.com
 wrote:
   Thanks BG, I'm trying that.
   But I don't think it addresses how to get from the string
   version-0-1-1 to
   the namespace something.something.version-0-**1-1. How can I do
 that?
  
   -A
  
  
  
   On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose
   b.g...@gmail.com
   wrote:
  
   Alan,
  
   Something like this might work for you -
  
   (defmacro eval-in
 Eval a Clojure form in a different namespace and switch back
 to
   current namespace.
  
  Args:
  code - Clojure form 

Re: ClojureCLR errors on Mono Linux

2012-12-18 Thread Shantanu Kumar
Thanks David, and sorry for the insufficient bug details. I tested this on 
64-bit Ubuntu where it works fine; however, the problem shows up on 32-bit 
Ubuntu.

I will post the exact steps in the evening on how to replicate the issue on 
32-bit Ubuntu.

Shantanu

On Wednesday, 19 December 2012 02:00:53 UTC+5:30, dmiller wrote:

 Shantanu,

 I created an Ubuntu 12.10 VM running in VirtualBox on my Win7 PC.  
 I installed Mono 2.10.8.
 I downloaded the zip for ClojureCLR 1.4.0 Debug-4.0.
 Extracted.
  mono Clojure.Main.exe  
 Runs with no problem.

  mono Clojure.Compile.exe test.junk
 Runs with no problem.

 From the errors you report, I can only guess that some pre-1.4 DLLs are 
 being found somehow and loaded.  
 For example,  the field clojure.lang.RT.OutVar did not exist in ClojureCLR 
 1.3.

 I do not know how else to help.

 -David
  


 On Saturday, December 15, 2012 10:17:59 PM UTC-6, Shantanu Kumar wrote:

 This is when using ClojureCLR 1.4.0 Debug-4.0 version.

 Shantanu

 On Sunday, 16 December 2012 09:45:21 UTC+5:30, Shantanu Kumar wrote:

 Hi,

 I noticed the following ClojureCLR errors using Mono 2.10 on Ubuntu 
 12.04 (they do not happen on Windows using either .NET or Mono):

 1. when running Clojure.Compile.exe:

 Exception: System.MissingFieldException: Field 'clojure.lang.RT.OutVar' 
 not found.

 2. when using Clojure.Main.exe:

 Exception: System.TypeLoadException: Could not load type 
 'Clojure.CljMain' from assembly 'Clojure.Main, Version=1.0.0.0, 
 Culture=neutral, PublicKeyToken=null'.

 It would be great if anybody can let me know what's going on.

 Shantanu



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

Need help in geeting cemerick/friend working with openid

2012-12-18 Thread Murtaza Husain
Hi,

I am trying to setup my authentication using cemerick/friend. I would like 
to authenticate using openid with gmail. 

Below is the code that I have - 

(ns faiz.handler
  (:use compojure.core)
  (:require [compojure.handler :as handler]
[compojure.route :as route]
[ring.util.response :as resp]
[me.shenfeng.mustache :as mustache]
[cemerick.friend :as friend]
(cemerick.friend [workflows :as workflows]
 [credentials :as creds]
 [openid :as openid])))

(mustache/deftemplate index (slurp public/index-async.html))

(def index-data {:title Invoize. :brand Faiz :links [{:url #/students 
:text Students} {:url #/thaalis :text Thaalis}]})




(defroutes app-routes
  (GET / [] (resp/redirect /landing))
  (GET /landing [] (resp/file-response landing.html {:root public}))
  (GET /index [] (index index-data))
  (route/files / {:root public})
  (route/not-found Not Found))

(def mock-app
  (- app-routes
  (friend/authenticate
   {:workflows [(openid/workflow :openid-uri 
https://www.google.com/accounts/o8/id; :realm http://invoize.com;)]})))

(def app
  (handler/site app-routes))

My expectation is that when I try to access the /index or /landing url, 
it should not allow me as I am not authenticated and redirect to the 
openid-url,however this does not happen. How do I achieve it ?

Thanks,
Murtaza

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