clojure

Performing Simple Mathematical Operations

Introduction#

This is how you would add some numbers in Clojure syntax. Since the method occurs as the first argument in the list, we are evaluating the + (or addition) method on the rest of the arguments in the list.

Remarks#

Performing mathematical operations is the basis of manipulating data and working with lists. Therefore, understand how it works is key to progressing in one’s understanding of Clojure.

Math Examples

;; returns 3
(+ 1 2) 

;; returns 300
(+ 50 210 40)

;; returns 2
(/ 8 4)

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow