From: rearman Date: Fri, 12 Sep 2025 18:44:50 +0000 (-0400) Subject: Set up for use as a package, get rid of defalias calls X-Git-Url: https://git.earman.xyz/?a=commitdiff_plain;h=e0487bb251a5429cc853bb5e10e6b11bddd5a816;p=lisp%2Fworkenv.git Set up for use as a package, get rid of defalias calls --- diff --git a/electrical.lisp b/electrical.lisp index a25cee7..c3f9474 100644 --- a/electrical.lisp +++ b/electrical.lisp @@ -1,3 +1,7 @@ +;;;; electrical.lisp + +(in-package #:work-env) + (defun eff-imp (r1 r2) (/ (+ (inv r1) (inv r2)))) (defun amps->volts (amps imp) (* amps imp)) diff --git a/math.lisp b/math.lisp index 4ac8794..31f2ded 100644 --- a/math.lisp +++ b/math.lisp @@ -1,4 +1,8 @@ -(defalias ^ expt) +;;;; math.lisp + +(in-package #:work-env) + +(setf (fdefinition '^) #'expt) (defmacro square (x) `(^ ,x 2)) diff --git a/package.lisp b/package.lisp new file mode 100644 index 0000000..bdd4675 --- /dev/null +++ b/package.lisp @@ -0,0 +1,4 @@ +;;;; package.lisp + +(defpackage #:work-env + (:use #:cl)) diff --git a/plc.lisp b/plc.lisp index 344b44e..9434c41 100644 --- a/plc.lisp +++ b/plc.lisp @@ -1,3 +1,7 @@ +;;;; plc.lisp + +(in-package #:work-env) + (defparameter *volt-max* 10.0) (defparameter *resolution* 16) (defparameter *impedance* 249) @@ -5,10 +9,10 @@ (defun 13-bit! () (setq *resolution* 13 *volt-max* 10.0)) (defun 16-bit! () (setq *resolution* 16 *volt-max* 10.0)) -(defalias p3k! 16-bit!) -(defalias slc! 16-bit!) -(defalias p1k! 13-bit!) -(defalias dl4! 13-bit!) +(setf (fdefinition 'p3k!) #'16-bit!) +(setf (fdefinition 'slc!) #'16-bit!) +(setf (fdefinition 'p1k!) #'13-bit!) +(setf (fdefinition 'dl4!) #'13-bit!) (defun max-counts (resolution) (- (^ 2 resolution) 1)) diff --git a/refrigeration.lisp b/refrigeration.lisp index ac025e2..105a4e5 100644 --- a/refrigeration.lisp +++ b/refrigeration.lisp @@ -1,3 +1,7 @@ +;;;; refrigeration.lisp + +(in-package #:work-env) + (defun cfm-circ (fpm radius) (float (* pi fpm (square (/ radius 12))))) (defun cfm-rect (fpm width height) diff --git a/unit-conv.lisp b/unit-conv.lisp index 76bfa1d..87ee679 100644 --- a/unit-conv.lisp +++ b/unit-conv.lisp @@ -1,3 +1,7 @@ +;;;; unit-conv.lisp + +(in-package #:work-env) + (defun mm->in (mm) (/ mm 25.4)) (defun in->mm (in) (* in 25.4)) diff --git a/work-env.asd b/work-env.asd new file mode 100644 index 0000000..0ee1650 --- /dev/null +++ b/work-env.asd @@ -0,0 +1,18 @@ +;;;; work-env.asd + +(asdf:defsystem #:work-env + :description + "Typical work environment for a Controls Engineer" + :author + "Rush Earman IV" + :version + "0.0.1" + :serial + t + :components + ((:file "package") + (:file "math") + (:file "unit-conv") + (:file "electrical") + (:file "plc") + (:file "refrigeration")))