Last active
August 29, 2015 14:06
-
-
Save escherize/ecb96689a13f8cb1cdfa 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
;; modify inputs if you wish and paste into tryclj.com | |
(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