Handling XML

2009-12-02 Thread Dennis
doseq [a (:content z)] (println (:dc dc) (:NAME (:attrs z)) (:NAME (:attrs a)) (:VAL (:attrs a)) (:TN (:attrs a) The XML is of the form: ganglia multiple clusters multiple hosts multiple metrics Example of the XML: ... Thanks, Dennis -- You received this message because you a

Re: Handling XML

2009-12-02 Thread Dennis
)) (:use [clojure.xml :only (parse)])) -- Dennis On Wed, Dec 2, 2009 at 10:23 AM, Sean Devlin wrote: > Try the clojure.xml namespace. There's a funciton parse in there that > should help. > > On Dec 2, 10:51 am, Dennis wrote: > > Howdy, > > > > Being new to cl

Re: Handling XML

2009-12-02 Thread Dennis
gt; ./clojure src/ziptest.clj ---> [a1b1c1] ---> [a1b2c1] On Wed, Dec 2, 2009 at 11:38 AM, pmf wrote: > On Dec 2, 4:51 pm, Dennis wrote: > > The XML is of the form: > > ganglia > > multiple clusters > > multiple hosts > > multiple metrics > >

Re: Handling XML

2009-12-02 Thread Dennis
Thanks a bunch, this has been very helpful. -- Dennis On Wed, Dec 2, 2009 at 1:03 PM, Tayssir John Gabbour < tayssir.j...@googlemail.com> wrote: > BTW, I should point out that zip-filter.xml/xml-> is surprisingly > syntaxy. > > (xml-> loc >:CLUSTER :HO

Re: Elegant way to replace a few words in string

2010-05-29 Thread Dennis
goal. I do not disagree with the idea of removing reflection warnings as a rule and not an exception, especially in production software. I should probably not fan this fire, but I did anyways... :) -- Dennis On Fri, May 28, 2010 at 2:45 PM, Laurent PETIT wrote: > > > 2010/5/28 Michae

How to convert a list to arguments?

2010-07-04 Thread dennis
For example: (max 1 2 3) => 3 (max (list 1 2 3)) => (1 2 3) How to convert (list 1 2 3) to arguments for function? Thanks a lot. -- 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

Re: Memoizing a recursive function?

2010-07-22 Thread dennis
You should make a LazySeq to momoize intermediate result: (defn fib[n] (if (> n 2) (+ (fib (- n 2)) (fib (- n 1))) 1)) (def fib (memoize fib)) (def fib-seq (map fib (iterate inc 0))) then take the result by nth: user=> (nth fib-seq 45) 1134903170 user=> (nth fib-seq 46) 1836311903 user

Why can not alter or ref-set ref after commute it?

2010-07-25 Thread dennis
Alter or ref-set a ref after commute would throw a IllegalStateException:Can't set after commute for example: user=> (def counter (ref 0)) #'user/counter (dosync (commute counter inc) (ref-set counter 3)) java.lang.IllegalStateException: Can't set after commute (NO_SOURCE_FILE:0) I want to know

Improvents on agent,user-custom thread pool.

2010-07-25 Thread dennis
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

Re: Why can not alter or ref-set ref after commute it?

2010-07-25 Thread dennis
an't > ref-set it after a commute; the commute isn't done. > > > > On Sun, Jul 25, 2010 at 11:19 AM, dennis wrote: > > Alter or ref-set a ref after commute would throw a > > IllegalStateException:Can't set after commute > > > for example: > &

Re: RabbitMQ

2011-03-24 Thread Dennis
We did the same On Thu, Mar 24, 2011 at 10:30 AM, Mark Rathwell wrote: > > I just wrapped their java client library: > http://www.rabbitmq.com/java-client.html > > On Thu, Mar 24, 2011 at 11:15 AM, Max Weber > wrote: >> >> What is the best Clojure library to work with RabbitMQ? >> >> Best regard

{ANN} clojure-control---DSL for system admin and deployment with many remote machines

