User talk:Balrog: Difference between revisions
Content added Content deleted
(Showing my buddy Nick how to add sample code to his discussion page) |
|||
Line 5: | Line 5: | ||
if you want to check the version of GeSHi installed, edit any page, type <nowiki><lang list></nowiki>, and preview (don't save it). If it shows "1.0.8.4" then he hasn't rolled back. This list is at the bottom of the new village pump page too. --[[User:Mwn3d|Mwn3d]] 17:50, 18 June 2009 (UTC) |
if you want to check the version of GeSHi installed, edit any page, type <nowiki><lang list></nowiki>, and preview (don't save it). If it shows "1.0.8.4" then he hasn't rolled back. This list is at the bottom of the new village pump page too. --[[User:Mwn3d|Mwn3d]] 17:50, 18 June 2009 (UTC) |
||
:Thanks. Alas, he hasn't. --[[User:Balrog|Balrog]] 23:12, 18 June 2009 (UTC) |
:Thanks. Alas, he hasn't. --[[User:Balrog|Balrog]] 23:12, 18 June 2009 (UTC) |
||
== Like This, Nick == |
|||
<lang clojure> |
|||
(def tables [[10 0 8500] |
|||
[15 8501 34500] |
|||
[25 34501 83600] |
|||
[28 83601 174400] |
|||
[33 174401 379150] |
|||
[35 379151 Long/MAX_VALUE]]) |
|||
(defn tax-calc |
|||
"Takes a dollar amount value and returns your federal tax obligation based on |
|||
the table above" |
|||
[taxable-income] |
|||
(second (reduce (fn [[dec-income calc] [percentage start end]] |
|||
(if (< start taxable-income) |
|||
(let[limit (min taxable-income end) |
|||
taxable-range (- limit start) |
|||
result (float (* (/ percentage 100) taxable-range)) |
|||
dec-income (- dec-income (min taxable-range dec-income))] |
|||
[dec-income (+ calc result)]) |
|||
[dec-income calc])) [taxable-income 0] |
|||
tables))) |
|||
</lang> |
Revision as of 05:12, 14 August 2011
You don't need to claim an example by putting the language header on before any code. It would look a little weird if someone were to access the page before you put the code on. You can just do it all at once. --Mwn3d 23:14, 6 April 2008 (MDT)
GeSHi rollback check
if you want to check the version of GeSHi installed, edit any page, type <lang list>, and preview (don't save it). If it shows "1.0.8.4" then he hasn't rolled back. This list is at the bottom of the new village pump page too. --Mwn3d 17:50, 18 June 2009 (UTC)
- Thanks. Alas, he hasn't. --Balrog 23:12, 18 June 2009 (UTC)
Like This, Nick
<lang clojure> (def tables [[10 0 8500]
[15 8501 34500] [25 34501 83600] [28 83601 174400] [33 174401 379150] [35 379151 Long/MAX_VALUE]])
(defn tax-calc
"Takes a dollar amount value and returns your federal tax obligation based on the table above" [taxable-income] (second (reduce (fn [[dec-income calc] [percentage start end]] (if (< start taxable-income) (let[limit (min taxable-income end) taxable-range (- limit start) result (float (* (/ percentage 100) taxable-range)) dec-income (- dec-income (min taxable-range dec-income))] [dec-income (+ calc result)]) [dec-income calc])) [taxable-income 0] tables)))
</lang>