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

Functions for querying a system

If you've followed the progress from the last chapter, per data chunk, you would have written out four kinds of files that represent all the data we've generated:

  <file-name>-tick.edn
  <file-name>-sma.edn
  <file-name>-ema.edn
  <file-name>-bol.edn

Since we've named the files appropriately in our list of many-files, we can use the filter function to isolate on any condition—in this case, we'll isolate only one type of file.

An example of a regular expression

For our predicate function, we can use a regular expression to search for a string pattern in a filename. Clojure represents regular expressions with a string prefixed by a hash such as #"". So, the re-matches function, for example, takes a regular expression and string ...

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