Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've written a cryptocurrency trading bot in clojure that uses this approach very heavily. I typically send around a context variable (containing the database connection, logger, correlation-id and other ancillary stuff) as well as maps specific to the task I'm performing (orders, market data, etc).

I heavily use destructuring so that functions access the bits they care about, threading macros like (-> stuff (assoc :foo x) ...) and spec to make sure the maps have the structure and keys I expect and rely on non-existent keys returning nil by default. I also use the sequence functions heavily. Mapping, filtering and reducing over vectors of maps, group-by if I need them grouped and so on.

I personally find it to be a very pleasant way to program.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: