Skip to content

Instantly share code, notes, and snippets.

@jprudent
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jprudent/a2c405ad16a5d9dee6fb to your computer and use it in GitHub Desktop.
Save jprudent/a2c405ad16a5d9dee6fb to your computer and use it in GitHub Desktop.
Calcul du revenu d'imposition
(let [revenu 50000
tranches [ [0 6011 0.] [6011 11991 0.055] [11991 26631 0.14] [26631 71397 0.3] [71397 151200 0.41]]]
(reduce
(fn [total [tmin tmax coeff]]
(let [m-in-tranche (- (min tmax revenu) tmin)]
(+ total (max 0 (* m-in-tranche coeff)))))
0
tranches))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment