interests in Clojure internals

2012-06-07 Thread jaime
Hello everyone,

I really have interests in internals of Cojure. I'm not talking about 
massive details of its implementation but rather some kind of 
overview/architecture of the language itself. I also know that reading 
source code is one of the best ways to understand it but it's not easy for 
me to start because I don't have a big picture.

Is there any introduction articles/books online that could be reached? even 
a few pieces that talk about its internal could be great helps too. Or 
maybe some materials/books about language/compiler designing could help me 
better understand these stuffs??

Thanks,
Jaime

-- 
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: interests in Clojure internals

2012-06-07 Thread Tim Visher
On Thu, Jun 7, 2012 at 4:41 AM, jaime xiejianm...@gmail.com wrote:
 I really have interests in internals of Cojure. I'm not talking about
 massive details of its implementation but rather some kind of
 overview/architecture of the language itself. I also know that reading
 source code is one of the best ways to understand it but it's not easy for
 me to start because I don't have a big picture.

 Is there any introduction articles/books online that could be reached? even
 a few pieces that talk about its internal could be great helps too. Or maybe
 some materials/books about language/compiler designing could help me better
 understand these stuffs??

I'm assuming you've read it, but this is the best I know of:
http://clojure.org/Reference

--

In Christ,

Timmy V.

http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail

-- 
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: interests in Clojure internals

2012-06-07 Thread Ken Causey
On Thu, Jun 7, 2012 at 3:41 AM, jaime xiejianm...@gmail.com wrote:
 Hello everyone,

 I really have interests in internals of Cojure. I'm not talking about
 massive details of its implementation but rather some kind of
 overview/architecture of the language itself. I also know that reading
 source code is one of the best ways to understand it but it's not easy for
 me to start because I don't have a big picture.

 Is there any introduction articles/books online that could be reached? even
 a few pieces that talk about its internal could be great helps too. Or maybe
 some materials/books about language/compiler designing could help me better
 understand these stuffs??

While I think the project is still in a very incomplete stage you can
find quite a bit of information in Tim Daly's re-organization of the
Clojure source code in literate form:

http://daly.axiom-developer.org/clojure.pdf
http://daly.axiom-developer.org/clojure.pamphlet


 Thanks,
 Jaime

-- 
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: interests in Clojure internals

2012-06-07 Thread Angel Java Lopez
Any project like
https://github.com/codereading/HQ
?
for Clojure

 some materials/books about language/compiler designing could help me
 better
  understand these stuffs??

 While I think the project is still in a very incomplete stage you can
 find quite a bit of information in Tim Daly's re-organization of the
 Clojure source code in literate form:

 http://daly.axiom-developer.org/clojure.pdf
 http://daly.axiom-developer.org/clojure.pamphlet

 
  Thanks,
  Jaime

 --
 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: Improvents on agent,user-custom thread pool.

