Commit f8606e64 authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Use less of create-form-readably, comment out test giving trouble

parent c6dc3d78
;; Object (re)creation.
;; Liam Healy Sat Feb 23 2002 - 17:35
;; Time-stamp: <2011-01-28 15:27:30EST object.lisp>
;; $Id: $
;; Time-stamp: <2014-11-05 12:06:11EST object.lisp>
;; Copyright 2011 Liam M. Healy
;; Copyright 2011, 2014 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
......@@ -27,9 +26,11 @@
(defun readably ()
(or *print-readably* *print-escape*))
;; See notes [[id:2c2599e1-16b1-441a-a34f-6d831b9bfb95][Creation form readably, creation-form-using-reader-macros]]
;; Essentially: it doesn't make any sense to return the object, because that can't be put into a serializable object.
;; Leave in for now, just don't use this.
(defmacro creation-form-readably (object non-readably)
"If we are printing readably, then rely on printed form
to create the new object."
"If we are printing readably, then rely on printed form to create the new object."
`(if (readably)
,object
,non-readably))
......@@ -47,9 +48,7 @@
object
`(vector ,@(map 'list #'creation-form object))))
(:method ((object list))
(creation-form-readably
`',object
`(list ,@(mapcar #'creation-form object))))
`(list ,@(mapcar #'creation-form object)))
(:method ((object hash-table))
`(let ((tbl (make-hash-table
:test ',(hash-table-test object)
......
;; Objects that represent physical measurements.
;; Liam Healy Wed Mar 6 2002 - 09:04
;; Time-stamp: <2014-01-14 21:20:38EST physical-quantities.lisp>
;; Time-stamp: <2014-11-05 11:30:50EST physical-quantities.lisp>
;; Copyright 2011, 2012, 2013 Liam M. Healy
;; Copyright 2011, 2012, 2013, 2014 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
......@@ -335,12 +335,11 @@
(scalar-units-p units))))))
(defmethod creation-form ((pq physical-quantity))
(creation-form-readably
pq
`(let ((*zero-is-dimensionless* nil))
(make-pq-object
,(creation-form (pq-magnitude pq))
,(creation-form (pq-dimension pq))
,(scalar-dimension pq)))))
(multiple-value-bind (mag units)
(pqval pq)
;; Units should probably have a creation-form on it but I don't
;; think this will do anything useful in practice, makes for a
;; more cluttered form.
`(make-pq ,(creation-form mag) ',units)))
(def-make-load-form physical-quantity)
;; Tests of physical quantities
;; Liam Healy 2011-01-09 17:38:41EST tests.lisp
;; Time-stamp: <2014-03-15 12:53:26EDT physical-quantities-grid.lisp>
;; Time-stamp: <2014-11-05 09:12:12EST physical-quantities-grid.lisp>
;; Copyright 2011, 2013, 2014 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -109,6 +109,7 @@
(check-pq (grid:aref grid 0) 1.0d0 'meter)
(check-pq (grid:aref grid 1) 5.0d0 'second))))
;; [[id:6e7e8d6f-cc79-44bb-a264-06e9ec160d49][This test prints out when quickloaded]]
#+(or)
(lisp-unit:assert-true
;; A physical-quantity with a foreign-array as magnitude
(check-pq #m(#_1.0d0_m #_5.0d0_s) #m(1.0d0 5.0d0) #(meter second)))
......
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