Here is an extremely simple example:

Problem: add a list of numbers

java: You put something like this in a class in a method

int[] numbers = {1,2,3,4,5,6,7,7,8,4,3} ;

int sum = 0 ;
for(int i = 0; i < sum.length; i++) {
    sum = sum + i;
}

return sum;


clojure: You put this in a clojure namespace

(def numbers [1 2 3 4 54 56 6])

;;to get the sum
(reduce + numbers)


You get the idea ;)

Josh


On Tue, Jan 5, 2016 at 4:19 PM, Thomas Saillard <tsaillar...@gmail.com>
wrote:

> Dear,
>
> In order to good understand the powerful of Clojure,
> I have heard that compare to a code in java you need only few lines in
> clojure.
> Is that true ?
> If it is the case, have you a sample of the 2 codes ?
> I appreciate your help.
> My Kind regards,
> Thomas
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from 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.

Reply via email to