Paste: agorian feaster

Author: zwarichfan
Mode: factor
Date: Tue, 28 Oct 2008 07:59:44
Plain Text |
:: gregorian-easter ( year -- month day )
    year 19 rem                      :> a
    year 100 /mod                    :> [ b c ]
    b 4 /mod                         :> [ d e ]
    b 8 + 25 /i                      :> f
    b f - 1+ 3 /i                    :> g
    19 a * b + d - g - 15 + 30 rem   :> h
    c 4 /mod                         :> [ i k ]
    32 2 e * + 2 i * + h - k - 7 rem :> l
    a 11 h * + 22 l * + 451 /i       :> m
    h l + 7 m * - 114 + 31 /mod      :> [ n p ]
    n p 1+ ;

Annotation: locals

Author: prunedtree
Mode: factor
Date: Tue, 28 Oct 2008 08:04:21
Plain Text |
:: gregorian-easter ( year -- month day )
    ! note, the definition isn't legal should have lots of [ f ]
    [let | a! b! c! d! e! f! g! h! i! k! l! m! n! p! |
        year 19 rem                      a!
        year 100 /mod                    b! c!
        b 4 /mod                         d! e!
        b 8 + 25 /i                      f!
        b f - 1+ 3 /i                    g!
        19 a * b + d - g - 15 + 30 rem   h!
        c 4 /mod                         i! k!
        32 2 e * + 2 i * + h - k - 7 rem l!
        a 11 h * + 22 l * + 451 /i       m!
        h l + 7 m * - 114 + 31 /mod      n! p!
        n p 1+ ;

Annotation: infix

Author: prunedtree
Mode: factor
Date: Tue, 28 Oct 2008 08:14:47
Plain Text |
: gregorian-easter ( year -- month day ) [[ year.gregorian-easter ]] 2first

::: year.gregorian-easter =>
    a    := year rem: 19
    b, c := year /mod: 100
    d, e := b /mod: 4
    f    := b + 8 /i: 25
    g    := b - f + 1 /i: 3
    h    := (19 * a + b) - (d + g) + 15 rem: 30
    i, k := c /mod: 4
    l    := 32 + 2 * e + 2 * i - (h + k) rem: 7
    m    := a + 11 * h + 22 * l /i: 451
    n, p := h + l - 7 * m + 114 /mod: 31
            n, p+1;;

New Annotation

Summary:
Author:
Mode:
Body: