DEV Community

Discussion on: Tis the season to write Clojure

Collapse
 
quii profile image
Chris James

Forgot to mention

secret-santa

Takes a CSV file of email addresses and emails them whoever they need to give a gift to

to run

lein run santas.csv

You will need a config.clj that looks roughly like this

{:host "smtp.gmail.com"
 :user "youremail@gmail.com"
 :pass "your password"}

And your CSV file should look something like

names,
santa1@gmail.com
santa2@gmail.com
santa3@gmail.com

This is a more fleshed out secret santa in Clojure, which has tests and emailing. Might be worth a look to see a more "complete" program.

I really like the way the program hangs together in a declarative way in main

(defn app [args]
  (->
    (get-santas (first args))
    shuffle
    assign-giving-and-receiving
    render
    create-emails
    send-emails))