Created
July 30, 2013 00:13
-
-
Save guilespi/6109036 to your computer and use it in GitHub Desktop.
el porcentaje de egresados es un bolaso si no contás cuantas veces la gente rinde una materia, estamos hablando de % de aprobación no de egreso
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
(defn analisis1 | |
[students approval-rate] | |
(let [total (count students) | |
expected-approvals (* total approval-rate)] | |
(loop [examined students iterations 0] | |
(let [remaining (- total (count examined))] | |
(if (< remaining expected-approvals) | |
(let [approved (* (count examined) 0.1)] | |
(recur (drop (int approved) examined) (inc iterations))) | |
iterations))))) | |
dummy-test> (analisis1 (range 100) 0.30) | |
4 | |
dummy-test> (analisis1 (range 100) 0.50) | |
7 | |
dummy-test> (analisis1 (range 100) 0.80) | |
17 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment