Git Product home page Git Product logo

clojure-intro's Introduction

Intro to Clojure

Clojure is a dialect of Lisp

  • Shares with Lisp the code-as-data philosophy and a powerful macro system.

A functional programming language

  • Favours immutable, persistent data structures (values don't change)
  • Not a strictly pure language which makes it practical

Sum a list of numbers in Python:

>>> sum = 0
>>> for n in [1, 2, 3]:
...   sum = sum + n
... 
>>> sum
6

Sum a list of numbers in Clojure:

user=> (reduce + [1 2 3])
6

Enables concurrency and shared state

  • Offers a software transactional memory system (think transactions in a database) and reactive Agent system that ensure clean, correct, multithreaded designs.

Dynamic and encourages iterative development

  • Compiled at runtime allowing runtime access to all features
  • Favours developing with a Read Eval Print Loop (REPL)

Examples

A basic set of examples can be found in src/intro/core.clj and ran in a REPL.

Setup

To run the examples:

  • Clone this repository,
  • Install Leiningen
  • Change to the project directory and run lein repl to open a REPL that you can copy the examples into

Attribution and License

The examples are taken from http://learnxinyminutes.com/docs/clojure/ (licensed under CC BY-SA 3.0). This project is also licensed under CC BY-SA 3.0.

clojure-intro's People

Contributors

walkermatt avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.