From 370b43a33a6205869cb8433e61631be125b00ce4 Mon Sep 17 00:00:00 2001 From: AJ Rossini Date: Sat, 18 Jul 2009 12:35:05 +0200 Subject: [PATCH] move guidance code examples into documentation and clean up current TODO tasks. Signed-off-by: AJ Rossini --- Doc/README.CL-based-design.txt | 53 ++++++++++++++++++++++++++++++++++++ TODO.lisp | 62 ++++++------------------------------------ 2 files changed, 62 insertions(+), 53 deletions(-) diff --git a/Doc/README.CL-based-design.txt b/Doc/README.CL-based-design.txt index d4a59c6..c66f75c 100644 --- a/Doc/README.CL-based-design.txt +++ b/Doc/README.CL-based-design.txt @@ -16,4 +16,57 @@ specified, i.e. (default is ls-user) +;;;;;;;;;;;;;;;;;;;;;;;;;;; SOME CL EXAMPLES and GUIDANCE. + +#+nil(progn + ;; REVIEW: general Lisp use guidance + + (fdefinition 'make-matrix) + (documentation 'make-matrix 'function) + +#| Examples from CLHS, a bit of guidance. + + ;; This function assumes its callers have checked the types of the + ;; arguments, and authorizes the compiler to build in that assumption. + (defun discriminant (a b c) + (declare (number a b c)) + "Compute the discriminant for a quadratic equation." + (- (* b b) (* 4 a c))) => DISCRIMINANT + (discriminant 1 2/3 -2) => 76/9 + + ;; This function assumes its callers have not checked the types of the + ;; arguments, and performs explicit type checks before making any assumptions. + (defun careful-discriminant (a b c) + "Compute the discriminant for a quadratic equation." + (check-type a number) + (check-type b number) + (check-type c number) + (locally (declare (number a b c)) + (- (* b b) (* 4 a c)))) => CAREFUL-DISCRIMINANT + (careful-discriminant 1 2/3 -2) => 76/9 +|# + ) + + + +#| + (defun testme (&key (a 3) (b (+ a 3))) + b) + + (testme) + (testme :a 2) + (testme :b 4) + (testme :a 2 :b (* a 5)) +|# + + +#| + (defun testme (&key (a 3) (b (+ a 3))) + b) + + (testme) + (testme :a 2) + (testme :b 4) + (testme :a 2 :b (* a 5)) +|# diff --git a/TODO.lisp b/TODO.lisp index 97d54ac..3b31ff3 100644 --- a/TODO.lisp +++ b/TODO.lisp @@ -1,6 +1,6 @@ ;;; -*- mode: lisp -*- -;;; Time-stamp: <2009-07-18 12:20:33 tony> +;;; Time-stamp: <2009-07-18 12:33:43 tony> ;;; Creation: <2008-09-08 08:06:30 tony> ;;; File: TODO.lisp ;;; Author: AJ Rossini @@ -60,63 +60,19 @@ (in-package :ls-user) -;;; Tasks to do and consider: -;;; -;;; * - -#+nil(progn - ;; REVIEW: general Lisp use guidance - - (fdefinition 'make-matrix) - (documentation 'make-matrix 'function) - -#| Examples from CLHS, a bit of guidance. - - ;; This function assumes its callers have checked the types of the - ;; arguments, and authorizes the compiler to build in that assumption. - (defun discriminant (a b c) - (declare (number a b c)) - "Compute the discriminant for a quadratic equation." - (- (* b b) (* 4 a c))) => DISCRIMINANT - (discriminant 1 2/3 -2) => 76/9 - - ;; This function assumes its callers have not checked the types of the - ;; arguments, and performs explicit type checks before making any assumptions. - (defun careful-discriminant (a b c) - "Compute the discriminant for a quadratic equation." - (check-type a number) - (check-type b number) - (check-type c number) - (locally (declare (number a b c)) - (- (* b b) (* 4 a c)))) => CAREFUL-DISCRIMINANT - (careful-discriminant 1 2/3 -2) => 76/9 -|# - ) - +;;; Tasks working on... #+nil (progn + ;; use of extension packages supporting versioning and validation of + ;; CLOS objects? (asdf:oos 'asdf:load-op 'versioned-objects) (asdf:oos 'asdf:load-op 'validations)) - - - -#| +#+nil +(progn + ;; Syntax examples using lexical scope, closures, and bindings to + ;; ensure a clean communication of results (with-data dataset ((dsvarname1 [usevarname1]) (dsvarname2 [usevarname2])) - @body) -|# - - - -#| - (defun testme (&key (a 3) (b (+ a 3))) - b) - - (testme) - (testme :a 2) - (testme :b 4) - (testme :a 2 :b (* a 5)) -|# - + @body)) -- 2.11.4.GIT