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 provided
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.36.38