probablyjg
probablyjg

Reputation: 21

Dynamically load functions from all files in a directory in Clojure

Say I have a directory structure:

- src
-- scraper
--- scrapers
---- scraper_a.clj
---- scraper_b.clj
---- scraper_c.clj
--- scrape.clj

In each scraper_x.clj there are three functions, fetch, collect, parse that I need to parse to a function in scrape.clj called scape which takes the three functions and fetches the source HTML, collects the elements from the HTML, then parses into an appropriate JSON format.

Is there a good way to dynamically load these three functions from all files in the src/scraper/scrapers directory to be utilised in the main function?

Upvotes: 2

Views: 53

Answers (0)

Related Questions