2011-07-24 Thread dennis
1.What is clojure-control? The idea came from node-control(https://github.com/tsmith/node- control). Define clusters and tasks for system administration or code deployment, then execute them on one or many remote machines. Clojure-control depends only on OpenSSH and clojure on the local control ma

Re: {ANN} clojure-control---DSL for system admin and deployment with many remote machines

2011-07-24 Thread dennis
eploy release.tar.gz The "release.tar.gz" will be used as "file" argument for scp macro. clojure-control is still on development,any suggestion welcomed. On 7月24日, 下午9时41分, dennis wrote: > 1.What is clojure-control? > > The idea came from node-control(https://github.com/ts

[ANN] clojure-control 0.1.0 released.

2011-07-26 Thread dennis
Clojure-control is an open source clojure DSL for system admin and deployment with many remote machines via ssh. You can define clusters and tasks to execute repeatly,an example: (ns samples (:use [control.core :only [task cluster scp ssh begin]])) (cluster :mycluster :clients [

Shameless self promotion - JavaOne

2011-09-27 Thread Dennis
ic languages to develop new monitoring tools Track Emerging Languages, Tools, and Techniques Optional Track The Java Frontier -- Dennis -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: Shameless self promotion - JavaOne

2011-09-28 Thread Dennis
I am not sure to what extent there will be recording. However, I can send you my slides after the presentation. -- Dennis On Wed, Sep 28, 2011 at 12:47 AM, Boris Mühmer wrote: > Will there be any slides or maybe even a recording of this session? > > I would be very interested in this

Re: Shameless self promotion - JavaOne

2011-10-04 Thread Dennis
Here is a link to my presentation. http://dl.dropbox.com/u/5831287/JavaOne%202011%20-%20Monitoring%20a%20Large-Scale%20Infrastructure%20with%20Clojure%20FINAL.pptx Sorry about the file format :) Let me know if the link doesn't work. -- Dennis On Tue, Oct 4, 2011 at 10:17 AM, C. Arel

Re: Shameless self promotion - JavaOne

2011-10-04 Thread Dennis
Good idea. I am having problems with slideshare displaying the presentation. I probably need to get on another machine to try to convert it to something more useful, and that will take a couple of days. I will post when I do. -- Dennis On Wed, Oct 5, 2011 at 12:05 AM, Leonardo Borges wrote

Re: Shameless self promotion - JavaOne

2011-10-12 Thread Dennis
Here is the slide deck uploaded to slideshare: http://www.slideshare.net/shr3kst3r/java-one-2011-monitoring-a-largescale-infrastructure-with-clojure Sorry for the delay -- Dennis On Wed, Oct 5, 2011 at 12:44 AM, Dennis wrote: > Good idea.  I am having problems with slideshare displaying

A memcached client for clojure wrapping xmemcached

2011-10-29 Thread dennis
Hi,all I wrote a memcached client for clojure wrapping xmemcached.Xmemcached is an opensource high performance memcached client for java. It's name is clj-xmemcached,and it is on github https://github.com/killme2008/clj-xmemcached A basic example: (ns demo (:use [clj-xmemcached.core])) (de

{ANN} clojure-control 0.2.1 released.

2011-10-31 Thread dennis
Clojure-control is a clojure DSL for system admin and deployment with many remote machines via ssh/rsync.It is on github: https://github.com/killme2008/clojure-control 0.2.1 has been released,main highlights: First,A shell command DSL by sunny87,for example: (cd "/home/login" (run "ls") (

A STM profile tool

2012-01-14 Thread dennis
I written a profile tool for clojure STM,it statistics all transactions information such as execution times,execution cost,the retry reason and times etc. If you are interested in it,please check it on github: https://github.com/killme2008/stm-profiler It's just a try to profile STM,if you have

Vararg in protocol methods

2011-01-19 Thread dennis
and say something: (let [ r (Robot.)] (say r "dennis")) It worked and print "hello,dennis",but if i passed more than one arguments,it failed: (let [ r (Robot.)] (say r "dennis" "zhuang")) and threw exception java.lang.IllegalArgumentException: No single me

ANN: A simple scheme interpreter in clojure

2011-01-23 Thread dennis
I have implemented a simple interpreter in clojure,it is just transformed from the interpreter in SICP.Maybe someone interested in it. I have pushed it on github at https://github.com/killme2008/cscheme ,you can clone and run it by yourself. -- You received this message because you are subscribe

Re: ANN: A simple scheme interpreter in clojure

2011-01-24 Thread dennis
Thanks,it is an issue. On Jan 24, 1:09 pm, David wrote: > Line 86 of core.clj is: > >         (list 'cadr caddr) > > and should be: > >         (list 'caddr caddr) > > On Jan 23, 9:45 pm, dennis wrote: > > > I have implemented a simple interpreter

Re: ANN: A simple scheme interpreter in clojure

2011-01-24 Thread dennis
n about the source code in metadata. > > OTOH, the evaluator is AFAIR fairly buggy and incomplete. > > The whole thing is unmaintained now so feel free to scavenge any parts > of it, if you like. > > Cheers, > > Andrzej > > On Mon, Jan 24, 2011 at 11:45 AM, dennis wrot

Re: Use of io!

2013-05-29 Thread dennis zhuang
Yep,wrap code that has side effects, prevent it to be evaluated in STM transaction. 2013/5/30 Maik Schünemann > 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. > > > On Thu, May 30, 20

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
(:a (sorted-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 > 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=&

Re: sorted-map-by issue?

2013-06-06 Thread dennis zhuang
come after :z, and later that :z should come after :a. No sorted tree can > 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/ot

Re: clojure diffs

2013-06-07 Thread Dennis Haupt
intellij can do exactly what you want 2013/6/7 Moocar > Hi all, > > Diffs for clojure code (and lisps in general) can be hard to read. Every > time we wrap a form, any lines below are indented. The resulting diff just > shows that you've deleted lines and added lines, even though you've only >

{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: Clojure in production

2013-06-18 Thread Dennis Roberts
Hi Plínio, We're using clojure for most of our back-end services at iPlant (http://www.iplantcollaborative.org). You can find our source code at https://github.com/organizations/iPlantCollaborativeOpenSource. Dennis On Monday, June 10, 2013 2:47:25 PM UTC-7, Plinio Balduino wrote: &

multimethod noob question

2013-06-22 Thread Dennis Haupt
hi, i was taking a look at multimethods: (defmulti fac int) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n this works however, this also works: (defmulti fac print) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n what exactly is "int" or "pr

can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
hi, i'm trying to compiler a clojure file using intellij. the error i get is: Clojure Compiler: java.io.IOException: The system cannot find the path specified, compiling:(D:\cloj\MultiMethod.clj:3) where the line number is pointing at a line that contains something that is declared in core.clr if

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
i don't know what "properly set up the environment" means exactly, but i can run my script in the repl 2013/6/22 Jim - FooBar(); > On 22/06/13 15:09, Dennis Haupt wrote: > >> where the line number is pointing at a line that contains something that >> is declare

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-until stackoverflow 2013/6/22 Chris Bilson > Dennis Haupt writes: > > > i was taking a look at multimethods: > > (defmulti fac int) > > (defmethod fac 1 [_] 1) > > (defmethod fac :default [n] (*' n (fac (

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
clojure jvm, intellij's repl. i'll try to run the file via commandline and see what happens 2013/6/22 Jim - FooBar(); > On 22/06/13 15:16, Dennis Haupt wrote: > >> i don't know what "properly set up the environment" means exactly, but i >> can

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
running the file works (from inside intellij), just intellijs compilation seems to be broken i can ignore the problem for now 2013/6/22 Dennis Haupt > clojure jvm, intellij's repl. i'll try to run the file via commandline and > see what happens > > > 2013/6/22

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to compile clojure files, something strange happens. if i remove the option to compile the files (and instead just use clojure.main and run them) there is no problem 2013/6/22 Jim - FooBar(); > On 22/06/13 15:21, Dennis Ha

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
yes. all glory to the repl that makes me figure out the internals via experiments :D is there a way to just pass the given value along? 2013/6/22 Chris Bilson > Dennis Haupt writes: > > > i am not trying anything, i just want to figure out what happens. this > is my output

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
ere stuff is the "match" and stuff2 is the complete set of original arguments? can you provide an example where stuff2 has more information than stuff? for fac, both are equal thx :D 2013/6/22 Dennis Haupt > yes. all glory to the repl that makes me figure out the internals

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
"identity" :) 2013/6/22 Chris Bilson > Dennis Haupt writes: > > > yes. all glory to the repl that makes me figure out the internals via > experiments :D > > is there a way to just pass the given value along? > > Yes, that's what I meant by my inspec

multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
i found example that i can do (defmethod x 5 [y] (do stuff)) but can i do (defmethod #(< % 10) [y] (do stuff)) somehow? like in a pattern match of haskell/scala? -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
alues > )) > ;; dispatch on the dispatch values > (defmethod x :less-then-10 [x] (do )) > > Hope it helps > > Las > > > 2013/6/23 Dennis Haupt > >> i found example that i can do >> (defmethod x 5 [y] (do stuff)) >> >> but can i do >&

Re: can't compile anything except "def"

2013-06-23 Thread Dennis Haupt
d > occasional problems with it. > > > On 23 June 2013 02:29, Dennis Haupt <mailto:d.haup...@gmail.com>> wrote: > > it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to > compile clojure files, something strange happens. if i remove the >

{ANN} clj-xmemacched release 0.2.2

2013-06-24 Thread dennis zhuang
An opensource memcached client for clojure wrapping 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 xzhu...@a

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

2013-07-02 Thread dennis zhuang
Maybe he means clear? 2013/7/2 Jim > 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 reference types

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 > what is 'clear' ? cannot find it anywhere... > > Jim > > > > On 02/07/13 12:

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 a

{{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 (ato

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 > If our votes count for anything, then I'd like to add +1 for getting rid > of :use, and stro

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 > Hi All, > > Almost 4 years ago I developed STM with semant

too circular?

2013-08-26 Thread Dennis Haupt
(defn fib-n [n] (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)] (take n (fib 1 1 can't i do a recursion here? how can i achieve this without doing an "outer defn"? -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Re: too circular?

2013-08-27 Thread Dennis Haupt
thx 2013/8/26 Marshall Bockrath-Vandegrift > Dennis Haupt writes: > > > (defn fib-n [n] > > (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)] > > (take n (fib 1 1 > > > > can't i do a recursion here? how can i achieve this without doing

Re: profiler?

2013-08-27 Thread Dennis Haupt
yep, yourkit 2013/8/27 Jay Fields > What are you all using these days? I've been using YourKit and I'm > fairly happy with it. Just making sure I'm not missing out on some new > hotness. > > Cheers, Jay > > -- > -- > You received this message because you are subscribed to the Google > Groups "C

Re: too circular?

2013-08-29 Thread Dennis Haupt
thx again 2013/8/30 Bruno Kim Medeiros Cesar > This exact use case is covered by letfn, which creates a named fn > accessible to all function definitions and the body. That even allows > mutual recursive definitions without declare. Your example would be > > (defn fib-n [n] >(letfn [(fib [

Re: DSL in RTL (Right to Left) languages.

2015-01-14 Thread Dennis Haupt
i encountered a "german" progamming language once. it was terrible. everybody should stick to english when it comes ot programming - you have to do it anyway, and there is no reason not to go ahead and learn a language since that is what brains are built for 2015-01-14 17:11 GMT+01:00 Jesse Alama

{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 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.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 [secure-ra

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 : > 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 : > 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." >

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 : > Well, it took me a while to perhaps get what you were telling me here.

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 : > 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) > (printl

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

2014-08-18 Thread dennis zhuang
ature 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

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 : > For "web stuff" we use jetty (9) apps as uberjar, behind nginx, deployed > and C&C via ansible, hosted on DigitalOcean as well. > Ansible is super easy to

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 : > The volatile construct seems very useful in some particular cases! I have > been missing "ugly-mutab

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

2014-09-13 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?") ([:gre

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

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

2014-09-14 Thread dennis zhuang
auto__)] [[0 ret]] (do ret) [[n ret]] (do (recur (vector (dec n) (+ n ret [[n]] (do (recur (vector n 0) The core procedure is at https://github.com/killme2008/defun/blob/master/src/defun.clj#L97-107 2014-09-15 0:15 GMT+08:00 Herwig Hochleitner : > Hi Dennis, > >

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

2014-09-14 Thread dennis zhuang
GMT+08:00 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 > ...argu

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 : > Hi. > > How many :keywords can I create in Clojure? Is there any limited > number of them? I know of such limitation of Erlang's atom

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

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 : > Hi everyone, > > Here is initial release for Monroe, a > new Clojure nREPL client for Emacs. The main idea behind Monroe is to be > simple, easy to install (just put it

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 : > 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: >&g

Re: Considering dropping Eclipse 3.x support for counterclockwise

2014-12-04 Thread Dennis Haupt
yuno 2014-12-04 11:45 GMT+01:00 Laurent PETIT : > The following Eclipse names are 3.x based : Indigo, Helios, Galileo > > The following are 4.x based : Juno, Kepler, Luna > > 2014-12-04 11:17 GMT+01:00 Laurent PETIT : > >> Hello, >> >> Eclipse 4.x has been around for many years now, and I'm cons

{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-16 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 : >

Re: New to Clojure

2017-01-09 Thread Dennis Roberts
ojure libraries that provide DSLs for generating SQL statements. I've tried http://sqlkorma.com/ and https://github.com/jkk/honeysql, and I've had fairly good luck with both of them. Dennis On Monday, January 9, 2017 at 4:06:30 PM UTC-7, (hash-map :new "to clojure" :need &

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 eval. > > An minimal examp

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 you a fast feedback loop wit

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) user/cr

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 1

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 Record with keyword keys it

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, which brings multimethod > loo

Natural Language Datalog

2017-12-23 Thread Dennis Heihoff
Alex Warth from HARC (Human Advancement Research Center) wrote a natural language datalog engine. It's is used to represent facts and queries in Bret Victor's https://dynamicland.org/ Could it work with Datomic? Demo: http://alexwarth.com/projects/nl-datalog/ Repo: https://github.com/harc/n

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 : > hi, > > I wonder if you tried clj-refactor which has find usages listing all the > usages of your symbol *and* its definitio

{{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: 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 > 7548979534287548957345843954749357348757897) > 65540955260808340

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 the benchmarks as is,

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 java

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 the symbol of a method

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 member using its symbol? >> >> For instance we

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

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 tha

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 tree (excluding test) in th

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 u

Re: Why do map/get and similar return nil if not found?

2016-01-12 Thread Dennis Haupt
i agree with the fast fail camp if a value is nil but is not supposed to be, i want the program to immediately tell me about that instead of telling me later and force me to trace it back. in scala, this is solved by providing 2 methods. one that gives you a result or crashes, one that maybe gives

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

  1   2   3   >