]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 14 Aug 2009 00:40:02 +0000 (19:40 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 14 Aug 2009 00:40:02 +0000 (19:40 -0500)
Conflicts:
basis/calendar/calendar.factor

1  2 
basis/calendar/calendar.factor

index 81bcff03c1524c7bb99584909ed3a8e11b52111f,536eb716878f4a031280fa69c78b41ed9adeed1a..a8bb60cbf36396f4098e37c23baf3b0b52a67d80
@@@ -34,14 -34,14 +34,14 @@@ C: <timestamp> timestam
  : <date> ( year month day -- timestamp )
      0 0 0 gmt-offset-duration <timestamp> ;
  
- ERROR: not-a-month ;
+ ERROR: not-a-month ;
  M: not-a-month summary
      drop "Months are indexed starting at 1" ;
  
  <PRIVATE
  
  : check-month ( n -- n )
-     dup zero? [ not-a-month ] when ;
+     [ not-a-month ] when-zero ;
  
  PRIVATE>
  
@@@ -52,7 -52,7 +52,7 @@@ CONSTANT: month-name
      }
  
  : month-name ( n -- string )
 -    check-month 1- month-names nth ;
 +    check-month 1 - month-names nth ;
  
  CONSTANT: month-abbreviations
      {
@@@ -61,7 -61,7 +61,7 @@@
      }
  
  : month-abbreviation ( n -- string )
 -    check-month 1- month-abbreviations nth ;
 +    check-month 1 - month-abbreviations nth ;
  
  CONSTANT: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 }
  
@@@ -113,7 -113,7 +113,7 @@@ CONSTANT: day-abbreviations
      100 b * d + 4800 -
      m 10 /i + m 3 +
      12 m 10 /i * -
 -    e 153 m * 2 + 5 /i - 1+ ;
 +    e 153 m * 2 + 5 /i - 1 + ;
  
  GENERIC: easter ( obj -- obj' )
  
@@@ -186,9 -186,6 +186,6 @@@ GENERIC: +second ( timestamp x -- times
      { [ day>> 29 = ] [ month>> 2 = ] [ leap-year? not ] } 1&&
      [ 3 >>month 1 >>day ] when ;
  
- : unless-zero ( n quot -- )
-     [ dup zero? [ drop ] ] dip if ; inline
  M: integer +year ( timestamp n -- timestamp )
      [ [ + ] curry change-year adjust-leap-year ] unless-zero ;
  
@@@ -196,7 -193,7 +193,7 @@@ M: real +year ( timestamp n -- timestam
      [ float>whole-part swapd days-per-year * +day swap +year ] unless-zero ;
  
  : months/years ( n -- months years )
-     12 /rem dup zero? [ drop 1 - 12 ] when swap ; inline
+     12 /rem [ 1 - 12 ] when-zero swap ; inline
  
  M: integer +month ( timestamp n -- timestamp )
      [ over month>> + months/years [ >>month ] dip +year ] unless-zero ;
@@@ -371,10 -368,10 +368,10 @@@ M: duration time
      #! http://web.textfiles.com/computers/formulas.txt
      #! good for any date since October 15, 1582
      [
 -        dup 2 <= [ [ 1- ] [ 12 + ] bi* ] when
 +        dup 2 <= [ [ 1 - ] [ 12 + ] bi* ] when
          [ dup [ 4 /i + ] [ 100 /i - ] [ 400 /i + ] tri ] dip
 -        [ 1+ 3 * 5 /i + ] keep 2 * +
 -    ] dip 1+ + 7 mod ;
 +        [ 1 + 3 * 5 /i + ] keep 2 * +
 +    ] dip 1 + + 7 mod ;
  
  GENERIC: days-in-year ( obj -- n )
  
@@@ -395,7 -392,7 +392,7 @@@ M: timestamp days-in-year ( timestamp -
      year leap-year? [
          year month day <date>
          year 3 1 <date>
 -        after=? [ 1+ ] when
 +        after=? [ 1 + ] when
      ] when ;
  
  : day-of-year ( timestamp -- n )