Skip to content

Instantly share code, notes, and snippets.

@guilespi
Created July 30, 2013 00:13
Show Gist options
  • Save guilespi/6109036 to your computer and use it in GitHub Desktop.
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
(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