O'Reilly logo

Clojure for Finance by Timothy Washington

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Function evaluation

The Clojure website has a cheatsheet (http://clojure.org/cheatsheet) with all the language's core functions. The first function we'll look at is rand, a function that randomly gives you a number within a given range. So, in your edgar/ project, launch the Read-Eval-Print-Loop (REPL) with the lein repl shell command. After a few seconds, you will be brought into a REPL. Again, Clojure functions are executed by being placed in the first position of a list. The function's arguments are placed directly afterwards as follows:

  • In your REPL, evaluate (rand 35), (rand 99), (rand 43.21), or any number you fancy
  • Run it many times to see whether you can get a different floating point number within 0 and the upper bound of the number you've ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required