From 65ba57c45a9fe4f6b5f51ce963fb8dc04b7ffe37 Mon Sep 17 00:00:00 2001 From: AJ Rossini Date: Wed, 15 Jul 2009 10:05:19 +0200 Subject: [PATCH] better logic for DEF. documentation Signed-off-by: AJ Rossini --- src/data/data.lisp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/data/data.lisp b/src/data/data.lisp index 12f9f83..7aaa7ed 100644 --- a/src/data/data.lisp +++ b/src/data/data.lisp @@ -1,6 +1,6 @@ ;;; -*- mode: lisp -*- -;;; Time-stamp: <2008-11-16 20:24:10 tony> +;;; Time-stamp: <2009-07-14 19:32:04 tony> ;;; Creation: <2005-08-xx 21:34:07 rossini> ;;; File: data.lisp ;;; Author: AJ Rossini @@ -228,8 +228,10 @@ Reads the data in FILE as COLS columns and returns a list of lists representing (transpose (split-list (read-data-file file) cols)))) -;;; FIXME:AJR: ALL THE FOLLOWING NEED TO BE SOLVED BY PLATFORM-INDEP PATHNAME WORK! -;;; FIXME:AJR: use either string or pathname. +;;; FIXME:AJR: ALL THE FOLLOWING NEED TO BE SOLVED BY PLATFORM-INDEP +;;; PATHNAME WORK! +;;; +;;; FIXME:AJR: should be able too use either string or pathname. (defun path-string-to-path (p s) (pathname (concatenate 'string (namestring p) s))) @@ -256,25 +258,24 @@ Read in lisp example file from the examples library." (defvar *ask-on-redefine* nil) (defmacro def (symbol value) -"Syntax: (def var form) + "Syntax: (def var form) VAR is not evaluated and must be a symbol. Assigns the value of FORM to VAR and adds VAR to the list *VARIABLES* of def'ed variables. Returns VAR. If VAR is already bound and the global variable *ASK-ON-REDEFINE* is not nil then you are asked if you want to redefine the variable." `(unless (and *ask-on-redefine* - (boundp ',symbol) - (not (y-or-n-p "Variable has a value. Redefine?"))) - (if (boundp ',symbol) - (setf ,symbol ,value) - (defvar ,symbol ,value)) - (pushnew ',symbol *variables*) - ',symbol)) + (boundp ',symbol) + (not (y-or-n-p "Variable has a value. Redefine?"))) + (defparameter ,symbol ,value)) + (pushnew ',symbol *variables*) + ',symbol) (defun variables-list () - (mapcar #'intern (sort-data (mapcar #'string *variables*)))) + "Return list of variables as a lisp list of strings." + (mapcar #'intern (sort-data (mapcar #'string *variables*)))) (defun variables () -"Args:() + "Args:() Returns a list of the names of all def'ed variables to STREAM" (if *variables* (mapcar #'intern (sort-data (mapcar #'string *variables*))))) -- 2.11.4.GIT