Re: How to indent clojure code in Emacs

2014-01-03 Thread dennis zhuang
use the 'indent-region' function.You can define a function to indent the whole buffer: (defun indent-buffer () Indent whole buffer (interactive) (indent-region (point-min) (point-max)) (message format successfully)) Then bind the function to a key, i bound it to F7 for me:

Re: JAVA_OPTS not accessible in my Clojure project

2014-01-12 Thread dennis zhuang
Tried System/getenv ? 2014/1/12 aidy lewis aidy.le...@gmail.com Hi Phil, M-x cider-jack-in, but the JAVA_OPT properties are also nil if I do a lein run. Thanks Aidy On 12 January 2014 05:25, Matching Socks phill.w...@gmail.com wrote: How did you start the Emacs Cider REPL? --

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
The String a=i+another word; is also compiled into using StringBuilder, see the byte code by javap -v: Code: stack=5, locals=5, args_size=1 0: invokestatic #2 // Method java/lang/System.nanoTime:()J 3: lstore_1 4: iconst_0 5:

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
I forgot to note hat i test the java sample and clojure sample code with the same jvm options '-server'. 2014-03-01 20:03 GMT+08:00 dennis zhuang killme2...@gmail.com: The String a=i+another word; is also compiled into using StringBuilder, see the byte code by javap -v: Code

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
20:07 GMT+08:00 dennis zhuang killme2...@gmail.com: I forgot to note hat i test the java sample and clojure sample code with the same jvm options '-server'. 2014-03-01 20:03 GMT+08:00 dennis zhuang killme2...@gmail.com: The String a=i+another word; is also compiled into using

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
) instruments. 2014-03-01 21:00 GMT+08:00 Jozef Wagner jozef.wag...@gmail.com: Clojure math functions compile down to the same JVM 'instruction' as from java. See http://galdolber.tumblr.com/post/77153377251/clojure-intrinsics On Sat, Mar 1, 2014 at 1:23 PM, dennis zhuang killme2

Re: [ANN] core.rrb-vector 0.0.11 -- Clojure 1.6 compatibility and bug fixes

2014-03-30 Thread dennis zhuang
I can't find any performance benchmark in the home page.Any links?Thanks. 2014-03-31 2:01 GMT+08:00 Michał Marczyk michal.marc...@gmail.com: Hi, I am pleased to announce the 0.0.11 release of core.rrb-vector, a Clojure Contrib library extending the Clojure vector API with logarithmic-time

Re: Imported Java lib can't find classes compiled on the fly

