Clojure Rules 101
What is Clojure?
Clojure (pronounced like 'closure') is a programming language. Clojure is a means of expressing ideas so that a computer can easily compute them, but humans can still understand them if they know what they're looking at.
Why Does Clojure Matter for LMS?
Loan Management System (LMS), our main software product, is built to let lenders customize and automate the software to suit their business needs. Many of the tools for customizing and automating the system hinge on Clojure.
Clojure in LMS, for instance, lets users:
- Write rules applied, which automatically apply effects on loans that meet certain conditions
- Configure trigger-based notifications
- Determine which loans qualify for a process wizard
- Configure Computation Fields to calculate custom values for display in your Loan Summary, Custom Forms, etc.
I'm a programmer. Can you tell me a little more technical info about why you use Clojure?
When describing human languages, syntax refers to the basic underlying grammar rules that everyone follows: We say the book instead of book the. With computer or programming languages, syntax refers to the same basic principles, the underlying rules of the language.
A Clojure formula's syntax hinges on operands, operators, and a whole bunch of parentheses.
An operand is a number, value, or variable.
An operator indicates an action performed on the operands.
What is one plus two?
1 + 2 =
(+ 1 2)
In the Clojure formula (+ 1 2) above, we have two operands, 1 and 2, and one operator, +, all enclosed in a set of parentheses. The operator always comes first, and tells you what you'll be doing to each of the operands that follow. With English, we might write this as a command: Add one and two. When we're adding more than two operands, we still only need one operator.
With this next example, you might see how Clojure is more efficient than standard math notation. Our earlier examples of (+ 1 2) and (1 + 2) look about the same, but the difference is more noticeable on larger equations.
1 + 2 + 4 + 5 + 5 + 6 =
(+ 1 2 4 5 5 6)
((3 + 6 + 10 + 18) * (5 - 3 - 2 - 1) * (10 * 5 * 5 * 4 * 2)) =
(* (+ 3 6 10 18) (- 5 3 2 1) (* 10 5 5 4 2))
Taking a closer look at that example, you'll notice how Clojure deals with multilayered equations. With a standard math equation, we might write (15 + 22) * (35 - 65), where parentheses show us that we should solve the two smaller questions before multiplying them together. Clojure similarly uses parentheses to show the order each operation should be performed in. This equation would be written (* (+ 15 22) (- 35 65)). Clojure works from the inside out: We first solve the two inner problems, then multiply them together.
Learning new ways to do math is certainly interesting, but none of the rules we've seen here would really be useful in LMS. Clojure becomes a valuable automation tool when we introduce more complex elements. Now that you understand the basic syntax, you can dive into Clojure Rules Next Steps and see how it can make your life easier in LMS.