remove old accessors before major refactoring

db4
Doug Coleman 2008-08-17 10:50:26 -05:00
parent 8f00739601
commit 507f814d48
2 changed files with 10 additions and 10 deletions

View File

@ -1 +1 @@
taxes

View File

@ -1,5 +1,7 @@
USING: arrays assocs kernel math math.intervals namespaces ! Copyright (C) 2008 Doug Coleman.
sequences combinators.lib money math.order ; ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs kernel math math.intervals
namespaces sequences combinators.lib money math.order ;
IN: taxes IN: taxes
: monthly ( x -- y ) 12 / ; : monthly ( x -- y ) 12 / ;
@ -14,22 +16,21 @@ C: <w4> w4
: allowance ( -- x ) 3500 ; inline : allowance ( -- x ) 3500 ; inline
: calculate-w4-allowances ( w4 -- x ) : calculate-w4-allowances ( w4 -- x ) allowances>> allowance * ;
w4-allowances allowance * ;
! Withhold: FICA, Medicare, Federal (FICA is social security) ! Withhold: FICA, Medicare, Federal (FICA is social security)
: fica-tax-rate ( -- x ) DECIMAL: .062 ; inline : fica-tax-rate ( -- x ) DECIMAL: .062 ; inline
! Base rate -- income over this rate is not taxed ! Base rate -- income over this rate is not taxed
TUPLE: fica-base-unknown ; ERROR: fica-base-unknown ;
: fica-base-rate ( year -- x ) : fica-base-rate ( year -- x )
H{ H{
{ 2008 102000 } { 2008 102000 }
{ 2007 97500 } { 2007 97500 }
} at* [ T{ fica-base-unknown } throw ] unless ; } at* [ fica-base-unknown ] unless ;
: fica-tax ( salary w4 -- x ) : fica-tax ( salary w4 -- x )
w4-year fica-base-rate min fica-tax-rate * ; year>> fica-base-rate min fica-tax-rate * ;
! Employer tax only, not withheld ! Employer tax only, not withheld
: futa-tax-rate ( -- x ) DECIMAL: .062 ; inline : futa-tax-rate ( -- x ) DECIMAL: .062 ; inline
@ -64,8 +65,7 @@ TUPLE: tax-table single married ;
0 -rot [ tax-bracket ] each drop ; 0 -rot [ tax-bracket ] each drop ;
: marriage-table ( w4 tax-table -- triples ) : marriage-table ( w4 tax-table -- triples )
swap w4-married? swap married?>> [ married>> ] [ single>> ] if ;
[ tax-table-married ] [ tax-table-single ] if ;
: federal-tax ( salary w4 tax-table -- n ) : federal-tax ( salary w4 tax-table -- n )
[ adjust-allowances ] 2keep marriage-table tax ; [ adjust-allowances ] 2keep marriage-table tax ;