2013-03-17 Thread dennis zhuang
You can make the clojure class loader by yourself: (import '(clojure.lang RT)) (def class-loader (RT/makeClassLoader)) user= (.loadClass class-loader user.Foo) user.Foo 2013/3/17 vemv v...@vemv.net Most definitely :) But that something is hard/confusing should'nt be enough reason to give

Re: Laziness in filter

2013-03-17 Thread dennis zhuang
Yep,it's chunked sequence,just like batch processing. You can use the seq1 function in fogus blog. 2013/3/17 Evan Mezeske emeze...@gmail.com I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ . On Sunday,

Re: Do you know which language the clojure is written by?

2013-04-22 Thread dennis zhuang
Java. But there is some clojure version written in ruby,python,c# and javascript. 2013/4/22 ljcppu...@gmail.com Hi, Do you know which language the clojure is written by? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Use of io!

2013-05-30 Thread dennis zhuang
Yep,wrap code that has side effects, prevent it to be evaluated in STM transaction. 2013/5/30 Maik Schünemann maikschuenem...@gmail.com I think It stops other code to wrap around the code with the explicit io! call. Its declarative way of saying: I am doing io! DONT USE me inside a dosync.

sorted-map-by issue?

2013-06-06 Thread dennis zhuang
user= (sorted-map-by (constantly 1) :b 1 :a 2) {:b 1, :a 2} user= (:a (sorted-map-by (constantly 1) :b 1 :a 2)) nil user= (keys (sorted-map-by (constantly 1) :b 1 :a 2)) (:b :a) user= (count (sorted-map-by (constantly 1) :b 1 :a 2)) 2 user= (:a (sorted-map-by (constantly 1) :b 1 :a 2)) nil It

Re: sorted-map-by issue?

2013-06-06 Thread dennis zhuang
-map-by #(if (= %1 %2) 0 1) :b 1 :a 2)) 2 user= (:b (sorted-map-by #(if (= %1 %2) 0 1) :b 1 :a 2)) 1 2013/6/6 dennis zhuang killme2...@gmail.com user= (sorted-map-by (constantly 1) :b 1 :a 2) {:b 1, :a 2} user= (:a (sorted-map-by (constantly 1) :b 1 :a 2)) nil user= (keys (sorted-map

Re: sorted-map-by issue?

2013-06-06 Thread dennis zhuang
hope to return correct results given such an inconsistent comparator. More examples and discussion at the link below, if you are interested: https://github.com/jafingerhut/thalia/blob/master/doc/other-topics/comparators.md Andy On Thu, Jun 6, 2013 at 4:19 AM, dennis zhuang killme2

{ANN} A clojure macro and ruby script to profile clojure program.

2013-06-08 Thread dennis zhuang
A macro named `p` to log data, and a ruby script to parse log file,and it will give the statistics result of a clojure program: Parsing log file test.log ... Prowl profile results: Labels: Label:logic count:1 Method: method2mean: 10.81 min: 10.81

Re: A memcached client for clojure wrapping xmemcached

2011-10-29 Thread dennis zhuang
An example with more detail is on https://github.com/killme2008/clj-xmemcached/blob/master/example/demo.clj 2011/10/29 dennis killme2...@gmail.com Hi,all I wrote a memcached client for clojure wrapping xmemcached.Xmemcached is an opensource high performance memcached client for java.

Re: Why :inline have to define the function twice?

2012-07-16 Thread dennis zhuang
function without repetition. --Aaron On Sun, Jul 15, 2012 at 10:43 PM, dennis zhuang killme2...@gmail.comwrote: Inline a function in clojure is easy,just define a :inline form to meta map and it will be inlined into the form which calls it.For example,the pos? function in clojure.core: (defn pos

Re: Why :inline have to define the function twice?

2012-07-16 Thread dennis zhuang
Thanks. Yeath,i know the defline macro,and it is the best way to define inline function.I got your point,thanks. 2012/7/17 Aaron Cohen aa...@assonance.org On Mon, Jul 16, 2012 at 11:26 AM, dennis zhuang killme2...@gmail.com wrote: Yes, thank you for your reply,i total agree with you about

{ANN} ring.velocity: render apache velocity templates for ring in clojure.

2012-07-17 Thread dennis zhuang
Hi,all Apache velocity http://velocity.apache.org/is a great java template engine used widely. I want to use it in clojure with compojure and ring framework,so i've created this project---ring.velocity. Home: https://github.com/killme2008/ring.velocity Getting started: Adds dependency in

Re: {ANN} ring.velocity: render apache velocity templates for ring in clojure.

2012-07-17 Thread dennis zhuang
A little error in getting started missing :age (render test.vm :name dennis :age 29) 2012/7/17 dennis zhuang killme2...@gmail.com Hi,all Apache velocity http://velocity.apache.org/is a great java template engine used widely. I want to use it in clojure with compojure and ring

Re: {ANN} ring.velocity: render apache velocity templates for ring in clojure.

2012-07-17 Thread dennis zhuang
其实就是几行代码封装下,我觉的velocity比什么enlive好用多了。 2012/7/18 Shen, Feng shen...@gmail.com 不错不错。 velocity 在java中用得较广。 这样为potential 的 clojure用户铺了一下道路。 沈锋 美味书签 http://meiwei.fm http://mei.fm On Wed, Jul 18, 2012 at 12:00 AM, dennis zhuang killme2...@gmail.comwrote: A little error in getting started

{ANN} clojure-control 0.4.1 released.

2012-07-17 Thread dennis zhuang
Clojure-control https://github.com/killme2008/clojure-control is a clojure tool library to execute user defined tasks on remote machines grouped into cluster just like fabric in python or node-control in node.js. *Home*: https://github.com/killme2008/clojure-control Control 0.4.1 released,it has

Re: {ANN} clojure-control 0.4.1 released.

2012-07-18 Thread dennis zhuang
I see,thanks. Pallet is more powerful than clojure-control.It seems that it contains many features for cloud service rather than just a deployment tool. And clojure-control is just a deployment tool like fabric in python for many machines using SSH,it can reuse tasks and clusters,and have a

Re: why does Clojure need to cache keywords?

2012-07-18 Thread dennis zhuang
Compare keywords can be very fast. 在 2012-7-18 PM4:51,jaime xiejianm...@gmail.com写道: Hello, When I read the source code keyword, say, Keyword.java (V1.3), I found that when we intern a keyword, (if I understand it correctly) it uses a cache for keywords:

Re: why does Clojure need to cache keywords?

2012-07-18 Thread dennis zhuang
I think this cache is just the same with String.intern method in java,it just want to reduce the cost (memory cpu) of producing keywords frequently especial when using them with map structure. 2012/7/18 jaime xiejianm...@gmail.com I doubt because keyword will use its internal Symbol object to

Re: {ANN} ring.velocity: render apache velocity templates for ring in clojure.

2012-07-19 Thread dennis zhuang
美味书签 http://mei.fm On Wed, Jul 18, 2012 at 11:59 AM, dennis zhuang killme2...@gmail.com mailto:killme2...@gmail.com wrote: 其实就是几行代码封装下,**我觉的velocity比什么enlive好用多了。 2012/7/18 Shen, Feng shen...@gmail.com mailto:shen...@gmail.com 不错不错。 velocity 在java中用得较广

Re: [ANN] Okku 0.1.0 - Akka interface for Clojure

2012-07-21 Thread dennis zhuang
Great work.Thanks. 2012/7/20 Gary Verhaegen gary.verhae...@gmail.com Okku is a thin wrapper around the Akka library that makes it easy to use it from Clojure. The Actor model can be considered a nice alternative for concurrent programming, but it really shines when you want to distribute

Re: [ANN] Okku 0.1.0 - Akka interface for Clojure

2012-07-21 Thread dennis zhuang
I try to run okku-pi,but it could not find okku 0.1.1-SNAPSHOT: Could not find artifact org.clojure.gaverhae:okku:jar:0.1.1-SNAPSHOT in clojars (https://clojars.org/repo/) Should i use 0.1.0? 2012/7/21 dennis zhuang killme2...@gmail.com Great work.Thanks. 2012/7/20 Gary Verhaegen

Re: Why does (conj (transient {}) {}) fail with CCE?

2012-08-09 Thread dennis zhuang
you must use conj! instead of conj. 在 2012-8-9 PM8:49,Jacek Laskowski ja...@japila.pl写道: Hi, I've been digging into the sources of Clojure and found frequencies. There's the transient function and I thought I'd use it with a map and conj. Why does this fail? user= (conj {} {:y 1}) {:y 1}

Re: Question about doseq

2012-10-30 Thread dennis zhuang
Please use prn insteadof println. By default, pr and prn print in a way that objects can be read by the reader,but print and println produce output for human consumption. 2012/10/31 arekanderu arekand...@gmail.com Hello all, I have the following code: (def my-hash {1 {:a-key {:value a

Re: converting a string to a list

2012-01-14 Thread dennis zhuang
You can do this ((comp #(map str %) seq) abcdef) (a b c d e f) 2012/1/15 Bruce Durling b...@otfrom.com Sam, Strings can be turned into sequences with seq. (seq foo) (\f \o \o) The backslashes are because f o and o are character literals. cheers, Bruce On Sat, Jan 14, 2012 at

Re: A STM profile tool

2012-01-16 Thread dennis zhuang
hi,all I've upgraded the version to 1.0.1-SNAPSHOT. And added a new function ref-stats to get the statistics information of a reference.For example: =(use'stm) =(def a (ref 1)) =(def b (ref 2)) =(dotimes [_ 100] (future (dosync (alter a + 1) (alter b - 1 =@a 101 =@b -98 =(stm-stats) {(alter

Re: Sorry Don't understand for macro, a bug or a newbie-question??

2012-01-18 Thread dennis zhuang
for returns a lazy sequence.You may prefer doseq: (defn fortest2 [] (doseq [a (range 2 10) b (range 2 10)] (do (println x: a b: b) (list a b))) (println ende) ) (fortest2) doseq will be forced for side-effects. 2012/1/19 Jack Moffitt j...@metajack.im doesn't show any

{ANN} clojure-control 0.2.4 is out

2012-02-13 Thread dennis zhuang
Hi,all Clojure-control is a clojure DSL for system admin and deployment with many remote machines via ssh,and i have checked out a branch to make it work with clojure 1.3 now. At last, control 0.2.4 works well with clojure 1.3,and 0.2.3 works well with clojure 1.2:

Re: Problem with amap over byte arrays

2012-02-16 Thread dennis zhuang
Because bit-xor returns a integer,so you have to cast it to byte: (amap ^bytes an-array idx ret (byte (bit-xor (byte 0) (aget ^bytes an-array idx 2012/2/17 Andreas Kostler andreas.koestler.le...@gmail.com Hi all, I'm experiencing the following problem: (def an-array

{ANN} Clojure-Control 0.3.0 is out

2012-02-18 Thread dennis zhuang
Hi,all Clojure-control https://github.com/killme2008/clojure-control is a clojure DSL for system admin and deployment with many remote machines via ssh. I am pleased to annoucment that clojure-control 0.3.0 is out.It adds some powerful features in this release ,includes: - ssh and scp

Re: Parallel SSH and system monitoring in Clojure

2012-03-15 Thread dennis zhuang
There is a clojure-control: https://github.com/killme2008/clojure-control 2012/3/16 Chris McBride cmm7...@gmail.com Hi, I releases two simple clojure libraries to help running commands via SSH on multiple servers. Hopefully someone will find it useful.

{ANN}Clojure-Control 0.3.2 is out

2012-03-24 Thread dennis zhuang
Hi,all I am pleased to announce that clojure-control 0.3.2 is out.Clojure-control is a clojure DSL for system admin and deployment with many remote machines via ssh.Please see https://github.com/killme2008/clojure-control Main highlights in 0.3.2: 1.You can include other clusters in

Re: Clojure Toolbox

2012-03-24 Thread dennis zhuang
Another link http://cnlojure.org/open.html 2012/3/24 Rostislav Svoboda rostislav.svob...@gmail.com A nice list of tools and libraries I stumbled upon. Enjoy! http://www.clojure-toolbox.com/ -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: seeking a lazy way to interleave a constant

2012-04-09 Thread dennis zhuang
D o you want this? user= (def x (interleave (iterate inc 1) (repeat 0))) #'user/x user= (take 10 x) (1 0 2 0 3 0 4 0 5 0) 2012/4/10 Andrew ache...@gmail.com Given a lazy sequence of numbers is there a way to interleave a constant and get another lazy sequence? Say the first sequence is 1 2 3 4

Re: Inconsistent refs within an STM transaction.

2012-04-16 Thread dennis zhuang
Hi Transaction read point is changed every time when transaction is started or retried.So the result is all right.If you want the ref1 cloud not be modified by other transactions ,you can use ensure: (defn deref-delay-deref [ref1 ref2 delay] (.start (Thread.

Re: question about partial

2012-04-16 Thread dennis zhuang
user= (defn f[x y] (+ x y)) #'user/f user= (- 3 ((partial f 2))) 5 It must works :). Please notice the extra parentheses. 2012/4/17 larry larrye2...@gmail.com On Monday, April 16, 2012 10:02:48 AM UTC-7, Cedric Greevey wrote: (- 3 ((partial f 2))) should also work. I just wrote that it

{ANN} Clojure-Control 0.3.3 release

2012-04-30 Thread dennis zhuang
Clojure-control: a clojure DSL for system admin and deployment with many remote machines via ssh Usage: https://github.com/killme2008/clojure-control *Release 0.3.3* - New function (set-options! key value) to set global options,include keys :ssh-options,:scp-options,:rsync-options and :user

Re: {ANN} Clojure-control 0.3.4 released

2012-05-10 Thread dennis zhuang
*A new release 0.3.5:* --Now you can run a task with user@host rather than a pre-defined cluster by: lein control run user@host task args *Upgrade:* lein plugin install control 0.3.5 2012/5/10 dennis zhuang killme2...@gmail.com Clojure-control: a clojure DSL for system admin

Re: {ANN} Clojure-control 0.3.4 released

2012-05-10 Thread dennis zhuang
I am sorry, 0.3.5 will break the example with only :clients in cluster. I've push 0.3.6 to clojars, upgrade control by: lein plugin install control 0.3.6 Sorry for this issue,thanks. 2012/5/11 Rostislav Svoboda rostislav.svob...@gmail.com I took the steps from your README.md and it seems

{ANN} clj.monitor: monitoring applications in clojure

2012-05-12 Thread dennis zhuang
Hi,all I've implemented a simple DSL for monitoring apps in clojure based on SSH. Usage: goog_1871645686https://github.com/killme2008/clj.monitor An example: (defcluster mysql :clients [{:user deploy :host mysql.app.com}]) (defmonitor mysql-monitor ;;Tasks to monitor

Re: Buggy FP behavior with Clojure 1.3

2012-06-25 Thread dennis zhuang
user= Double/MAX_VALUE 1.7976931348623157E308 2012/6/26 Sean Corfield seancorfi...@gmail.com On Mon, Jun 25, 2012 at 9:19 PM, Cedric Greevey cgree...@gmail.com wrote: user= 1e309 Infinity FWIW, on 1.4.0 I get: user= 1e309 CompilerException java.lang.RuntimeException: Unable to

Re: Buggy FP behavior with Clojure 1.3

2012-06-25 Thread dennis zhuang
Added a postfix M to make the number as BigDecimal or N as a BigInteger: user= 1e308M 1E+308M user= (class 1e308M) java.math.BigDecimal user= (* 10.0 1e108M) 1.0E109 2012/6/26 Cedric Greevey cgree...@gmail.com On Tue, Jun 26, 2012 at 1:11 AM, Sean Corfield seancorfi...@gmail.com wrote: On

{ANN} clj-xmemacched release 0.2.2

2013-06-24 Thread dennis zhuang
An opensource memcached client for clojure wrapping xmemcachedhttp://code.google.com/p/xmemcached/.It released 0.2.2, added 'clj-json-transcoder' that encode/decode values using clojure.data.json. https://github.com/killme2008/clj-xmemcached -- 庄晓丹 Email:killme2...@gmail.com

Re: reset! and merge for (transient {})

2013-07-02 Thread dennis zhuang
Maybe he means clear? 2013/7/2 Jim jimpil1...@gmail.com No merge will not work with transients because it uses conj instead of conj! If you absolutely have to do this define your own 'merge!' that uses conj!. I'm not sure what you mean by reset! for transients...reset! is an operation on

Re: reset! and merge for (transient {})

2013-07-02 Thread dennis zhuang
Clear the collection. user= (doc empty) - clojure.core/empty ([coll]) Returns an empty collection of the same category as coll, or nil nil 2013/7/2 Jim jimpil1...@gmail.com what is 'clear' ? cannot find it anywhere... Jim On 02/07/13 12:03, dennis zhuang wrote

Re: core.async

2013-07-06 Thread dennis zhuang
It's so cool,great job! But i don't find any way to do io blocking operations such as socket.read in 'go'. Is there a roadmap to make alts! working with java NIO selector that waits on socket channels? Then we can read/write data with socket/file channel in go without blocking. Thanks,it's really

{{ANN} clj-xmemcached release 0.2.3

2013-07-19 Thread dennis zhuang
An opensource memcached client for clojure,it wraps xmemcached. 0.2.3 releases, main highlights: 1.Supports delete with CAS value in binary protocol ;;delete with CAS (xm/delete num (:cas (gets num))) 2.Supports lighweight distribution lock with try-lock macro: (def counter (atom

Re: Can we please deprecate the :use directive ?

2013-07-24 Thread dennis zhuang
I am using ':use' for my own namespaces.I know it's discouraged, but if i can control my own code,why not? Compiler can give me warnings and i process all warnings carefully. 2013/7/25 Steven Degutis sbdegu...@gmail.com If our votes count for anything, then I'd like to add +1 for getting rid

Re: Entwined STM V1.0

2013-08-18 Thread dennis zhuang
That's really cool. Do you have any performance benchmark between TransactionalMap and java.util.concurrent.ConcurrentHashMap? When should i use these collections instead of java.util.concurrent.* collections? 2013/8/18 Ivan Koblik ivankob...@gmail.com Hi All, Almost 4 years ago I

Re: get fn and not-found

2013-10-27 Thread dennis zhuang
The function's arguments will be evaluated before calling it. So the (my-foo) will be called before 'get'. 2013/10/28 Ryan arekand...@gmail.com Hello, I am trying to understanding why is this happening: (defn my-foo [] (println Why do I get printed?)) #'sandbox4724/my-foo (get {:b 1}

{{ANN} clj-xmemcached release 0.2.4

2014-04-27 Thread dennis zhuang
An opensource memcached client for clojure,it wraps xmemcached. 0.2.4 releases, main highlights: - Upgrade xmemcached to 2.0.0https://github.com/killme2008/xmemcached/releases/tag/xmemcached-2.0.0, 10% performance improved for text protocol and fixed some issues. - Added

Re: Effective Clojure book?

2014-06-04 Thread dennis zhuang
《The joy of clojure》 ? 2014-06-05 9:30 GMT+08:00 Mike Fikes mikefi...@me.com: Are there any books yet that prescribe best practices for Clojure, à la Meyers or Bloch? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

{ANN} clj.qrgen and securen-rand : generate QRCode and secure random in clojure

2014-06-22 Thread dennis zhuang
*clj.qrgen*: https://github.com/killme2008/clj.qrgen Generate QRCode in clojure: (as-file (from hello world)) *secure-rand*: https://github.com/killme2008/secure-rand Secure version for clojure.core/rand etc. (ns test (:refer-clojure :exclude [rand rand-int rand-nth]) (:use

CtorReader bug?

2014-08-16 Thread dennis zhuang
user= #java.lang.String[hello world] hello world user= #java.lang.String[(byte-array) utf8] IllegalArgumentException No matching ctor found for class java.lang.String clojure.lang.Reflector.invokeConstructor (Reflector.java:183) It seems that the CtorReader

Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Sorry,the error example must be: user= #java.lang.String[(byte-array 10) utf8] IllegalArgumentException No matching ctor found for class java.lang.String clojure.lang.Reflector.invokeConstructor (Reflector.java:183) 2014-08-16 19:59 GMT+08:00 dennis zhuang killme2...@gmail.com: user

Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Got it. Thanks for your quick reply. 2014-08-16 20:14 GMT+08:00 Nicola Mometto brobro...@gmail.com: It's by design, see the section on ctor literals http://clojure.org/reader#toc1 The elements in the vector part are passed unevaluated to the relevant constructor. Nicola dennis zhuang

Re: Supplied-p parameter in clojure similar to lisp lambda lists

2014-08-17 Thread dennis zhuang
I think that adding a :p option to destructuring would be great: (let [ {:keys [a b c] :p {a a-p}} params] (if a-p (println a) (println a is not exists.))) 2014-08-17 20:05 GMT+08:00 Dave Tenny dave.te...@gmail.com: Well, it took me a while to perhaps get what you were

Re: Supplied-p parameter in clojure similar to lisp lambda lists

2014-08-18 Thread dennis zhuang
I created a ticket http://dev.clojure.org/jira/browse/CLJ-1508 2014-08-18 11:02 GMT+08:00 dennis zhuang killme2...@gmail.com: I think that adding a :p option to destructuring would be great: (let [ {:keys [a b c] :p {a a-p}} params] (if a-p (println a) (println

Re: Supplied-p parameter in clojure similar to lisp lambda lists

2014-08-18 Thread dennis zhuang
feature is necessary, since all you need to do to emulate it is a (:baz all-keys) to know if the user explicitly specified it. I.e. I think the capability is already present in adequate form but the documentation on map destructuring could be improved. On Sun, Aug 17, 2014 at 11:02 PM, dennis

Re: Clojure production environment

2014-08-20 Thread dennis zhuang
jetty + lein jar + lein libdir,and used fabric to deploy applications.Uses nginx as load balancer. 2014-08-20 16:55 GMT+08:00 Max Penet m...@qbits.cc: For web stuff we use jetty (9) apps as uberjar, behind nginx, deployed and CC via ansible, hosted on DigitalOcean as well. Ansible is super

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-11 Thread dennis zhuang
May be the LongAdder in Java8 can beat AtomicLong :D http://blog.palominolabs.com/2014/02/10/java-8-performance-improvements-longadder-vs-atomiclong/ 2014-09-11 17:30 GMT+08:00 Linus Ericsson oscarlinuserics...@gmail.com: The volatile construct seems very useful in some particular cases! I

{ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
Hi , i am pleased to introduce defun https://github.com/killme2008/defun: a beautiful macro to define clojure functions with pattern match. Some examples: (defun say-hi ([:dennis] Hi,good morning, dennis.) ([:catty] Hi, catty, what time is it?) ([:green] Hi,green, what a good day!)

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
Released 0.1.0-RC, defun collect :arglists metadata, another recursive function example: (defun accum ([0 ret] ret) ([n ret] (recur (dec n) (+ n ret))) ([n] (recur n 0))) (accum 100) ;; the result is 5050 2014-09-14 14:46 GMT+08:00 dennis zhuang killme2...@gmail.com

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
Hi Herwig Actually,defun just define a variadic arguments function,so it doesn't have different arities. And when using defun macro ,it walk through the body forms, find 'recur' forms and replace them with (recur (vector ...arguments)) instead. A macroexpand-1 result of accum: (macroexpand-1

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
dennis zhuang killme2...@gmail.com: Hi Herwig Actually,defun just define a variadic arguments function,so it doesn't have different arities. And when using defun macro ,it walk through the body forms, find 'recur' forms and replace them with (recur (vector ...arguments)) instead

Re: keywords

2014-09-15 Thread dennis zhuang
Clojure's keyword is using a soft reference cache, they would be garbage collected when used memory reaches threshold. 2014-09-15 18:36 GMT+08:00 Paweł Sabat noni...@gmail.com: Hi. How many :keywords can I create in Clojure? Is there any limited number of them? I know of such limitation of

Re: How do I track down a painfully long pause in a small web app?

2014-09-24 Thread dennis zhuang
You can use jstat -gcutil pid 2000 to print the GC statistics every 2 seconds, http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html It the long pause is from GC, the columns FGCT/FGC values would be large. If you think it's a swap issue, you may want to use vmstat 1 1

Re: [ANN] Monroe 0.1.0 - nrepl client for Emacs

2014-09-24 Thread dennis zhuang
Looks great.But it doesn't support code completion? 2014-09-25 0:50 GMT+08:00 Sanel Zukan san...@gmail.com: Hi everyone, Here https://github.com/sanel/monroe is initial release for Monroe, a new Clojure nREPL client for Emacs. The main idea behind Monroe is to be simple, easy to install

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-26 Thread dennis zhuang
I will add supporting for clojurescript this weekend.Thanks for your suggestion. 2014-09-26 1:09 GMT+08:00 Ivan L ivan.laza...@gmail.com: Is this clojurescript ready? This looks amazing, I would also love to have it in core. On Sunday, September 14, 2014 2:47:28 AM UTC-4, dennis wrote:

{ANN} clj-archaius releases: wrapper for netflix archaius

2015-07-02 Thread dennis zhuang
Hi,all I create a new project https://github.com/leancloud/clj-archaius that wraps netflix https://github.com/Netflix/archaius archaius https://github.com/Netflix/archaius library for configuration management. It's really simple to use in your project,i hope it can help someone that is using

{{ANN}} clj-rate-limiter: rate limiter for clojure backed by memory or redis.

2015-08-17 Thread dennis zhuang
clj-rate-limiter is a rate limiter for clojure,that supports a rolling window, either in-memory or backed by redis. https://github.com/killme2008/clj-rate-limiter Hope it can help someone. -- 庄晓丹 Email:killme2...@gmail.com xzhu...@avos.com Site: http://fnil.net Twitter:

Re: [ANN] sniper, emacs assistant for deleting dead code

2015-07-29 Thread dennis zhuang
Cool work. But missing installation or user guide in readme.md? I don't know how to use it in my project. I want to try it. 2015-07-30 13:26 GMT+08:00 benedek fazekas benedek.faze...@gmail.com: hi, I wonder if you tried clj-refactor which has find usages listing all the usages of your

{{ANN}} defun 0.3.0-alapha: supports clojurescript

2015-10-24 Thread dennis zhuang
defun is a macro to define clojure functions with parameter pattern matching just like erlang or elixir based on core.match. https://github.com/killme2008/defun Thanks to sander dijkhuis , it supports clojurescript right now. You

Re: how to speedup lein uberjar?

2015-10-27 Thread dennis zhuang
Recommend to use libdir plugin: https://github.com/djpowell/lein-libdir Run lein libdir to copy all the dependencies to lib directory, and just run lein jar to package the project. Then you can rsync or copy the project jar with all dependent jars instead of compiling all dependent namespaces

Re: Largest Clojure codebases?

2015-11-15 Thread dennis zhuang
I use cloc(http://cloc.sourceforge.net/) to counting the LOC of our projects, it's total about 41025 lines of Clojure code. 2015-11-16 7:22 GMT+08:00 Colin Yates : > Exactly this. I couldn’t find a reliable way of counting LOC but my > (Clojure/ClojureSciprt) src

Re: Locking non-local variable inside macro

2015-11-15 Thread dennis zhuang
I think the reason is in macroexpand-1 result: user=> (macroexpand-1 '(mac1 1)) (clojure.core/locking # 1) It's not a valid form to be read and eval by clojure reader,the object form can't be parsed. If define obj to be a map {}, it works fine: user=> (def obj {}) #'user/obj user=> (mac1 1) 1

Re: Calling object members with symbols

2015-10-18 Thread dennis zhuang
In such case you have to use `eval`, another post https://groups.google.com/forum/#!topic/clojure/YJNRnGXLr2I 2015-10-19 9:10 GMT+08:00 James Reeves : > On 18 October 2015 at 23:54, Timur wrote: > >> Hi all, >> >> Is there anyway to call an object

Re: Calling object members with symbols

2015-10-18 Thread dennis zhuang
You may have to use macro: user=> (defmacro invoke [obj sym] `(. ~obj ~sym)) #'user/invoke user=> (invoke 1 toString) "1" 2015-10-19 6:54 GMT+08:00 Timur : > Hi all, > > Is there anyway to call an object member using its symbol? > > For instance we have an object o, we get

Re: numbers, why?

2015-09-04 Thread dennis zhuang
Because the literal is readed as BigInt: user=> (class 6546546546546546546850348954895480584039545804 ) clojure.lang.BigInt 2015-09-04 22:48 GMT+08:00 Ali M : > why? > > > user=> (+ 6546546546546546546850348954895480584039545804 >

Re: Just found out about Elixirs function argument pattern matching...

2015-09-07 Thread dennis zhuang
Thanks for your benchmark. I will upgrade all the dependencies and release 0.2.0 We are using defun with instparse in a DSL implementation, the performance is acceptable, but the code is much more readable. 2015-09-06 4:33 GMT+08:00 Rob Lally : > Out of interest, I ran

Re: Bug in DynamicClassLoader?

2015-09-16 Thread dennis zhuang
I don't think it's a bug. Indeed, the class loader will invoke loadClass, and the loadClass method will checking the parent class loader for the requested class, if it is not found,then invoke findClass of current class loader implementation to find the requested class as describe in loadClass

Re: which GC optimizations work better with Clojure?

2016-04-29 Thread dennis zhuang
It depends. CMS or G1 would be better in common cases as you said, clojure runtime has many short-lived objects. We are using G1 in your production. But sometimes you would prefer system throughput rather than GC pause time, you may try Parallel GC. 2016-04-29 19:02 GMT+08:00 Camilo Roca

Re: apply madness

2016-05-12 Thread dennis zhuang
A try: (let [raw (list :a 1 :b 2 :c 3)] (->> raw (partition 2) (filter #(even? (second %))) (map vec) (into {}) (merge {:raw raw}))) => {:b 2, :raw (:a 1 :b 2 :c 3)} 2016-05-12 15:46 GMT+08:00 hiskennyness : > This does what I want

{ANN}} Carmine-sentinel: connect redis by sentinel, make carmine to support sentinel.

2016-10-13 Thread dennis zhuang
Hi, all I wrote a library to make carmine support redis sentinel : https://github.com/killme2008/carmine-sentinel Someone may want to try it if you are interested. It's a beta release, feedback is welcome. -- 庄晓丹 Email:

Re: {ANN}} Carmine-sentinel: connect redis by sentinel, make carmine to support sentinel.

2016-10-17 Thread dennis zhuang
lave? true}) (defmacro wcars* [& body] `(cs/wcar slave-conn ~@body)) (wcars* (car/set "key" 1)) ;; ExceptionInfo READONLY You can't write against a read only slave More info please visit https://github.com/killme2008/carmine-sentinel 2016-10-13 19:43 GMT+08:00 dennis zhuang <killme2...@g

Re: Java object in eval

2017-03-30 Thread dennis zhuang
You should quote the binding vector: (let [v '[D (LocalDate/of 2017 03 30)] f '(.getYear D)] (eval `(let ~v ~f))) 2017-03-30 16:04 GMT+08:00 'Burt' via Clojure : > Hi, > > I want to pass Java objects to a piece of code via let and then get it > evaluated with

Re: Clojure rookie vs parsing

2017-08-15 Thread dennis zhuang
In my experience, instaparse + defun is a good choice. https://github.com/Engelberg/instaparse https://github.com/killme2008/defun/ 2017-08-15 22:02 GMT+08:00 Gary Trakhman : > I enjoyed working with clj-antlr recently, it's a wrapper over a java > library, but gives

Re: The performance of plain map vs. defrecord

2017-10-08 Thread dennis zhuang
First, the alphabet-macro is wrong, it should use name instead of str in comp: user=> (macroexpand-1 '(alphabet-macro)) (do (clojure.core/defrecord Alphabet [:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u :w :v :x :y :z]) (def dummy-record (Alphabet. 0 1 2 3 4 5 6 7 8 9 10 11 12

Re: Starting Clojure again

2017-09-06 Thread dennis zhuang
1.Maybe you can use :pre metadata: (defn create-pin ([] (create-pin 8)) ([n] {:pre [(<= n 16) (>= n 4)]} (let [chars (map char (range (int \0) (inc (int \9] (reduce str (repeatedly n #(rand-nth chars)) (create-pin 3) AssertionError Assert failed: (>= n 4)

Re: The performance of plain map vs. defrecord

2017-10-09 Thread dennis zhuang
In fact they are symbols, but print as keywords: user=> (symbol ":a") :a user=> (symbol? (symbol (str :a))) true 2017-10-09 16:26 GMT+08:00 Peter Hull : > Slightly off-topic, but why doesn't using the 'incorrect' alphabet-macro > give an error? If I try and define a

Re: [ANN] faster-multimethods

2017-10-12 Thread dennis zhuang
why not merge it to clojure.core multimethods? I think it's a valuable work, you can create a patch to make clojure better. See https://clojure.org/community/contributing 2017-10-13 8:13 GMT+08:00 John Alan McDonald : > Beta release (0.1.0) of faster-multimethods,