Learning to use Clojure (1)

Source: Internet
Author: User

Clojure is a functional language.

Functional language is not the mainstream of today's development language.

Most mainstream is the "imperative" language (imperative language)

Among them, the object-oriented paradigm is mostly.


On the trend of development, parallel, distributed, multi-CPU is becoming more and more popular.

Mainstream language in the treatment of these changes is inefficient, a little powerless.

Therefore, in recent years, functional language has the meaning of a comeback.


A functional or functional language, the oldest Lisp series,

The scholarly Haskell, the OCaml of the ML family.

A vain attempt to replace Java's Scala

And, of course, the clojure of simplicity and pragmatism.


Clojure is very simple, the whole language is a Clojure-xxxx.jar file, the development of nearly 10 years, still only about 3M.

The common features of the functional formula are:

    1. Advocating "pure function", that is, no side effects, on the specific input, will always be the same output.

    2. "Function" is a class citizen. Can be passed as a parameter as a variable of type int string, as a return value,

      It can also be said that high-order function features are supported.

    3. Use immutable "data" instead of "variables"

      This benefits a lot and can easily handle concurrency without the "lock" puzzle

    4. The focus is on "transformations" and "combinations of transformations", which are concerned with "verbs" rather than "nouns" in object-oriented kingdoms-that is, objects. It's called "The Revenge of the verb."


Clojure is very pragmatic, not to swim in the math world, but chose the JVM as the host.

You can manipulate classes, objects, and methods in the Java class Library as easily as you would call your own function.

Java can do a very good thing, Clojure no longer re-invent, at most is packaging, in order to better combination.

Clojure emphasizes "invariance", but does not refuse to use "variable" occasionally

Clojure emphasizes "pure function", but does not reject necessary "side effects" (such as debug printing)

Clojure advocates "lazy evaluation", but does not compel you to do so.


Finally, Clojure is a Lisp dialect, a Lisp dialect on the JVM.

It retains the power of Lisp and is more concise


Even if it is never used, its design philosophy, inner philosophy is definitely worth the taste!

Learning to use Clojure (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.