(FILECREATED "12-Feb-86 12:07:20" {QV}<IDL>SOURCES>IDLDEMO.;7 7561   

      changes to:  (FNS IDLDEMO)

      previous date: " 4-Sep-85 17:16:46" {QV}<IDL>SOURCES>IDLDEMO.;6)


(* Copyright (c) 1985, 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT IDLDEMOCOMS)

(RPAQQ IDLDEMOCOMS ((FNS IDLDEMO IDLDEMO.CLEANUP IDLDEMO.SHADEDOUBLEITEM IDLDEMO.WHENSELECTEDFN)))
(DEFINEQ

(IDLDEMO
  [LAMBDA NIL                                                (* jop: "12-Feb-86 11:16")
    (PROG ((TTYWINDOW (WFROMDS (TTYDISPLAYSTREAM)))
	     (TEDITWINDOW (CREATEW (CREATEREGION 570 30 450 700)
				     "N.J. Pick-It Lottery Data" NIL T))
	     (IDLDEMO.MENU (create MENU
				     ITEMS ←[QUOTE (("Inspect Lottery data" (INSPECT LOTTERY))
						       ((INSPECT LOTTERY)
							(INSPECT LOTTERY))
						       ("Select winning numbers" (SETQ NUMBERS IT))
						       ((SETQ NUMBERS IT)
							(SETQ NUMBERS IT))
						       ("Histogram of winning numbers" (HISTOGRAM
											 NUMBERS))
						       ((HISTOGRAM NUMBERS)
							(HISTOGRAM NUMBERS))
						       ("Select payoffs" (SETQ PAYOFF IT))
						       ((SETQ PAYOFF IT)
							(SETQ PAYOFF IT))
						       ("Histogram of payoffs" (SETQ HIST
										 (HISTOGRAM PAYOFF))
									       )
						       ((HISTOGRAM PAYOFF)
							(SETQ HIST (HISTOGRAM PAYOFF)))
						       ("Add $500 line to Histogram"
							 (PLOTLINE HIST NIL 500 (QUOTE $500)
								     2))
						       ((PLOTLINE HIST NIL 500)
							(PLOTLINE HIST NIL 500 (QUOTE $500)
								    2))
						       ("Relate Payoff to winning number"
							 (SETQ SCAT (SCATTERPLOT PAYOFF NUMBERS)))
						       ((SCATTERPLOT PAYOFF NUMBERS)
							(SETQ SCAT (SCATTERPLOT PAYOFF NUMBERS)))
						       ("Regress payoff on number"
							 (PROGN (SETQ CV (COVAR LOTTERY))
								  (SETQ SWEPT (SWEEP
								      CV
								      (QUOTE Number)))
								  [SETQ RESULT
								    (AT (REGRESS CV SWEPT)
									  (QUOTE (Payoff ALL ALL]
								  (SHOW)))
						       (((COVAR LOTTERY)
							 etc.)
							(PROGN (SETQ CV (COVAR LOTTERY))
								 (SETQ SWEPT (SWEEP CV
											(QUOTE
											  Number)))
								 [SETQ RESULT
								   (AT (REGRESS CV SWEPT)
									 (QUOTE (Payoff ALL ALL]
								 (SHOW)))
						       ("Inspect result" (INSPECT RESULT))
						       ((INSPECT RESULT)
							(INSPECT RESULT))
						       ["Extract Coefficients"
							 (SETQ COEF (AT IT (QUOTE
									      ((Number Constant]
						       [(SETQ COEF IT)
							(SETQ COEF (AT IT (QUOTE ((Number
											   Constant]
						       ("Add the regression line"
							 (ADDLINESTOPLOT SCAT COEF (QUOTE $500)
									   2))
						       ((ADDLINESTOPLOT SCAT COEF)
							(ADDLINESTOPLOT SCAT COEF (QUOTE $500)
									  2))
						       ["Add smoother to menu"
							 (PLOTADDMENUITEMS SCAT (QUOTE RIGHT)
									     (QUOTE ((Smooth 
								       SCATTERPLOT.RUNNINGREGRESS]
						       [(PLOTADDMENUITEMS SCAT ...)
							(PLOTADDMENUITEMS SCAT (QUOTE RIGHT)
									    (QUOTE ((Smooth 
								       SCATTERPLOT.RUNNINGREGRESS]
						       ["Select Payoff's for Second Year"
							 (SETQ PAYOFF2 (AT LOTTERY2
									       (QUOTE (Payoff2]
						       [(AT LOTTERY2 (QUOTE (Payoff2)))
							(SETQ PAYOFF2 (AT LOTTERY2
									      (QUOTE (Payoff2]
						       ["Select Payoff's for Third Year"
							 (SETQ PAYOFF3 (AT LOTTERY3
									       (QUOTE (Payoff3]
						       [(AT LOTTERY3 (QUOTE (Payoff3)))
							(SETQ PAYOFF3 (AT LOTTERY3
									      (QUOTE (Payoff3]
						       ("Compare payoff's for three years"
							 (SETQ BOXPLOT (BOXPLOTS PAYOFF PAYOFF2 
										     PAYOFF3)))
						       ((BOXPLOTS PAYOFF ...)
							(SETQ BOXPLOT (BOXPLOTS PAYOFF PAYOFF2 
										    PAYOFF3)))
						       ("Add $500 mark to Boxplots"
							 (PLOTLINE BOXPLOT 0 500 (QUOTE $500)
								     2))
						       ((PLOTLINE BOXPLOT 0 500)
							(PLOTLINE BOXPLOT 0 500 (QUOTE $500)
								    2]
				     WHENSELECTEDFN ←(FUNCTION IDLDEMO.WHENSELECTEDFN)
				     TITLE ← "Typescript Menu for IDL demo")))
	    (DECLARE (SPECVARS IDLDEMO.SHADEDITEM IDLDEMO.TTYWINDOW LOTTERY LOTTERY2 LOTTERY3))
	    [SETQ LOTTERY (IDLMATRIX (READFILE (QUOTE {QV}<IDL>DATA>LOTTERY1.DATA]
	    [SETQ LOTTERY2 (IDLMATRIX (READFILE (QUOTE {QV}<IDL>DATA>LOTTERY2.DATA]
	    [SETQ LOTTERY3 (IDLMATRIX (READFILE (QUOTE {QV}<IDL>DATA>LOTTERY3.DATA]
	    (SETQ IDLDEMO.TTYWINDOW TTYWINDOW)
	    (SHAPEW TTYWINDOW (CREATEREGION 5 570 300 150))
	    (ATTACHMENU IDLDEMO.MENU TTYWINDOW (QUOTE RIGHT)
			  (QUOTE TOP))
	    (SETQ IDLDEMO.SHADEDITEM (CAR (fetch ITEMS of IDLDEMO.MENU)))
	    (IDLDEMO.SHADEDOUBLEITEM IDLDEMO.SHADEDITEM IDLDEMO.MENU SHADE1)
	    (TEDIT (QUOTE {QV}<IDL>DEMO>DEMOSCRIPT.TEDIT)
		     TEDITWINDOW)
	    (GIVE.TTY.PROCESS TTYWINDOW])

(IDLDEMO.CLEANUP
  [LAMBDA NIL                                                (* edited: "13-Aug-85 22:03")
    (PROG [(TTYWINDOW (WFROMDS (TTYDISPLAYSTREAM]
          (DETACHALLWINDOWS TTYWINDOW)
          (WINDOWPROP TTYWINDOW (QUOTE MINSIZE)
		      NIL])

(IDLDEMO.SHADEDOUBLEITEM
  [LAMBDA (ITEM1 MENU SHADE)                                 (* edited: "13-Aug-85 22:25")
    (PROG ((MENUW (WFROMMENU MENU))
	   [ITEM2 (CADR (MEMB ITEM1 (fetch ITEMS of MENU]
	   REGION1 REGION2)
          (SETQ REGION1 (MENUITEMREGION ITEM1 MENU))
          (SETQ REGION2 (MENUITEMREGION ITEM2 MENU))
          (BITBLT NIL NIL NIL MENUW (fetch LEFT of REGION1)
		  (fetch BOTTOM of REGION1)
		  (fetch WIDTH of REGION1)
		  (fetch HEIGHT of REGION1)
		  (QUOTE TEXTURE)
		  (QUOTE INVERT)
		  SHADE)
          (BITBLT NIL NIL NIL MENUW (fetch LEFT of REGION2)
		  (fetch BOTTOM of REGION2)
		  (fetch WIDTH of REGION2)
		  (fetch HEIGHT of REGION2)
		  (QUOTE TEXTURE)
		  (QUOTE INVERT)
		  SHADE])

(IDLDEMO.WHENSELECTEDFN
  [LAMBDA (ITEM MENU BUTTON)                                 (* jop: "16-Aug-85 13:38")
    (PROG ((FORM (CADR ITEM)))
          (DECLARE (USEDFREE IDLDEMO.SHADEDITEM IDLDEMO.TTYWINDOW))
          (IDLDEMO.SHADEDOUBLEITEM IDLDEMO.SHADEDITEM MENU SHADE1)
          (GIVE.TTY.PROCESS IDLDEMO.TTYWINDOW)
          (if (EQ (CAR FORM)
		  (QUOTE PROGN))
	      then (for SUBFORM in (CDR FORM) do (BKSYSBUF SUBFORM))
	    else (BKSYSBUF FORM))
          [SETQ IDLDEMO.SHADEDITEM (LET [(TAIL (MEMB ITEM (fetch ITEMS of MENU]
				        (if (EVENP (LENGTH TAIL))
					    then (CADDR TAIL)
					  else (CADR TAIL]
          [if (NULL IDLDEMO.SHADEDITEM)
	      then (SETQ IDLDEMO.SHADEDITEM (CAR (fetch ITEMS of MENU]
          (IDLDEMO.SHADEDOUBLEITEM IDLDEMO.SHADEDITEM MENU SHADE1])
)
(PUTPROPS IDLDEMO COPYRIGHT ("Xerox Corporation" 1985 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (390 7478 (IDLDEMO 400 . 5358) (IDLDEMO.CLEANUP 5360 . 5650) (IDLDEMO.SHADEDOUBLEITEM 
5652 . 6516) (IDLDEMO.WHENSELECTEDFN 6518 . 7476)))))
STOP