Commit 3062b939 by Samuel W. Flint

Brought in aget and ensure-list because informatimago is no longer in quicklisp

parent b46b18a4
Pipeline #70 passed with stage
in 41 seconds
......@@ -85,7 +85,7 @@ The CAS contained in this is called LARCS, or the Lisp Automated Rewrite and Cal
#+TOC: headlines 3
#+TOC: listings
* DONE Common Functionality [3/3]
* WORKING Common Functionality [3/5]
:PROPERTIES:
:CREATED: <2016-06-11 Sat 22:23>
:ID: f153a0fe-ec04-47b1-bdc5-290cc62bc985
......@@ -173,6 +173,58 @@ This is a mapping between the names of constants and the way that they are corre
(mapcar #'export *constant-names*)
#+END_SRC
** TODO Aget
:PROPERTIES:
:CREATED: <2016-10-23 Sun 11:14>
:END:
#+Caption: Aget
#+Name: common-aget
#+BEGIN_SRC lisp
(defun aget (place indicator &optional default)
"
RETURN: The value of the entry INDICATOR of the a-list PLACE, or DEFAULT.
"
(let ((a (assoc indicator place)))
(if a (cdr a) default)))
(define-setf-expander aget (place indicator &optional default &environment env)
(declare (ignore default))
(multiple-value-bind (vars vals store-vars writer-form reader-form)
(get-setf-expansion place env)
(let* ((vindicator (gensym "INDICATOR"))
(vvalue (gensym "VALUE"))
(vstore (first store-vars))
(acs (gensym "PAIR")))
(values (list* vindicator vars)
(list* indicator vals)
(list vvalue)
`(let* ((,acs (assoc ,vindicator ,reader-form)))
(if ,acs
(setf (cdr ,acs) ,vvalue)
(let ((,vstore (acons ,vindicator ,vvalue ,reader-form)))
,writer-form))
,vvalue)
`(assoc ,vindicator ,reader-form)))))
#+END_SRC
** TODO Ensure List
:PROPERTIES:
:CREATED: <2016-10-23 Sun 11:17>
:ID: 08d8e031-a30f-41b6-9981-caec2f07f2a0
:END:
#+Caption: Ensure List
#+Name: ensure-list
#+BEGIN_SRC lisp
(defun ensure-list (object)
"
RETURN: If OBJECT is a list then OBJECT, otherwise a fresh
list containing OBJECT.
"
(if (listp object) object (list object)))
#+END_SRC
** DONE Assembly
CLOSED: [2016-07-30 Sat 15:43]
:PROPERTIES:
......@@ -190,6 +242,10 @@ This is where the common functions and constants are assembled into their own pa
<<common-generate-an-args-list>>
<<constants-and-greeks>>
<<aget>>
<<ensure-list>>
#+END_SRC
* DONE Expression Typing [8/8]
......@@ -2379,7 +2435,9 @@ This defines the common package, which keeps a few macros and variables that are
#:symbolicate)
(:export #:gen-args-list
#:*special-symbols-to-sequences*
#:*constant-names*)
#:*constant-names*
#:aget
#:ensure-list)
(:nicknames #:common))
#+END_SRC
......@@ -2478,9 +2536,6 @@ This is a rather simple package, providing a way to differentiate equations for
#:larcs.polynomials)
(:import-from #:alexandria
#:symbolicate)
(:import-from #:com.informatimago.common-lisp.cesarum.list
#:aget
#:ensure-list)
(:export :differentiate)
(:nicknames :diff))
#+END_SRC
......@@ -2505,9 +2560,6 @@ Again, this is a relatively simple package definition, providing a way to conver
#:larcs.polynomials)
(:import-from #:alexandria
#:symbolicate)
(:import-from #:com.informatimago.common-lisp.cesarum.list
#:aget
#:ensure-list)
(:export #:convert-for-display)
(:nicknames #:typeset))
#+END_SRC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment