[q-lang-cvs] qcalc/examples calendar.qcalc, NONE, 1.1 date.q, NONE, 1.1 dates.qcalc, NONE, 1.1
                
                Brought to you by:
                
                    agraef
                    
                
            
            
        
        
        
    | 
      
      
      From: Albert G. <ag...@us...> - 2007-11-05 01:27:13
      
     | 
| Update of /cvsroot/q-lang/qcalc/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16462 Added Files: calendar.qcalc date.q dates.qcalc Log Message: add calendar examples --- NEW FILE: calendar.qcalc --- // qcalc 1.0, created Mon Nov 5 02:17:50 2007 -*-Q-*- -*- coding: UTF-8 -*- // [((1,0),"Enter year:"),((2,0),"2008"),((3,0),"= matrix (4,0) (mycal A3)")] // [] // [(0,77),(1,26),(2,28),(3,26),(4,30),(5,25),(6,27),(7,26),(8,74),(9,26),(10,28),(11,25),(12,30),(13,26),(14,27),(15,26),(16,77),(17,26),(18,28),(19,25),(20,30),(21,25),(22,29),(23,26)] // Start of script. Please do not remove this line. /* cal.qcalc: Print a calendar. */ import date, calclib; show (I,J) A = matrix (I,J) A || A; /* Format the calendar nicely in three columns, one for each quarter. */ mycal Y = cat $ map (quarter CAL) [0..3] where CAL = map (map (fill 7).cal Y) [1..12]; quarter CAL I = zipwith (++) M1 $ zipwith (++) M2 M3 where [M1,M2,M3] = map month $ sub CAL (I*3) ((I+1)*3-1); month [R1,[M|_],_,R2|R] = [[""|R1],[M|R2]|map (cons "") R]; fill N Xs = Xs++map (cst "") [#Xs..N-1]; --- NEW FILE: date.q --- (This appears to be a binary file; contents omitted.) --- NEW FILE: dates.qcalc --- // qcalc 1.0, created Mon Nov 5 02:23:56 2007 -*-Q-*- -*- coding: UTF-8 -*- // [((0,1),"Month"),((0,2),"Day"),((0,3),"Year"),((2,0),"Enter your birthday (M, D, Y) here:"),((2,1),"12"),((2,2),"29"),((2,3),"1991"),((3,0),"Today you are:"),((3,1),"= today-(C3,B3,D3)"),((3,2),"days old."),((5,0),"You can celebrate your (enter #days):"),((5,1),"20000"),((5,2),"days party"),((6,0),"on:"),((6,1),"10"),((6,2),"1"),((6,3),"2046"),((6,5),"= show (6,1) $ (C3,B3,D3)+B6"),((8,0),"Enter a year:"),((8,1),"2007"),((9,0),"Easter that year:"),((9,1),"4"),((9,2),"8"),((9,3),"2007"),((9,5),"= show (9,1) $ easter B9"),((10,0),"Fri the 13th's that year:"),((10,1),"4"),((10,2),"13"),((10,3),"2007"),((10,5),"= clear (10,1) 6 || show (10,1) [(13,M,B9) : M in [1..12],wday (13,M,B9)=5]"),((11,1),"7"),((11,2),"13"),((11,3),"2007")] // [] // [(0,207)] // Start of script. Please do not remove this line. /* dates.qcalc: Play around with some calendar formulas (cf. date.q). */ import date, calclib; /* Helper functions to show a date or a list of dates starting at the given cell. Note that date.q internally represents dates as (D,M,Y) tuples. */ show (I,J) (D,M,Y) = rowvect (I,J) [M,D,Y] || (D,M,Y); show (I,J) DATES:List = dowith show [(I+K,J) : K in [0..N-1]] DATES || DATES where N = #DATES; clear (I,J) N = matrix (I,J) $ map (cst ["","",""]) [1..N]; |