Performance trouble with Processing jar

2014-03-29 Thread tamichan
Hi All

I'm writing graphic clojure code with Processing jars.
When I wrote heavy draw code, I found clojure code is slower than an 
equivalent of java.

Probably, the cause is java method call.
I call processing drawing method thousands times per one frame. 
(.line applet x1 y1 z1 x2 y2 z2)

So decrease the call count, increase draw performance.
Do you know anything speed up way of java method call?

I tied quil, but it was same performance.
clojure version is 1.5.1

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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Adding multiple entries in a vector with (something like) for.

2014-03-29 Thread Paul Schulz
Greetings,
I have a vector definition (containing maps), where a lot of them are very 
similar.
eg.
  [ :first
   :second
   {:name :third-1}
   {:name :third-2}
  ]

I would like to use something like the following to replace the iterated 
rows
  (for [x (range 1 2)]
{:name (keyword (str third- x))})

The problem as that this creates a seq that gets put into the third spot in 
the vector.
Time for a macro? (- Time to learn about macros)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding multiple entries in a vector with (something like) for.

2014-03-29 Thread Jozef Wagner
How about using 'into'?

(into [:first :second] (for [x (range 1 5)] {:name (keyword (str third-
x))}))

Jozef


On Sat, Mar 29, 2014 at 9:25 AM, Paul Schulz pschul...@gmail.com wrote:

 Greetings,
 I have a vector definition (containing maps), where a lot of them are very
 similar.
 eg.
   [ :first
:second
{:name :third-1}
{:name :third-2}
   ]

 I would like to use something like the following to replace the iterated
 rows
   (for [x (range 1 2)]
 {:name (keyword (str third- x))})

 The problem as that this creates a seq that gets put into the third spot
 in the vector.
 Time for a macro? (- Time to learn about macros)

  --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: dependencies from github

2014-03-29 Thread t x
Ray, David, Aaron, Phil, dgrnbrg:

  Understood. Thanks for clarifying my misunderstandings!

On Thu, Mar 27, 2014 at 10:39 AM, dgrnbrg dsg123456...@gmail.com wrote:
 Voom is a Lein plugin that lets you depend on a repository and pins you to a 
 specific commit. It also provides tools manage systems spanning multiple 
 repos. You can find it here: https://github.com/LonoCloud/lein-voom and see 
 the video from clojure/west here: 
 https://m.youtube.com/watch?v=axztcYJUN4Ilist=PLZdCLR02grLp__wRg5OTavVj4wefg69hM

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding multiple entries in a vector with (something like) for.

2014-03-29 Thread Paul Schulz
Hi Jozef,

Thank you. 

I was hoping for a syntax that I could use inside the structure (similarly 
to the way that huccup supports embedded 'for' in HTML definitions).

On Saturday, 29 March 2014 19:53:06 UTC+10:30, Jozef Wagner wrote:

 How about using 'into'?

 (into [:first :second] (for [x (range 1 5)] {:name (keyword (str third- 
 x))}))

 Jozef


 On Sat, Mar 29, 2014 at 9:25 AM, Paul Schulz psch...@gmail.comjavascript:
  wrote:

 Greetings,
 I have a vector definition (containing maps), where a lot of them are 
 very similar.
 eg.
   [ :first
:second
{:name :third-1}
{:name :third-2}
   ]

 I would like to use something like the following to replace the iterated 
 rows
   (for [x (range 1 2)]
 {:name (keyword (str third- x))})

 The problem as that this creates a seq that gets put into the third spot 
 in the vector.
 Time for a macro? (- Time to learn about macros)

  -- 
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error when starting REPL

2014-03-29 Thread Arie van Wingerden
Thx Niels, that works!


2014-03-29 0:46 GMT+01:00 Niels van Klaveren niels.vanklave...@gmail.com:

 Its a problem with writing to a temp folder. Run Ccw as admin, or take a
 look at the counterclockwise group for a solution that doesn't need that.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding multiple entries in a vector with (something like) for.

2014-03-29 Thread Jozef Wagner
Well you can always abuse syntax quote :)

