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


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

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

2016-10-17 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 <killme2...@gmail.com>:

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


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

2016-05-12 Thread dennis zhuang
A try:

(let [raw (list  :a 1 :b 2 :c 3)]
  (->> raw
   (partition 2)
   (filter #(even? (second %)))
   (map vec)
   (into {})
   (merge {:raw raw})))

=> {:b 2, :raw (:a 1 :b 2 :c 3)}



2016-05-12 15:46 GMT+08:00 hiskennyness :

> This does what I want but feels nooby-ish, as in "in a month I will do
> this without APPLY":
>
> (let [raw (list  :a 1 :b 2 :c 3)]
>>   (apply assoc {}
>>  :raw raw
>>   (apply concat
>>(filter #(even? (second %))
>>(apply hash-map raw)
>> ;; => {:raw (:a 1 :b 2 :c 3), :b 2}
>
>
> Am I being too hard on myself?
>
> Meta question: is there a better place to ask such questions?
>
> -kt
>
> --
> 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: 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.


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

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


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


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


{{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: [ANN] sniper, emacs assistant for deleting dead code

2015-07-29 Thread dennis zhuang
Cool work.

But missing installation or user guide in readme.md? I don't know how to
use it in my project. I want to try it.


2015-07-30 13:26 GMT+08:00 benedek fazekas benedek.faze...@gmail.com:

 hi,

 I wonder if you tried clj-refactor which has find usages listing all the
 usages of your 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-archaius releases: wrapper for netflix archaius

2015-07-02 Thread dennis zhuang
Hi,all

I create a new project https://github.com/leancloud/clj-archaius that wraps
netflix  https://github.com/Netflix/archaius
archaius https://github.com/Netflix/archaius library for configuration
management.

It's really simple to use in your project,i hope it can help someone that
is using 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.


Re: Prevayler in Clojure

2015-06-09 Thread Dennis van den Berg
Nice job, so much in a few lines of code.

Thanks, Dennis

Op zaterdag 30 mei 2015 22:58:23 UTC+2 schreef Klaus Wuestefeld:

 Prevalence is the fastest possible and third simplest ACID persistence 
 technique, combining the two simplest ones.

 https://github.com/klauswuestefeld/prevayler-clj


-- 
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: PersistentTreeMap, seqFrom, subseq and range queries

2015-06-09 Thread Dennis van den Berg
I think the subset and submap would be a nice addition!

Op maandag 15 februari 2010 16:23:22 UTC+1 schreef Rich Hickey:

 On Mon, Feb 15, 2010 at 8:45 AM, George . cloju...@gmail.com 
 javascript: wrote:
  Currently, if you want to perform a range query on a sorted-seq (AKA
  PersistentTreeMap), you are are advised to use the subseq wrapper for
  seqFrom.
 
  For instance, let's say your  keys are dollar values you could do (subseq
  my-map  30) to get all entries with keys greater than 30 or (subseq 
 my-map
  30  100) to get all entries with keys that range between 30 and 11.  
 The
  former case is O(logN) as it is entirely delegated to the logarithmic
  seqFrom method.  However, the latter example has worst case O(N) behavior
  since subseq is doing a take-while after .seqFrom.
 
  Is there any plan to support upper bounds directly within seqFrom in 
 order
  to make the worst-case behavior logarithmic all around?
 
  If not, would such a patch even be considered or is the simplicity of
  implementation an overriding factor?
 
 

 I'm confused. Do you want something other than a seq of values in
 range as a result? Because if there are K things in range, there is no
 way to consume them in complexity less than O(K). That cost won't be
 incurred until you consume them, due to take-while being lazy.

 OTOH, if what you want is a subset or submap, or, from them, a
 constant-time count, well, that's a different function altogether. I'm
 not opposed to subset or submap proposals.

 Rich



-- 
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: 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 jesse.al...@gmail.com:

 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.


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 laurent.pe...@gmail.com:

 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 laurent.pe...@gmail.com:

 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.


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

2014-09-26 Thread dennis zhuang
I will add supporting for clojurescript this weekend.Thanks for your
suggestion.

2014-09-26 1:09 GMT+08:00 Ivan L ivan.laza...@gmail.com:

 Is this clojurescript ready?  This looks amazing, I would also love to
 have it in core.

 On Sunday, September 14, 2014 2:47:28 AM UTC-4, dennis wrote:


 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: How do I track down a painfully long pause in a small web app?

2014-09-24 Thread dennis zhuang
You can use

jstat -gcutil pid 2000

to print the GC statistics every 2 seconds,
http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html

It the long pause is from GC, the columns FGCT/FGC values would be large.

If you think it's a swap issue, you may want to use

   vmstat 1 1

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 lawrencecloj...@gmail.com:

 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 ran in 1 process?
 Does strace show me userland threads (like htop does) or are these child
 processes?





 On Monday, 

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

2014-09-24 Thread dennis zhuang
Looks great.But it doesn't support code completion?

2014-09-25 0:50 GMT+08:00 Sanel Zukan san...@gmail.com:

 Hi everyone,

 Here https://github.com/sanel/monroe is initial release for Monroe, a
 new Clojure nREPL client for Emacs. The main idea behind Monroe is to be
 simple, easy to install (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: keywords

2014-09-15 Thread dennis zhuang
Clojure's keyword is using a soft reference cache, they would be garbage
collected  when used memory reaches threshold.


2014-09-15 18:36 GMT+08:00 Paweł Sabat noni...@gmail.com:

 Hi.

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


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

2014-09-14 Thread dennis zhuang
Hi , i am pleased to introduce defun https://github.com/killme2008/defun:
a beautiful macro to define clojure functions with pattern match.

Some examples:


(defun say-hi

  ([:dennis] Hi,good morning, dennis.)

  ([:catty] Hi, catty, what time is it?)

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

  ([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 killme2...@gmail.com:


 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 hhochleit...@gmail.com:

 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 killme2...@gmail.com:

 Hi Herwig

 Actually,defun just define a variadic arguments function,so it doesn't
 have different arities. And when using defun macro ,it walk through the
 body forms, find 'recur'  forms and replace them with (recur (vector
 ...arguments)) instead.

 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 hhochleit...@gmail.com:

 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: [ANN] Clojure 1.7.0-alpha2

2014-09-11 Thread dennis zhuang
May be the LongAdder in Java8 can beat AtomicLong :D

http://blog.palominolabs.com/2014/02/10/java-8-performance-improvements-longadder-vs-atomiclong/

2014-09-11 17:30 GMT+08:00 Linus Ericsson oscarlinuserics...@gmail.com:

 The volatile construct seems very useful in some particular cases! I 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 fsodo...@gmail.com:

 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.


Re: Clojure production environment

2014-08-20 Thread dennis zhuang
jetty + lein jar + lein libdir,and used fabric to deploy applications.Uses
nginx as load balancer.



2014-08-20 16:55 GMT+08:00 Max Penet m...@qbits.cc:

 For web stuff we use jetty (9) apps as uberjar, behind nginx, deployed
 and CC via ansible, hosted on DigitalOcean as well.
 Ansible is super 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
 michael@gmail.com 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: Supplied-p parameter in clojure similar to lisp lambda lists

2014-08-18 Thread dennis zhuang
I created a ticket http://dev.clojure.org/jira/browse/CLJ-1508


2014-08-18 11:02 GMT+08:00 dennis zhuang killme2...@gmail.com:

 I think that adding a :p option to destructuring would be great:

 (let [ {:keys [a b c] :p {a a-p}} params]
 (if a-p
 (println a)
 (println a is not exists.)))






 2014-08-17 20:05 GMT+08:00 Dave Tenny dave.te...@gmail.com:

 Well, it took me a while to perhaps get what you were 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 dave@gmail.com 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 dave.te...@gmail.com:

 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 killme2...@gmail.com
 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 dave.te...@gmail.com:

  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 dave@gmail.com 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 a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/jWc51JOkvsA/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr

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

2014-08-17 Thread dennis zhuang
I think that adding a :p option to destructuring would be great:

(let [ {:keys [a b c] :p {a a-p}} params]
(if a-p
(println a)
(println a is not exists.)))






2014-08-17 20:05 GMT+08:00 Dave Tenny dave.te...@gmail.com:

 Well, it took me a while to perhaps get what you were 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 dave@gmail.com 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.


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


Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Sorry,the error example must be:

user= #java.lang.String[(byte-array 10) utf8]
IllegalArgumentException No matching ctor found for class java.lang.String
 clojure.lang.Reflector.invokeConstructor (Reflector.java:183)



2014-08-16 19:59 GMT+08:00 dennis zhuang killme2...@gmail.com:

 user= #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 brobro...@gmail.com:

 It's by design, see the section on ctor literals
 http://clojure.org/reader#toc1

 The elements in the vector part are passed unevaluated to the relevant
 constructor.

 Nicola

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


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


Re: Effective Clojure book?

2014-06-04 Thread dennis zhuang
《The joy of clojure》 ?


2014-06-05 9:30 GMT+08:00 Mike Fikes mikefi...@me.com:

 Are there any books yet that prescribe best practices for Clojure, à la
 Meyers or Bloch?

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send 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-xmemcached release 0.2.4

2014-04-27 Thread dennis zhuang
An opensource memcached client for clojure,it wraps xmemcached.

0.2.4 releases, main highlights:

   - Upgrade xmemcached to
2.0.0https://github.com/killme2008/xmemcached/releases/tag/xmemcached-2.0.0,
   10% performance improved for text protocol and fixed some issues.
   - Added nippy-transcoder to support
nippyhttps://github.com/ptaoussanis/nippyserialization.
   - Added expiration time parameters for incr/decr functions.
   - Added :session-locator option for memcached function to use special
   
MemcachedSessionLocatorhttp://fnil.net/docs/xmemcached/net/rubyeye/xmemcached/MemcachedSessionLocator.html
   .

Manual and home:  https://github.com/killme2008/clj-xmemcached

Thanks.

-- 
庄晓丹
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] core.rrb-vector 0.0.11 -- Clojure 1.6 compatibility and bug fixes

2014-03-30 Thread dennis zhuang
I can't find any performance benchmark in the home page.Any links?Thanks.



2014-03-31 2:01 GMT+08:00 Michał Marczyk michal.marc...@gmail.com:

 Hi,

 I am pleased to announce the 0.0.11 release of core.rrb-vector, a
 Clojure Contrib library extending the Clojure vector API with
 logarithmic-time concatenation and slicing:

   https://github.com/clojure/core.rrb-vector

   [org.clojure/core.rrb-vector 0.0.11]

   dependency
 groupIdorg.clojure/groupId
 artifactIdcore.rrb-vector/artifactId
 version${version}/version
   /dependency

   compile org.clojure:core.rrb-vector:${version}

 This release updates the hashing mechanism used by RRB vectors for
 compatibility with Clojure 1.6 (while maintaining compatibility with
 1.5.1) and fixes two bugs. Additionally, the README now states that
 view vectors produced by clojure.core/subvec are handled correctly in
 Clojure = 1.6.0.

 Many thanks to the two new contributors: Jozef Wagner, who reported
 and fixed a bug to do with transient vectors of primitives and who
 reported a bug in sequences over RRB vectors that would surface when
 using such sequences with the reducers library; and Andy Fingerhut,
 who kept on top of the hashing changes and contributed improvements to
 the test suite, which now explicitly checks both hash codes (hasheq
 and hashCode).

 Cheers,
 Michał

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

2014-03-13 Thread Dennis Haupt
i also did an asteroid game in clojure. i don't think you can ever achieve
the performance of hackedyhack-mutablility with pure functional algorithms
- my approach to get the best performance while staying as clean as
possible would be to keep two copies of the game world, using one as source
data and generating the next version into the other, and vice versa.
similar to double buffering.
as long as you can guarantee that objects in the working copy are just
data that is not referenced anywhere, you can pretend that an initAll
method on an object is nothing else than a fully working constructor - just
that the object you initialize is initially filled with random data instead
of not yet existing.
you can pretend it's new, and pretend your algorithms are functional^^


2014-03-13 0:19 GMT+01:00 Jacob Goodson submissionfight...@gmx.com:

 Let me state that, as long as it is a asteroids clone, it is fine.
 However, compared to Java, the performance was much worse(when just playing
 with it and drawing tons of asteroids in opengl).  Also, I do not know what
 you mean when you say that you have tested it... the

 pure way or the mutate objects in place way?  I can get great performance
 with clojure, no doubt about it, by violating the shat out of functional
 programming.  I can not get great performance with the beautiful, pure,
 composable, clojure that I desire!  I have seen many game

 examples in clojure where, basically, clojure is just a scripting
 language that wraps java.  It is no problem if this is the case, my
 question has jack crap to do about getting good performance writing
 asteroids.  My question is: Will clojure(the immutable composable side)

 benefit from shenandoah(blasted font) at all?  Can someone who knows a
 good bit about clojure tell me if a more powerful garbage collector would
 allow us clojurians to be more pure or is it something else inherently in
 immutable land that will never(it will take a long time) get fixed.


 On Wednesday, March 12, 2014 6:53:43 PM UTC-4, James Reeves wrote:

 I've done a fair bit of experimentation with writing games in Clojure,
 and I haven't noticed any major performance issues. If you're getting
 issues on a 2D asteroids clone, I suspect there might be something
 inefficient in your code. I find Criterium useful for benchmarking parts of
 my code in isolation to get an idea of how its running.

 - James


 On 12 March 2014 21:53, Jacob Goodson submissio...@gmx.com wrote:

 How many people have heard of this GC?  http://www.jclarity.com/2014/
 02/19/shenandoah-a-new-low-pause-garbage-collection-
 algorithm-for-the-java-hotspot-jvm/

 I want to know if this would benefit clojure.  I wrote a small asteroids
 game in clojure and the performance was not good.  I stuck to purity when
 writing the game, only mutating my data after it had passed through a
 bazillion pure functions.  I was wondering, would a GC like this one(or
 Azul's) make a significant impact so that I, or others, could make games in
 a more pure fashion?  I WANT MY EFFIN PURITY!

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com

 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com

 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@googlegroups.com.

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


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


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

Re: Do I have to have knowlegde about Lisp

2014-03-10 Thread Dennis Haupt
you can learn clojure without learning lisp first :)


2014-03-10 15:41 GMT+01:00 Roelof Wobben rwob...@hotmail.com:

 Hello,

 I like the idea of Clojure but I wonder if I have to know a lot of Lisp to
 work with Clojure.

 What is the best way to go from a absolute beginner to someone who can
 work with Clojure.

 Roelof

  --
 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: Clojure performance question

2014-03-01 Thread dennis zhuang
The String a=i+another word; is also compiled into using
 StringBuilder, see the byte code by javap -v:

   Code:
  stack=5, locals=5, args_size=1
 0: invokestatic  #2  // Method
java/lang/System.nanoTime:()J
 3: lstore_1
 4: iconst_0
 5: istore_3
 6: iload_3
 7: ldc   #3  // int 1000
 9: if_icmpge 39
12: new   #4  // class
java/lang/StringBuilder
15: dup
16: invokespecial #5  // Method
java/lang/StringBuilder.init:()V
19: iload_3
20: invokevirtual #6  // Method
java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
23: ldc   #7  // String another word
25: invokevirtual #8  // Method
java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
28: invokevirtual #9  // Method
java/lang/StringBuilder.toString:()Ljava/lang/String;
31: astore4
33: iinc  3, 1
36: goto  6
39: getstatic #10 // Field
java/lang/System.out:Ljava/io/PrintStream;
42: invokestatic  #2  // Method
java/lang/System.nanoTime:()J
45: lload_1
46: lsub
47: l2d
48: ldc2_w#11 // double 1.0E9d
51: ddiv
52: invokevirtual #13 // Method
java/io/PrintStream.println:(D)V


I think the performance hotspot in this simple example is the object
allocate/gc  and function calling overhead.The str function create
an anonymous function every time to concat argument strings:

(^String [x  ys]
 ((fn [^StringBuilder sb more]
  (if more
(recur (. sb  (append (str (first more (next more))
(str sb)))
  (new StringBuilder (str x)) ys)))

And we all know that a function in clojure is a java object allocated in
heap.And another overhead is calling the function,it's virtual method.

By watching the gc statistics using 'jstat -gcutil pid 2000', i found
that the clojure sample ran about 670 minor gc,but the java sample is only
120 minor gc.

A improved clojure version,it's performance is closed to java sample:

user= (time (dotimes [n 1000] (- (StringBuilder.) (.append n)
(.append another word) (.toString
Elapsed time: 1009.942 msecs




2014-03-01 18:02 GMT+08:00 bob wee@gmail.com:

 Case :

 clojure verison:

 (time (dotimes [n 1000] (str n another word))) ;; take about 5000msec

 java version

 long time = System.nanoTime();

 for(int i=0 ; i1000 ;i++){
 String a=i+another word;
 }
   System.out.println(System.nanoTime()-time);


 The java version take about 500 msecs, I thought it might be caused by the
 str implementation which is using string builder, and it might not be the
 best choice in the case of no much string to concat, and then I replace
 another word with 5 long strings as the parameter, however no surprise.

 I just wonder what make the difference, or how to find the difference.

 Thanks



 On Saturday, March 1, 2014 1:26:38 PM UTC+8, Shantanu Kumar wrote:

 I have seen (and I keep seeing) a ton of Java code that performs poorly.
 Empirically, it's equally easy to write a slow Java app. You always need a
 discerning programmer to get good performance from any language/tool.

 Numbers like 1/4 or 1/10 can be better discussed in presence of the
 use-cases and perf test cases. Most of the problems you listed can be
 mitigated by `-server` JIT, avoiding reflection, transients, loop-recur,
 arrays, perf libraries and some Java code.

 Shantanu

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

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
I forgot to note hat i test the java sample and clojure sample code with
the same jvm options '-server'.



2014-03-01 20:03 GMT+08:00 dennis zhuang killme2...@gmail.com:

 The String a=i+another word; is also compiled into using
  StringBuilder, see the byte code by javap -v:

Code:
   stack=5, locals=5, args_size=1
  0: invokestatic  #2  // Method
 java/lang/System.nanoTime:()J
  3: lstore_1
  4: iconst_0
  5: istore_3
  6: iload_3
  7: ldc   #3  // int 1000
  9: if_icmpge 39
 12: new   #4  // class
 java/lang/StringBuilder
 15: dup
 16: invokespecial #5  // Method
 java/lang/StringBuilder.init:()V
 19: iload_3
 20: invokevirtual #6  // Method
 java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
 23: ldc   #7  // String another word
 25: invokevirtual #8  // Method
 java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
 28: invokevirtual #9  // Method
 java/lang/StringBuilder.toString:()Ljava/lang/String;
 31: astore4
 33: iinc  3, 1
 36: goto  6
 39: getstatic #10 // Field
 java/lang/System.out:Ljava/io/PrintStream;
 42: invokestatic  #2  // Method
 java/lang/System.nanoTime:()J
 45: lload_1
 46: lsub
 47: l2d
 48: ldc2_w#11 // double 1.0E9d
 51: ddiv
 52: invokevirtual #13 // Method
 java/io/PrintStream.println:(D)V


 I think the performance hotspot in this simple example is the object
 allocate/gc  and function calling overhead.The str function create
 an anonymous function every time to concat argument strings:

 (^String [x  ys]
  ((fn [^StringBuilder sb more]
   (if more
 (recur (. sb  (append (str (first more (next more))
 (str sb)))
   (new StringBuilder (str x)) ys)))

 And we all know that a function in clojure is a java object allocated in
 heap.And another overhead is calling the function,it's virtual method.

 By watching the gc statistics using 'jstat -gcutil pid 2000', i found
 that the clojure sample ran about 670 minor gc,but the java sample is only
 120 minor gc.

 A improved clojure version,it's performance is closed to java sample:

 user= (time (dotimes [n 1000] (- (StringBuilder.) (.append n)
 (.append another word) (.toString
 Elapsed time: 1009.942 msecs




 2014-03-01 18:02 GMT+08:00 bob wee@gmail.com:

 Case :

 clojure verison:

 (time (dotimes [n 1000] (str n another word))) ;; take about
 5000msec

 java version

 long time = System.nanoTime();

 for(int i=0 ; i1000 ;i++){
 String a=i+another word;
 }
   System.out.println(System.nanoTime()-time);


 The java version take about 500 msecs, I thought it might be caused by
 the str implementation which is using string builder, and it might not be
 the best choice in the case of no much string to concat, and then I replace
 another word with 5 long strings as the parameter, however no surprise.

 I just wonder what make the difference, or how to find the difference.

 Thanks



 On Saturday, March 1, 2014 1:26:38 PM UTC+8, Shantanu Kumar wrote:

 I have seen (and I keep seeing) a ton of Java code that performs poorly.
 Empirically, it's equally easy to write a slow Java app. You always need a
 discerning programmer to get good performance from any language/tool.

 Numbers like 1/4 or 1/10 can be better discussed in presence of the
 use-cases and perf test cases. Most of the problems you listed can be
 mitigated by `-server` JIT, avoiding reflection, transients, loop-recur,
 arrays, perf libraries and some Java code.

 Shantanu

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





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

-- 
You received this message because you are subscribed

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
I think the remaining overhead of clojure sample code is that operators in
java such as '++' and ' etc.They are just an instrument of JVM -- iinc
and if_icmpge. But they are both functions in clojure,and they will be
called by invokevirtual instrument.It cost much more performance.




2014-03-01 20:07 GMT+08:00 dennis zhuang killme2...@gmail.com:

 I forgot to note hat i test the java sample and clojure sample code with
 the same jvm options '-server'.



 2014-03-01 20:03 GMT+08:00 dennis zhuang killme2...@gmail.com:

 The String a=i+another word; is also compiled into using
  StringBuilder, see the byte code by javap -v:

Code:
   stack=5, locals=5, args_size=1
  0: invokestatic  #2  // Method
 java/lang/System.nanoTime:()J
  3: lstore_1
  4: iconst_0
  5: istore_3
  6: iload_3
  7: ldc   #3  // int 1000
  9: if_icmpge 39
 12: new   #4  // class
 java/lang/StringBuilder
 15: dup
 16: invokespecial #5  // Method
 java/lang/StringBuilder.init:()V
 19: iload_3
 20: invokevirtual #6  // Method
 java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
 23: ldc   #7  // String another word
 25: invokevirtual #8  // Method
 java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
 28: invokevirtual #9  // Method
 java/lang/StringBuilder.toString:()Ljava/lang/String;
 31: astore4
 33: iinc  3, 1
 36: goto  6
 39: getstatic #10 // Field
 java/lang/System.out:Ljava/io/PrintStream;
 42: invokestatic  #2  // Method
 java/lang/System.nanoTime:()J
 45: lload_1
 46: lsub
 47: l2d
 48: ldc2_w#11 // double 1.0E9d
 51: ddiv
 52: invokevirtual #13 // Method
 java/io/PrintStream.println:(D)V


 I think the performance hotspot in this simple example is the object
 allocate/gc  and function calling overhead.The str function create
 an anonymous function every time to concat argument strings:

 (^String [x  ys]
  ((fn [^StringBuilder sb more]
   (if more
 (recur (. sb  (append (str (first more (next more))
 (str sb)))
   (new StringBuilder (str x)) ys)))

 And we all know that a function in clojure is a java object allocated in
 heap.And another overhead is calling the function,it's virtual method.

 By watching the gc statistics using 'jstat -gcutil pid 2000', i found
 that the clojure sample ran about 670 minor gc,but the java sample is only
 120 minor gc.

 A improved clojure version,it's performance is closed to java sample:

 user= (time (dotimes [n 1000] (- (StringBuilder.) (.append n)
 (.append another word) (.toString
 Elapsed time: 1009.942 msecs




 2014-03-01 18:02 GMT+08:00 bob wee@gmail.com:

 Case :

 clojure verison:

 (time (dotimes [n 1000] (str n another word))) ;; take about
 5000msec

 java version

 long time = System.nanoTime();

 for(int i=0 ; i1000 ;i++){
 String a=i+another word;
 }
   System.out.println(System.nanoTime()-time);


 The java version take about 500 msecs, I thought it might be caused by
 the str implementation which is using string builder, and it might not be
 the best choice in the case of no much string to concat, and then I replace
 another word with 5 long strings as the parameter, however no surprise.

 I just wonder what make the difference, or how to find the difference.

 Thanks



 On Saturday, March 1, 2014 1:26:38 PM UTC+8, Shantanu Kumar wrote:

 I have seen (and I keep seeing) a ton of Java code that performs
 poorly. Empirically, it's equally easy to write a slow Java app. You always
 need a discerning programmer to get good performance from any 
 language/tool.

 Numbers like 1/4 or 1/10 can be better discussed in presence of the
 use-cases and perf test cases. Most of the problems you listed can be
 mitigated by `-server` JIT, avoiding reflection, transients, loop-recur,
 arrays, perf libraries and some Java code.

 Shantanu

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

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
Yep, you are right, inspecting the byte code generated by the clojure code:

 (loop [n 0]
(when ( n 1000)
  (- (StringBuilder.) (.append n) (.append another word)
(.toString))
  (recur (unchecked-inc n

It is:


L4
LINENUMBER 4 L4
LLOAD 1
LDC 1000
LCMP
IFGE L5
   L6
LINENUMBER 5 L6
   L7
LINENUMBER 5 L7
   L8
LINENUMBER 5 L8
NEW java/lang/StringBuilder
DUP
INVOKESPECIAL java/lang/StringBuilder.init ()V
CHECKCAST java/lang/StringBuilder
LLOAD 1
INVOKEVIRTUAL java/lang/StringBuilder.append
(J)Ljava/lang/StringBuilder;
CHECKCAST java/lang/StringBuilder
LDC another word
CHECKCAST java/lang/String
INVOKEVIRTUAL java/lang/StringBuilder.append
(Ljava/lang/String;)Ljava/lang/StringBuilder;
CHECKCAST java/lang/StringBuilder
INVOKEVIRTUAL java/lang/StringBuilder.toString ()Ljava/lang/String;
POP
   L9
LINENUMBER 6 L9
LLOAD 1
LCONST_1
LADD
LSTORE 1
GOTO L2
GOTO L10
   L11
POP
   L5
ACONST_NULL


It's almost the same with java compiled byte code,except using long type's
instruments (LCMP and LADD etc) and some CHECKCAST (cast type) instruments.





2014-03-01 21:00 GMT+08:00 Jozef Wagner jozef.wag...@gmail.com:

 Clojure math functions compile down to the same JVM 'instruction' as from
 java. See http://galdolber.tumblr.com/post/77153377251/clojure-intrinsics



 On Sat, Mar 1, 2014 at 1:23 PM, dennis zhuang killme2...@gmail.comwrote:

 I think the remaining overhead of clojure sample code is that operators
 in java such as '++' and ' etc.They are just an instrument of JVM -- iinc
 and if_icmpge. But they are both functions in clojure,and they will be
 called by invokevirtual instrument.It cost much more performance.




 2014-03-01 20:07 GMT+08:00 dennis zhuang killme2...@gmail.com:

 I forgot to note hat i test the java sample and clojure sample code with
 the same jvm options '-server'.



 2014-03-01 20:03 GMT+08:00 dennis zhuang killme2...@gmail.com:

 The String a=i+another word; is also compiled into using
  StringBuilder, see the byte code by javap -v:

Code:
   stack=5, locals=5, args_size=1
  0: invokestatic  #2  // Method
 java/lang/System.nanoTime:()J
  3: lstore_1
  4: iconst_0
  5: istore_3
  6: iload_3
  7: ldc   #3  // int 1000
  9: if_icmpge 39
 12: new   #4  // class
 java/lang/StringBuilder
 15: dup
 16: invokespecial #5  // Method
 java/lang/StringBuilder.init:()V
 19: iload_3
 20: invokevirtual #6  // Method
 java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
 23: ldc   #7  // String another word
 25: invokevirtual #8  // Method
 java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
 28: invokevirtual #9  // Method
 java/lang/StringBuilder.toString:()Ljava/lang/String;
 31: astore4
 33: iinc  3, 1
 36: goto  6
 39: getstatic #10 // Field
 java/lang/System.out:Ljava/io/PrintStream;
 42: invokestatic  #2  // Method
 java/lang/System.nanoTime:()J
 45: lload_1
 46: lsub
 47: l2d
 48: ldc2_w#11 // double 1.0E9d
 51: ddiv
 52: invokevirtual #13 // Method
 java/io/PrintStream.println:(D)V


 I think the performance hotspot in this simple example is the object
 allocate/gc  and function calling overhead.The str function create
 an anonymous function every time to concat argument strings:

 (^String [x  ys]
  ((fn [^StringBuilder sb more]
   (if more
 (recur (. sb  (append (str (first more (next more))
 (str sb)))
   (new StringBuilder (str x)) ys)))

 And we all know that a function in clojure is a java object allocated
 in heap.And another overhead is calling the function,it's virtual method.

 By watching the gc statistics using 'jstat -gcutil pid 2000', i found
 that the clojure sample ran about 670 minor gc,but the java sample is only
 120 minor gc.

 A improved clojure version,it's performance is closed to java sample:

 user= (time (dotimes [n 1000] (- (StringBuilder.) (.append n)
 (.append another word) (.toString
 Elapsed time: 1009.942 msecs




 2014-03-01 18:02 GMT+08:00 bob wee@gmail.com:

 Case :

 clojure verison:

 (time (dotimes [n 1000] (str n another word))) ;; take about
 5000msec

 java version

 long time = System.nanoTime();

 for(int i=0 ; i1000 ;i++){
 String a=i+another word;
 }
   System.out.println(System.nanoTime()-time);


 The java version take about 500 msecs, I thought it might be caused by
 the str implementation

Re: JRE/JVM for development

2014-01-29 Thread Dennis Haupt
my vm starts up within a second or so, what's the problem for you?


2014-01-29 ton...@gmail.com

 Are there any Java VMs strictly for development use that could be started
 up quicker, use less memory or compile clojure during execution?
 Alternatively can OpenJDK or similar be configured to do so? I don't care
 about application performance during development.

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

2014-01-27 Thread Dennis Haupt
one does not simply compare floating point numbers for equality


2014-01-27 Eric Le Goff eleg...@gmail.com

 Newbie question :

 user= (= 42 42)
 true
 user= (= 42 42.0)
 false

 I did not expect last result.

 I understand that underlying classes are not the same
 i.e
 user= (class 42)
 java.lang.Long
 user= (class 42.0)
 java.lang.Double


 but anyway I'am surprised

 Cheers


 --
 Eric

  --
 --
 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: JAVA_OPTS not accessible in my Clojure project

2014-01-12 Thread dennis zhuang
Tried System/getenv ?


2014/1/12 aidy lewis aidy.le...@gmail.com

 Hi Phil,

 M-x cider-jack-in, but the JAVA_OPT properties are also nil if I do a lein
 run.

 Thanks

 Aidy


 On 12 January 2014 05:25, Matching Socks phill.w...@gmail.com wrote:

 How did you start the Emacs Cider REPL?

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




 --
 @AidyLewis

 --
 --
 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: How to indent clojure code in Emacs

2014-01-03 Thread dennis zhuang
use the 'indent-region' function.You can define a function to indent the
whole buffer:

(defun indent-buffer ()
  Indent whole buffer
  (interactive)
  (indent-region (point-min) (point-max))
  (message format successfully))


Then bind the function to a key, i bound it to F7 for me:

(global-set-key [f7] 'indent-buffer)

Also, you can indent-buffer before saving file:

(defun indent-file-when-save ()
  indent file when save.
  (make-local-variable 'after-save-hook)
  (add-hook 'after-save-hook
(lambda ()
  (if (buffer-file-name)
  (indent-buffer))
  (save-buffer
(add-hook 'clojure-mode-hook 'indent-file-when-save)



2014/1/3 tao tao.zhou2...@gmail.com

  https://github.com/clojure-emacs/clojure-mode

 I have installed this plugin, but I don’t know how to indent clojure code,
 when I already selected a region. In Vim, I can do this using “=“, just a
 simple key stroke.

 This a problem when I copy some clojure code from other place, not typed
 in.

 I already read this tutorial (
 http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html),
 but I cannot found the method.

 sorry for disturb. :)

 --
 tao
 Sent with Sparrow http://www.sparrowmailapp.com/?sig

  --
 --
 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: Read Microsoft Word .doc files in Clojure

2014-01-02 Thread Dennis Haupt
use apache poi and write a small wrapper or something
this is what i did


2014/1/2 Joshua Mendoza joshua.m...@gmail.com

 Hi!,

 I've been looking for libraries or resources to read MS .doc files in
 Clojure, but found none. Does anyone have tried, used, encountered or
 witnessed such a thing to read them?

 I found a lot of info publicly available by the government in .doc files
 but I want to process them automatically with Clojure.

 The closest thing I know is using Incanter but to read XLS files, which is
 not useful at all for this...

 Well, any help would be great.

 Thank you!

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


some clojure experience

2013-12-31 Thread Dennis Haupt
i solved a few little thingy with clojure now, including some euler
problems, java interop and an asteroids clone.

my summary would be:
* very nice to write +1. i used clojure's collections for a lot of things,
and they made a good impression
* you need to plan far ahead compared to java. in java, it's easy to
hack-fix something if it doesn't work by adding a field somewhere and
read its value later, or add a parameter to a call hierarchy. i know this
isn't the way it should be done, but sometimes code quality is irrelevant
(for example if you are just making some experiments)
* the effort to modify code is either very low, or very high - in java, it
was kind of always the same. in clojure, it seems to depend a lot on the
existing code.
* debugging is impossible (or very hard) if you want to debug like you are
used to do it in java - meaning stop if condition x is true and evaluate
expressions at that point. i made some mistakes that i would have
immediately seen in a standard debug session, but i don't know how i could
have seen it in clojure. i needed to think a lot more or add debug output
to understand those bugs - like flipping x and y in a grid. so, fixing bugs
took longer than it takes in java.
* how do you deal with complex data structures? since i cannot tell what
the type of a parameter is, it could be anything, including a map with
unknown content. i can only see which properties of it are immediately
accessed. is that the trick? to not care about what you don't care about?
and having something like hallucinated interfaces?

what are your experiences?

-- 
-- 
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: Is Clojure right for me?

2013-12-26 Thread Dennis Haupt
exactly which part of OOP is missing in clojure that you would like to use?
if you took my java code and ported it to clojure, the main difference
would be (a b) instead of b.a , but the main design would be similar


2013/12/26 Massimiliano Tomassoli kiuhn...@gmail.com

 On Thursday, December 26, 2013 7:51:39 PM UTC+1, James Reeves wrote:

 On 26 December 2013 16:32, Massimiliano Tomassoli kiuh...@gmail.comwrote:

 Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm
 a little bit worried about the absence of support for OOP in Clojure. How
 do you decompose large systems in Clojure?


 You write functions. To quote Alan J. Perlis:

 It is better to have 100 functions operate on one data structure than to
 have 10 functions operate on 10 data structures.


 Classes or objects are not simple data structures.


 IMO, OOP just makes it harder to build modular systems, because OOP
 involves a lot of implicit connections between components. Clojure, and
 other functional languages, tend to emphasise isolation more.


 Why implicit? Objects communicate through well-defined channels. OOP can
 certainly be misused but it served me well for over 20 years (C++/C#). And
 Scala proves that FP and OOP are orthogonal paradigms. I can't see how the
 lack of OOP is a good thing for Clojure, honestly. I'm willing to give up
 mutability because I never programmed that way and I believe it can be a
 good thing (after I get used to it), but giving up OOP means going back to
 something I already know and I don't like.

 --
 --
 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: How to go about 'proving' why dynamically typed languages are better.

2013-12-20 Thread Dennis Haupt
in my mental world, there is a pure human, and a 4 armed human would
probably be a 95% human or something, just like a hobbit would be. the
other way round, a human would be a 95% hobbit. an elephant would be 4%
hobbit on that scale.
this model is flexible, covers everything, and is not really helpful when
you ask what is it? you have to ask is this at least 90% cat?


2013/12/20 Phillip Lord phillip.l...@newcastle.ac.uk

 zcaudate z...@caudate.me writes:
  @philip lord.
 
  Where would mutant elephants and the elephant god Ganesha fit in that
 classification?


 It might surprise you to know that there is actually quite a lot work on
 both of these.

 The problem with mutant elephants generalises into the problem with
 abnormalities; for example, if I build a model of a human which says,
 humans have two hands, and two legs then there are plenty of counter
 examples, having more or less than two hands (mostly less). If, on the
 other hand, you have a model which can cope with these exceptions, then
 it gets too complex to handle, and you can rarely conclude anything
 useful.

 Ganesha causes a different problem: that is does he exist at all, and if
 he does, is he an elephant. Now there are those who say no he isn't, so
 he shouldn't be in the model. And, there are those (like me) who say,
 well it depends on your application and what you are trying to achieve.

 Farcical as all of this sounds, it does actually have implications for
 the way that we build data models, particularly for biology and
 medicine. If you are interested, you can read my paper on the subject
 here:

 http://www.russet.org.uk/blog/1713

 And a companion article by my co-author. It's about unicorns, but most
 of it probably covers Ganesha also.

 http://robertdavidstevens.wordpress.com/2011/05/26/unicorns-in-my-ontology/

 Phil

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

2013-10-27 Thread dennis zhuang
The function's arguments will be evaluated before calling it.
So the (my-foo) will be called before 'get'.



2013/10/28 Ryan arekand...@gmail.com

 Hello,

 I am trying to understanding why is this happening:

  (defn my-foo [] (println Why do I get printed?))
 #'sandbox4724/my-foo
  (get {:b 1} :b (my-foo))
 Why do I get printed?
 1
 


 Shouldn't (my-foo) only be called in case the key isn't found? Why am I
 seeing the above behavior instead?

 Thank you for your time,

 Ryan

 --
 --
 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: How to go about 'proving' why dynamically typed languages are better.

2013-10-09 Thread Dennis Haupt
let's see...
really used:
sql
java
javascript
basic
pascal/delphi
scala

experimented with:
logo (some old language intended to teach people to make their first steps)
haskell
kotlin
clojure

seen in action:
php
groovy

still prefer smart static typing :D




2013/10/9 Nando Breiter na...@aria-media.com


 The best explanation of these misunderstandings I've come across is What
 to Know Before Debating Type Systems:

 http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/


 I have learned quite a lot from reading this article and following this
 discussion, particularly that type and type checking is much more
 nuanced and complex than I have understood until now, and that the terms
 static and dynamic expand into a much larger range of issues upon close
 examination, such as the difference between explicitly declaring types (as
 in Java) and implicitly inferring types from code context. Quoting from the
 article:

 *Many programmers approach the question of whether they prefer static or
 dynamic types by comparing some languages they know that use both
 techniques. This is a reasonable approach to most questions of preference.
 The problem, in this case, is that most programmers have limited
 experience, and haven’t tried a lot of languages. For context, here, six or
 seven doesn't count as “a lot.”*
 *
 *

 So I can say I prefer dynamic typing, but the reasons are more personal,
 and molded by my development experience.

 --
 --
 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: How to go about 'proving' why dynamically typed languages are better.

2013-10-09 Thread Dennis Haupt
especially haskell  scala are missing in your list :)
as long as you haven't at least seen haskell, you haven't seen the creme de
la creme of statically typed languages


2013/10/9 Softaddicts lprefonta...@softaddicts.ca

 Let's see:

 strong data typing:

 Fortran
 Cobol
 Pl/1
 Pascal
 C/C++
 Java
 C#
 Ruby

 à la carte data typing or no data typing at all:

 Basic (more or less depending on the implementation)
 Lisp
 Clojure
 A dozen assemblers
 A dozen scripting languages

 And I probably forgot some while excluding the ones I worked with
 (Algol, Simula, GPSS, ...) in academic projects. I used the above ones
 on real projects at work and not small projects.

 Lets keep SQL out of the picture, it's an exaggeration to call this a
 programming
 language.

 Still prefer less data typing or no typing at all :)

 Luc P.


  let's see...
  really used:
  sql
  java
  javascript
  basic
  pascal/delphi
  scala
 
  experimented with:
  logo (some old language intended to teach people to make their first
 steps)
  haskell
  kotlin
  clojure
 
  seen in action:
  php
  groovy
 
  still prefer smart static typing :D
 
 
 
 
  2013/10/9 Nando Breiter na...@aria-media.com
 
  
   The best explanation of these misunderstandings I've come across is
 What
   to Know Before Debating Type Systems:
  
   http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/
  
  
   I have learned quite a lot from reading this article and following this
   discussion, particularly that type and type checking is much more
   nuanced and complex than I have understood until now, and that the
 terms
   static and dynamic expand into a much larger range of issues upon
 close
   examination, such as the difference between explicitly declaring types
 (as
   in Java) and implicitly inferring types from code context. Quoting
 from the
   article:
  
   *Many programmers approach the question of whether they prefer static
 or
   dynamic types by comparing some languages they know that use both
   techniques. This is a reasonable approach to most questions of
 preference.
   The problem, in this case, is that most programmers have limited
   experience, and haven’t tried a lot of languages. For context, here,
 six or
   seven doesn't count as “a lot.”*
   *
   *
  
   So I can say I prefer dynamic typing, but the reasons are more
 personal,
   and molded by my development experience.
  
   --
   --
   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.
 
 --
 Softaddictslprefonta...@softaddicts.ca 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 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 

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-08 Thread Dennis Haupt
while i can see the strengths of both sides, the ideal solution is imho
this:

everything is statically typed. always. but you *never* have to write
the type explicitly. you *can* do it, but it is always optional.

i made good experiences with both scala and haskell (although i just
wrote minor things in the latter). the compiler really helps spotting
oops-errors early on, and the ide (in case of scala) has a lot of
information about the code and can assist you in ways that are simply
impossible without static typing.

please, do not confuse java with static typing. static typing could
also track all supported methods of an object as its type. imagine java,
but let every class implement one interface for each method that can be
called on it - its inferred type is, instead of just a simple class, the
set of interfaces necessary for the code to compile.
to actually write that would be completely annoying, but if a compiler
actually does the work for you and breaks it down, you would have a lot
of error checking and static information without losing much flexibility

Am 09.10.2013 00:36, schrieb Kendall Shaw:
 Some things that I see most of the time when I read debates about
 dynamic vs static are:
 
 1. Statically defined types don't solve everything, so they are not useful.
 
 Some help is better than no help even if the help doesn't solve all of
 your problems.
 
 Yes, you should wash your hands before dinner, even though we are all
 going to die in the end anyway.
 
 2. I like static typing as long as it is optional
 
 In the case where the point of using statically defined types is to have
 a compiler catch problems instead of you needing to predict their
 occurrence then static typing would have to be non-optional.
 
 3. You don't need the compiler to warn you about types, because you can
 write tests.
 
 A difficult problem is one that occurs on a rare occasion in some place
 that you would not have thought to check. So, you can't expect to be
 able to catch them with tests. If the problem is one that would have
 been flagged as a compile-time error, then in that case it would have
 been useful to have been using static typing.
 
 I am still unsure. It seems likely that the usefulness of statically
 defined types would depend upon the application. When using statically
 defined types makes development slower to an extent that outways the
 benefit, then it is bad. If  faster initial development as a result of
 dynamic typing ultimately ends up taking more time because of problems
 that would have been caught by a compiler, then it is bad. If statically
 defined typing makes you not discover things you would have because of
 the overhead of dealing with the static typing, then that is bad.
 
 Kendall
 
 
 On 10/05/2013 08:35 PM, zcaudate wrote:
 I'm a little bit miffed over this current craze of `types` and
 `correctness` of programs. It smells to me of the whole `object` craze
 of the last two decades. I agree that types (like objects) have their
 uses, especially in very well defined problems, but they have got me
 in trouble over and over again when I am working in an area where the
 goal is unclear and requirements are constantly changing. 

 BTW... This is no means a criticism of all the type system work that
 is going on in the clojure community. I am a huge fan of Ambrose's
 Typed Clojure project because it gives me the *option *of using
 types... not shoving it down my throat. I like the freedom to choose.

 My experience of programming in clojure has freed me from thinking
 about types and hierarchies and this article rings so true:
 http://steve.yegge.googlepages.com/is-weak-typing-strong-enough.

 However, everywhere I look, there are smug type-weenies telling me
 that my dynamically typed program is bad because it cannot be `proven
 correct` and not `checked by the compiler`. This question on SO really
 makes me
 angry 
 http://stackoverflow.com/questions/42934/what-do-people-find-so-appealing-about-dynamic-languages
 because no one is defending dynamic languages on there. The reason is
 very simple. because we don`t have a theory to back us up!

 I do want to put up an counter argument against this barrage of abuse
 against dynamic languages. And I want to put some academic weight
 behind this. The only counter I could come up with was to use Godel's
 incompleteness theorem. For those that don't know... here is an
 introduction to the man and his theory.
 http://www.youtube.com/watch?v=i2KP1vWkQ6Y. Godel's theorem,
 invalidated Principia Mathematica as a complete system of description.
 Principia Mathematica btw  effectively led to Type Theory.


 According to http://en.wikipedia.org/wiki/Type_theory. The types
 of type theory were invented by Bertrand Russell in response to
 his discovery that Gottlob Frege's version of naive set theory was
 afflicted with Russell's paradox. This theory of types features
 prominently in Whitehead and Russell's Principia 

Re: too circular?

2013-08-29 Thread Dennis Haupt
thx again


2013/8/30 Bruno Kim Medeiros Cesar brunokim...@gmail.com

 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: too circular?

2013-08-27 Thread Dennis Haupt
thx


2013/8/26 Marshall Bockrath-Vandegrift llas...@gmail.com

 Dennis Haupt d.haup...@gmail.com 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 j...@jayfields.com

 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.


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: Entwined STM V1.0

2013-08-18 Thread dennis zhuang
That's really cool.
Do you have any performance benchmark between TransactionalMap and
java.util.concurrent.ConcurrentHashMap?  When should i use these
collections instead of java.util.concurrent.* collections?




2013/8/18 Ivan Koblik ivankob...@gmail.com

 Hi All,

 Almost 4 years ago I 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.


Re: Can we please deprecate the :use directive ?

2013-07-24 Thread dennis zhuang
I am using ':use' for my own namespaces.I know it's discouraged, but if i
can control my own code,why not? Compiler can give me warnings and i
process all warnings carefully.



2013/7/25 Steven Degutis sbdegu...@gmail.com

 If our votes count for anything, then I'd like to add +1 for getting rid
 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 lprefonta...@softaddicts.ca
  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.
 
 
 
 --
 Softaddictslprefonta...@softaddicts.ca 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
 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 

{{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: 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 dpollak...@gmail.com

 Thanks!


 On Mon, Jul 1, 2013 at 8:13 AM, Sean Corfield seancorfi...@gmail.comwrote:

 On Sun, Jun 30, 2013 at 4:42 PM, David Pollak dpollak...@gmail.com
 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.




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

2013-07-02 Thread dennis zhuang
Maybe he means clear?


2013/7/2 Jim jimpil1...@gmail.com

 No merge will not work with transients because it uses conj instead of
 conj!
 If you absolutely have to do this define your own 'merge!' that uses conj!.

 I'm not sure what you mean by reset! for transients...reset! is an
 operation on 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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 jimpil1...@gmail.com

  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 jimpil1...@gmail.com

 No merge will not work with transients because it uses conj instead of
 conj!
 If you absolutely have to do this define your own 'merge!' that uses
 conj!.

 I'm not sure what you mean by reset! for transients...reset! is an
 operation on 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.




{ANN} clj-xmemacched release 0.2.2

2013-06-24 Thread dennis zhuang
An opensource memcached client for clojure wrapping
xmemcachedhttp://code.google.com/p/xmemcached/.It
released 0.2.2, added 'clj-json-transcoder' that encode/decode values using
clojure.data.json.

https://github.com/killme2008/clj-xmemcached


-- 
庄晓丹
Email:killme2...@gmail.com 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.




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 ltoro...@gmail.com

 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 d.haup...@gmail.com

 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 d.haup...@gmail.com
 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(); jimpil1...@gmail.com
 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.




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(); jimpil1...@gmail.com

 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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
#MultiFn clojure.lang.MultiFn@1afb02d
#MultiFn clojure.lang.MultiFn@1afb02d
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 cbil...@pobox.com

 Dennis Haupt d.haup...@gmail.com 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)
  #Var@6427854d: #MultiFn clojure.lang.MultiFn@4bddef9a
  nil
  user (defmethod fac 1 [_] 1)
  #MultiFn clojure.lang.MultiFn@4bddef9a
  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)
 #MultiFn clojure.lang.MultiFn@4bddef9a
 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))
 #Var@5b1413a8:
   #user$eval336$inspect__337 user$eval336$inspect__337@68903261
 nil
 user (inspect 1)
 inspect:  (1)
 1
 nil
 user (defmulti fac2 inspect)
 nil
 nil
 user (defmethod fac2 1 [_] 1)
 #MultiFn clojure.lang.MultiFn@e2df60d
 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(); jimpil1...@gmail.com

 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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 d.haup...@gmail.com

 clojure jvm, intellij's repl. i'll try to run the file via commandline and
 see what happens


 2013/6/22 Jim - FooBar(); jimpil1...@gmail.com

 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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(); 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
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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 cbil...@pobox.com

 Dennis Haupt d.haup...@gmail.com 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
  #MultiFn clojure.lang.MultiFn@1afb02d
  #MultiFn clojure.lang.MultiFn@1afb02d
  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 stuff [stuff2] 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 d.haup...@gmail.com

 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 cbil...@pobox.com

 Dennis Haupt d.haup...@gmail.com 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
  #MultiFn clojure.lang.MultiFn@1afb02d
  #MultiFn clojure.lang.MultiFn@1afb02d
  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 cbil...@pobox.com

 Dennis Haupt d.haup...@gmail.com 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.




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.




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

2013-06-07 Thread Dennis Haupt
intellij can do exactly what you want


2013/6/7 Moocar anthony.mar...@gmail.com

 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.




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 killme2...@gmail.com

 user= (sorted-map-by (constantly 1) :b 1 :a 2)
 {:b 1, :a 2}
 user= (:a (sorted-map-by (constantly 1) :b 1 :a 2))
 nil
 user= (keys (sorted-map-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 andy.finger...@gmail.com写道:

 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 killme2...@gmail.comwrote:

 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 killme2...@gmail.com

 user= (sorted-map-by (constantly 1) :b 1 :a 2)
 {:b 1, :a 2}
 user= (:a (sorted-map-by (constantly 1) :b 1 :a 2))
 nil
 user= (keys (sorted-map-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: Use of io!

2013-05-30 Thread dennis zhuang
Yep,wrap code that has side effects, prevent it to be evaluated in STM
transaction.


2013/5/30 Maik Schünemann maikschuenem...@gmail.com

 I think It stops other code to wrap around the code with the explicit io!
 call.
 Its declarative way of saying: I am doing io! DONT USE me inside a dosync.


 On Thu, May 30, 2013 at 7:47 AM, Josh Kamau joshnet2...@gmail.com 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.




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

2013-04-22 Thread dennis zhuang
Java.

But there is some clojure version written in ruby,python,c# and javascript.


2013/4/22 ljcppu...@gmail.com

 Hi,
 Do you know which language the clojure is written by?

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this 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: Imported Java lib can't find classes compiled on the fly

2013-03-17 Thread dennis zhuang
You can make the clojure class loader by yourself:

(import '(clojure.lang RT))
(def class-loader (RT/makeClassLoader))

user= (.loadClass class-loader user.Foo)
user.Foo



2013/3/17 vemv v...@vemv.net

 Most definitely :) But that something is hard/confusing should'nt be
 enough reason to give up.


 On Sunday, March 17, 2013 4:11:34 AM UTC+1, James Xu wrote:

 Then things will get complicated and ugly.

   原始邮件
 *发件人:* Víctor M. Valenzuelave...@vemv.net
 *收件人:* clojureclo...@**googlegroups.com
 *发送时间:* 2013年3月17日(周日) 11:05
 *主题:* Re: Imported Java lib can't find classes compiled on the fly

 My guess is it was set via Thread.currentThread().**
 setContextClassLoader()...?

 On Sun, Mar 17, 2013 at 3:07 AM, Víctor M. Valenzuela ve...@vemv.netwrote:

 Yeah I was working in that direction now!

 Anyway, how come (Class/forName) can work if used from the repl? My
 understanding is that the classloader provided by Class is different from
 DynamicClassLoader.


 On Sun, Mar 17, 2013 at 3:01 AM, Michael Klishin 
 michael@gmail.comwrote:


 2013/3/17 vemv ve...@vemv.net

 I guess that somehow the Java library uses a different classloader or
 something like that? Any possible solution?


 Clojure itself uses a separate classloader: a 
 clojure.lang.**DynamicClassLoader
 instance.

 If you can use an instance of that classloader, you should be fine.
 --
 MK

 http://github.com/**michaelklishin http://github.com/michaelklishin
 http://twitter.com/**michaelklishin http://twitter.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=enhttp://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/clojure/-n3jul1IeZ8/**unsubscribe?hl=enhttps://groups.google.com/d/topic/clojure/-n3jul1IeZ8/unsubscribe?hl=en
 .
  To unsubscribe from this group and all its topics, send an email to
 clojure+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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 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=enhttp://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/**groups/opt_outhttps://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.




  1   2   3   >