Skip to content
Snippets Groups Projects
Commit c5b5ffea authored by Luís Oliveira's avatar Luís Oliveira
Browse files

Remove trailing whitespace in source code

parent f9e669c8
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ ARRAY-DIMENSION-LIMIT."
ARRAY-DIMENSION-LIMIT."
`(integer 0 ,length))
(defun copy-array (array &key
(defun copy-array (array &key
(element-type (array-element-type array))
(fill-pointer (and (array-has-fill-pointer-p array)
(fill-pointer array)))
......@@ -24,7 +24,7 @@ the keyword arguments."
;; Dictionary entry for ADJUST-ARRAY requires adjusting a
;; displaced array to a non-displaced one to make a copy.
(adjust-array
(make-array dims
(make-array dims
:element-type element-type :fill-pointer fill-pointer
:adjustable adjustable :displaced-to array)
dims)))
......
......@@ -98,7 +98,7 @@ it is called with to FUNCTION."
with and ARGUMENTS to FUNCTION."
(declare (optimize (speed 3) (safety 1) (debug 1)))
(lambda (&rest more)
(declare (dynamic-extent more))
(declare (dynamic-extent more))
(multiple-value-call function (values-list more) (values-list arguments))))
(defmacro named-lambda (name lambda-list &body body)
......
(in-package :alexandria)
(defun copy-hash-table (table &key
(defun copy-hash-table (table &key
(test (hash-table-test table))
(size (hash-table-size table))
(rehash-size (hash-table-size table))
......@@ -8,8 +8,8 @@
"Returns a shallow copy of hash table TABLE, with the same keys and values
as the TABLE. The copy has the same properties as the original, unless
overridden by the keyword arguments."
(let ((copy (make-hash-table :test test :size size
:rehash-size rehash-size
(let ((copy (make-hash-table :test test :size size
:rehash-size rehash-size
:rehash-threshold rehash-threshold)))
(maphash (lambda (k v)
(setf (gethash k copy) v))
......
......@@ -94,8 +94,8 @@ proper list."
(return (cadr last)))
(when (endp (cdr fast))
(return (car fast)))
(when (eq fast slow)
(error 'type-error
(when (eq fast slow)
(error 'type-error
:datum list
:expected-type '(and list (not circular-list))))))
......@@ -110,8 +110,8 @@ list."
(return (setf (cadr last) object)))
(when (endp (cdr fast))
(return (setf (car fast) object)))
(when (eq fast slow)
(error 'type-error
(when (eq fast slow)
(error 'type-error
:datum list
:expected-type '(and list (not circular-list))))))
......@@ -188,7 +188,7 @@ denotes a set if each element of the list is unique under KEY and TEST."
(let (seen)
(dolist (elt object t)
(let ((key (funcall key elt)))
(if (member key seen :test test)
(if (member key seen :test test)
(return nil)
(push key seen)))))))
......@@ -210,8 +210,8 @@ from LIST, and one from each of MORE-LISTS for each combination of arguments.
In other words, returns the product of LIST and MORE-LISTS using FUNCTION.
Example:
(map-product 'list '(1 2) '(3 4) '(5 6)) => ((1 3 5) (1 3 6) (1 4 5) (1 4 6)
(map-product 'list '(1 2) '(3 4) '(5 6)) => ((1 3 5) (1 3 6) (1 4 5) (1 4 6)
(2 3 5) (2 3 6) (2 4 5) (2 4 6))
"
(labels ((%map-product (f lists)
......@@ -222,7 +222,7 @@ Example:
(mappend (lambda (x)
(%map-product (curry f x) more))
one)))))
(%map-product (if (functionp function)
(%map-product (if (functionp function)
function
(fdefinition function))
(cons list more-lists))))
......@@ -233,7 +233,7 @@ Example:
(labels ((traverse (subtree)
(when subtree
(if (consp subtree)
(progn
(progn
(traverse (car subtree))
(traverse (cdr subtree)))
(push subtree list)))))
......
......@@ -26,11 +26,11 @@ Example:
(let ((y 0)) (cons1 (incf y))) => (1 . 1)"
(let ((gensyms (make-gensym-list (length names) "ONCE-ONLY")))
;; bind in user-macro
`(let ,(mapcar (lambda (g n) (list g `(gensym ,(string n))))
`(let ,(mapcar (lambda (g n) (list g `(gensym ,(string n))))
gensyms names)
;; bind in final expansion
`(let (,,@(mapcar (lambda (g n) ``(,,g ,,n)) gensyms names))
;; bind in user-macro
;; bind in user-macro
,(let ,(mapcar #'list names gensyms)
,@forms)))))
......
......@@ -14,8 +14,8 @@ MIN and MAX if NUMBER is greater then MAX, otherwise returns NUMBER."
"Returns two gaussian random double floats as the primary and secondary value,
optionally constrained by MIN and MAX. Gaussian random numbers form a standard
normal distribution around 0.0d0."
(labels ((gauss ()
(loop
(labels ((gauss ()
(loop
for x1 = (- (random 2.0d0) 1.0d0)
for x2 = (- (random 2.0d0) 1.0d0)
for w = (+ (expt x1 2) (expt x2 2))
......@@ -172,7 +172,7 @@ minimum of its original value and NUMBERS.")
(declare (type (integer 1) j k))
(if (= j k)
j
(let ((middle (+ j (truncate (- k j) 2))))
(let ((middle (+ j (truncate (- k j) 2))))
(* (if (<= middle most-positive-fixnum)
(bisect j middle)
(bisect-big j middle))
......
(defpackage :alexandria.0.dev
(:nicknames :alexandria)
(:use :cl)
(:export
(:export
;; Binding constructs
#:if-let
#:if-let*
......@@ -65,11 +65,11 @@
#:count-permutations
#:factorial
#:gaussian-random
#:iota
#:iota
#:lerp
#:map-iota
#:maxf
#:mean
#:maxf
#:mean
#:median
#:minf
#:standard-deviation
......
......@@ -119,21 +119,21 @@ SEQUENCE."
(defun first-elt (sequence)
"Returns the first element of SEQUENCE. Signals a type-error if SEQUENCE is
not a sequence, or is an empty sequence."
;; Can't just directly use ELT, as it is not guaranteed to signal the
;; Can't just directly use ELT, as it is not guaranteed to signal the
;; type-error.
(cond ((consp sequence)
(car sequence))
((and (typep sequence '(and sequence (not list))) (plusp (length sequence)))
(elt sequence 0))
(t
(error 'type-error
:datum sequence
(error 'type-error
:datum sequence
:expected-type '(and sequence (not (satisfies emptyp)))))))
(defun (setf first-elt) (object sequence)
"Sets the first element of SEQUENCE. Signals a type-error if SEQUENCE is
not a sequence, is an empty sequence, or if OBJECT cannot be stored in SEQUENCE."
;; Can't just directly use ELT, as it is not guaranteed to signal the
;; Can't just directly use ELT, as it is not guaranteed to signal the
;; type-error.
(cond ((consp sequence)
(setf (car sequence) object))
......@@ -141,14 +141,14 @@ not a sequence, is an empty sequence, or if OBJECT cannot be stored in SEQUENCE.
(plusp (length sequence)))
(setf (elt sequence 0) object))
(t
(error 'type-error
:datum sequence
(error 'type-error
:datum sequence
:expected-type '(and sequence (not (satisfies emptyp)))))))
(defun last-elt (sequence)
"Returns the last element of SEQUENCE. Signals a type-error if SEQUENCE is
not a proper sequence, or is an empty sequence."
;; Can't just directly use ELT, as it is not guaranteed to signal the
;; Can't just directly use ELT, as it is not guaranteed to signal the
;; type-error.
(let ((len 0))
(cond ((consp sequence)
......@@ -156,8 +156,8 @@ not a proper sequence, or is an empty sequence."
((and (typep sequence '(and sequence (not list))) (plusp (setf len (length sequence))))
(elt sequence (1- len)))
(t
(error 'type-error
:datum sequence
(error 'type-error
:datum sequence
:expected-type '(and proper-sequence (not (satisfies emptyp))))))))
(defun (setf last-elt) (object sequence)
......@@ -169,8 +169,8 @@ sequence, is an empty sequence, or if OBJECT cannot be stored in SEQUENCE."
((and (typep sequence '(and sequence (not list))) (plusp (setf len (length sequence))))
(setf (elt sequence (1- len)) object))
(t
(error 'type-error
:datum sequence
(error 'type-error
:datum sequence
:expected-type '(and proper-sequence (not (satisfies emptyp))))))))
(defun starts-with-subseq (sequence prefix &rest args &key (return-suffix nil) &allow-other-keys)
......@@ -215,7 +215,7 @@ the last (length SUFFIX) elements of SEQUENCE are equal to SUFFIX."
"Returns true if SEQUENCE is a sequence whose first element is EQL to OBJECT.
Returns NIL if the SEQUENCE is not a sequence or is an empty sequence."
(funcall test
(funcall key
(funcall key
(typecase sequence
(cons (car sequence))
(sequence
......@@ -233,11 +233,12 @@ an error if SEQUENCE is an improper list."
(funcall test
(funcall key
(typecase sequence
(cons
(cons
;; signals for improper lists
(lastcar sequence))
(lastcar sequence))
(sequence
;; Can't use last-elt, as that signals an error for empty sequences
;; Can't use last-elt, as that signals an error
;; for empty sequences
(let ((len (length sequence)))
(if (plusp len)
(elt sequence (1- len))
......@@ -348,7 +349,7 @@ if calling FUNCTION modifies either the derangement or SEQUENCE."
(size (- end start))
;; We don't really care about the elements here.
(derangement (subseq sequence 0 size))
;; Bitvector that has 1 for elements that have been deranged.
;; Bitvector that has 1 for elements that have been deranged.
(mask (make-array size :element-type 'bit :initial-element 0)))
(declare (dynamic-extent mask))
;; ad hoc algorith
......
......@@ -148,7 +148,7 @@
(dotimes (i 10)
(setf (gethash i table) (- i)))
(maphash-values (lambda (v) (push v vals)) table)
(set-equal vals '(0 -1 -2 -3 -4 -5 -6 -7 -8 -9)))
(set-equal vals '(0 -1 -2 -3 -4 -5 -6 -7 -8 -9)))
t)
(deftest hash-table-keys.1
......@@ -224,7 +224,7 @@
(nil :cons :string))
(deftest conjoin.1
(let ((conjunction (conjoin #'consp
(let ((conjunction (conjoin #'consp
(lambda (x)
(stringp (car x)))
(lambda (x)
......@@ -235,7 +235,7 @@
(nil nil #\f))
(deftest compose.1
(let ((composite (compose '1+
(let ((composite (compose '1+
(lambda (x)
(* x 2))
#'read-from-string)))
......@@ -243,9 +243,9 @@
3)
(deftest compose.2
(let ((composite
(let ((composite
(locally (declare (notinline compose))
(compose '1+
(compose '1+
(lambda (x)
(* x 2))
#'read-from-string))))
......@@ -254,7 +254,7 @@
(deftest compose.3
(let ((compose-form (funcall (compiler-macro-function 'compose)
'(compose '1+
'(compose '1+
(lambda (x)
(* x 2))
#'read-from-string)
......@@ -300,7 +300,7 @@
(multiple-value-list (funcall fun "2 9"))))
(4 1))
(deftest curry.1
(deftest curry.1
(let ((curried (curry '+ 3)))
(funcall curried 1 5))
9)
......@@ -419,7 +419,7 @@
(quite-proper (list 1 2 3))
(quite-dotted (list 1 (cons 2 3))))
(list (circular-tree-p circle)
(circular-tree-p tree1)
(circular-tree-p tree1)
(circular-tree-p tree2)
(circular-tree-p dotted)
(circular-tree-p proper)
......@@ -467,7 +467,7 @@
(deftest lastcar.error.2
(handler-case
(progn
(progn
(lastcar (circular-list 1 2 3))
nil)
(error ()
......@@ -681,7 +681,7 @@
(mean '(1 2 3 4))
5/2)
(deftest mean.3
(deftest mean.3
(mean '(1 2 10))
13/3)
......@@ -879,7 +879,7 @@
(t t nil nil))
(deftest emptyp.1
(mapcar #'emptyp
(mapcar #'emptyp
(list (list 1)
(circular-list 1)
nil
......@@ -993,10 +993,10 @@
:zot
(circular-list 1 2 3)
(list* 1 2 3 (circular-list 4 5))))
(:type-error
:type-error
:type-error
:type-error
(:type-error
:type-error
:type-error
:type-error
:type-error
:type-error))
......@@ -1115,20 +1115,20 @@
(deftest parse-body.1
(parse-body '("doc" "body") :documentation t)
("body")
nil
("body")
nil
"doc")
(deftest parse-body.2
(parse-body '("body") :documentation t)
("body")
nil
("body")
nil
nil)
(deftest parse-body.3
(parse-body '("doc" "body"))
("doc" "body")
nil
("doc" "body")
nil
nil)
(deftest parse-body.4
......@@ -1181,7 +1181,7 @@
(deftest format-symbol.2
(format-symbol :keyword "SYM-~A" :bolic)
:sym-bolic)
:sym-bolic)
(deftest format-symbol.3
(let ((*package* (find-package :cl)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment