Want a mudballs loader, but this is BROKEN.
[CommonLispStat.git] / TODO.lisp
blob92732d304c7cac83e440d7ed806557481acb17bd
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2009-04-29 08:35:29 tony>
4 ;;; Creation: <2008-09-08 08:06:30 tony>
5 ;;; File: TODO.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c) 2007-2008, AJ Rossini <blindglobe@gmail.com>. BSD.
8 ;;; Purpose: Stuff that needs to be made working sits inside the
9 ;;; progns... This file contains the current challenges to
10 ;;; solve, including a description of the setup and the work
11 ;;; to solve....
13 ;;; What is this talk of 'release'? Klingons do not make software
14 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
15 ;;; designers and quality assurance people in its wake.
17 ;;; SET UP
19 (in-package :cl-user)
20 ;;(asdf:oos 'asdf:load-op 'lisp-matrix)
21 ;;(asdf:oos 'asdf:compile-op 'lispstat :force t)
22 ;;(asdf:oos 'asdf:load-op 'lispstat)
24 (in-package :lisp-stat-unittests)
26 ;; tests = 80, failures = 8, errors = 15
27 (run-tests :suite 'lisp-stat-ut)
28 (describe (run-tests :suite 'lisp-stat-ut))
30 ;; FIXME: Example: currently not relevant, yet
31 ;; (describe (lift::run-test :test-case 'lisp-stat-unittests::create-proto
32 ;; :suite 'lisp-stat-unittests::lisp-stat-ut-proto))
34 (describe (lift::run-tests :suite 'lisp-stat-ut-dataframe))
35 (lift::run-tests :suite 'lisp-stat-ut-dataframe)
37 (describe
38 (lift::run-test
39 :test-case 'lisp-stat-unittests::create-proto
40 :suite 'lisp-stat-unittests::lisp-stat-ut-proto))
42 (describe 'lisp-stat-ut)
44 (in-package :ls-user)
46 #+nil
47 (progn
48 ;; Plotting -- need to figure out the core-dump, or change libraries.
49 ;; (asdf:oos 'asdf:load-op 'cl-plplot)
51 ;; (defparameter *gdev* "xwin")
52 (defparameter *gdev* "xcairo")
53 ;; (cl-plplot::plsdev *gdev*) ; -- usually handled within call.
54 (plot-ex)
55 (plot-ex)
56 ;; Boom! -- there is currently a loose pointer floating around that
57 ;; causes errors the 3rd time that we create a plot (and crashes
58 ;; SBCL the 4th time). Order independent.
59 (plot-ex)
61 (contour-plot-ex)
62 (fn-contour-plot-ex)
63 (shade-plot-ex)
64 (3D-plot-ex))
67 (progn
68 ;; REVIEW: general Lisp use guidance
70 (fdefinition 'make-matrix)
71 (documentation 'make-matrix 'function)
73 #| Examples from CLHS, a bit of guidance.
75 ;; This function assumes its callers have checked the types of the
76 ;; arguments, and authorizes the compiler to build in that assumption.
77 (defun discriminant (a b c)
78 (declare (number a b c))
79 "Compute the discriminant for a quadratic equation."
80 (- (* b b) (* 4 a c))) => DISCRIMINANT
81 (discriminant 1 2/3 -2) => 76/9
83 ;; This function assumes its callers have not checked the types of the
84 ;; arguments, and performs explicit type checks before making any assumptions.
85 (defun careful-discriminant (a b c)
86 "Compute the discriminant for a quadratic equation."
87 (check-type a number)
88 (check-type b number)
89 (check-type c number)
90 (locally (declare (number a b c))
91 (- (* b b) (* 4 a c)))) => CAREFUL-DISCRIMINANT
92 (careful-discriminant 1 2/3 -2) => 76/9
97 #+nil
98 (progn ;; experiments with GSL and the Lisp interface.
99 (asdf:oos 'asdf:load-op 'gsll)
100 (asdf:oos 'asdf:load-op 'gsll-tests) ; requires lisp-unit
102 ;; the following should be equivalent
103 (defparameter *t1* (LIST 6.18d0 6.647777777777779d0 6.18d0))
104 (defparameter *t2* (MULTIPLE-VALUE-LIST
105 (LET ((VEC
106 (gsll:make-marray 'DOUBLE-FLOAT
107 :INITIAL-CONTENTS '(-3.21d0 1.0d0 12.8d0)))
108 (WEIGHTS
109 (gsll:MAKE-MARRAY 'DOUBLE-FLOAT
110 :INITIAL-CONTENTS '(3.0d0 1.0d0 2.0d0))))
111 (LET ((MEAN (gsll:MEAN VEC)))
112 (LIST (gsll:ABSOLUTE-DEVIATION VEC)
113 (gsll:WEIGHTED-ABSOLUTE-DEVIATION VEC WEIGHTS)
114 (gsll:ABSOLUTE-DEVIATION VEC MEAN))))))
115 (eql *t1* *t2*)
116 (equal *t1* *t2*)
118 ;; from (gsll:examples 'gsll::numerical-integration) ...
119 (gsll:integration-qng gsll::one-sine 0.0d0 PI)
121 (gsll:defun-single axpb (x) (+ (* 2 x) 3)) ;; a<-2, b<-3
122 (gsll:integration-qng axpb 1d0 2d0)
124 (let ((a 2)
125 (b 3))
126 (defun-single axpb2 (x) (+ (* a x) b)))
127 (gsll:integration-qng axpb2 1d0 2d0)
129 ;; BAD
130 ;; (gsll:integration-qng
131 ;; (let ((a 2)
132 ;; (b 3))
133 ;; (defun-single axpb2 (x) (+ (* a x) b)))
134 ;; 1d0 2d0)
136 ;; right, but weird expansion...
137 (gsll:integration-qng
138 (let ((a 2)
139 (b 3))
140 (defun axpb2 (x) (+ (* a x) b))
141 (gsll:def-single-function axpb2)
142 axpb2)
143 1d0 2d0)
145 ;; Linear least squares
147 (gsll:gsl-lookup "gsl_linalg_LU_decomp") ; => gsll:lu-decomposition
148 (gsll:gsl-lookup "gsl_linalg_LU_solve") ; => gsll:lu-solve