From 83a82217e4bf47457aab6478f4e23be6fa6e496b Mon Sep 17 00:00:00 2001 From: AJ Rossini Date: Tue, 17 Feb 2009 06:45:09 +0100 Subject: [PATCH] clean up packaging for lsbasics package. Signed-off-by: AJ Rossini --- src/basics/lsbasics.lsp | 25 +++++-------------------- src/packages.lisp | 14 +++++++++++--- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/basics/lsbasics.lsp b/src/basics/lsbasics.lsp index 9d62e7b..311d525 100644 --- a/src/basics/lsbasics.lsp +++ b/src/basics/lsbasics.lsp @@ -8,22 +8,6 @@ ;;;; Copyright (c) 1991, by Luke Tierney. Permission is granted for ;;;; unrestricted use. -;;; Package Setup - -(in-package :cl-user) - -(defpackage :lisp-stat-basics - (:use :common-lisp - :lisp-stat-object-system - :lisp-stat-types - :lisp-stat-float - :lisp-stat-macros - :lisp-stat-compound-data) - (:shadowing-import-from :lisp-stat-object-system - slot-value call-method call-next-method) - (:export permute-array sum prod count-elements mean - if-else sample)) - (in-package :lisp-stat-basics) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -133,7 +117,7 @@ Returns a copy of the array A permuted according to the permutation P." (sum 0)) (if (consp seq) (dolist (x seq sum) - (setf sum (+ sum (if (numberp x) x (sum-1 x))))) + (incf sum (+ sum (if (numberp x) x (sum-1 x))))) ;; was setf (let ((n (length seq))) (declare (fixnum n)) (dotimes (i n sum) @@ -141,6 +125,8 @@ Returns a copy of the array A permuted according to the permutation P." (let ((x (aref seq i))) (setf sum (+ sum (if (numberp x) x (sum-1 x))))))))))) +;; incr + (defun sum (&rest args) "Args: (&rest number-data) Returns the sum of all the elements of its arguments. Returns 0 if there @@ -200,8 +186,7 @@ Returns the number of its arguments. Vector reducing" (defun if-else (a x y) "Args: (first x y) -Takes simple or compound data items FIRST, X and Y and returns result -of elementswise selecting from X if FIRST is not NIL and from Y -otherwise." +Takes simple or compound data items A, X and Y and returns result +of elementswise selection, from X if A is not NIL, otherwise from Y." (flet ((base-if-else (a x y) (if a x y))) (recursive-map-elements #'base-if-else #'if-else a x y))) diff --git a/src/packages.lisp b/src/packages.lisp index 66945d9..9834662 100644 --- a/src/packages.lisp +++ b/src/packages.lisp @@ -1,6 +1,6 @@ ;;; -*- mode: lisp -*- -;;; Time-stamp: <2009-02-04 10:19:31 tony> +;;; Time-stamp: <2009-02-13 17:18:50 tony> ;;; Creation: <2008-03-11 19:18:34 user> ;;; File: packages.lisp ;;; Author: AJ Rossini @@ -284,9 +284,9 @@ (:use :common-lisp :lisp-matrix :lisp-stat-object-system -#| :lisp-stat-basics :lisp-stat-compound-data +#| :lisp-stat-math :lisp-stat-descriptive-statistics |# @@ -307,7 +307,10 @@ ;; sweep-matrix basis weights included total-sum-of-squares residual-sum-of-squares - predictor-names response-name case-labels)) + predictor-names response-name case-labels + ;; functions for helpers + lm xtxinv + )) (defpackage :lisp-stat (:documentation "Experimentation package for LispStat. Serious @@ -438,13 +441,18 @@ ;; subpackages prior to export. ;; regression.lsp + ;; -- linear regressin models. regression-model regression-model-proto x y intercept sweep-matrix basis weights included total-sum-of-squares residual-sum-of-squares predictor-names response-name case-labels + lm xtxinv ;; nonlin.lsp + ;; -- nonlinear regression models nreg-model nreg-model-proto mean-function theta-hat epsilon count-limit verbose + ;; we might need something like xtxinv here? But should be + ;; encapsulated, so we use the one in regression.lisp ;; bayes.lsp bayes-model bayes-model-proto bayes-internals)) -- 2.11.4.GIT