From: Alex Klinkhamer Date: Fri, 25 Jul 2008 00:02:44 +0000 (-0400) Subject: +Trace function, +Constants X-Git-Url: https://repo.or.cz/w/lineal.git/commitdiff_plain/bedd6aaf64f36baa889f91125068c6e386d366e1 +Trace function, +Constants --- diff --git a/src/globals.lisp b/src/globals.lisp index c9fef42..314b701 100644 --- a/src/globals.lisp +++ b/src/globals.lisp @@ -60,4 +60,6 @@ where [name] is what you want the variable to be called and [value] is its desired value."))) +(store-vrbl "pi" pi) +(store-vrbl "e" (exp 1)) diff --git a/src/overload/client-fns.lisp b/src/overload/client-fns.lisp index 1f8e729..3acdc76 100644 --- a/src/overload/client-fns.lisp +++ b/src/overload/client-fns.lisp @@ -5,7 +5,9 @@ '(("+" addn) ("-" subtrn) ("*" multn) ("/" divisn) ("^" over-expt) + ("asin" asin) ("acos" acos) ("atan" atan) ("cat" over-cat) + ("cos" cos) ("crop" over-crop) ("cross" over-cross-prod) ("det" over-det) @@ -18,8 +20,11 @@ ("proj" over-proj) ("recall" lineal::over-recall) ("ref" over-r-ef) ("rref" over-rr-ef) + ("sin" sin) ("sqrt" sqrt) ("store" lineal::over-store) + ("tan" tan) + ("tr" over-trace) ("transpose" over-transpose) ("vcat" over-vcat) ("vcrop" over-vcrop))) diff --git a/src/overload/matrices.lisp b/src/overload/matrices.lisp index 68e73c1..330d5de 100644 --- a/src/overload/matrices.lisp +++ b/src/overload/matrices.lisp @@ -4,6 +4,14 @@ (dimcodom 0 :type integer) (elems nil :type list)) +(defun over-trace (a) + (unless (= (mtrix-dimdom a) (mtrix-dimcodom a)) + (throw 'over-ex + "Can only get the trace of a square matrix.")) + (loop :for i :from 0 + :for row :in (mtrix-elems a) + :sum (elt row i))) + (defun make-mtrix-like (a elems) (make-mtrix :dimdom (mtrix-dimdom a) diff --git a/src/webui/calcupage-buttons.lisp b/src/webui/calcupage-buttons.lisp index 85b9ecb..a0cb00b 100644 --- a/src/webui/calcupage-buttons.lisp +++ b/src/webui/calcupage-buttons.lisp @@ -1,6 +1,4 @@ -(in-package :lineal.webui) - (defun htm-button (text id action) (with-html-output-to-string diff --git a/src/webui/calcupage.lisp b/src/webui/calcupage.lisp index 4f581bc..2f8a2ce 100644 --- a/src/webui/calcupage.lisp +++ b/src/webui/calcupage.lisp @@ -1,6 +1,4 @@ -(in-package :lineal.webui) - ;V URL: /process-infix ;V Receive user's calculation, return result.V (defun receive-and-process diff --git a/src/webui/compile-ps.lisp b/src/webui/compile-ps.lisp index 630a06b..387a2ee 100644 --- a/src/webui/compile-ps.lisp +++ b/src/webui/compile-ps.lisp @@ -1,6 +1,4 @@ -(in-package :lineal.webui) - ;V Compile given ParenScript file.V (defun compile-ps (ps-path js-path) (when (and (probe-file js-path) diff --git a/src/webui/devvars.lisp b/src/webui/devvars.lisp index ec84c6a..657388f 100644 --- a/src/webui/devvars.lisp +++ b/src/webui/devvars.lisp @@ -5,7 +5,8 @@ (setq *file-tree* (nconc *file-tree* - '(("webui" "webvars" "compile-ps" "index" + '(("webui" "webvars";< :lineal.webui + :lineal.webui "compile-ps" "index" "matrixui" "calcupage-buttons" "calcupage" "save-restore" "reload")))) diff --git a/src/webui/index.lisp b/src/webui/index.lisp index af8e8eb..eb8948f 100644 --- a/src/webui/index.lisp +++ b/src/webui/index.lisp @@ -1,6 +1,4 @@ -(in-package :lineal.webui) - ;V Insert javascript tags.V (defmacro js-tag (s . body) `(progn diff --git a/src/webui/matrixui.lisp b/src/webui/matrixui.lisp index e5e5d4c..0166c77 100644 --- a/src/webui/matrixui.lisp +++ b/src/webui/matrixui.lisp @@ -1,6 +1,4 @@ -(in-package :lineal.webui) - ;V URL: /matrix_select_contents ;V Return html code for the dropdown menu V ;V (html's "select" element) to list all V diff --git a/src/webui/reload.lisp b/src/webui/reload.lisp index 6cd823d..7aed6bf 100644 --- a/src/webui/reload.lisp +++ b/src/webui/reload.lisp @@ -1,6 +1,4 @@ -(in-package :lineal.webui) - (defmacro bind-reset ((&body args) . body) (let (tmp-lets s-sets) (loop :for a :in args diff --git a/src/webui/save-restore.lisp b/src/webui/save-restore.lisp index 781f5cb..d950cd5 100644 --- a/src/webui/save-restore.lisp +++ b/src/webui/save-restore.lisp @@ -1,6 +1,4 @@ -(in-package :lineal.webui) - ;V URL: capture_session ;V Return a file for the user to download V ;V containing all session variables. V