2012-06-07 Thread mnicky
I just came across this thread (and also [1]) when I was googling for a way 
to customize the Clojure agents. Were any of these 'post 1.2' suggestions 
reconsidered since then? (I see they haven't been implemented yet).

Marek.

[1] 
https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/qDfxSoesp4o

On Monday, July 26, 2010 2:54:29 AM UTC+2, Alex Miller wrote:

 Hey Dennis, 

 I suggested some of the same ideas here (http://tech.puredanger.com/ 
 2010/06/08/clojure-agent-thread-pools/http://tech.puredanger.com/2010/06/08/clojure-agent-thread-pools/)
  
 and Rich said that these 
 seemed like good suggestions post-1.2.  I think allowing you to modify 
 the agent thread pools after construction seems possibly dangerous 
 from a concurrency point of view, but maybe that would be ok. 

 Alex 


 On Jul 25, 3:47 am, dennis killme2...@gmail.com wrote: 
  Agent use two thread pools to execute actions,send use a fixed thread 
  pool (2+cpus threads),and send-off use a cached thread pool.These 
  pools are global in clojure system. 
  
  I think the Agent should allow users to customize the thread pool, 
  if no custom,  then use the global thread pool. 
 Why do I need a custom thread pool? 
 First, the default thread pool is global, send use the thread pool 
  is a fixed size cpus +2, is likely to become the system bottleneck 
  sometime. Although you can use the send-off, use the cache thread 
  pool, but in a real world application, I can not use the cache thread 
  pool, which will introduce the risk of OutOfMemoryError, normally I 
  like to use a fixed-size thread pool. 
  
Second, the actions which global thread pool execute are from a 
  variety of agents, the actions are not homogeneous, and can not 
  maximize the efficient use of the thread pool, we hope that you can 
  specify different agent to isolate a particular thread pool to 
  maximize the use of thread pool . 
  
 I think Agent could add two new functions: 
  
  (set-executor! agent (java.util.concurrent.Executors/ 
  newFixedThreadPool 2)) 
  (shutdown-agent agent) 
  
  set-executor! is to set the agent's custom thread pool,and shutdown- 
  agent to shutdown the agent's custom thread pool.

-- 
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: Can we use Clojure like a general library in Java?

2012-06-07 Thread Qihui Sun
Thank you! It seems a good begin.

2012/6/3 Karl Krukow karl.kru...@gmail.com

 Regarding those...

 Some time ago I created a project containing only the persistent data
 structures for use with Java et al.

 https://github.com/krukow/clj-ds

 It is the data structures only so no bootstrap penalty. There are also
 Java'ish improvements like basic Generics and improved performance on the
 iterator pattern.

 It's still on Clojure 1.3 (As far as I recall), but I am planning on
 taking another iteration.

 TODO:

 - better Generics support
 - more data structures  (tries, RRB-trees)
 - include the reducers library support for parallelism

 given this is a spare time project, I welcome everyone interested to
 contribute.

 /Karl

 On 02/06/2012, at 23.00, Philip Potter wrote:

 Yes it can! It's just a jar file after all, so you can use the classes in
 your java program if you like.

 However, clojure data structures typically do not use static typing as
 java uses it. For example, PersistentVector is a collection of Objects and
 not genericized. Getting things out of such a vector will no doubt require
 typecasting, just like the old 1.4 days.

 Phil
 On Jun 2, 2012 9:25 PM, Qihui Sun qihui@gmail.com wrote:

 Hi,the Thoughtworks technology radar mentioned below:

 http://www.thoughtworks.com/articles/technology-radar-march-2012

 Functional programming continues its slow but steady ascent into
 developer mind share and, increasingly, code bases. New languages like
 Clojure, Scala, and F# offer great new features. Now libraries such 
 as*Functional
 Java*,* TotallyLazy and LambdaJ* are back porting some functional
 language capabilities, particularly around higher-order functions and
 collections, into Java. We like this trend because it previews common
 capabilities of future languages yet allows developers to stay in their
 comfort zone.

 So I am interested,if Clojure can be used like a general library in
 Java,it will beat above libraries and be awesome !

 --
 Solomon
 HUAWEI http://www.huawei.com/
 Google+: Qihui Sun http://gplus.to/sunqihui




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




-- 
Solomon
HUAWEI http://www.huawei.com/
Google+: Qihui Sun http://gplus.to/sunqihui

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

Strange evaluation result of the quoted form on 1.3

2012-06-07 Thread Alex Shabanov
I'm curious why the following form evaluates to 2:

(defn foo [ more]
  (println foo( more  )))

(defn bar [v]
  (apply (first v) (rest v)))

(bar '(foo 1 2))

If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the 
arity exception will be thrown.
The behavior can be reproduced after picking another names for foo and/or 
bar functions.

-- 
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: Strange evaluation result of the quoted form on 1.3

2012-06-07 Thread Bronsa
you' are calling (apply 'foo '(1 2)), what you want is (apply foo '(1 2))
just call bar as
(bar (list foo 1 2))

2012/6/7 Alex Shabanov avshaba...@gmail.com

 I'm curious why the following form evaluates to 2:

 (defn foo [ more]
   (println foo( more  )))

 (defn bar [v]
   (apply (first v) (rest v)))

 (bar '(foo 1 2))

 If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the
 arity exception will be thrown.
 The behavior can be reproduced after picking another names for foo and/or
 bar functions.

 --
 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: Strange evaluation result of the quoted form on 1.3

2012-06-07 Thread Alex Shabanov
Oh, I see. This is because of the reader that interprets symbols from the 
quoted forms in different way it does for the unquoted ones (and this 
feature still strikes me as odd).
To make matters more complicated the quoted symbols seems to have some 
meanings as functions for the clojure, since ('foo 1) - nil, ('foo 1 2) - 
2, ('foo 1 2 3 4) - arity exception.

четверг, 7 июня 2012 г., 20:05:43 UTC+4 пользователь Bronsa написал:

 you' are calling (apply 'foo '(1 2)), what you want is (apply foo '(1 2))
 just call bar as
 (bar (list foo 1 2))

 2012/6/7 Alex Shabanov avshaba...@gmail.com

 I'm curious why the following form evaluates to 2:

 (defn foo [ more]
   (println foo( more  )))

 (defn bar [v]
   (apply (first v) (rest v)))

 (bar '(foo 1 2))

 If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the 
 arity exception will be thrown.
 The behavior can be reproduced after picking another names for foo and/or 
 bar functions.

 -- 
 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: Strange evaluation result of the quoted form on 1.3

2012-06-07 Thread Carlo Zancanaro
A quoted symbol is just a literal symbol typed object. These symbols
act as functions where they evaluate like this:
('x 1) = (get 1 'x) - look itself up in its argument
('x 1 2) = (get 1 'x 2) - look itself up in its argument with a
not-found value.

So, in your example:

(bar '(foo 1 2)) tries to run ('foo 1 2). 'foo can't find itself in
the map 1 (because it's not a map), so it returns the default value
provided (in this case: 2).

On Fri, Jun 8, 2012 at 2:23 AM, Alex Shabanov avshaba...@gmail.com wrote:
 Oh, I see. This is because of the reader that interprets symbols from the
 quoted forms in different way it does for the unquoted ones (and this
 feature still strikes me as odd).
 To make matters more complicated the quoted symbols seems to have some
 meanings as functions for the clojure, since ('foo 1) - nil, ('foo 1 2) -
 2, ('foo 1 2 3 4) - arity exception.

 четверг, 7 июня 2012 г., 20:05:43 UTC+4 пользователь Bronsa написал:

 you' are calling (apply 'foo '(1 2)), what you want is (apply foo '(1 2))
 just call bar as
 (bar (list foo 1 2))

 2012/6/7 Alex Shabanov avshaba...@gmail.com

 I'm curious why the following form evaluates to 2:

 (defn foo [ more]
   (println foo( more  )))

 (defn bar [v]
   (apply (first v) (rest v)))

 (bar '(foo 1 2))

 If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the
 arity exception will be thrown.
 The behavior can be reproduced after picking another names for foo and/or
 bar functions.

 --
 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 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: Strange evaluation result of the quoted form on 1.3

2012-06-07 Thread Bronsa
yes, symbols like keywords lookup themselves into the second element, or
return the third if they cannot find their value
('a {'a 1} 2) ;= 1
('b {'a 1} 2} ;= 2

2012/6/7 Alex Shabanov avshaba...@gmail.com

 Oh, I see. This is because of the reader that interprets symbols from the
 quoted forms in different way it does for the unquoted ones (and this
 feature still strikes me as odd).
 To make matters more complicated the quoted symbols seems to have some
 meanings as functions for the clojure, since ('foo 1) - nil, ('foo 1 2) -
 2, ('foo 1 2 3 4) - arity exception.

 четверг, 7 июня 2012 г., 20:05:43 UTC+4 пользователь Bronsa написал:

 you' are calling (apply 'foo '(1 2)), what you want is (apply foo '(1 2))
 just call bar as
 (bar (list foo 1 2))

 2012/6/7 Alex Shabanov avshaba...@gmail.com

 I'm curious why the following form evaluates to 2:

 (defn foo [ more]
   (println foo( more  )))

 (defn bar [v]
   (apply (first v) (rest v)))

 (bar '(foo 1 2))

 If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the
 arity exception will be thrown.
 The behavior can be reproduced after picking another names for foo
 and/or bar functions.

 --
 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.comclojure%2bunsubscr...@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: Strange evaluation result of the quoted form on 1.3

2012-06-07 Thread Alex Shabanov
Thanks, I missed that :)
I forgot to take into an account the short `map lookup' form.

четверг, 7 июня 2012 г., 20:28:24 UTC+4 пользователь Bronsa написал:

 yes, symbols like keywords lookup themselves into the second element, or 
 return the third if they cannot find their value
 ('a {'a 1} 2) ;= 1
 ('b {'a 1} 2} ;= 2

 2012/6/7 Alex Shabanov avshaba...@gmail.com

 Oh, I see. This is because of the reader that interprets symbols from the 
 quoted forms in different way it does for the unquoted ones (and this 
 feature still strikes me as odd).
 To make matters more complicated the quoted symbols seems to have some 
 meanings as functions for the clojure, since ('foo 1) - nil, ('foo 1 2) - 
 2, ('foo 1 2 3 4) - arity exception.

 четверг, 7 июня 2012 г., 20:05:43 UTC+4 пользователь Bronsa написал:

 you' are calling (apply 'foo '(1 2)), what you want is (apply foo '(1 2))
 just call bar as
 (bar (list foo 1 2))

 2012/6/7 Alex Shabanov avshaba...@gmail.com

 I'm curious why the following form evaluates to 2:

 (defn foo [ more]
   (println foo( more  )))

 (defn bar [v]
   (apply (first v) (rest v)))

 (bar '(foo 1 2))

 If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the 
 arity exception will be thrown.
 The behavior can be reproduced after picking another names for foo 
 and/or bar functions.

 -- 
 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.comclojure%2bunsubscr...@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

gen-class naming

2012-06-07 Thread Jon Rose
Does anyone know how to change the my-project.core name in the OSX menubar 
and icon tray? I have added
   
  :jvm-opts ~(if (= (System/getProperty os.name) Mac OS X) 
[-Xdock:name=MyProject] []))

to my project.clj file which fixes the naming issues when I run lein run. I 
was having issues running my project as a standalone from lein uberjar then 
added a (:gen-class) to myproject.core's name space declaration which now 
allows me to run standalone but the menu naming is back to myproject.core. 


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

Help with Macros and Matchure

2012-06-07 Thread JvJ
Hi,

I've recently started using the matchure library for pattern matching
(https://github.com/dcolthorp/matchure).

Basically, I'd like match a number of different values and bind the
first match to a symbol.  In matchure, binding to a variable can be
done like this:

(if-match [(and ?c Hi) Hi] c) ; Will return Hi

I have a map:

(def *chars* { Grace :Grace
   grace :Grace
   Trip :Trip
   trip :Trip})

And I'd like to produce something like this:

(if-match [(or
  (and ?c #Grace)
  (and ?c #grace)
  (and ?c #Trip)
  (and ?c #trip))
  Trip]
  c)

From something like this:

(if-match [(match-character ?c) Trip] c)

Currently, I have the following macro:

(defmacro match-character
  Creates a pattern-matching OR that binds the provided symbol
to the first matched name.
  [x]
  `(or
~@(map
  (fn [[k _]]
`(and ~x ~(re-pattern k)))
  *chars*)))

It produces the following code after macroexpand-1:

(clojure.core/or (clojure.core/and ?c #trip) (clojure.core/and ?c
#Trip) (clojure.core/and ?c #Grace) (clojure.core/and ?c
#grace))

Which is exactly what I want.  However, when I use it in the context I
want, it goes too far and tries to evaluate ?c.  Is there a way to
just have it splice-in the code, or would I need another macro to do
that?

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


Memory issues processing large lazy sequences

2012-06-07 Thread Tom Hume
Hi

I'm trying to generate a sequence which corresponds to a breadth-first 
search of a very wide, deep tree... and I'm hitting memory problems when I 
go too far along the sequence. Having asked around on the IRC channel and 
looked here, the number 1 cause of such problems is inadvertently holding 
onto the head; but I can't see where I'm doing this.

The code is quite simple; here's a version which displays the problem:

(def atoms '(a b c))

(defn get-ch [n] (map #(str n %) atoms)) 

(defn add-ch 
  ([] (apply concat (iterate add-ch atoms))) 
  ([n] (mapcat get-ch n)))

(dorun (take 2000 (add-ch)))
And here's another version (which is the one I started out with before 
getting help from #clojure), which displays the same issue:

(def atoms '(a b c))

(defn get-children [n] (map #(str n %) atoms))

(defn add-layer 
  ([] (add-layer atoms)) 
  ([n] (let [child-nodes (mapcat get-children n) ] 
  (lazy-seq (concat n (add-layer child-nodes))

(dorun (take 2000 (add-layer)))
Both give me an OutOfMemoryError Java heap space. I'm running them from 
the REPL in Eclipse/CounterClockwise, on a Macbook Air.

I'm pretty new to Clojure, so after beating my head against this for a day 
I'm hoping that this is something trivial I'm overlooking. I realise I 
could up my heap-size to make the issue less likely to occur, but the 
sequences I ultimately want to process are so vast I don't think this is 
going to help me...

Any suggestions warmly welcomed.

Thanks
Tom

-- 
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: Clojurians in Austria

2012-06-07 Thread Jorge Duenas
Hi,

I am experimenting with Clojure since more than a year in my spare
time - e.g., I solved all but one of the katas in the now defunct
coding-kata.org but know I still have quite a lot to learn.

Thanks for founding a group.

Jorge

P.S. Will join the google group right now.

On 30 Mai, 14:38, Jozef Wagner jozef.wag...@gmail.com wrote:
 Thanks for replies!

 I've created a group athttps://groups.google.com/forum/#!forum/clojure-at

 Feel free to join :)

 Best,
 Jozef







 On Tuesday, May 29, 2012 7:20:02 PM UTC+2, bsmith.occs wrote:

  I too am in Vienna. I use Clojure at work for a few small internal
  tools, but not in production. I'd be glad to meet some other
  Clojurists.

  // Ben

  On Tue, May 29, 2012 at 5:05 PM, Nuno Marques
   wrote:
   I'm in Vienna and I know a couple of more Clojure people here.
   I would be happy to help start a clojure group here.

   On May 29, 2012, at 4:40 PM, Florian Over wrote:

   Hi
   i met a nice guy (David from intermaps.com) from Vienna on
  EuroClojure.
   He mentioned that there are other Clojure-User in Vienna as well.
   But no UserGroup right now.

   Maybe you can start irc clojure-at ?

   Florian

   2012/5/29 Jozef Wagner :
   Hi,

   Are there some Clojurians from Austria or is there an Austria Clojure
   group?

   I'm looking for a Clojure related job in Austria, and so far I haven't
  found
   any Austrian group on meetup.com nor on the google groups :(

   Best,
   Jozef

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


why String is not a collection (of Character)

2012-06-07 Thread Andy Coolware
Hi,

So my questions is as in subject. I did a bit of research but could not
find a good answer.

Would appreciate an insight ...

(thank you 'Andy)

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

newbie clojure.zip help

2012-06-07 Thread fenton
Nicely formatted version of the question:
https://github.com/ftravers/PublicDocumentation/blob/master/clojure-question1.md

I'm not sure if it's that cool to put questions somewhere else and
reference from here...it's just that the formatting there is so nice!
If anyone has some nice pointers to tutorials around manipulating xml
in clojure, that would be appreciated too!

-- 
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: Converting project.clj to maven's pom.xml

2012-06-07 Thread Mark Derricutt
Maybe I should write a lein plugin that generates a pom for my maven 
plugin - but that feels a little rude :)


Mark

On 21/04/12 8:46 AM, Ben Smith-Mannschott wrote:

It does't configure clojure-maven-plugin, so executing 'mvn package'
with the resulting pom will not produce a useful result.



--
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.core.unify and exceptions

2012-06-07 Thread Brian Marick

On Jun 6, 2012, at 5:59 PM, Kevin Livingston wrote:

 I was surprised to find that clojure.core.unify returns an exception
 when something does not unify rather than something like nil (false)
 when they don't. 

You can use core.logic's unifier:

user= (require '[clojure.core.logic :as l])
user= (l/unifier '[1 ?two 3 4] '[1 2 ?three 4])
[1 2 3 4]
user= (l/unifier '[1 ?two 3 4] '[1 2 ?three NOT-FOUR])
nil

user= (l/binding-map '[1 ?two 3 4] '[1 2 ?three 4])
{?three 3, ?two 2}

-
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Occasional consulting on Agile
www.exampler.com, www.twitter.com/marick

-- 
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: why String is not a collection (of Character)

2012-06-07 Thread Evan Mezeske
How would that affect Java interop?  It seems like it would make Clojure 
strings incompatible with Java functions that take strings as arguments.

On Wednesday, June 6, 2012 11:03:11 PM UTC-7, Andy C wrote:

 Hi,

 So my questions is as in subject. I did a bit of research but could not 
 find a good answer.

 Would appreciate an insight ...

 (thank you 'Andy)


-- 
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: Converting project.clj to maven's pom.xml

2012-06-07 Thread Joseph Smith
Doesn't lein pom do it?

---
Joseph Smith
j...@uwcreations.com
(402)601-5443


On Jun 6, 2012, at 11:20 PM, Mark Derricutt m...@talios.com wrote:

 Maybe I should write a lein plugin that generates a pom for my maven plugin - 
 but that feels a little rude :)
 
 Mark
 
 On 21/04/12 8:46 AM, Ben Smith-Mannschott wrote:
 It does't configure clojure-maven-plugin, so executing 'mvn package'
 with the resulting pom will not produce a useful result.
 
 
 -- 
 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: Converting project.clj to maven's pom.xml

2012-06-07 Thread Phil Hagelberg
On Thu, Jun 7, 2012 at 2:52 PM, Joseph Smith j...@uwcreations.com wrote:
 Doesn't lein pom do it?

Not yet, but it's planned: https://github.com/technomancy/leiningen/pull/454

Happy to take a patch for it.

-Phil

-- 
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: why String is not a collection (of Character)

2012-06-07 Thread James Reeves
On 7 June 2012 07:03, Andy Coolware andy.coolw...@gmail.com wrote:
 So my questions is as in subject. I did a bit of research but could not find
 a good answer.

Because otherwise Clojure wouldn't be compatible with Java APIs. It
would also probably be slower than using the native String class.

- James

-- 
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: newbie clojure.zip help

2012-06-07 Thread fenton
Found the answer and made a tutorial out of it...feel free to enjoy
it:

https://github.com/ftravers/PublicDocumentation/blob/master/clojure-read-xml.md

On Jun 6, 3:56 pm, fenton fenton.trav...@gmail.com wrote:
 Nicely formatted version of the 
 question:https://github.com/ftravers/PublicDocumentation/blob/master/clojure-q...

 I'm not sure if it's that cool to put questions somewhere else and
 reference from here...it's just that the formatting there is so nice!
 If anyone has some nice pointers to tutorials around manipulating xml
 in clojure, that would be appreciated too!

-- 
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: why String is not a collection (of Character)

2012-06-07 Thread Andy Coolware
I was wondering cause we can do all awesome stuff like that:

user= (last abc)
\c
user= (first abc)
\a
user= (map (fn[z] (str z -)) abc)
(a- b- c-)

but this renders false

user= (coll? abc)
false

A.

-- 
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: Memory issues processing large lazy sequences

2012-06-07 Thread Jorge Barrios
The first version completes without problems.
Make sure your JVM has plenty of memory available to garbage collect.
Look at the -Xmx setting (for instance with leiningen   :jvm-opts [-
Xmx2g -server])

REPL started; server listening on localhost port 18885
user=   (def atoms '(a b c))
#'user/atoms
user=
user=   (defn get-ch [n] (map #(str n %) atoms))
#'user/get-ch
user=   (defn add-ch
([] (apply concat (iterate add-ch atoms)))
([n] (mapcat get-ch n)))
#'user/add-ch
user= (time (dorun (take 2000 (add-ch
Elapsed time: 89922.105 msecs
nil
user=

On Jun 7, 10:53 am, Tom Hume twh...@gmail.com wrote:
 Hi

 I'm trying to generate a sequence which corresponds to a breadth-first
 search of a very wide, deep tree... and I'm hitting memory problems when I
 go too far along the sequence. Having asked around on the IRC channel and
 looked here, the number 1 cause of such problems is inadvertently holding
 onto the head; but I can't see where I'm doing this.

 The code is quite simple; here's a version which displays the problem:

 (def atoms '(a b c))

 (defn get-ch [n] (map #(str n %) atoms))

 (defn add-ch
   ([] (apply concat (iterate add-ch atoms)))
   ([n] (mapcat get-ch n)))

 (dorun (take 2000 (add-ch)))
 And here's another version (which is the one I started out with before
 getting help from #clojure), which displays the same issue:

 (def atoms '(a b c))

 (defn get-children [n] (map #(str n %) atoms))

 (defn add-layer
   ([] (add-layer atoms))
   ([n] (let [child-nodes (mapcat get-children n) ]
       (lazy-seq (concat n (add-layer child-nodes))

 (dorun (take 2000 (add-layer)))
 Both give me an OutOfMemoryError Java heap space. I'm running them from
 the REPL in Eclipse/CounterClockwise, on a Macbook Air.

 I'm pretty new to Clojure, so after beating my head against this for a day
 I'm hoping that this is something trivial I'm overlooking. I realise I
 could up my heap-size to make the issue less likely to occur, but the
 sequences I ultimately want to process are so vast I don't think this is
 going to help me...

 Any suggestions warmly welcomed.

 Thanks
 Tom

-- 
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: why String is not a collection (of Character)

2012-06-07 Thread Ambrose Bonnaire-Sergeant
Hi Andy,

Many collection functions call seq on their arguments, therefore
those expect a Seqable (or a String, Iterable, Array, java.util.Map etc.),
not an IPersistentCollection (which coll? tests for).

Working these things out can get subtle.

Thanks,
Ambrose

On Fri, Jun 8, 2012 at 7:54 AM, Andy Coolware andy.coolw...@gmail.comwrote:

 I was wondering cause we can do all awesome stuff like that:

 user= (last abc)
 \c
 user= (first abc)
 \a
 user= (map (fn[z] (str z -)) abc)
 (a- b- c-)

 but this renders false

 user= (coll? abc)
 false

 A.



  --
 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: why String is not a collection (of Character)

2012-06-07 Thread Tim Visher
Hi Andy,

On Thu, Jun 7, 2012 at 7:54 PM, Andy Coolware andy.coolw...@gmail.com wrote:
 I was wondering cause we can do all awesome stuff like that:

 user= (last abc)
 \c
 user= (first abc)
 \a
 user= (map (fn[z] (str z -)) abc)
 (a- b- c-)

 but this renders false

 user= (coll? abc)
 false

Few thoughts:

1. You're using a type test there. I'd check out the Collections
section of the cheatsheet: http://clojure.org/cheatsheet

2. While I would very much expect the type test (coll? seq?) to return
false on a string, I would _not_ expect the capability test
(sequential?) to return false, and it does for a String. Is this the
expected behavior? I would think that any seqable would return true
for sequential?. What do we think? Then, at least, you could easily
write code that expects to process only seqable things with a simple
pre-condition that the argument is sequential?.

-- 
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: why String is not a collection (of Character)

2012-06-07 Thread Ambrose Bonnaire-Sergeant
Hi Tim,

On Fri, Jun 8, 2012 at 12:11 PM, Tim Visher tim.vis...@gmail.com wrote:


 2. While I would very much expect the type test (coll? seq?) to return
 false on a string, I would _not_ expect the capability test
 (sequential?) to return false, and it does for a String. Is this the
 expected behavior? I would think that any seqable would return true
 for sequential?. What do we think?


sequential? is a type predicate also. This probably works as expected in
CLJS
using protocols.

Every Seqable is not Sequential.

(sequential? {:a 1}) = false

Thanks,
Ambrose

-- 
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: why String is not a collection (of Character)

2012-06-07 Thread Andy L

On 06/07/2012 09:22 PM, Ambrose Bonnaire-Sergeant wrote:

Every Seqable is not Sequential.

(sequential? {:a 1}) = false


Is there a simple test for sequable?

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