Add examples and clean up some stuff

This commit is contained in:
2024-12-08 22:06:58 -08:00
parent 5adc755be4
commit 9b8584bd6f
10 changed files with 275 additions and 102 deletions
+4 -2
View File
@@ -1,5 +1,7 @@
;;;; Parse back the states printed by pprint.lisp
(defpackage :cl-quantum/parse
(:use :cl :cl-quantum/state)
(:documentation "Parse back the states printed by pprint.lisp.")
(:use :cl :cl-quantum/math :cl-quantum/state)
(:export #:parse-real
#:parse-complex
#:parse-state
@@ -44,7 +46,7 @@ stopped. That is, the index of the first un-parsed character."
(list 0 0)
(error "Malformed number: ~s" (subseq string start end))))))
(define-constatnt +parse-complex-regexp+
(define-constant +parse-complex-regexp+
(ppcre:create-scanner
"^\\s*([-+])?\\s*([-+]?)([0-9/.]+(?:[eE][-+]?[0-9]+)?)?(i)?"
:extended-mode t)