Skip to main content
added 30 characters in body
Source Link
Rosario
  • 351
  • 1
  • 5

APL(NARS), 190183 chars

L←{(0=400∣⍵)∨(0≠25∣⍵)∧0=4∣⍵}⋄C←{Y←(30+2741⊤⍨12/2)+(¯2+L⍵[2])×2=⍳12⋄d←7∣+/Y[⍳⍵[1]-1],{1+L⍵}1900..⍵[2]-1⋄(11⋄7 7⍴(,/7 2⍴'MoTuWeThFrSaSu'),[1]6 7⍴(d⍴⊂''),{2 0⍕⍵}¨(⍳Y[⍵[1]]),12⍴⊂''}∘{(100∣⍵),⌊⍵÷100}

Input ok only from 1900. Test & how to use it:

    C 201312         
 Mo Tu We Th Fr Sa Su 
                    1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31                
    C 202312        
 Mo Tu We Th Fr Sa Su 
              1  2  3 
  4  5  6  7  8  9 10 
 11 12 13 14 15 16 17 
 18 19 20 21 22 23 24 
 25 26 27 28 29 30 31 
                  

APL(NARS), 190 chars

L←{(0=400∣⍵)∨(0≠25∣⍵)∧0=4∣⍵}⋄C←{Y←(30+2741⊤⍨12/2)+(¯2+L⍵[2])×2=⍳12⋄d←7∣+/Y[⍳⍵[1]-1],{1+L⍵}1900..⍵[2]-1⋄(1 7⍴,/7 2⍴'MoTuWeThFrSaSu'),[1]6 7⍴(d⍴⊂''),{2 0⍕⍵}¨(⍳Y[⍵[1]]),12⍴⊂''}∘{(100∣⍵),⌊⍵÷100}

Input ok only from 1900. Test & how to use it:

   C 201312     
 Mo Tu We Th Fr Sa Su 
                    1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31                
   C 202312     
 Mo Tu We Th Fr Sa Su 
              1  2  3 
  4  5  6  7  8  9 10 
 11 12 13 14 15 16 17 
 18 19 20 21 22 23 24 
 25 26 27 28 29 30 31 

APL(NARS), 183 chars

L←{(0=400∣⍵)∨(0≠25∣⍵)∧0=4∣⍵}⋄C←{Y←(30+2741⊤⍨12/2)+(¯2+L⍵[2])×2=⍳12⋄d←7∣+/Y[⍳⍵[1]-1],{1+L⍵}1900..⍵[2]-1⋄7 7⍴(,/7 2⍴'MoTuWeThFrSaSu'),(d⍴⊂''),{2 0⍕⍵}¨(⍳Y[⍵[1]]),12⍴⊂''}∘{(100∣⍵),⌊⍵÷100}

Input ok only from 1900. Test & how to use it:

    C 201312         
 Mo Tu We Th Fr Sa Su 
                    1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31                
    C 202312        
 Mo Tu We Th Fr Sa Su 
              1  2  3 
  4  5  6  7  8  9 10 
 11 12 13 14 15 16 17 
 18 19 20 21 22 23 24 
 25 26 27 28 29 30 31 
                  
deleted 4 characters in body
Source Link
Rosario
  • 351
  • 1
  • 5

APL(NARS), 215190 chars

L←{(0=400∣⍵)∨(0≠25∣⍵)∧0=4∣⍵}⋄Z←⋄C←{Y←(30+2741⊤⍨12/2)+(¯2+L⍵¯2+L⍵[2])×2=⍳12}⋄G←{7∣+×2=⍳12⋄d←7∣+/((Z⍵[2])[⍳⍵[1]Y[⍳⍵[1]-1]),{1+L⍵}¯1↓19001900..⍵[2]}⋄C←{d←G⍵⋄Y←Z⍵[2]⋄a←1-1⋄(1 7⍴,/7 2⍴'MoTuWeThFrSaSu'⋄a2⍴'MoTuWeThFrSaSu'),[1]6 7⍴(d⍴⊂''),{2 0⍕⍵}¨(⍳Y[⍵[1]]),12⍴⊂''}∘{(100∣⍵),⌊⍵÷100}

Input ok only from 1900. Test & how to use it:

   C 201312     
 Mo Tu We Th Fr Sa Su 
                    1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31                
   C 202312     
 Mo Tu We Th Fr Sa Su 
              1  2  3 
  4  5  6  7  8  9 10 
 11 12 13 14 15 16 17 
 18 19 20 21 22 23 24 
 25 26 27 28 29 30 31 

APL(NARS), 215 chars

L←{(0=400∣⍵)∨(0≠25∣⍵)∧0=4∣⍵}⋄Z←{(30+2741⊤⍨12/2)+(¯2+L⍵)×2=⍳12}⋄G←{7∣+/((Z⍵[2])[⍳⍵[1]-1]),{1+L⍵}¯1↓1900..⍵[2]}⋄C←{d←G⍵⋄Y←Z⍵[2]⋄a←1 7⍴,/7 2⍴'MoTuWeThFrSaSu'⋄a,[1]6 7⍴(d⍴⊂''),{2 0⍕⍵}¨(⍳Y[⍵[1]]),12⍴⊂''}∘{(100∣⍵),⌊⍵÷100}

Input ok from 1900. Test & how to use it:

  C 201312
 Mo Tu We Th Fr Sa Su 
                    1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31                
  C 202312
 Mo Tu We Th Fr Sa Su 
              1  2  3 
  4  5  6  7  8  9 10 
 11 12 13 14 15 16 17 
 18 19 20 21 22 23 24 
 25 26 27 28 29 30 31 

APL(NARS), 190 chars

L←{(0=400∣⍵)∨(0≠25∣⍵)∧0=4∣⍵}⋄C←{Y←(30+2741⊤⍨12/2)+(¯2+L⍵[2])×2=⍳12⋄d←7∣+/Y[⍳⍵[1]-1],{1+L⍵}1900..⍵[2]-1⋄(1 7⍴,/7 2⍴'MoTuWeThFrSaSu'),[1]6 7⍴(d⍴⊂''),{2 0⍕⍵}¨(⍳Y[⍵[1]]),12⍴⊂''}∘{(100∣⍵),⌊⍵÷100}

Input ok only from 1900. Test & how to use it:

   C 201312     
 Mo Tu We Th Fr Sa Su 
                    1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31                
   C 202312     
 Mo Tu We Th Fr Sa Su 
              1  2  3 
  4  5  6  7  8  9 10 
 11 12 13 14 15 16 17 
 18 19 20 21 22 23 24 
 25 26 27 28 29 30 31 
Source Link
Rosario
  • 351
  • 1
  • 5

APL(NARS), 215 chars

L←{(0=400∣⍵)∨(0≠25∣⍵)∧0=4∣⍵}⋄Z←{(30+2741⊤⍨12/2)+(¯2+L⍵)×2=⍳12}⋄G←{7∣+/((Z⍵[2])[⍳⍵[1]-1]),{1+L⍵}¯1↓1900..⍵[2]}⋄C←{d←G⍵⋄Y←Z⍵[2]⋄a←1 7⍴,/7 2⍴'MoTuWeThFrSaSu'⋄a,[1]6 7⍴(d⍴⊂''),{2 0⍕⍵}¨(⍳Y[⍵[1]]),12⍴⊂''}∘{(100∣⍵),⌊⍵÷100}

Input ok from 1900. Test & how to use it:

  C 201312
 Mo Tu We Th Fr Sa Su 
                    1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31                
  C 202312
 Mo Tu We Th Fr Sa Su 
              1  2  3 
  4  5  6  7  8  9 10 
 11 12 13 14 15 16 17 
 18 19 20 21 22 23 24 
 25 26 27 28 29 30 31