user= `[:first :second ~@(for [x (range 1 5)] {:name (keyword (str
third- x))})]
[:first :second {:name :third-1} {:name :third-2} {:name :third-3} {:name
:third-4}]

Jozef


On Sat, Mar 29, 2014 at 10:41 AM, Paul Schulz pschul...@gmail.com wrote:

 Hi Jozef,

 Thank you.

 I was hoping for a syntax that I could use inside the structure (similarly
 to the way that huccup supports embedded 'for' in HTML definitions).

 On Saturday, 29 March 2014 19:53:06 UTC+10:30, Jozef Wagner wrote:

 How about using 'into'?

 (into [:first :second] (for [x (range 1 5)] {:name (keyword (str third-
 x))}))

 Jozef


 On Sat, Mar 29, 2014 at 9:25 AM, Paul Schulz psch...@gmail.com wrote:

 Greetings,
 I have a vector definition (containing maps), where a lot of them are
 very similar.
 eg.
   [ :first
:second
{:name :third-1}
{:name :third-2}
   ]

 I would like to use something like the following to replace the iterated
 rows
   (for [x (range 1 2)]
 {:name (keyword (str third- x))})

 The problem as that this creates a seq that gets put into the third spot
 in the vector.
 Time for a macro? (- Time to learn about macros)

  --
 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 unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


  --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding multiple entries in a vector with (something like) for.

2014-03-29 Thread Paul Schulz
Ooo.. and Ah-ha! That's (almost) exactly what I was thinking of, and will 
work very nicely.

I was thinking that I could just use a macro in the place of ~@ and somehow 
avoid the initial quote.

Thank you..

On Saturday, 29 March 2014 20:20:57 UTC+10:30, Jozef Wagner wrote:

 Well you can always abuse syntax quote :)

 user= `[:first :second ~@(for [x (range 1 5)] {:name (keyword (str 
 third- x))})]
 [:first :second {:name :third-1} {:name :third-2} {:name :third-3} {:name 
 :third-4}]

 Jozef


 On Sat, Mar 29, 2014 at 10:41 AM, Paul Schulz psch...@gmail.comjavascript:
  wrote:

 Hi Jozef,

 Thank you. 

 I was hoping for a syntax that I could use inside the structure 
 (similarly to the way that huccup supports embedded 'for' in HTML 
 definitions).

 On Saturday, 29 March 2014 19:53:06 UTC+10:30, Jozef Wagner wrote:

 How about using 'into'?

 (into [:first :second] (for [x (range 1 5)] {:name (keyword (str 
 third- x))}))

 Jozef


 On Sat, Mar 29, 2014 at 9:25 AM, Paul Schulz psch...@gmail.com wrote:

 Greetings,
 I have a vector definition (containing maps), where a lot of them are 
 very similar.
 eg.
   [ :first
:second
{:name :third-1}
{:name :third-2}
   ]

 I would like to use something like the following to replace the 
 iterated rows
   (for [x (range 1 2)]
 {:name (keyword (str third- x))})

 The problem as that this creates a seq that gets put into the third 
 spot in the vector.
 Time for a macro? (- Time to learn about macros)

  -- 
 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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


  -- 
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


probably a noobie question: apparent memory leak

2014-03-29 Thread Ryan Waters
I have some code that blows up the heap and I'm not sure why.  I've reduced
it down to the following.

I've tried to make sure the atom doesn't have boundless growth and I didn't
think 'while' hangs on to the head of sequences so I'm embarrassed to say
I'm stumped.


(defn leaks-memory
  []
  (let [mem (atom [])
chunksize 1000
threshold 2000]
  (while true
(swap! mem conj (rand-int 100))

; every 'chunksize' item past 'threshold'
(when (and (= 0 (mod (count @mem) chunksize))
   ( (count @mem) threshold))
  (swap! mem subvec chunksize)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Performance trouble with Processing jar

2014-03-29 Thread Adam Clements
Have you got type hints? If you do a java method call on something which
isn't type hinted then clojure has to use reflection to look up a list of
the available methods, which is slw. If however you tell it what type
you expect it to be, it can better optimise it. So in the above code you
would have something more like (defn draw [^Applet applet] (.line applet
))

Look up how to turn on reflection warnings in your project and that will
highlight all the lines which need attention.

Hopefully it's as simple as that, but I would have expected quil to have
type hints already, so possibly not...

Adam


Adam


On Sat, Mar 29, 2014 at 6:20 AM, tamichan hogehogegeheg...@gmail.comwrote:

 Hi All

 I'm writing graphic clojure code with Processing jars.
 When I wrote heavy draw code, I found clojure code is slower than an
 equivalent of java.

 Probably, the cause is java method call.
 I call processing drawing method thousands times per one frame.
 (.line applet x1 y1 z1 x2 y2 z2)

 So decrease the call count, increase draw performance.
 Do you know anything speed up way of java method call?

 I tied quil, but it was same performance.
 clojure version is 1.5.1

 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: probably a noobie question: apparent memory leak

2014-03-29 Thread Aaron Cohen
On Sat, Mar 29, 2014 at 10:09 AM, Ryan Waters ryan.or...@gmail.com wrote:

 I have some code that blows up the heap and I'm not sure why.  I've
 reduced it down to the following.

 I've tried to make sure the atom doesn't have boundless growth and I
 didn't think 'while' hangs on to the head of sequences so I'm embarrassed
 to say I'm stumped.


 (defn leaks-memory
   []
   (let [mem (atom [])
 chunksize 1000
 threshold 2000]
   (while true
 (swap! mem conj (rand-int 100))

 ; every 'chunksize' item past 'threshold'
 (when (and (= 0 (mod (count @mem) chunksize))
( (count @mem) threshold))
   (swap! mem subvec chunksize)

 (doc subvec)

Returns a persistent vector of the items in vector from
start (inclusive) to end (exclusive). If end is not supplied,
defaults to (count vector). This operation is O(1) and very fast, as
the resulting vector shares structure with the original and no
trimming is done.

subvec is fast, but it's not saving you any memory.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reuse of Java instances that have the same value

2014-03-29 Thread vtekal
Hi all,

maybe someone here can point me to the right direction. I have a large 
lookup tree (millions of entries), but the values in the leafs don't 
contain much information. That is, the number of unique values stored in 
leafs is rather small, same values are used over and over again. I load the 
tree from DB and create leaf values one by one as vectors. Clojure creates 
every time a new vector instance (e.g (= (java.lang.System/identityHashCode 
[1 2]) (java.lang.System/identityHashCode [1 2])) evaluates always to 
false) although most of the time there is no need for that because I 
already have it somewhere and could just reuse previous instance. I 
implemented that optimization manually and it works. The memory consumption 
dropped 20 times. My question is, that is there any way Clojure can do this 
optimization automatically (like Java handles strings for example)? Or are 
there any libraries, that can help to do that?

Thank you in advance,

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: using contrib functions

2014-03-29 Thread Sam Ritchie
defadt defines an algebraic data type - so, imagine a record with a 
finite number of implementations (Boolean is an algebraic data type 
since it only has true and false, for example. Chess pieces would be 
another one.)


Once you define an ADT you can use that contrib library's match macro 
to do exhaustive case matches. Without the defadt thing, you just have 
to trust that the user knows how to handle all of your cases.



Sean Corfield mailto:s...@corfield.org
March 28, 2014 9:05 PM

That's very out of date documentation. The current documentation is here:

http://clojure.github.io/

The old monolithic clojure-contrib library hasn't been maintained for 
a very long time.


Some parts of that library were migrated to the new modular contrib 
libraries. You can read more about that here:


http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go

The old clojure.contrib.types library was not one of those so it's 
essentially gone now. That usually means there are better ways to do 
what the old library did - or that the old library was never really a 
good way to do things in the first place. I've no idea what defadt was 
meant to do, I'm afraid.


Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)



Christopher Howard mailto:cmhowa...@alaska.edu
March 28, 2014 8:40 PM
Hi. --Insert here the usual caveats about being new to Clojure and
Java.--

I wanted to try out this Contrib function describe on this
page
http://richhickey.github.io/clojure-contrib/types-api.html#clojure.contrib.types/defadt. 
How

do I get that in my project? Trying to follow documentation, I did
lein search:

code:

my-host:~/my-project$ lein search contrib
Warning: couldn't download index for http://repo1.maven.org/maven2
== Results from clojars - Showing page 1 / 1 total
[webnf.deps/contrib 0.0.1] The uber dependency to get a full set of 
popular

dependencies. For development or when you have room in your .m2 repo.

my-host:~/my-project$ lein search clojure.contrib.types
Warning: couldn't download index for http://repo1.maven.org/maven2
my-host:~/my-project$ lein search defadt
Warning: couldn't download index for http://repo1.maven.org/maven2


Is that webnf package the thing I am supposed to put in my
dependencies list? Version 0.0.1 doesn't sound right. Or am I
supposed to download something myself and throw it in my lib
directory?



--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com http://www.paddleguru.com/
Twitter http://twitter.com/paddleguru// Facebook 
http://facebook.com/paddleguru


--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
inline: postbox-contact.jpginline: compose-unknown-contact.jpg

Re: java interop help for beginner calling java class

2014-03-29 Thread Chris Shellenbarger
Did you move it to the corresponding directory structure?  So, 
com.example.mystuff would need a directory hierarchy like com/example/mystuff.  
The mystuff directory is where you need to put your java files that are in the 
com.example.mystuff package.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: probably a noobie question: apparent memory leak

2014-03-29 Thread Ryan Waters
If you do a (count @mem) it reports the length of the atom's vector isn't
growing without bounds.  It seems counterintuitive that the parts of the
old vector wouldn't get garbage collected because the atom no longer points
to them.  But I guess I need to rtfd.

Thank you.


On Sat, Mar 29, 2014 at 10:07 AM, Aaron Cohen aa...@assonance.org wrote:



 On Sat, Mar 29, 2014 at 10:09 AM, Ryan Waters ryan.or...@gmail.comwrote:

 I have some code that blows up the heap and I'm not sure why.  I've
 reduced it down to the following.

 I've tried to make sure the atom doesn't have boundless growth and I
 didn't think 'while' hangs on to the head of sequences so I'm embarrassed
 to say I'm stumped.


 (defn leaks-memory
   []
   (let [mem (atom [])
 chunksize 1000
 threshold 2000]
   (while true
 (swap! mem conj (rand-int 100))

 ; every 'chunksize' item past 'threshold'
 (when (and (= 0 (mod (count @mem) chunksize))
( (count @mem) threshold))
   (swap! mem subvec chunksize)

 (doc subvec)

 Returns a persistent vector of the items in vector from
 start (inclusive) to end (exclusive). If end is not supplied,
 defaults to (count vector). This operation is O(1) and very fast, as
 the resulting vector shares structure with the original and no
 trimming is done.

 subvec is fast, but it's not saving you any memory.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: using contrib functions

2014-03-29 Thread Sean Corfield
On Mar 29, 2014, at 9:39 AM, Sam Ritchie sritchi...@gmail.com wrote:
 defadt defines an algebraic data type - so, imagine a record with a finite 
 number of implementations (Boolean is an algebraic data type since it only 
 has true and false, for example. Chess pieces would be another one.)
 
 Once you define an ADT you can use that contrib library's match macro to do 
 exhaustive case matches. Without the defadt thing, you just have to trust 
 that the user knows how to handle all of your cases.

Cool. That makes sense. I think that part of my 30+ years ago Comp Sci degree 
must be very rusty :)

So what would be the modern Clojure way to implement ADTs...

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)





signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: probably a noobie question: apparent memory leak

2014-03-29 Thread Jonas
You could give core.rrb-vector[1]. From the docs:

The main API entry points are clojure.core.rrb-vector/catvec, 
performing vector concatenation, and clojure.core.rrb-vector/subvec, which 
produces a new vector containing the appropriate subrange of the input 
vector (in contrast to clojure.core/subvec, which returns a view on the 
input vector).

[1] https://github.com/clojure/core.rrb-vector

On Saturday, March 29, 2014 8:42:25 PM UTC+2, Ryan Waters wrote:

 If you do a (count @mem) it reports the length of the atom's vector isn't 
 growing without bounds.  It seems counterintuitive that the parts of the 
 old vector wouldn't get garbage collected because the atom no longer points 
 to them.  But I guess I need to rtfd.

 Thank you.


 On Sat, Mar 29, 2014 at 10:07 AM, Aaron Cohen 
 aa...@assonance.orgjavascript:
  wrote:



 On Sat, Mar 29, 2014 at 10:09 AM, Ryan Waters 
 ryan@gmail.comjavascript:
  wrote:

 I have some code that blows up the heap and I'm not sure why.  I've 
 reduced it down to the following.

 I've tried to make sure the atom doesn't have boundless growth and I 
 didn't think 'while' hangs on to the head of sequences so I'm embarrassed 
 to say I'm stumped.


 (defn leaks-memory
   []
   (let [mem (atom [])
 chunksize 1000
 threshold 2000]
   (while true
 (swap! mem conj (rand-int 100))

 ; every 'chunksize' item past 'threshold'
 (when (and (= 0 (mod (count @mem) chunksize))
( (count @mem) threshold))
   (swap! mem subvec chunksize)

 (doc subvec)

 Returns a persistent vector of the items in vector from
 start (inclusive) to end (exclusive). If end is not supplied,
 defaults to (count vector). This operation is O(1) and very fast, as
 the resulting vector shares structure with the original and no
 trimming is done.

 subvec is fast, but it's not saving you any memory.

 -- 
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: probably a noobie question: apparent memory leak

2014-03-29 Thread Ryan Waters
Nice!  I hadn't seen that before.

Thank you both.


On Sat, Mar 29, 2014 at 3:29 PM, Jonas jonas.enl...@gmail.com wrote:

 You could give core.rrb-vector[1]. From the docs:

 The main API entry points are clojure.core.rrb-vector/catvec,
 performing vector concatenation, and clojure.core.rrb-vector/subvec, which
 produces a new vector containing the appropriate subrange of the input
 vector (in contrast to clojure.core/subvec, which returns a view on the
 input vector).

 [1] https://github.com/clojure/core.rrb-vector


 On Saturday, March 29, 2014 8:42:25 PM UTC+2, Ryan Waters wrote:

 If you do a (count @mem) it reports the length of the atom's vector isn't
 growing without bounds.  It seems counterintuitive that the parts of the
 old vector wouldn't get garbage collected because the atom no longer points
 to them.  But I guess I need to rtfd.

 Thank you.


 On Sat, Mar 29, 2014 at 10:07 AM, Aaron Cohen aa...@assonance.orgwrote:



 On Sat, Mar 29, 2014 at 10:09 AM, Ryan Waters ryan@gmail.comwrote:

 I have some code that blows up the heap and I'm not sure why.  I've
 reduced it down to the following.

 I've tried to make sure the atom doesn't have boundless growth and I
 didn't think 'while' hangs on to the head of sequences so I'm embarrassed
 to say I'm stumped.


 (defn leaks-memory
   []
   (let [mem (atom [])
 chunksize 1000
 threshold 2000]
   (while true
 (swap! mem conj (rand-int 100))

 ; every 'chunksize' item past 'threshold'
 (when (and (= 0 (mod (count @mem) chunksize))
( (count @mem) threshold))
   (swap! mem subvec chunksize)

 (doc subvec)

 Returns a persistent vector of the items in vector from
 start (inclusive) to end (exclusive). If end is not supplied,
 defaults to (count vector). This operation is O(1) and very fast, as
 the resulting vector shares structure with the original and no
 trimming is done.

 subvec is fast, but it's not saving you any memory.

 --
 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 unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@googlegroups.com.

 For more options, visit https://groups.google.com/d/optout.


  --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: test.check, quickcheck concurrency

2014-03-29 Thread Reid Draper
Hi Brian,

clojure.test.check does not currently ship with any concurrency support. 
That being said, I've been working an implementation on Erlang's PULSE, 
which I hope to have usable in the next couple months [1][2]. John's talk 
touches on using state machines to test concurrent code, which is something 
I'd like to attack eventually, but don't have any concrete plans at the 
moment.

Reid

[1] https://groups.google.com/forum/#!topic/clojure-dev/GhG-PbKW_ew
[2] http://www.cse.chalmers.se/~nicsma/papers/finding-race-conditions.pdf

On Friday, March 28, 2014 11:48:20 PM UTC-5, Brian Craft wrote:

 Re: John Hughes' talk at clojure/west, at the end he did a fairly 
 incredible demo of testing concurrency. It doesn't look like this was 
 implemented in test.check (or I'm not finding it). Are there any plans?


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: java interop help for beginner calling java class

2014-03-29 Thread bww00amd...@yahoo.com
Thanks 
I did not set the hierarchy
I will give that a whirl

Regards
Bryan

On Saturday, March 29, 2014 1:07:40 PM UTC-5, Chris Shellenbarger wrote:

 Did you move it to the corresponding directory structure?  So, 
 com.example.mystuff would need a directory hierarchy like 
 com/example/mystuff.  The mystuff directory is where you need to put your 
 java files that are in the com.example.mystuff package.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reuse of Java instances that have the same value

2014-03-29 Thread James Reeves
What about memoizing (clojure.core/memoize) the function that creates the
leaves?

- James


On 29 March 2014 11:36, vte...@gmail.com wrote:

 Hi all,

 maybe someone here can point me to the right direction. I have a large
 lookup tree (millions of entries), but the values in the leafs don't
 contain much information. That is, the number of unique values stored in
 leafs is rather small, same values are used over and over again. I load the
 tree from DB and create leaf values one by one as vectors. Clojure creates
 every time a new vector instance (e.g (= (java.lang.System/identityHashCode
 [1 2]) (java.lang.System/identityHashCode [1 2])) evaluates always to
 false) although most of the time there is no need for that because I
 already have it somewhere and could just reuse previous instance. I
 implemented that optimization manually and it works. The memory consumption
 dropped 20 times. My question is, that is there any way Clojure can do this
 optimization automatically (like Java handles strings for example)? Or are
 there any libraries, that can help to do that?

 Thank you in advance,

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Performance trouble with Processing jar

2014-03-29 Thread tamichan
Thanks Adam

(def applet (new PApplet)) - (def ^PApplet (new PApplet))  results in 
amazing speed!

And, quil certainly uses these type hints, sorry.
In this trouble, I learned the principle of using type hints for much java 
method call.

Ideally I wish clojure compiler may automatically add type when using (new 
...).


2014年3月29日土曜日 23時28分29秒 UTC+9 Adam Clements:

 Have you got type hints? If you do a java method call on something which 
 isn't type hinted then clojure has to use reflection to look up a list of 
 the available methods, which is slw. If however you tell it what type 
 you expect it to be, it can better optimise it. So in the above code you 
 would have something more like (defn draw [^Applet applet] (.line applet 
 ))

 Look up how to turn on reflection warnings in your project and that will 
 highlight all the lines which need attention.

 Hopefully it's as simple as that, but I would have expected quil to have 
 type hints already, so possibly not...

 Adam


 Adam


 On Sat, Mar 29, 2014 at 6:20 AM, tamichan hogehoge...@gmail.comjavascript:
  wrote:

 Hi All

 I'm writing graphic clojure code with Processing jars.
 When I wrote heavy draw code, I found clojure code is slower than an 
 equivalent of java.

 Probably, the cause is java method call.
 I call processing drawing method thousands times per one frame. 
 (.line applet x1 y1 z1 x2 y2 z2)

 So decrease the call count, increase draw performance.
 Do you know anything speed up way of java method call?

 I tied quil, but it was same performance.
 clojure version is 1.5.1

 thanks

 -- 
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: STM and persistent data structures performance on mutli-core archs

2014-03-29 Thread Andy C
Hi,

So this is a follow-up. I claimed that 1 CPU core can saturate the memory
but it turns out I was wrong, at least to some extend. Driven by curiosity
I decided to do some measurements and test my somewhat older MBP 2.2GHz
Inter Core i7. While it obviously all depends on the hardware, I thought it
could be still a good test.

In order to rule out the GC and JVM out of equation I went back to old good
C and wrote a simple program which accesses a 40MB chunk of memory in both
linear and random manner. All tests run a few times to ensure proper warm
up and allocations within OS, however  saw a great deal of consistency.  It
is not scientific by any means, but gives a rough idea what we are dealing
with. Here are results where numbers are normalized gains.

++---++
| # of processes |  random   |  linear|
++---++
|1   |   1.00|   1.00 |
++---++
|2   |   1.97|   1.76 |
++---++
|4   |   3.51|   1.83 |
++---++
|8   |   4.24|   1.86 |
++---++

The conclusion is that in practice two cores can easily saturate memory
buses.  Accessing it in certain patters helps to some extend. Although 8
cores is pretty much all what makes sense unless you do tons of in cache
stuff.

Best,
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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.