Created
September 10, 2014 17:12
-
-
Save escherize/c827a53da369e9e24b5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [total-sq-ft 1267 | |
price 3479 | |
utilities 275.12 | |
rooms [{:title "jeff's room" :headcount 3 :area 171.5625} | |
{:title "bryan's room" :headcount 1 :area 155.25} | |
{:title "thaly's room" :headcount 1 :area 121.875}] | |
private-area (apply + (map :area rooms)) | |
occupants (apply + (map :headcount rooms)) | |
common-area (- total-sq-ft private-area) | |
price-sqft (double (/ price total-sq-ft)) | |
common-price (-> common-area (* price-sqft) (/ occupants)) | |
common-util (/ utilities occupants)] | |
(map (fn [room] | |
(assoc room :total-price-pp (-> (:area room) | |
(* price-sqft) | |
(/ (:headcount room)) | |
(+ common-price) | |
(+ common-util)))) | |
rooms)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment