Special Operators for Computation Rules


If you've read Clojure Rules 101 and Clojure Rules Next Steps, then you know that some operators perform special functions, and return different kinds of data. This article discusses several operators available in LoanPro that can be used with Computation Rules. These rules allow you to get whole numbers out of text, grab portions of text, and work with special LoanPro variables.

Avoid Non-Clojure Languages

Avoid using interop of languages such as Java when using LoanPro's computation rules.

Do not use functions such as

  • Double/valueOf
  • Integer/parseInt
  • Double/parseDouble

Instead, opt to use Lisp/Clojure specific functions and the operators provided by LoanPro, covered below.

Text Evaluations

These operators evaluate text.

  • v/parse-int can pull a whole number from a string.
  • v/parse-float can pull numbers with decimals from a string.
  • subs returns a portion of a string.

Text to a Whole Number

You can extract a whole number from a string of text using the “v/parse-int” operator. Text is often enclosed in double quotes, and dates are automatically converted to text when needed.




(v/parse-int "80")


The operator turns the string "80" into just a number, 80. (You can't perform math operations on a string, so this converts a string to a number)

(v/parse-int "2.984938")


This operator will only return a whole number, so it cuts off anything following a decimal.

(v/parse-int "L42-20132")


It will look for the first whole number it can, skipping past text and ignoring everything after the number.

(v/parse-int "2024-08-09")


If used on a date, it'll only return the year.

Text to a Floating Point Number

The LoanPro Computation Rules also allow you to extract floating point numbers from a string of text using the “v/parse-float” operator. The examples used in the section above apply the same here but for floating point numbers, instead of whole numbers.




(v/parse-float "80.5")


The operator turns the string "80.5" into a number.


The Substring operator (subs) evaluates a text operand and returns a smaller portion of it. The substring operator takes two to three operands: The text to use as a base, the starting character (the first character is 0, the second is 1, and so forth), and the ending character (if not provided then it will include everything to the right of the starting character).

Note that the ending character is exclusive; in other words, the result will not include the end character.




(subs "2022-02-14" 0 4)


The operator starts at zero and goes four characters deep, then drops the rest. Note that the date will be a string, not a number.

(subs "L212-5142b" 5)


It starts after the fifth character and then includes everything that follows. This can be useful for redacting sensitive information, like contact info or account IDs.

(v/parse-int (subs “2022-12-23” 4 7))


The substring operator returns a string of '12', and the the v/parse-int operator then converts it into a number.

Mathematical Evaluations

These operators evaluate numbers.

  • max and min return the highest or lowest numbers of a set.
  • pos? and neg? tell whether a number is positive or negative.

Maximum and Minimum

The maximum (max) operator returns the highest operand given, and the minimum (min) operator returns the lowest. They can take any number of operands.




(max 35 192 32 -999 221 100 102 202)


221 is the highest number of the bunch.

(min 35 192 32 -999 221 100 102 202)


-999 is the lowest number.

Positive and Negative

The positive (pos?) and negative (neg?) operators look at a number and return either "True" or "False".




(pos? 4)


The pos? operator will return True for positive numbers.

(neg? -5)


The neg? operator will return True for negative numbers.

How did we do?

Powered by HelpDocs (opens in a new tab)