Handling XML

2009-12-02 Thread Dennis
Howdy,

Being new to clojure, I am having a difficult time parsing XML in an elegant
manner.  I am pulling metric information from a ganglia server as XML and
then parsing it.  The below function works but it makes me feel icky.  I was
hoping for some tips.

The "dc" variable contains a map with some data center information (not
really interesting), and the "stream" variable comes from http.agent.

(defn handle-xml [dc stream]
  (let [xml-out (xml-seq (parse (http/stream stream)))]
(doseq [x xml-out]
  (doseq [y (:content x)]
(doseq [z (:content y)]
  (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 are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Handling XML

2009-12-02 Thread Dennis
Sean,

I probably did not make it clear, but I am using parse.  The second line of
handle-xml function in my original E-Mail has the parse in it.  I then
iterate over the xml-seq.

I am also using:
(ns zod
  (:require [clojure.contrib.http.agent :as http])
  (:import (java.util Timer TimerTask))
  (: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 clojure, I am having a difficult time parsing XML in an
> elegant
> > manner.  I am pulling metric information from a ganglia server as XML and
> > then parsing it.  The below function works but it makes me feel icky.  I
> was
> > hoping for some tips.
> >
> > The "dc" variable contains a map with some data center information (not
> > really interesting), and the "stream" variable comes from http.agent.
> >
> > (defn handle-xml [dc stream]
> >   (let [xml-out (xml-seq (parse (http/stream stream)))]
> > (doseq [x xml-out]
> >   (doseq [y (:content x)]
> > (doseq [z (:content y)]
> >   (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:
> > 
> >  > OWNER="unspecified" LATLONG="unspecified" URL="unspecified">
> >  TN="3"
> > TMAX="20" DMAX="86400" LOCATION="unspe
> > cified" GMOND_STARTED="1255757736">
> >  TN="6684"
> > TMAX="1200" DMAX="0" SLOPE="both" SOURCE="gmond"/>
> >  > TMAX="1200" DMAX="0" SLOPE="zero" SOURCE="gmond"/>
> > ...
> >
> > Thanks,
> > Dennis
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Handling XML

2009-12-02 Thread Dennis
Thanks, I think I have the idea.

(ns ziptest
  (:require [clojure.zip :as zip]
[clojure.xml :as xml]
[clojure.contrib.zip-filter :as zf])
  (:use clojure.contrib.zip-filter.xml)
  (:import (java.io ByteArrayInputStream)))

(def *xml-string*
"a1b1c1a1b1c2a1b2c1")

(defn string-to-zip [s]
  (zip/xml-zip (xml/parse (ByteArrayInputStream. (.getBytes s)

(defn parse-xml [string]
  (doseq [x (xml-> (string-to-zip string) zf/descendants :c1)]
(println "---> " (:content (first x)

(parse-xml *xml-string*)

[dr...@drowe][h:10013][J:0]> ./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
>
> Use XPath. Seriously, I hate XML and XSLT, but XPath is simply the
> most concise way to extract things from a nested structure. Most XPath-
> libraries allow for precompilation of XPath-expressions (similar to
> RegEx-precompilation) and don't require the whole XML-file to reside
> in memory, which makes this a nice solution for huge XML-files (though
> in your case this is probably no issue).
>
> To get a list of all metrics in all hosts in all clusters, you'd
> simply use the XPath-expression "ganglia/cluster/host/metric" against
> an XML-document; recursive fetching (if clusters could contain other
> clusters) could be done by using a double slash instead of a single
> slash.
>
> A Clojure-solution for a similar expression language would be
> clojure.contrib.zip-filter.xml, though I did not use it, but you might
> try it out.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: 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 :HOST :METRIC
>   (fn [loc]
> [[(xml1-> (zip/up loc) (attr :NAME))
>   (xml1-> loc  (attr :NAME))
>   (xml1-> loc  (attr :VAL))
>   (xml1-> loc  (attr :TN))]]))
>
> In the above, I pass keywords, a function and calls to attr() to the
> xml-> (and xml1->) functions. The keywords (like :CLUSTER, :HOST
> and :METRIC) expand into things like
>  (tag= :CLUSTER)
> which return functions that operate on zipper objects.
>
> So if you're a bit overwhelmed by all the stuff that xml-> accepts,
> just note that much of it is syntactic sugar, for your convenience.
>
>
> Tayssir
>
>
>
> On Dec 2, 7:41 pm, Tayssir John Gabbour 
> wrote:
> > Hi!
> >
> > Taking minor liberties with your code (for clarity), the following
> > gives pretty much the same result as your handle-xml function:
> >
> > (ns blah
> >   (:require [clojure.xml :as xml]
> > [clojure.zip :as zip])
> >   (:use clojure.contrib.zip-filter.xml))
> >
> > (defn my-test []
> >   (doseq [x (xml-> (zip/xml-zip (xml/parse "/my-path-to/GANGLIA.xml"))
> >:CLUSTER :HOST :METRIC
> >(fn [loc]
> >  [[(xml1-> (zip/up loc) (attr :NAME))
> >(xml1-> loc  (attr :NAME))
> >(xml1-> loc  (attr :VAL))
> >(xml1-> loc  (attr :TN))]]))]
> > (apply println x)))
> >
> > The call to zip/xml-zip creates a zipper object, a simple trick to
> > travel around xml.
> >
> > Each argument to xml-> (after the first) drills down the tree. The
> > last argument, once I've drilled down to the :METRIC node, collects
> > the attributes you're interested in.
> >
> > The sourcecode has handy examples to play along with. For your
> > reference:
> http://github.com/richhickey/clojure-contrib/blob/81b9e71effbaf6aa294...
> >
> > Note: If you print the zipper object, its representation will be
> > pretty, pretty big. If that's a problem, remember to call zip/node at
> > the end, as per the examples. Or do the crazy thing I do, which is to
> > customize print-method (specifying each zipper object's :type
> > metadata), so it'll have a tiny representation like:
> > #
> >
> > Hope that makes sense,
> > Tayssir
> >
> > On Dec 2, 4:51 pm, Dennis  wrote:
> >
> > > Howdy,
> >
> > > Being new to clojure, I am having a difficult time parsing XML in an
> elegant
> > > manner.  I am pulling metric information from a ganglia server as XML
> and
> > > then parsing it.  The below function works but it makes me feel icky.
>  I was
> > > hoping for some tips.
> >
> > > The "dc" variable contains a map with some data center information (not
> > > really interesting), and the "stream" variable comes from http.agent.
> >
> > > (defn handle-xml [dc stream]
> > >   (let [xml-out (xml-seq (parse (http/stream stream)))]
> > > (doseq [x xml-out]
> > >   (doseq [y (:content x)]
> > > (doseq [z (:content y)]
> > >   (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:
> > > 
> > >  > > OWNER="unspecified" LATLONG="unspecified" URL="unspecified">
> > >  TN="3"
> > > TMAX="20" DMAX="86400" LOCATION="unspe
> > > cified" GMOND_STARTED="1255757736">
> > >  TN="6684"
> > > TMAX="1200" DMAX="0" SLOPE="both" SOURCE="gmond"/>
> > >  > > TMAX="1200" DMAX="0" SLOPE="zero" SOURCE="gmond"/>
> > > ...
> >
> > > Thanks,
> > > Dennis
> >
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Elegant way to replace a few words in string

2010-05-29 Thread Dennis
However, in this case, the point of the code was probably to
show/teach somebody how to solve a problem.  When teaching, you want
to make the point as clear as possible, and I think John is trying to
point out, in this instance, the extra code to remove the reflection
warnings detracts from that 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 Michael Gardner 
>>
>> On May 28, 2010, at 12:42 PM, Laurent PETIT wrote:
>>
>> > The rule should really always be: no warning at all (with
>> > *warn-on-reflection* set to true, of course).
>>
>> I strongly disagree. Why should you care about those sorts of warnings
>> unless you've already identified a bottleneck that needs elimination?
>
> Said differently than my previous answer : consider removing warnings as the
> act of keeping your code in a good state/shape. I tend to not get rid of
> warnings enough in my own java code, but for clojure production code, I
> would take warnings wayy more  seriously than e.g. java warnings.
>
> My 0,02€,
>
> --
> Laurent
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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


Re: 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=> (nth fib-seq 47)
2971215073

The only problem is that the fib-seq would cosume more memories to
hold  intermediate result.

On Jul 22, 5:47 am, logan  wrote:
> Lets say I have the following function
>
> (defn fib[n]
>   (if (> n 2)
>     (+ (fib (- n 2)) (fib (- n 1)))
>     1))
>
> and I want to memoize it, what is the right way to do it?
>
> Using the default memoize does not work correctly. the reason is even
> though the first call to fib is memoized, the recursive calls go to
> the original fib, and not the memoized function.
>
> Even using
>
> (def fib (memoize fib))
>
> does not seem to work. if you run (fib 45) and (fib 46), in the ideal
> case, (fib 47) should just call the memoized (fib 45) and (fib 46) and
> return almost immediately, but that is not the case.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Why 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 why this should not happen?is it a explanation here? I
can't understand what is the difference with  commuting ref  after ref-
set or alter.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 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


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 do I need a custom thread pool?
   First, the default thread pool is global, send use the thread pool
is a fixed size cpus +2, is likely to become the system bottleneck
sometime. Although you can use the send-off, use the cache thread
pool, but in a real world application, I can not use the cache thread
pool, which will introduce the risk of OutOfMemoryError, normally I
like to use a fixed-size thread pool.

  Second, the actions which global thread pool execute are from a
variety of agents, the actions are not homogeneous, and can not
maximize the efficient use of the thread pool, we hope that you can
specify different agent to isolate a particular thread pool to
maximize the use of thread pool .

   I think Agent could add two new functions:

(set-executor! agent (java.util.concurrent.Executors/
newFixedThreadPool 2))
(shutdown-agent agent)

set-executor! is to set the agent's custom thread pool,and shutdown-
agent to shutdown the agent's custom thread pool.



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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

2010-07-25 Thread dennis
Thanks for your reply,Ulrich

I knew that comute would rerun before the commit,but my problem is
that if we allow ref-set ref after commuting,it seems there is no bad
thing would happen.What's the purpose of this limitation except alter
or ref-set have no lasting result?

On Jul 25, 7:01 pm, Moritz Ulrich 
wrote:
> Read the documentation of commute 
> carefully:http://richhickey.github.com/clojure/clojure.core-api.html#clojure.co...
>
> commute acts at the end of the current dosync-block, regardless of
> when commute was applied inside it. That's the reason why you can'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:
>
> > 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 why this should not happen?is it a explanation here? I
> > can't understand what is the difference with  commuting ref  after ref-
> > set or alter.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 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
>
> --
> Moritz Ulrich
> Programmer, Student, Almost normal Guy
>
> http://www.google.com/profiles/ulrich.moritz

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 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 regards
>>
>> Max
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


{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 machine.Remote machines simply need a standard sshd daemon.

2.Quick example

Get the current date from the two machines listed in the 'mycluster'
config with a single command:

 (ns samples
 (:use [control.core :only [task cluster scp ssh begin]]))
 ;;define clusters
 (cluster :mycluster
 :clients [
   { :host "a.domain.com" :user "alogin"}
   { :host "b.domain.com" :user "blogin"}
 ])
 ;;define tasks
 (task :date "Get date"
  (ssh "date"))
;;start running
(begin)

If saved in a file named "controls.clj",run with

java -cp clojure.jar:clojure-contrib.jar:control-0.1-SNAPSHOT.jar
clojure.main controls.clj mycluster date

Each machine execute "date" command ,and the output form the remote
machine is printed to the console.Exmaple console output

Performing mycluster
Performing date for a.domain.com
a.domain.com:ssh: date
a.domain.com:stdout: Sun Jul 24 19:14:09 CST 2011
a.domain.com:exit: 0
Performing date for b.domain.com
b.domain.com:ssh: date
b.domain.com:stdout: Sun Jul 24 19:14:09 CST 2011
b.domain.com:exit: 0

Each line of output is labeled with the address of the machine the
command was executed on. The actual command sent and the user used to
send it is displayed. stdout and stderr output of the remote process
is identified as well as the final exit code of the local ssh
command.

3.How to scp files?
Let's define a new task named deploy

  (task :deploy "scp files to remote machines"
(scp ("release1.tar.gz" "release2.tar.gz") "/home/alogin/"))

Then it will copy release1.tar.gz and release2.tar.gz to remote
machine's /home/alogin directory.

4.More information please goto project homepage

https://github.com/killme2008/clojure-control

Any suggestion or bug reports welcomed.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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

2011-07-24 Thread dennis
Now it's allow passing command line arguments to task now,the task
macro is changed,it must have an argument vector now:

(task :deploy "deploy a file to remote machines"
  [file]
  (scp (file) "/home/user1"))

And run with

 clojure controls.clj deploy 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/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 machine.Remote machines simply need a standard sshd daemon.
>
> 2.Quick example
>
> Get the current date from the two machines listed in the 'mycluster'
> config with a single command:
>
>  (ns samples
>  (:use [control.core :only [task cluster scp ssh begin]]))
>  ;;define clusters
>  (cluster :mycluster
>  :clients [
>{ :host "a.domain.com" :user "alogin"}
>{ :host "b.domain.com" :user "blogin"}
>  ])
>  ;;define tasks
>  (task :date "Get date"
>   (ssh "date"))
> ;;start running
> (begin)
>
> If saved in a file named "controls.clj",run with
>
> java -cp clojure.jar:clojure-contrib.jar:control-0.1-SNAPSHOT.jar
> clojure.main controls.clj mycluster date
>
> Each machine execute "date" command ,and the output form the remote
> machine is printed to the console.Exmaple console output
>
> Performing mycluster
> Performing date for a.domain.com
> a.domain.com:ssh: date
> a.domain.com:stdout: Sun Jul 24 19:14:09 CST 2011
> a.domain.com:exit: 0
> Performing date for b.domain.com
> b.domain.com:ssh: date
> b.domain.com:stdout: Sun Jul 24 19:14:09 CST 2011
> b.domain.com:exit: 0
>
> Each line of output is labeled with the address of the machine the
> command was executed on. The actual command sent and the user used to
> send it is displayed. stdout and stderr output of the remote process
> is identified as well as the final exit code of the local ssh
> command.
>
> 3.How to scp files?
> Let's define a new task named deploy
>
>   (task :deploy "scp files to remote machines"
> (scp ("release1.tar.gz" "release2.tar.gz") "/home/alogin/"))
>
> Then it will copy release1.tar.gz and release2.tar.gz to remote
> machine's /home/alogin directory.
>
> 4.More information please goto project homepage
>
> https://github.com/killme2008/clojure-control
>
> Any suggestion or bug reports welcomed.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


[ANN] 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 [
   { :host "a.domain.com" :user "alogin"}
   { :host "b.domain.com" :user "blogin"}
 ])
(task :date "Get date"
 []
 (ssh "date"))
(task :deploy "scp files to remote machines"
 [file1 file2]
(scp (file1 file2) "/home/alogin/"))
(begin)

More information please visit it on github 
https://github.com/killme2008/clojure-control

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


Shameless self promotion - JavaOne

2011-09-27 Thread Dennis
Hey guys,

I will be giving a talk at JavaOne (it is Clojure related).  Here is
the information.

Title:  Monitoring a Large-Scale Infrastructure with Clojure
Time Tuesday, 07:30 PM, Parc 55 - Embarcadero
Length  45 Minutes
Abstract:   Monitoring a large infrastructure brings unique 
challenges
that require blending development and operations concepts. This
session discusses how Dell Inc. used Clojure to develop a
data-flow-based monitoring system that stores, evaluates, and acts on
hundreds of thousands of metrics.

It covers
• Real-world applications of Clojure's parallel programming constructs
to take advantage of multiple cores available in today's systems
• Using Clojure's homoiconic nature to create DSLs
• Taking advantage of Clojure running on the JVM to use the Java ecosystem
• How DevOps takes advantage of the JVM dynamic 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 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 talk, but I can't go there...
>
>
> Regards,
> Boris
>
>
> 2011/9/27 Dennis :
>> Hey guys,
>>
>> I will be giving a talk at JavaOne (it is Clojure related).  Here is
>> the information.
>>
>> Title:          Monitoring a Large-Scale Infrastructure with Clojure
>> Time             Tuesday, 07:30 PM, Parc 55 - Embarcadero
>> Length          45 Minutes
>> Abstract:               Monitoring a large infrastructure brings unique 
>> challenges
>> that require blending development and operations concepts. This
>> session discusses how Dell Inc. used Clojure to develop a
>> data-flow-based monitoring system that stores, evaluates, and acts on
>> hundreds of thousands of metrics.
>>
>> It covers
>> • Real-world applications of Clojure's parallel programming constructs
>> to take advantage of multiple cores available in today's systems
>> • Using Clojure's homoiconic nature to create DSLs
>> • Taking advantage of Clojure running on the JVM to use the Java ecosystem
>> • How DevOps takes advantage of the JVM dynamic 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 clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 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  wrote:
> Hi Dennis and Chas,
> I'd also like the slides if possible. Maybe if you could post them
> here in the group more people can get them.
>
> Thanks,
> Can
>
> On 27 Sep, 17:50, Dennis  wrote:
>> Hey guys,
>>
>> I will be giving a talk at JavaOne (it is Clojure related).  Here is
>> the information.
>>
>> Title:          Monitoring a Large-Scale Infrastructure with Clojure
>> Time             Tuesday, 07:30 PM, Parc 55 - Embarcadero
>> Length          45 Minutes
>> Abstract:               Monitoring a large infrastructure brings unique 
>> challenges
>> that require blending development and operations concepts. This
>> session discusses how Dell Inc. used Clojure to develop a
>> data-flow-based monitoring system that stores, evaluates, and acts on
>> hundreds of thousands of metrics.
>>
>> It covers
>> • Real-world applications of Clojure's parallel programming constructs
>> to take advantage of multiple cores available in today's systems
>> • Using Clojure's homoiconic nature to create DSLs
>> • Taking advantage of Clojure running on the JVM to use the Java ecosystem
>> • How DevOps takes advantage of the JVM dynamic 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 clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 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:
> How about putting it up on slideshare?  Pretty sure they can import pptx ;)
> Cheers,
> Leonardo Borges
> www.leonardoborges.com
>
>
> On Wed, Oct 5, 2011 at 3:55 PM, Dennis  wrote:
>>
>> 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  wrote:
>> > Hi Dennis and Chas,
>> > I'd also like the slides if possible. Maybe if you could post them
>> > here in the group more people can get them.
>> >
>> > Thanks,
>> > Can
>> >
>> > On 27 Sep, 17:50, Dennis  wrote:
>> >> Hey guys,
>> >>
>> >> I will be giving a talk at JavaOne (it is Clojure related).  Here is
>> >> the information.
>> >>
>> >> Title:          Monitoring a Large-Scale Infrastructure with Clojure
>> >> Time             Tuesday, 07:30 PM, Parc 55 - Embarcadero
>> >> Length          45 Minutes
>> >> Abstract:               Monitoring a large infrastructure brings unique
>> >> challenges
>> >> that require blending development and operations concepts. This
>> >> session discusses how Dell Inc. used Clojure to develop a
>> >> data-flow-based monitoring system that stores, evaluates, and acts on
>> >> hundreds of thousands of metrics.
>> >>
>> >> It covers
>> >> • Real-world applications of Clojure's parallel programming constructs
>> >> to take advantage of multiple cores available in today's systems
>> >> • Using Clojure's homoiconic nature to create DSLs
>> >> • Taking advantage of Clojure running on the JVM to use the Java
>> >> ecosystem
>> >> • How DevOps takes advantage of the JVM dynamic 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 clojure@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with
>> > your first post.
>> > To unsubscribe from this group, send email to
>> > clojure+unsubscr...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/clojure?hl=en
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 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 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:
>> How about putting it up on slideshare?  Pretty sure they can import pptx ;)
>> Cheers,
>> Leonardo Borges
>> www.leonardoborges.com
>>
>>
>> On Wed, Oct 5, 2011 at 3:55 PM, Dennis  wrote:
>>>
>>> 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  wrote:
>>> > Hi Dennis and Chas,
>>> > I'd also like the slides if possible. Maybe if you could post them
>>> > here in the group more people can get them.
>>> >
>>> > Thanks,
>>> > Can
>>> >
>>> > On 27 Sep, 17:50, Dennis  wrote:
>>> >> Hey guys,
>>> >>
>>> >> I will be giving a talk at JavaOne (it is Clojure related).  Here is
>>> >> the information.
>>> >>
>>> >> Title:          Monitoring a Large-Scale Infrastructure with Clojure
>>> >> Time             Tuesday, 07:30 PM, Parc 55 - Embarcadero
>>> >> Length          45 Minutes
>>> >> Abstract:               Monitoring a large infrastructure brings unique
>>> >> challenges
>>> >> that require blending development and operations concepts. This
>>> >> session discusses how Dell Inc. used Clojure to develop a
>>> >> data-flow-based monitoring system that stores, evaluates, and acts on
>>> >> hundreds of thousands of metrics.
>>> >>
>>> >> It covers
>>> >> • Real-world applications of Clojure's parallel programming constructs
>>> >> to take advantage of multiple cores available in today's systems
>>> >> • Using Clojure's homoiconic nature to create DSLs
>>> >> • Taking advantage of Clojure running on the JVM to use the Java
>>> >> ecosystem
>>> >> • How DevOps takes advantage of the JVM dynamic 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 clojure@googlegroups.com
>>> > Note that posts from new members are moderated - please be patient with
>>> > your first post.
>>> > To unsubscribe from this group, send email to
>>> > clojure+unsubscr...@googlegroups.com
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/clojure?hl=en
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>

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


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

(def client (xmemcached "localhost:12000"))
(xset client "key" "value")
(prn (xget client "key"))
(xcas client "key" #(str % " update"))
(xshutdown client)

More detail please visit the github homepage.


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


{ANN} 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")
(cd "bin"
(run "ls")))

(cd "/home/login"
(path "/home/login/bin"
(env "JAVA_OPTS" "-XMaxPermSize=128m"
(run "clojure"

Second,Supports ssh/scp/rsync options when defining cluster,they can
be a string or a vector:

(defcluster :mycluster
  :ssh-options "-p 44"
  :scp-options "-v"
  :rsync-options ["-arz" "--delete"]
  :clients [
   { :host "c.domain.com" :user "clogin" :ssh-
options "-v -p 43"}
   ]
  :user "login"
  :addresses ["a.domain.com" "b.domain.com"])

Third, It supports executing task in parallel now,just define cluster
by
(defcluster :mycluster
  :parallel true
  )

At last, i recommend everyone try the lein-control plugin developed by
sunny87 for using cc much more simply,please visit
https://github.com/sunng87/lein-control

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


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 any problems ,please let me
know,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


Vararg in protocol methods

2011-01-19 Thread dennis
I have defined a protocol with  overload methods,and one has varargs:

(ns test)
(defprotocol Say
  (say [this a] [this a & b] "say hello"))
(defrecord Robot []
  Say
  (say [this a] (println (str "hello," a)))
  (say [this a & b] (println b)))

Then ,i new a robot 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 method: say of
interface: test.Say found for function: say of protocol: Say (test.clj:
9)

It seems that clojure find methods in protocol both by name and
arity,and in this situation it found more than one methods named
"say".

I don't know how to solve this problem,any suggestion? 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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: 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 subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: 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 in clojure,it is just
> > transformed from the interpreter in SICP.Maybe someone interested in
> > it.
>
> > I have pushed it on github athttps://github.com/killme2008/cscheme
> > ,you can clone and run it by yourself.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: A simple scheme interpreter in clojure

2011-01-24 Thread dennis
Hi,
Yes,i have seen the rscheme.

cscheme is just an exercise,it is not practical at all.

On Jan 24, 1:44 pm, Andrzej  wrote:
> Hi,
>
> You may want to see if there is anything of interest for you 
> there:http://clojure.wikidot.com/scheme-interpreter-in-clojure
>
> It has its own reader that attempts to be more compatible with Scheme
> than the reader used in Clojure. It constructs a fairly elaborate
> syntactic tree (perhaps it would be better to abstract its nodes a bit
> - currently it's somewhat convoluted) and preserves a lot of
> information 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  wrote:
> > 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 subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 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, 2013 at 7:47 AM, Josh Kamau  wrote:
>
>> Hi ;
>>
>> Whats the point of using io! inside dosync if all it does is make an
>> exception to be thrown? Please someone make me understand.
>>
>> Regards.
>> Josh
>>
>> --
>> --
>> 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/groups/opt_out.
>>
>>
>>
>
>  --
> --
> 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/groups/opt_out.
>
>
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




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 looks so strange.The result map has keys :a and :b,but i can't get their
values.
Why? I try to hack the code,but i can't find the reason.


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




Re: sorted-map-by issue?

2013-06-06 Thread dennis zhuang
Sorry, it's my mistake.
Because treep map use the comparator to compare keys, and if the comparator
returns 1 constantly,it can not find the item that equals the key.

So i can modified the example,and it works:

user=> (sorted-map-by #(if (= %1 %2) 0 1) :b 1 :a 2)
{:b 1, :a 2}
user=> (: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=> (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 looks so strange.The result map has keys :a and :b,but i can't get
> their values.
> Why? I try to hack the code,but i can't find the reason.
>
>
> --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




Re: sorted-map-by issue?

2013-06-06 Thread dennis zhuang
Thanks,you are right.I want to creat a map which keeps elements in
insertion order, but clojure doesn‘t have.
在 2013-6-6 下午10:02,"Andy Fingerhut" 写道:

> Your comparator #(if (= %1 %2) 0 1) may happen to give the correct answers
> for your example sorted-maps, but it is also a bad comparator that will
> fail for larger examples:
>
> user=> (:a (sorted-map-by #(if (= %1 %2) 0 1) :z -26 :b 1 :a 2 :c 3 :m 13
> :h 8))
> nil
> user=> (:z (sorted-map-by #(if (= %1 %2) 0 1) :z -26 :b 1 :a 2 :c 3 :m 13
> :h 8))
> nil
>
> That is because if two items are not =, by returning 1 you are telling the
> caller "the first argument should come after the second argument".  Thus if
> at some time the comparator is called as (cmp :a :z), and later it is
> called as (cmp :z :a), it returns the inconsistent results that :a should
> 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/other-topics/comparators.md
>
> Andy
>
>
> On Thu, Jun 6, 2013 at 4:19 AM, dennis zhuang wrote:
>
>> Sorry, it's my mistake.
>> Because treep map use the comparator to compare keys, and if the
>> comparator returns 1 constantly,it can not find the item that equals the
>> key.
>>
>> So i can modified the example,and it works:
>>
>> user=> (sorted-map-by #(if (= %1 %2) 0 1) :b 1 :a 2)
>> {:b 1, :a 2}
>> user=> (: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=> (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 looks so strange.The result map has keys :a and :b,but i can't get
>>> their values.
>>> Why? I try to hack the code,but i can't find the reason.
>>>
>>>
>>> --
>>> 庄晓丹
>>> Email:killme2...@gmail.com xzhu...@avos.com
>>> Site:   http://fnil.net
>>> Twitter:  @killme2008
>>>
>>>
>>>
>>
>>
>> --
>> 庄晓丹
>> Email:killme2...@gmail.com xzhu...@avos.com
>> Site:   http://fnil.net
>> Twitter:  @killme2008
>>
>>
>>  --
>> --
>> 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/groups/opt_out.
>>
>>
>>
>
>  --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.




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
> changed a few characters.
>
> What diff tools do people use to address this? I've found ediff is useful
> in emacs, but what I really want is a way to see good diffs in github pull
> requests.
>
> --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.




{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  max: 10.81  count: 1
Method: method1mean:
145.90 min: 145.90 max: 145.90 count: 1
Method: start  mean:
159.59 min: 159.59 max: 159.59 count: 1

Methods:
  Method: method2mean: 10.81
   min: 10.81  max: 10.81  count: 1
  Method: method1mean: 145.90
   min: 145.90 max: 145.90 count: 1
  Method: start  mean: 159.59
   min: 159.59 max: 159.59 count: 1

It's on github,have fun.

https://github.com/killme2008/prowl

-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




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:
>
> Hi there 
>
> I'm writing a talk about Clojure in the real world and I would like to 
> know, if possible, which companies are using Clojure for production or 
> to make internal tools. 
>
> Thank you 
>
> Plínio Balduino 
>

-- 
-- 
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/groups/opt_out.




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 "print" doing? it doesn't seem to have an effect?

-- 
-- 
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/groups/opt_out.




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 i use only "def", everything works, i can compile the file

what's the problem?

-- 
-- 
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/groups/opt_out.




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 declared in core.clr
>>
>
> core.clr and intelliJ? I've never used intelliJ but I was under the
> impression it was JVM only...
>
> are you sure you've got the right version of Clojure and properly set up
> your environment?
>
> Jim
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@**googlegroups.com
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en<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+unsubscribe@**googlegroups.com
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
-- 
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/groups/opt_out.




Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
i am not trying anything, i just want to figure out what happens. this is
my output for the "print" version:
user=> (defmulti fac print)
(defmethod fac 1 [_] 1)
(defmethod fac :default [n] (*' n (fac (dec n
#'user/fac
#
#
user=> (fac 1)
10-1-2-3-4-5-6-7-8-9-10-11-12-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 (dec n
> >
> > this works
> >
> > however, this also works:
> >
> > (defmulti fac print)
> > (defmethod fac 1 [_] 1)
> > (defmethod fac :default [n] (*' n (fac (dec n
>
> This definately does not work when I try it:
>
>  user> (defmulti fac print)
>  #>
>  nil
>  user> (defmethod fac 1 [_] 1)
>  #
>  nil
>  user> (fac 1)
>  IllegalArgumentException No method in multimethod 'fac' for dispatch
> value: null  clojure.lang.MultiFn.getFn (MultiFn.java:160)
>  1
>
> The second arg to defmulti's job is to decide which method to call. The
> print function always produces nil, so you would need a defmethod for
> dispatch value nil to use print as a dispatch function:
>
> user> (defmethod fac nil [_] 2)
> #
> nil
> user> (fac 1)
> 12
> nil
>
> Notice the "12": the "1" is from print and the "2" is the value the
> method produced.
>
> Are you trying to print the dispatch values so you can see them for
> tracing or something? If so, you could try something like:
>
> user> (defn inspect [& stuff]
> (println "inspect: " stuff)
> (first stuff))
> #   #>
> nil
> user> (inspect 1)
> inspect:  (1)
> 1
> nil
> user> (defmulti fac2 inspect)
> nil
> nil
> user> (defmethod fac2 1 [_] 1)
> #
> nil
> user> (fac2 1)
> inspect:  (1)
> 1
> nil
> user>
>
>
> --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.




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 run my script in the repl
>>
>
> what repl? intelliJ's repl? or a bare repl from your terminal?
>
> do you want to use Clojure JVM or Clojure CLR?
>
>
> Jim
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@**googlegroups.com
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en<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+unsubscribe@**googlegroups.com
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
-- 
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/groups/opt_out.




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 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 run my script in the repl
>>>
>>
>> what repl? intelliJ's repl? or a bare repl from your terminal?
>>
>> do you want to use Clojure JVM or Clojure CLR?
>>
>>
>> Jim
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscribe@**googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/**group/clojure?hl=en<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+unsubscribe@**googlegroups.com
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>> .
>>
>>
>>
>

-- 
-- 
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/groups/opt_out.




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 Haupt wrote:
>
>> clojure jvm, intellij's repl. i'll try to run the file via commandline
>> and see what happens
>>
>
> where did core.clr come from then?
>
> can you somehow see what version of clojure your intelliJ is using? I've
> got no experience with intelliJ really...it's just that your error you
> reported earlier is very weird...
>
>
> Jim
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@**googlegroups.com
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en<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+unsubscribe@**googlegroups.com
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
-- 
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/groups/opt_out.




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 for the "print" version:
> > user=> (defmulti fac print)
> > (defmethod fac 1 [_] 1)
> > (defmethod fac :default [n] (*' n (fac (dec n
> > #'user/fac
> > #
> > #
> > user=> (fac 1)
> >
> 10-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-until
> > stackoverflow
>
> Since print produces nil for a dispatch value, and nil is not 1, it
> always calls your :default method.
>
> --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.




Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
(ns experiments.MultiMethod)
(defmulti fac identity)
(defmethod fac 1 [n] (print "n:" n" <- ") 1)
(defmethod fac :default [n] (*' n (fac (dec n
(print (fac 125))

if i am getting this right, defmethod fac  [] is the
equivalent to a scala or haskell pattern match, where 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 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 for the "print" version:
>> > user=> (defmulti fac print)
>> > (defmethod fac 1 [_] 1)
>> > (defmethod fac :default [n] (*' n (fac (dec n
>> > #'user/fac
>> > #
>> > #
>> > user=> (fac 1)
>> >
>> 10-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-until
>> > stackoverflow
>>
>> Since print produces nil for a dispatch value, and nil is not 1, it
>> always calls your :default method.
>>
>> --
>> --
>> 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/groups/opt_out.
>>
>>
>>
>

-- 
-- 
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/groups/opt_out.




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 inspect method in my original reply. It
> prints the value and passes it along:
>
>(defn inspect [& args]
>  (println "inspect:" args)
>  (first args))
>
> --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.




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 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/groups/opt_out.




Re: multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
i see
thx


2013/6/23 László Török 

> you need a dispatch functions that produces discrete dispatch values
> using your example:
>
> (defmulti x #(cond
>(< % 10) :less-than-10
>   ;;... further conditions producing different dispatch
> values
> ))
> ;; 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
>> (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 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/groups/opt_out.
>>
>>
>>
>
>
>
> --
> László Török
>
> --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.




Re: can't compile anything except "def"

2013-06-23 Thread Dennis Haupt
plugin version is 0.5.286

Am 23.06.2013 00:25, schrieb Colin Fleming:
> Which version of the IntelliJ plugin are you using? You can see this by
> opening the settings, selecting plugins then selecting the La Clojure
> plugin. In recent versions the compiler has changed and I've had
> 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
> option to compile the files (and instead just use clojure.main and
> run them) there is no problem
> 
> 
> 
> 
> 2013/6/22 Jim - FooBar();  <mailto:jimpil1...@gmail.com>>
> 
> On 22/06/13 15:21, Dennis Haupt wrote:
> 
> clojure jvm, intellij's repl. i'll try to run the file via
> commandline and see what happens
> 
> 
> where did core.clr come from then?
> 
> can you somehow see what version of clojure your intelliJ is
> using? I've got no experience with intelliJ really...it's just
> that your error you reported earlier is very weird...
> 
> 
> Jim
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> <mailto:clojure@googlegroups.com>
> Note that posts from new members are moderated - please be
> patient with your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@__googlegroups.com
> <mailto:clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/__group/clojure?hl=en
> <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+unsubscribe@__googlegroups.com
> <mailto:clojure%2bunsubscr...@googlegroups.com>.
> For more options, visit
> https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
> 
> 
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> <mailto:clojure@googlegroups.com>
> Note that posts from new members are moderated - please be patient
> with your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> <mailto:clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to clojure+unsubscr...@googlegroups.com
> <mailto:clojure%2bunsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> 
> 
> -- 
> -- 
> 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/groups/opt_out.
>  
>  

-- 

-- 
-- 
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/groups/opt_out.




{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...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




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 (atom, ref, agent etc)
>
> Jim
>
>
>
> On 02/07/13 11:33, Amir Wasim wrote:
>
>> Is there reset! and merge a possibility for (transient {})
>>
>> sometimes we have a doseq and it might be requirement sometime.
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscribe@**googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/**group/clojure?hl=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+unsubscribe@**googlegroups.com
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out
>> .
>>
>>
>>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@**googlegroups.com
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=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+unsubscribe@**googlegroups.com
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




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:03, dennis zhuang wrote:
>
> 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 (atom, ref, agent etc)
>>
>> Jim
>>
>>
>>
>> On 02/07/13 11:33, Amir Wasim wrote:
>>
>>> Is there reset! and merge a possibility for (transient {})
>>>
>>> sometimes we have a doseq and it might be requirement sometime.
>>> --
>>> --
>>> 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/groups/opt_out.
>>>
>>>
>>>
>> --
>> --
>> 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/groups/opt_out.
>>
>>
>>
>
>
>  --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>  --
> --
> 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/groups/opt_out.
>
>
>
>
>  --
> --
> 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/groups/opt_out.
>
>
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




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




2013/7/1 David Pollak 

> Thanks!
>
>
> On Mon, Jul 1, 2013 at 8:13 AM, Sean Corfield wrote:
>
>> On Sun, Jun 30, 2013 at 4:42 PM, David Pollak 
>> wrote:
>> > Looking forward to it
>> > being published (even as SNAPSHOT) in a Maven repo.
>>
>> It's accessible like this:
>>
>> (defproject async "0.1.0-SNAPSHOT"
>>   :description "FIXME: write description"
>>   :url "http://example.com/FIXME";
>>   :license {:name "Eclipse Public License"
>> :url "http://www.eclipse.org/legal/epl-v10.html"}
>>   :repositories {"sonatype-oss-public"
>> "https://oss.sonatype.org/content/groups/public/"}
>>   :dependencies [[org.clojure/clojure "1.5.1"]
>>  [org.clojure/core.async "0.1.0-SNAPSHOT"]])
>> --
>> Sean A Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>> World Singles, LLC. -- http://worldsingles.com/
>>
>> "Perfection is the enemy of the good."
>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>
>> --
>> --
>> 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/groups/opt_out.
>>
>>
>>
>  --
> --
> 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/groups/opt_out.
>
>
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




{{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 0))
(future (try-lock "lock" 5 (do (Thread/sleep 3000)
   (swap! counter inc))
(println "else1")))
(future (try-lock "lock" 5 (do (Thread/sleep 3000)
   (swap! counter inc))
(println "else2")))
(future (try-lock "lock" 5 (do (Thread/sleep 3000)
   (swap! counter inc))
(println "else3")))

(Thread/sleep 4000)
(is (nil? (get "lock")))
(is (= 1 @counter))

3.Through macro:


(through uid (get-user-from-databse uid))

Equals to:


(if-let [rt (get uid)]
rt
(let [rt (get-user-from-database uid)]
(when rt
(add uid rt 0))
rt))

4.Upgrade xmemcached to 1.4.2

More tutorial please visit https://github.com/killme2008/clj-xmemcached

--

庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.




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 strongly discouraging :refer :all.
>
>
> On Wed, Jul 24, 2013 at 11:16 AM, Alex Baranosky <
> alexander.barano...@gmail.com> wrote:
>
>> +1 for scary compiler deprecation warning for 1.6.0, then removing :use
>> in the 1.7.0 release.
>>
>>
>> On Wed, Jul 24, 2013 at 8:49 AM, Softaddicts > > wrote:
>>
>>> I disagree, when I use tracing fns and other useful REPL tools,
>>> I like to have them included without having to prefix them with an alias.
>>>
>>> It's not a hack  it's a feature and you are free to use it or not.
>>> If code writers do not care about code readers it's a choice, maybe bad
>>> but
>>> that decision is not yours to take. It's theirs in their own context.
>>>
>>> Now this thread has slowly shifted to "can we streamline how we express
>>> this
>>> feature" to "lets forbid this feature to be used". If ends up creating
>>> such
>>> "policies" enforced by the language, it's the wrong route.
>>>
>>> My answer to such proposals is a definite "no". This a red line to me
>>> that should
>>> not be crossed.
>>>
>>> Luc P.
>>>
>>>
>>> > > I hate it mainly in blogs, where they explain some new API. They :use
>>> > like 3 namespaces and you have to guess which fn is from which ns :)
>>> >
>>> > Agree.
>>> > Code is read much more often than it is written, so omitting a few
>>> > character is not effective time-saving.
>>> > I also don't like :refer :all.
>>> > I think it should be considered hack rather than official feature.
>>> >
>>> > On Wednesday, July 24, 2013 3:17:02 AM UTC+9, Jozef Wagner wrote:
>>> > >
>>> > > +1, :use is IMO an antipattern.
>>> > >
>>> > > I hate it mainly in blogs, where they explain some new API. They
>>> :use like
>>> > > 3 namespaces and you have to guess which fn is from which ns :)
>>> > >
>>> > > JW
>>> > >
>>> > > On Tuesday, July 23, 2013 5:50:50 PM UTC+2, Greg Slepak wrote:
>>> > >>
>>> > >> I think I read somewhere that :use is no longer encouraged, but I
>>> could
>>> > >> be mistaken.
>>> > >>
>>> > >> From what I've read, it seems like most people agree that Clojure
>>> has too
>>> > >> many ways of including/importing/referencing/requiring/using things:
>>> > >>
>>> > >>
>>> > >>
>>> http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
>>> > >>
>>> > >> The above gives a very nice explanation of all the various
>>> difference,
>>> > >> but it also acknowledges their complexity.
>>> > >>
>>> > >> Since :use uses :require, and since :require can do everything that
>>> :use
>>> > >> can, can we simplify Clojure programming a bit for newcomers by
>>> deprecating
>>> > >> the use of :use? The situation in ClojureScript is even worse
>>> because it
>>> > >> adds :require-macros on top of all the other ways of including
>>> files.
>>> > >>
>>> > >> Ideally, it would be awesome if there was just a single directive
>>> for
>>> > >> everything, but perhaps there's some complicated low-level reason
>>> why
>>> > >> that's not possible. :-\
>>> > >>
>>> > >> Thoughts?
>>> > >>
>>> > >> Thanks,
>>> > >> Greg
>>> > >>
>>> > >> P.S. If this has already been brought up you have my sincere
>>> apologies.
>>> > >>
>>> > >> --
>>> > >> Please do not email me anything that you are not comfortable also
>>> sharing
>>> > >> with the NSA.
>>> > >>
>>> > >>
>>> >
>>> > --
>>> > --
>>> > 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/groups/opt_out.
>>> >
>>> >
>>> >
>>> --
>>> Softaddicts sent by ibisMail from my ipad!
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>

Re: 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 semantic concurrency control for
> my project at CERN. Main feature of this STM is the TransactionalMap that
> lets you merge concurrent changes. Library is heavily tested and is very
> stable. It has been used in production for the past 2 years.
>
> Recently I released it on GitHub:
> http://entwined.koblik.ch (will redirect to
> https://github.com/CERN-BE/Entwined-STM)
>
> Since Entwined STM was designed to be used from Java I wrote a simple
> facade for it in Clojure that you can load with
>
> (require '[cern.entwined.core :as stm])
>
> Entwined STM operates on a memory with a fixed structure, meaning that you
> have to define what and how many collections you want to have in your STM
> and this can't be changed after construction. To construct memory with 1
> transactional map and 1 transactional queue run this:
>
> (def memory (stm/create-memory :map (stm/create-map) :queue
> (stm/create-queue)))
>
> It's impossible to access transactional entities outside of a transaction,
> to run a transaction you can use "intrans" macro
>
> (stm/intrans memory data (-> data :map (.put :key1 "value1")) true)
>
> (stm/intrans memory data (-> data :map (.get :key1))) ;-> "value1"
>
> First line puts [:key1 "value1"] pair into the map. True at the end of the
> body tells the memory to commit this transaction. intrans will initiate
> commit if body returns truthy value. Second line just shows that the change
> has been committed.
>
> A couple more words on the implementation: I used HashMap to implement the
> TransactionalMap, I copy the backing map for every transaction which may be
> expensive for some scenarios. Obvious solution would be to use Clojure's
> persistent map. Commits are eventually serialized and protected with a
> single lock. If you take a look at the Java source you'll see that
> Transaction interface has a second method "committed" that is called when
> commit is being done. I use this method to write to the hardware knowing
> that execution order of committed callbacks is the same as the commit order.
>
> I would greatly appreciate any feedback and suggestions. If you have any
> questions don't hesitate to ask here or email me directly. Documentation is
> still somewhat lacking and I'd be interested to know which parts of it
> should be improved first.
>
> Cheers,
> Ivan.
>
> --
> --
> 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/groups/opt_out.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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/groups/opt_out.


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 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/groups/opt_out.


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 an
> > "outer defn"?
>
> You just need to give the anonymous function a name it can use to refer
> to itself for (non-tail) recursion:
>
> (defn fib-n [n]
>   (let [fib (fn fib [a b] (cons a (lazy-seq (fib b (+ b a)]
> (take n (fib 1 1
>
> -Marshall
>
> --
> --
> 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/groups/opt_out.
>

-- 
-- 
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/groups/opt_out.


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 "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/groups/opt_out.
>

-- 
-- 
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/groups/opt_out.


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 [a b]
>
> (cons a (lazy-seq (fib b (+ b a)]
>  (take n (fib 1 1
>
> Note that its grammar is
>
> (letfn [fnspecs*] exprs*)
> fnspec ==> (fname [params*] exprs)
>
> That is, don't forget to surround a function definition with parentheses
> as above, and not as
>
> (letfn [fib [a b] ...])
> CompilerException java.lang.IllegalArgumentException: Don't know how to
> create ISeq from: clojure.lang.Symbol
>
> The reason is that letfn accepts multiple definitions, and as each
> function can have multiple expressions as in a do form, you can't just
> partition the vector as you do in let.
>
> On Thursday, August 29, 2013 4:32:00 PM UTC-3, Jim foo.bar wrote:
>>
>> On 29/08/13 20:23, JvJ wrote:
>> > I wonder if the somewhat counterintuitive concept of a "named
>> > anonymous function" eludes some people, or isn't properly conveyed in
>> > tutorials.
>>
>> I only consider #(...) as an anonymous function. The longer form (fn []
>> (...)) has the potential of being perfectly named, it's just you who
>> doesn't give it a name usually...
>>
>> Jim
>>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> 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/groups/opt_out.
>

-- 
-- 
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/groups/opt_out.


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 :

> On Wednesday, January 14, 2015 at 2:42:57 PM UTC+1, clojur...@gmail.com
> wrote:
>
>
>> Thanks Jan,
>>
>> Good idea!
>>
>> It is just a hobby project for now... I am thinking of a language for
>> kids (8+) . Would be interesting to see how kids react to programming in a
>> more familiar language.
>>
>
> Some similar work has been with قلب.  It's a Scheme-like language
> written entirely in Arabic.  Article about the language:
>
> http://www.theregister.co.uk/2013/01/25/arabic_programming_language
>
> GitHub repo:
>
> https://github.com/nasser/---
>
> Jesse
>
>
> --
> 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.


{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 netflix archaius lib.


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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


{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-rand.core :only [rand rand-int rand-nth]]))
(rand)(rand 10)(rand-int 100)(rand-nth (range 10))


Hope they could be helpful for someone.
-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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


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

doesn't eval the arguments before invoking constructor,so it can't find a
valid ctor.

I am not sure whether it's a bug or an expected behaviour.


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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=> #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
> <https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1187-1245>
> doesn't eval the arguments before invoking constructor,so it can't find a
> valid ctor.
>
> I am not sure whether it's a bug or an expected behaviour.
>
>
> --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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."
>
> Nicola
>
> dennis zhuang writes:
>
> > 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
> > <
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1187-1245
> >
> > doesn't eval the arguments before invoking constructor,so it can't find a
> > valid ctor.
> >
> > I am not sure whether it's a bug or an expected behaviour.
> >
> >
> > --
> > 庄晓丹
> > Email:killme2...@gmail.com xzhu...@avos.com
> > Site:   http://fnil.net
> > Twitter:  @killme2008
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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.
>
> In my case I I had something like
>
> (defn foo [ & {:keys [bar ... more keys ...] :or {bar 1}} ] ...)
>
> and I wanted to know whether the user had explicilty invoked foo with :bar.
>
> What wasn't clear to me was that :as solved this problem.
> Reading http://clojure.org/special_forms#Special Forms--Binding Forms
> (Destructuring)-Map binding destructuring
> I guess I can see that it's telling me :as shows things that weren't in
> the init-form, but that's with hindsight.
>
> So, to emulated common lisp 'supplied-p' semantics, you can check the :as
> form, which will **not**
> contain :or values for keywords.
>
> E.g.
>
> user> (defn bar [ & {:keys [baz] :or {baz 'baz} :as all-keys} ] (println
> baz all-keys))
> #'user/bar
> user> (bar :bof 1)
> baz {:bof 1}
> nil
>
> And not that the all-keys form does not show a binding for baz, and that's
> what I wanted.
>
> Just fyi in case anybody searches topics for 'supplied-p' again.
>
>
> On Saturday, June 21, 2014 7:22:13 PM UTC-4, Jason Felice wrote:
>
>> If you destructure the parameters like this:
>> (defn f [& {:as a-map}] ...)
>>
>> You can use map primitives on a-map.  But you can also supply defaults
>> here.
>>  On Jun 20, 2014 2:14 PM, "Dave Tenny"  wrote:
>>
>>>  What is the commonly accepted technique for declaring/using
>>> 'supplied-p' type lambda list functionality in clojure?
>>>
>>> http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/
>>> HyperSpec/Body/sec_3-4-1.html
>>>
>>>
>>> I have some clojure functions with a large number of keywords and
>>> various defaults, I want to know if a keyword was specified by the caller
>>> (rather than defaulted) in some cases.
>>>
>>> Certainly I could implement my own destructuring macros that did this,
>>> but I'd like to avoid reinventing a wheel here if I can, and also to know
>>> the idiomatic clojure way to do it.
>>>
>>> Thanks for any tips.
>>>
>>>
>>>  --
>>> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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)
> (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.
>>
>> In my case I I had something like
>>
>> (defn foo [ & {:keys [bar ... more keys ...] :or {bar 1}} ] ...)
>>
>> and I wanted to know whether the user had explicilty invoked foo with
>> :bar.
>>
>> What wasn't clear to me was that :as solved this problem.
>> Reading http://clojure.org/special_forms#Special Forms--Binding Forms
>> (Destructuring)-Map binding destructuring
>> I guess I can see that it's telling me :as shows things that weren't in
>> the init-form, but that's with hindsight.
>>
>> So, to emulated common lisp 'supplied-p' semantics, you can check the :as
>> form, which will **not**
>> contain :or values for keywords.
>>
>> E.g.
>>
>> user> (defn bar [ & {:keys [baz] :or {baz 'baz} :as all-keys} ] (println
>> baz all-keys))
>> #'user/bar
>> user> (bar :bof 1)
>> baz {:bof 1}
>> nil
>>
>> And not that the all-keys form does not show a binding for baz, and
>> that's what I wanted.
>>
>> Just fyi in case anybody searches topics for 'supplied-p' again.
>>
>>
>> On Saturday, June 21, 2014 7:22:13 PM UTC-4, Jason Felice wrote:
>>
>>> If you destructure the parameters like this:
>>> (defn f [& {:as a-map}] ...)
>>>
>>> You can use map primitives on a-map.  But you can also supply defaults
>>> here.
>>>  On Jun 20, 2014 2:14 PM, "Dave Tenny"  wrote:
>>>
>>>>  What is the commonly accepted technique for declaring/using
>>>> 'supplied-p' type lambda list functionality in clojure?
>>>>
>>>> http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/
>>>> HyperSpec/Body/sec_3-4-1.html
>>>>
>>>>
>>>> I have some clojure functions with a large number of keywords and
>>>> various defaults, I want to know if a keyword was specified by the caller
>>>> (rather than defaulted) in some cases.
>>>>
>>>> Certainly I could implement my own destructuring macros that did this,
>>>> but I'd like to avoid reinventing a wheel here if I can, and also to know
>>>> the idiomatic clojure way to do it.
>>>>
>>>> Thanks for any tips.
>>>>
>>>>
>>>>  --
>>>> 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.
>>
>
>
>
> --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: Supplied-p parameter in clojure similar to lisp lambda lists

2014-08-18 Thread dennis zhuang
Yep, it's an optional syntax sugar.
Indeed, you should use (contains? all-keys :baz) to check if :baz is
present in options. If :baz is present but it's value is nil,then (:baz
all-keys) returns nil too.


2014-08-18 18:57 GMT+08:00 Dave Tenny :

> I don't think that a :p 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 zhuang 
> wrote:
>
>> 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.
>>>
>>> In my case I I had something like
>>>
>>> (defn foo [ & {:keys [bar ... more keys ...] :or {bar 1}} ] ...)
>>>
>>> and I wanted to know whether the user had explicilty invoked foo with
>>> :bar.
>>>
>>> What wasn't clear to me was that :as solved this problem.
>>> Reading http://clojure.org/special_forms#Special Forms--Binding Forms
>>> (Destructuring)-Map binding destructuring
>>> I guess I can see that it's telling me :as shows things that weren't in
>>> the init-form, but that's with hindsight.
>>>
>>> So, to emulated common lisp 'supplied-p' semantics, you can check the
>>> :as form, which will **not**
>>> contain :or values for keywords.
>>>
>>> E.g.
>>>
>>> user> (defn bar [ & {:keys [baz] :or {baz 'baz} :as all-keys} ] (println
>>> baz all-keys))
>>> #'user/bar
>>> user> (bar :bof 1)
>>> baz {:bof 1}
>>> nil
>>>
>>> And not that the all-keys form does not show a binding for baz, and
>>> that's what I wanted.
>>>
>>> Just fyi in case anybody searches topics for 'supplied-p' again.
>>>
>>>
>>> On Saturday, June 21, 2014 7:22:13 PM UTC-4, Jason Felice wrote:
>>>
>>>> If you destructure the parameters like this:
>>>> (defn f [& {:as a-map}] ...)
>>>>
>>>> You can use map primitives on a-map.  But you can also supply defaults
>>>> here.
>>>>  On Jun 20, 2014 2:14 PM, "Dave Tenny"  wrote:
>>>>
>>>>>  What is the commonly accepted technique for declaring/using
>>>>> 'supplied-p' type lambda list functionality in clojure?
>>>>>
>>>>> http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/
>>>>> HyperSpec/Body/sec_3-4-1.html
>>>>>
>>>>>
>>>>> I have some clojure functions with a large number of keywords and
>>>>> various defaults, I want to know if a keyword was specified by the caller
>>>>> (rather than defaulted) in some cases.
>>>>>
>>>>> Certainly I could implement my own destructuring macros that did this,
>>>>> but I'd like to avoid reinventing a wheel here if I can, and also to know
>>>>> the idiomatic clojure way to do it.
>>>>>
>>>>> Thanks for any tips.
>>>>>
>>>>>
>>>>>  --
>>>>> 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.
>>>>>

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 get started with and can grow to complicated
> setups relatively painlessly, can't say enough good things about it.
>
> On Wednesday, August 20, 2014 10:40:15 AM UTC+2, Bruce Durling wrote:
>
>> Embedded jetty or httpkit + uberjar running behind nginx running
>> behind elastic load balancer on aws.
>>
>> On Wed, Aug 20, 2014 at 9:37 AM, Michael Klishin
>>  wrote:
>> > On 20 August 2014 at 11:52:51, Serzh Nechyporchuk (nechyp...@gmail.com)
>> wrote:
>> >> > I want to ask what environments for production do you use (e.g.
>> >> application server, cloud platform, deploy tool, etc)?
>> >> I think this information will be interesting for many people.
>> >> For now in our project we use Jetty server on Digital Ocean droplet.
>> >> We deploy by copying war file generated by lein ring uberwar.
>> >
>> > Jetty + lein uberjar is by far the most popular option from what I see.
>> >
>> > You can deploy with Chef/Puppet/etc, run on Heroku or Cloud Foundry, or
>> even
>> > use very basic SSH commands or Capistrano to deploy.
>> > --
>> > @michaelklishin, github.com/michaelklishin
>> >
>> > --
>> > 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.
>>
>>
>>
>> --
>> @otfrom | CTO & co-founder @MastodonC | mastodonc.com
>> See recent coverage of us in the Economist http://econ.st/WeTd2i and
>> the Financial Times http://on.ft.com/T154BA
>>
>  --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: [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-mutable" variables for things such as certain types of
> heaps/queues or write-intensive, slightly probabilistic stuff where one
> missed write doesn't matter that much.
>
> For people who don't have a Java background, I just want to point the very
> useful package java.util.concurrent.atomic, in which one can find gems such
> as AtomicLong, which is almost unbeatable as a counter.
>
> An example in which an AtomicLong is about three times quicker than an
> atom:
>
> https://gist.github.com/claj/6711556#file-countertest-clj
>
> Javadoc for AtomicLong:
>
>
> http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicLong.html
>
> In the sake of completeness,
> Linus
>
> 2014-09-11 11:06 GMT+02:00 Frantisek Sodomka :
>
>> Using my timings macro:
>> https://gist.github.com/fsodomka/5890711
>>
>> I am getting that:
>> - creation & derefing is 60% faster
>> - swapping is 25% faster
>> - resetting is about the same
>>
>>
>> ;; volatile vs. atom ;;
>>
>> (report
>>   (timings 1e7
>> (deref (volatile! 42))
>> (deref (atom 42
>>
>> ; |  :expr | :time | :ratio | :perc |
>> ; |+---++---|
>> ; | (deref (volatile! 42)) | 30.688238 |1.0 | 39.81 |
>> ; |  (deref (atom 42)) | 77.081141 |   2.51 | 100.0 |
>>
>>
>> (report
>>   (let [v (volatile! 42)
>> a (atom 42)]
>> (timings 1e7
>>   (vswap! v inc)
>>   (swap! a inc
>>
>> ; |  :expr |  :time | :ratio | :perc |
>> ; |+++---|
>> ; | (vswap! v inc) | 136.052946 |1.0 | 75.08 |
>> ; |  (swap! a inc) | 181.218748 |   1.33 | 100.0 |
>>
>>
>> (report
>>   (let [v (volatile! 42)
>> a (atom 42)]
>> (timings 1e7
>>   (vreset! v 10)
>>   (reset! a 10
>>
>> ; |  :expr | :time | :ratio | :perc |
>> ; |+---++---|
>> ; |  (reset! a 10) | 98.755318 |1.0 | 96.69 |
>> ; | (vreset! v 10) | 102.13944 |   1.03 | 100.0 |
>>
>>
>>
>>
>> On Thursday, September 11, 2014 6:18:08 AM UTC+2, puzzler wrote:
>>>
>>> I'm curious: how much faster are volatiles than atoms?
>>>
>>>  --
>> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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


{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?")

  ([:green] "Hi,green, what a good day!")

  ([other] (str "Say hi to " other)))


(say-hi :dennis)

;;  "Hi,good morning, dennis."

(say-hi :catty)

;;  "Hi, catty, what time is it?"

(say-hi :green)

;;  "Hi,green, what a good day!"

(say-hi "someone")

;;  "Say hi to someone"


Recursive function? It's all right:

(defun count-down

  ([0] (println "Reach zero!"))

  ([n] (println n)

 (recur (dec n

(defun fib

([0] 0)

([1] 1)

([n] (+ (fib (- n 1)) (fib (- n 2)



Guard functions? it's all right:

(defun valid-geopoint?

([(_ :guard #(and (> % -180) (< % 180)))

  (_ :guard #(and (> % -90) (< % 90)))] true)

([_ _] false))


(valid-geopoint? 30 30)

;; true

(valid-geopoint? -181 30)

;; false


It's really cool,all the magic are from core.match, much more details
please see
https://github.com/killme2008/defun


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: {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 , 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!")
>
>   ([other] (str "Say hi to " other)))
>
>
> (say-hi :dennis)
>
> ;;  "Hi,good morning, dennis."
>
> (say-hi :catty)
>
> ;;  "Hi, catty, what time is it?"
>
> (say-hi :green)
>
> ;;  "Hi,green, what a good day!"
>
> (say-hi "someone")
>
> ;;  "Say hi to someone"
>
>
> Recursive function? It's all right:
>
> (defun count-down
>
>   ([0] (println "Reach zero!"))
>
>   ([n] (println n)
>
>  (recur (dec n
>
> (defun fib
>
> ([0] 0)
>
> ([1] 1)
>
> ([n] (+ (fib (- n 1)) (fib (- n 2)
>
>
>
> Guard functions? it's all right:
>
> (defun valid-geopoint?
>
> ([(_ :guard #(and (> % -180) (< % 180)))
>
>   (_ :guard #(and (> % -90) (< % 90)))] true)
>
> ([_ _] false))
>
>
> (valid-geopoint? 30 30)
>
> ;; true
>
> (valid-geopoint? -181 30)
>
> ;; false
>
>
> It's really cool,all the magic are from core.match, much more details
> please see
> https://github.com/killme2008/defun
>
>
> --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

  '(defun accum

  ([0 ret] ret)

  ([n ret] (recur (dec n) (+ n ret)))

  ([n] (recur n 0

=>


(clojure.core/defn

 accum

 {:arglists '([0 ret] [n ret] [n])}

 [& args__4602__auto__]

 (clojure.core.match/match

  [(clojure.core/vec args__4602__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,
>
> marrying core.match to defn is a pretty neat idea. Thanks for releasing it!
>
> I see that you actually extended defn in that you made it possible to
> recur between different arities.
> Can you give a quick rundown on how you made that work? Are the arities
> still separate IFn arities? Does it still run in constant stack space?
>
> kind regards
>
> PS @adrian: If you feel like "Friendly advice" ing someone, why not do so
> in a private email?
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
And of course ,it still run in constant stack space just like normal recur
form.

P.S. I think adrian's advice is good, please forgive my poor english,and i
changes the description to ' a macro to define clojure functions with
pattern match just like erlang or elixir.

2014-09-15 0:26 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
> ...arguments)) instead.
>
> A macroexpand-1 result of accum:
>
>
> (macroexpand-1
>
>   '(defun accum
>
>   ([0 ret] ret)
>
>   ([n ret] (recur (dec n) (+ n ret)))
>
>   ([n] (recur n 0
>
> =>
>
>
> (clojure.core/defn
>
>  accum
>
>  {:arglists '([0 ret] [n ret] [n])}
>
>  [& args__4602__auto__]
>
>  (clojure.core.match/match
>
>   [(clojure.core/vec args__4602__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,
>>
>> marrying core.match to defn is a pretty neat idea. Thanks for releasing
>> it!
>>
>> I see that you actually extended defn in that you made it possible to
>> recur between different arities.
>> Can you give a quick rundown on how you made that work? Are the arities
>> still separate IFn arities? Does it still run in constant stack space?
>>
>> kind regards
>>
>> PS @adrian: If you feel like "Friendly advice" ing someone, why not do so
>> in a private email?
>>
>> --
>> 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.
>>
>
>
>
> --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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 atoms, which are
> just like Clojure's keywords.
>
>
> noniwoo
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

watch out the si/so columns.

What's your jvm arguments? Too small heap memory size may be the issue.

2014-09-24 9:47 GMT+08:00 larry google groups :

> I'm guessing that strace is showing me userland threads? When I quit
> strace I see:
>
> ^CProcess 19363 detached
> Process 19364 detached
> Process 19365 detached
> Process 19366 detached
> Process 19367 detached
> Process 19368 detached
> Process 19369 detached
> Process 19370 detached
> Process 19371 detached
> Process 19372 detached
> Process 19377 detached
> Process 19378 detached
> Process 19379 detached
> Process 19380 detached
> Process 19381 detached
> Process 19382 detached
> Process 19383 detached
> Process 19384 detached
> Process 19385 detached
> Process 19386 detached
> Process 19387 detached
> Process 19388 detached
> Process 19389 detached
> Process 19390 detached
> Process 19391 detached
> Process 19392 detached
> Process 19393 detached
> Process 19394 detached
> Process 19395 detached
> Process 19396 detached
> Process 19397 detached
> Process 19398 detached
> Process 19399 detached
> Process 19400 detached
> Process 19401 detached
> Process 19402 detached
> Process 19403 detached
> Process 19404 detached
> Process 19405 detached
> Process 19406 detached
> Process 19407 detached
> Process 19408 detached
> Process 19409 detached
> Process 19410 detached
> Process 19606 detached
> % time seconds  usecs/call callserrors syscall
> -- --- --- - - 
>  90.06   40.9730721363 30059 10449 futex
>   4.231.926411 819  2353   epoll_wait
>   3.021.373282  11444012 6 restart_syscall
>   1.240.563107   93851 6   accept
>   0.990.449988  12 36909   gettimeofday
>   0.350.156992   5 29410   clock_gettime
>   0.050.021064  67   316   recvfrom
>   0.020.010338  30   347   write
>   0.010.005117  24   209   sendto
>   0.010.004369  24   180   poll
>   0.010.002683  24   11222 read
>   0.010.002563  24   108 6 epoll_ctl
>   0.000.001618  14   112   open
>   0.000.001189   5   230   fcntl
>   0.000.001132   8   142   mprotect
>   0.000.000969   8   118   close
>   0.000.000806  3821   writev
>   0.000.000685   6   109   ioctl
>   0.000.000655   6   110   fstat
>   0.000.000229  1317   mmap
>   0.000.000216  36 6   shutdown
>   0.000.000197  33 6   dup2
>   0.000.92  46 2   madvise
>   0.000.61   512   setsockopt
>   0.000.57  14 4   munmap
>   0.000.56   512   getsockname
>   0.000.35   4 8   rt_sigprocmask
>   0.000.18   5 4   sched_getaffinity
>   0.000.10   5 2   clone
>   0.000.09   9 1   rt_sigreturn
>   0.000.09   5 2   uname
>   0.000.09   5 2   set_robust_list
>   0.000.08   4 2   gettid
> -- --- --- - - 
> 100.00   45.497046100943 10483 total
>
>
>
>
>
>
> On Tuesday, September 23, 2014 9:44:52 PM UTC-4, larry google groups wrote:
>>
>> I am intrigued by this article, as the problem sounds the same as mine:
>>
>> http://corner.squareup.com/2014/09/logging-can-be-tricky.html
>>
>> "No significant amount of resources appeared to be in use — disk I/O,
>> network I/O, CPU, and memory all looked fairly tame. Furthermore, the bulk
>> of queries being served were all performing as expected. "
>>
>> So I tried to follow their example regarding strace. But I have never
>> worked with strace before. I used grep to find the PID and then I:
>>
>>  sudo strace -c -f -p 19363
>>
>> and I got:
>>
>> Process 19363 attached with 45 threads
>>
>> Then I ran our "health check" which is like a series of functional tests
>> that ping our actual app (a live environment rather than a test
>> environment). I got nothing out of strace except these 2 lines appeared:
>>
>> Process 20973 attached
>> Process 20974 attached
>>
>> What does this mean? I had the impression that the JVM r

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 in your *load-path*) and to work
> like inferior modes (inferior-lisp or inferior-scheme), providing common
> keybindings in REPL, including color and history support. You will also
> need clojure-mode.el for code syntax highlighting, but this is optional.
>
> This initial release is ready for consumption (I'm using it on a bit
> larger project) and feel free to drop me a line if you find some issues.
>
> Again, the url is https://github.com/sanel/monroe
>
> Best,
> Sanel
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: {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:
>>
>>
>> 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!")
>>
>>   ([other] (str "Say hi to " other)))
>>
>>
>> (say-hi :dennis)
>>
>> ;;  "Hi,good morning, dennis."
>>
>> (say-hi :catty)
>>
>> ;;  "Hi, catty, what time is it?"
>>
>> (say-hi :green)
>>
>> ;;  "Hi,green, what a good day!"
>>
>> (say-hi "someone")
>>
>> ;;  "Say hi to someone"
>>
>>
>> Recursive function? It's all right:
>>
>> (defun count-down
>>
>>   ([0] (println "Reach zero!"))
>>
>>   ([n] (println n)
>>
>>  (recur (dec n
>>
>> (defun fib
>>
>> ([0] 0)
>>
>> ([1] 1)
>>
>> ([n] (+ (fib (- n 1)) (fib (- n 2)
>>
>>
>>
>> Guard functions? it's all right:
>>
>> (defun valid-geopoint?
>>
>> ([(_ :guard #(and (> % -180) (< % 180)))
>>
>>   (_ :guard #(and (> % -90) (< % 90)))] true)
>>
>> ([_ _] false))
>>
>>
>> (valid-geopoint? 30 30)
>>
>> ;; true
>>
>> (valid-geopoint? -181 30)
>>
>> ;; false
>>
>>
>> It's really cool,all the magic are from core.match, much more details
>> please see
>> https://github.com/killme2008/defun
>>
>>
>> --
>> 庄晓丹
>> Email:killm...@gmail.com xzh...@avos.com
>> Site:   http://fnil.net
>> Twitter:  @killme2008
>>
>>
>>   --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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 considering
>> dropping definitely the support for Eclipse 3.x.
>>
>> This would simplify ccw internals (merge 2 plugins which are separate due
>> to this), and also allow ccw to embrace Eclipse 4.x APIs in more areas than
>> today (today only User Plugins use Eclipse 4.x APIs).
>>
>> Before committing to this choice, I'd like to hear from you if some think
>> it's still too early to do so.
>>
>> Cheers,
>>
>> --
>> Laurent Petit
>>
>
>
>
> --
> Laurent Petit
>
> --
> 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.


{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:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: {ANN}} Carmine-sentinel: connect redis by sentinel, make carmine to support sentinel.

2016-10-16 Thread dennis zhuang
hi, all

I released carmine-sentinel 0.1.0-RC1, it supports reading data from  Redis
slave and supports other APIs(MQ, Pub/Sub,Lock etc) in carmine.

(def slave-conn {:pool {} :spec {}
 :sentinel-group :group1 :master-name "mymaster"
 :prefer-slave? 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 :

> Hi, all
>
> I wrote a library to make carmine <https://github.com/ptaoussanis/carmine>
> support redis sentinel <http://redis.io/topics/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:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: New to Clojure

2017-01-09 Thread Dennis Roberts
>From what you've described, it seems as though it would be easy to build 
the server side of this application in Clojure.

I found Clojure to be very easy to pick up. I won't say that the first few 
applications that I wrote in Clojure were great Clojure code, but it was 
easy for me to move from Java to Clojure.

Ring is a good start. You might also want to check into some libraries 
built on top of  Ring such as https://github.com/weavejester/compojure 
and https://github.com/metosin/compojure-api. We've found compojure-api to 
be extremely handy.

I haven't played with any AWS clients in Clojure, so I'm afraid I can't 
answer that question.

Clojure does integrate well with relational databases in general. We're 
using PostgreSQL, but any database that has a JDBC driver available should 
be easy to use. You may want to check into some of the Clojure 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 "assistance") wrote:
>
> Hi all!
>
> So, I'm new to Clojure! I'm coming in from a Java background and am 
> currently working on a project that has prompted me to have a look at 
> whether Clojure would be useful. 
> I have started by going through the "Brave Clojure" website and working 
> through the exercises and what I've seen has at many times just made me 
> smile at the (at least so far) intuitiveness, simplicity and power of the 
> language. My use case is this:
>
> A real time (sealed bid) auctioning system. We have a maximum number of 
> bids (example 100) that's set by the owner of the product. Our clients then 
> bid on the product. Once a bid is made, it's committed to a database and 
> the counter increments. The next bid is processed, and so on. Once the 
> maximum number of bids is reached, bidding stops. This auctioning system is 
> for a mobile application however the main code for the real time system 
> sits on a web server. The mobile app is a very thin client so simply makes 
> a call to the app server via an API which then processes that request (and 
> returns the result). 
>
> Requests are processed in order - so we're following a "first come first 
> serve" approach. If at any time a request is due to be processed and the 
> counter hits 100, all requests should gracefully "fail" and be blocked from 
> bidding. Now this is obviously possible in Java, albeit with a lot more 
> code and thinking about the different ways to make everything thread-safe, 
> etc. This is a completely new project so there's no restriction on 
> languages to be used, etc. PS: We're all Java developers.
>
> I was really attracted to Clojure because of a) the JVM b) the fact that 
> it seems to be able to handle concurrency effortlessly c) our API needs to 
> scale and so we want to ensure that we can handle the 100K+ connections 
> easily when the project reaches that stage. Obviously this is more to do 
> with the hardware, but the way we build the API is a definite factor. 
> Finally, there seems to be less verbose codebases on Clojure and it might 
> help to keep our overall codebase light and readable! 
>
> My questions therefore are these:
>
> With the time we have (around 1 month for this stage), is this something 
> we can easily build in Clojure?
> Is the movement from Java to Clojure easy for someone completely new to 
> Clojure?
> Are the libraries that we might use for this - I had a look at Ring 
> briefly robust for our use case?
> Does Clojure have good support for using AWS for example? (You can call 
> Java from Clojure so I guess this wouldn't really be an issue.)
> Does it interface well with MySQL?
>
> I'd be very grateful if someone could point me in the right direction on 
> this - like I said, really really like what I'm seeing of Clojure but just 
> want to be sure from the community before I recommend this as an action to 
> take!
>
> (hash-map :many "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.


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 example:
>
> (ns eval
>   (:import (java.time LocalDate)))
>
> (let [v ['S (String. "ab")]
>   f '(.length S)]
>   (eval `(let ~v ~f)))
>
> ; => 2
>
> (let [v ['D (LocalDate/of 2017 03 30)]
>   f '(.getYear D)]
>   (eval `(let ~v ~f
>
> ; => CompilerException java.lang.RuntimeException: Can't embed object in 
> code, maybe print-dup not defined: 2017-03-30
>
>
> The first example with String works fine and is what I want to do.
>
>
> But if I transfer the example to other Java classes, for example LocalDate I 
> get an error, see the second example.
>
>
> Can anybody help?
>
>
> Kind regards,
>
> Burt
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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 with an interpreter instead of
> generated java code.  The 'clojurey' part is that the output is a nested
> sequence, from there it's really effective to use tree zippers and
> core.match to transform the parse-tree into the data structure you need.
>
> Take a look at:
> https://github.com/clojure/core.match
> https://github.com/aphyr/clj-antlr
> https://www.ibm.com/developerworks/library/j-treevisit/
> https://github.com/akhudek/zip-visit
>
> On Tue, Aug 15, 2017 at 9:56 AM Laurens Van Houtven <_...@lvh.cc> wrote:
>
>> Hi,
>>
>>
>> Instaparse is a great parser generator, especially if you already have a
>> BNF.
>>
>> Sent from my iPhone
>>
>> On Aug 15, 2017, at 08:44, sventrax...@gmail.com wrote:
>>
>> Thanks for your input. LFE is quite an unexpected "thing".
>>
>> What I'm trying to do, is just a "lunch time project"; something that I
>> can target without corporate constrains just as a learning exercise.
>> Furthermore I can test the Clojure version against my old working Java
>> version.
>>
>> As I was saying, while experimenting with Instaparse, I'm having the
>> feeling it is not the correct Clojure tool for this type of development
>>
>>
>>
>> On Tuesday, August 15, 2017 at 2:17:50 PM UTC+1, adrians wrote:
>>>
>>> If you need the features of Erlang but would like that in a Lisp (not
>>> Common Lisp, though) environment, have you taken a look at LFE (Lisp
>>> Flavored Erlang)? I'm not trying to discourage you from looking at Clojure,
>>> but if you need/depend on some of the features of Erlang, LFE might be a
>>> closer fit.
>>>
>>> http://lfe.io
>>>
>>> On Tuesday, August 15, 2017 at 8:11:53 AM UTC-4, svent...@gmail.com
>>> wrote:


 Hi

 Months ago I read a review that praised Clojure's clean approach and
 use of JVM that is almost always available in my deployments.

 My background: started with 370 assembly ( so I'm not young!!!) and
 during the last four years I've been using Erlang for network applications.
 For my type of work the functional approach, concurrency and bit handling
 of Erlang are life savings. Nonetheless I feel "the call" of Clojure. As an
 exercise I would like to re implement something I did years ago in Java,
 i.e. a sort of parser. What I have on my hands is a DSL like this

 HeaderRule=hr-ftp
Term=100
   name="ftp"
   From=1
  networkPort="21"
  Protocol=1
 Tcp=1
up
 up
  up
   Then=1
  ProtocolInspection=1
 ftpRuleSet="frs-ftp"
 up
  ServiceDataFlowId=1
 payload=99
 up
  up
   up
up
 HeaderRule=hr-http
   ..

 For my old Java implementation I used state machines to build an
 internal representation, sort of an AST, that would be used to analyze pcap
 files. In my Clojure challenge, I would like to have a different approach.
 Googling around I've found many options: Parsley, Instaparse, cljcc and
 more. Some mentioned on www.clojure-toolbox.com seem to be more
 abandonware.
 At the moment I'm focusing on Instaparse. However, maybe due to the
 previous implementation, I feel that this is not the best approach with
 Clojure. Certainly my rookie state is leading me the wrong way.

 Comments and feedback will be greatly appreciated

 Fred





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

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/create-pin (NO_SOURCE_FILE:27)


and clojure.spec is great too.
2. you can use concat

(concat seq1 seq2)

see cheat sheet for clojure: https://clojure.org/api/cheatsheet

2017-09-06 16:10 GMT+08:00 Colin Yates :

> Hi Cecil - welcome back!
>
> This would be perfect to test using the new clojure.spec. I can't give
> you any advice on the specifics as I have yet to break into it myself,
> but the properties of this function are crying out for generative
> testing.
>
> Cecil Westerhof writes:
>
> > I want to start using Clojure again. I made the following simple function
> > to generate a PIN:
> > (defn create-pin
> >   ([] (create-pin 8))
> >   ([n]
> >(let [chars (map char (range (int \0) (inc (int \9]
> > (reduce str (repeatedly n #(rand-nth chars))
> >
> > So far so good. But I want to improve a little.
> >
> > I think n should at least be four, but not greater as 16. What is the
> > Clojure way to do this?
> >
> > The next step is that I want to use hexadecimal numbers. So I should use
> > (range (int \0) (inc (int \9))) combined with (range (int \A) (inc (int
> > \F))).
> > How would I do that?
> >
> > Is there anything I should do differently?
> >
> > Of-course I make a general function that is then called from create-pin
> and
> > create-pin-hex.
> >
> > --
> > Cecil Westerhof
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com
Site:   http://fnil.net

不学习,毋宁死

-- 
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: 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 13 14 15 16 17 18 19 20 21 22 23 24 25)))
user=> (get dummy-record  :a)
nil

fixed it with name:

(defmacro alphabet-macro []
  `(do
 (defrecord ~'Alphabet [~@(map (comp symbol name) a-z-ks)])
 (def ~'dummy-record (~'Alphabet. ~@(range 26)

(alphabet-macro)
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
13 14 15 16 17 18 19 20 21 22 23 24 25)))

user=> (get dummy-record  :a)
0

After fixed, the benchmark result is as expected.



2017-10-08 16:40 GMT+08:00 Jiacai Liu :

> As I read JoyOfClojure, it says one of reasons that prefer record over
> plain map is speed, out of curiosity I test this using
> https://github.com/hugoduncan/criterium, but the result is just contrary
> to  my expectation. record is slower than map. Is there any optimizations
> made to clojure 1.8.0 ?
>
> test  code: https://gist.github.com/jiacai2050/
> cdaaffa93079a4b8451727ace0c13064
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com
Site:   http://fnil.net

不学习,毋宁死

-- 
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: 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 tells me
> very clearly not to:
>
> user=> (defrecord Wrong [:a])
> CompilerException java.lang.AssertionError: defrecord and deftype fields
> must be  symbols, user.Wrong had: :a, compiling:(C:\Users\Peter\AppData\
> Local\Temp\form-init3187870874322021043.clj:1:1)
>
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com
Site:   http://fnil.net

不学习,毋宁死

-- 
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: [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
> lookup overhead to roughly the same cost as protocols, with only modest
> changes to the Clojure 1.8.0 implementation.
>
> It is mostly backwards compatible with Clojure 1.8.0. I would very much
> appreciate feedback on the semantic changes described in
> https://github.com/palisades-lakes/faster-multimethods/blob/master/docs/
> changes.md.
>
> I would also appreciate feedback on the choice of benchmarks --- the claim
> of protocol level performance depends on the benchmarks I've chosen, which
> may not be representative of your code.
>
> documentation: https://palisades-lakes.github.io/faster-multimethods/
>
> source for this release: https://github.com/palisades-
> lakes/faster-multimethods/tree/faster-multimethods-0.1.0
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com
Site:   http://fnil.net

不学习,毋宁死

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


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/nl-datalog

-- 
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: [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 definition. So if you only find the
> definition and usages in test that symbol might be candidate for deletion...
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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


{{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:  @killme2008

-- 
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: 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)
> 6554095526080834095807694798850229941388303701N
>
> user=> (+ Long/MAX_VALUE Long/MAX_VALUE)
>
> ArithmeticException integer overflow
> clojure.lang.Numbers.throwIntOverflow (Numbers.java:1501)
>
> user=> Long/MAX_VALUE
> 9223372036854775807
> 
>
> Why the much bigger numbers get promoted, and a smaller number overflows?
>
> Thank you
> Ali
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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, and got more or less the same
> results - 15x. Then I tried upgrading the defun dependencies - clojure,
> core.match and tools.macro - all of which have newer versions, and then
> running the benchmarks without leiningen’s jvm-opts and in a trampolined
> repl. The results are better (see below). Still not great - but down from
> 15x to 10x.
>
> That said:
>
> * I’m not sure I’d care: for most applications the overhead of function
> dispatch is probably not the bottleneck.
> * Elixir and the BEAM VM are awesome at many things, but I suspect (from
> experience not evidence) that the defun version is still faster than the
> elixir version.
>
>
> Rob
>
> ---
>
> user=> (bench (accum-defn 1))
> WARNING: Final GC required 2.590098761776679 % of runtime
> Evaluation count : 429360 in 60 samples of 7156 calls.
>  Execution time mean : 139.664539 µs
> Execution time std-deviation : 4.701755 µs
>Execution time lower quantile : 134.451108 µs ( 2.5%)
>Execution time upper quantile : 150.214646 µs (97.5%)
>Overhead used : 1.565276 ns
>
> Found 5 outliers in 60 samples (8. %)
> low-severe   5 (8. %)
>  Variance from outliers : 20.5880 % Variance is moderately inflated by
> outliers
>
> user=> (bench (accum-defun 1))
> Evaluation count : 44940 in 60 samples of 749 calls.
>  Execution time mean : 1.361631 ms
> Execution time std-deviation : 40.489537 µs
>Execution time lower quantile : 1.333474 ms ( 2.5%)
>Execution time upper quantile : 1.465123 ms (97.5%)
>Overhead used : 1.565276 ns
>
> Found 9 outliers in 60 samples (15. %)
> low-severe   1 (1.6667 %)
> low-mild 8 (13. %)
>  Variance from outliers : 17.3434 % Variance is moderately inflated by
> outliers
>
> ---
>
>
> On 5 Sep 2015, at 05:16, Amith George  wrote:
>
> Nice. Hadn't heard of it before. It looks interesting. The criterium
> benchmark is kinda disappointing though. The pattern matched function took
> nearly 15x the time of the normal function.
>
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

.

The DynamicClassLoader extends the URLClassLoader, and wraps a class cache
for it.

Also see the javadoc of findClass:

protected Class

findClass(String

name)
  throws ClassNotFoundException


Finds the class with the specified binary name
.
This method should be overridden by class loader implementations that
follow the delegation model for loading classes, and will be invoked by the
loadClass

method
*after checking the parent class loader for the requested class*. The
default implementation throws a ClassNotFoundException.

2015-09-16 21:23 GMT+08:00 András Pálinkás :

> Can anyone explain to me why do we call super.findClass here:
>
> https://github.com/clojure/clojure/blob/41af6b24dd5be8bd62dc2b463bc53b55e18cd1e5/src/jvm/clojure/lang/DynamicClassLoader.java#L69
>
> I believe, on this line, instead of super.findClass, it should call
> getParent().findClass, otherwise we'll get to the system classloader almost
> immediately (and the parent classloader will never be used).
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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, e.g.,
> toString, of our object o using clojure.reflect/reflect and and I want to
> execute this method on this object through the symbol.
>
> For instance *(. obj sym)* throws an exception. Here symbol for instance
> contains toString
>
> Any ideas about how I can do this?
>
> Regards,
>
> Timur
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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 have an object o, we get the symbol of a method, e.g.,
>> toString, of our object o using clojure.reflect/reflect and and I want to
>> execute this method on this object through the symbol.
>>
>> For instance *(. obj sym)* throws an exception. Here symbol for instance
>> contains toString
>>
>> Any ideas about how I can do this?
>>
>
> eval is probably the most straightforward way to achieve this:
>
> (eval `(. ~obj ~sym))
>
> I'm uncertain of the performance of this compared to using the Java
> reflection API, but it's a lot easier to write.
>
> - James
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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


{{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 can use it in clojurescript as below:

  (ns cljs-test.core
(:require [defun :refer-macros [defun]]))

  (defun count-down
([0] (println "Reach zero!"))
([n] (println n)
(recur (dec n

  (count-down 5)  #Count down from five to zero.


Have fun!


-- 
庄晓丹
Email:killme2...@gmail.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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 that is really slow.


2015-10-28 7:44 GMT+08:00 Matching Socks :

> If you do not want much to be compiled ahead-of-time and represented in
> the jar as class files, you may use the :impl-ns option on :gen-class.
>
> e.g.,
>
> 1) project.clj says
> :aot [bla.bla-aot]
>
> 2) bla.bla_aot.clj says
> (ns bla.bla-aot (:gen-class :impl-ns bla.bla))
>
> Ahead-of-time compilation does not follow the impl-ns reference.
>
> 3) bla.bla.clj has functions that Java may call as though they were in the
> bla.bla_aot class: for example, a -main function, which Java may call as
> bla.bla_aot.main.
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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 the project I have to
> hand is 1.5MB.
>
>
> On 15 Nov 2015, at 21:27, Timothy Baldridge  wrote:
>
> It's funny, because most of the larger OOP projects I worked on were large
> because of class bloat, not because of business concerns. For example, the
> C# app I used to work on was a more or less simple CRUD app. We had a ORM
> that served up objects to a Silverlight UI. So if we wanted to display
> information about a person on the UI we normally had to modify around 5
> classes in 5 files. We had the following layers
>
> ORM - 1.4MB of generated C# for interfacing with the 200 or so SQL tables
> we had
> DTO - Data Transfer Object, where used "normal" C# objects to abstract the
> ORM. This is where we had the "Person" object
> API - A web service that served up DTOs over HTTP
> Data Model - Processed views of DTOs formatted in a way that was easily
> viewable by the UI
> View Model - UI classes that would take data from a Data Model and emit UI
> controls.
>
> All of that ceremonythat is replaced by one thing in Clojure...data.
> Hashmaps and vectors replace all the junk you see above.
>
> So that's where I often assert "Yes, you may have 1 million lines of Java
> codebut that would only be ~10,000 lines of Clojure." With proper
> application of data driven systems (data that configures pipelines and
> writes code) you can easily get a 100:1 ratio of Java to Clojure code.
>
> Timothy
>
>
> On Sun, Nov 15, 2015 at 12:48 PM, Marc O'Morain  wrote:
>
>> We have a large app at CircleCI - as of September:
>>
>> "The repo for our main app contains 93,983 lines of Clojure code. The src 
>> directory
>> of our main app contains 369 namespaces."
>>
>> http://blog.circleci.com/why-were-no-longer-using-core-typed/
>>
>>
>>
>> On Sun, Nov 15, 2015 at 7:22 PM, dilettante.co...@live.com <
>> dilettante.co...@live.com> wrote:
>>
>>> I've been having a (friendly) argument with a friend who is an
>>> old-school OOP programmer.  He insists that you need objects to make
>>> large-scale codebases legible and maintainable over the long run.  Quite
>>> apart from this argument's virtues or lack thereof, this made me curious --
>>> what are the largest programs written in Clojure in terms of LOC?  I know
>>> I've seen mentions of 50k-100k LOC projects (World Singles, if I'm
>>> remembering correctly), but are there any that are larger?
>>>
>>>Vikram
>>>
>>> --
>>> 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.
>>
>
>
>
> --
> “One of the main causes of the fall of the Roman Empire was that–lacking
> zero–they had no way to indicate successful termination of their C
> programs.”
> (Robert Firth)
>
> --
> 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+un

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
user=> (macroexpand-1 '(mac1 1))
(clojure.core/locking {} 1)


2015-11-16 13:55 GMT+08:00 Alice :

> user=> (def obj (Object.))
> #'user/obj
> user=> (defmacro mac1 [& body] `(locking ~obj ~@body))
> #'user/mac1
> user=> (mac1 nil)
> CompilerException java.lang.RuntimeException: Can't embed object in code,
> maybe print-dup not defined: java.lang.Object@2a747a37,
> compiling:(NO_SOURCE_PATH:1:1)
>
>
> Why am I getting the error?
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 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 you a result and never crashes,
depending on your use case.

2016-01-12 23:03 GMT+01:00 Gregg Reynolds :

>
> On Jan 12, 2016 2:25 PM, "mattias w"  wrote:
> >
> > Clojure and Erlang are very similar, except for the syntax, macros and
> that you can use Java libraries.
> >
> > There is one big difference: In Erlang, fail as early as possible is the
> norm. In Clojure it is almost the opposite.
> >
> > Many errors in Clojure code will result in nil, and most operations
> accept nil as a valid parameter, i.e. many fails will not even be visible
> unless you check the result.
> >
> > The most common I stumble on is assuming that a value exists in a map,
> but that is just the top of the iceberg
>
> Not finding what you're looking for is not failure.  Nil means you have
> successfully discovered that you can't always get what you want.  There is
> no error there.
>
> Gregg
>
> --
> 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: 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 :

>
> Following this thread:
> http://stackoverflow.com/questions/16695874/why-does-the-jvm-full-gc-need-to-stop-the-world
>
> I was wondering if anybody has some experience regarding GC optimizations
> that would work better for Clojure than the default: stop-the-world
> approach.
> My point being that given Clojure's immutable data structures, there is a
> lot of GC that is performed on young-objects which I guess could be
> optimized with some GC tweaks.
>
> Has anybody experience with something similar?
>
> So far the only reference that I have of a Clojure project using such
> optimizations is Overtone:
> https://github.com/overtone/overtone/blob/master/project.clj
>
> Which scenarios do you think that call for GC tweaks in Clojure?
>
> --
> 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.
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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


  1   2   3   >