Skip to content

Commit

Permalink
Convert remaining alexandria: references to spiffy new nickname a:
Browse files Browse the repository at this point in the history
  • Loading branch information
appleby committed Jun 4, 2019
1 parent de79d15 commit 2fcde9c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/parser.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ INPUT-STRING that triggered the condition."
(token-payload tok))))))

(eval-when (:compile-toplevel :load-toplevel :execute)
(alexandria:define-constant +quil<->lisp-functions+
(a:define-constant +quil<->lisp-functions+
'(("SIN" . cl:sin)
("COS" . cl:cos)
("SQRT" . cl:sqrt)
Expand All @@ -1527,13 +1527,13 @@ INPUT-STRING that triggered the condition."

;;; If you add a new arithmetic operator to +QUIL<->LISP-PREFIX-ARITHMETIC-OPERATORS+ or
;;; +QUIL<->LISP-INFIX-ARITHMETIC-OPERATORS+, you must also add it to *ARITHMETIC-GRAMMAR*, below.
(alexandria:define-constant +quil<->lisp-prefix-arithmetic-operators+
(a:define-constant +quil<->lisp-prefix-arithmetic-operators+
'(("-" . cl:-))
:test #'equal
:documentation
"Prefix arithmetic operators usable from within Quil, and their associated Lisp function symbols.")

(alexandria:define-constant +quil<->lisp-infix-arithmetic-operators+
(a:define-constant +quil<->lisp-infix-arithmetic-operators+
'(("+" . cl:+)
("-" . cl:-)
("/" . cl:/)
Expand All @@ -1545,12 +1545,12 @@ INPUT-STRING that triggered the condition."

(defun %lisp->quil (lisp-symbol alist)
(check-type lisp-symbol symbol)
(alexandria:when-let ((found (rassoc lisp-symbol alist :test #'eq)))
(a:when-let ((found (rassoc lisp-symbol alist :test #'eq)))
(car found)))

(defun %quil->lisp (quil-string alist)
(check-type quil-string string)
(alexandria:when-let ((found (assoc quil-string alist :test #'string-equal)))
(a:when-let ((found (assoc quil-string alist :test #'string-equal)))
(cdr found)))

;;; The following functions handle conversion between Quil's arithmetic operators/functions and
Expand Down
2 changes: 1 addition & 1 deletion tests/printer-tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ admonition against carelessness."
;; Ensure expected-output is a fixed point of parse -> print. In rare cases, this check
;; might fail, so skip it if we find a magic cookie at the start of the input section
;; indicating that we should do so.
(unless (alexandria:starts-with-subseq "# Disable fixed-point check" input)
(unless (a:starts-with-subseq "# Disable fixed-point check" input)
(is (string= expected-output
(parse-and-print-quil-to-string expected-output))
message))))
Expand Down
12 changes: 6 additions & 6 deletions tests/utilities.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ If SUFFIX-P is non-nil, suffix the returned string with DELIMITER."
;;; "# Output" is required; otherwise, UPDATE-GOLDEN-FILE-OUTPUT-SECTIONS will fail when attempting
;;; to parse the file.

(define-condition golden-file-parse-error (alexandria:simple-parse-error)
(define-condition golden-file-parse-error (a:simple-parse-error)
((line-number
:initarg :line-number
:initform 0
Expand All @@ -197,9 +197,9 @@ If SUFFIX-P is non-nil, suffix the returned string with DELIMITER."
(format stream
"Error while parsing golden file at line ~D."
(golden-file-parse-error-line-number condition))
(alexandria:when-let ((bad-text (golden-file-parse-error-bad-text condition)))
(a:when-let ((bad-text (golden-file-parse-error-bad-text condition)))
(format stream "~&Invalid text: ~S" bad-text))
(alexandria:when-let ((format-control (simple-condition-format-control condition)))
(a:when-let ((format-control (simple-condition-format-control condition)))
(apply #'format stream
(concatenate 'string "~&" format-control)
(simple-condition-format-arguments condition)))))
Expand Down Expand Up @@ -239,7 +239,7 @@ and OUTPUT slots, respectively."
:format-control format-control
:format-arguments format-arguments))
(stream-file-name (stream)
(alexandria:if-let ((path (uiop:truename* stream)))
(a:if-let ((path (uiop:truename* stream)))
(enough-namestring path)
;; If STREAM is not a FILE-STREAM, it won't have an a TRUENAME. Just format the STREAM.
(format nil "~A" stream))))
Expand Down Expand Up @@ -340,15 +340,15 @@ OUTPUT-CALLBACK is function from STRING -> STRING. It will be called successivel
golden-file input section, and should return the corresponding output string for the given input.
IF-EXISTS has the standard Common Lisp meaning. See http://l1sp.org/cl/open."
(let ((file-paths-list (alexandria:ensure-list file-paths)))
(let ((file-paths-list (a:ensure-list file-paths)))
(when (or skip-prompt
(y-or-n-p
"Are you sure you want to clobber all the output sections of the following files?~%~@
~{~A~%~}~%"
file-paths-list))
(dolist (file file-paths-list)
(format t "~&Updating ~A" file)
(alexandria:write-string-into-file
(a:write-string-into-file
(join-strings (loop :for test-case :in (parse-golden-file file)
:for input := (golden-test-case-input test-case)
:for output := (funcall output-callback input)
Expand Down

0 comments on commit 2fcde9c

Please sign in to comment.