Skip to content
Snippets Groups Projects
Commit 1f08608d authored by pfdietz's avatar pfdietz
Browse files

Added tests for stepping of a complex-values loop index in LOOP FOR ... FROM...

Added tests for stepping of a complex-values loop index in LOOP FOR ... FROM ... without a termination test.
parent 78ffcc30
No related branches found
No related tags found
No related merge requests found
...@@ -224,4 +224,33 @@ ...@@ -224,4 +224,33 @@
(deftest loop.1.43 (deftest loop.1.43
(loop for x from 10 above 0 do nil finally (return x)) (loop for x from 10 above 0 do nil finally (return x))
1) 1)
|# |#
\ No newline at end of file
;;; The arithmetic loop form says the types are numbers, not
;;; reals, so arguably they should work on complexes (which are
;;; numbers.) Comparing these for termination could be problematic,
;;; but a clause without termination should work just fine.
(deftest loop.1.44
(loop for i from 1 to 5 for c from #c(0 1) collect c)
(#c(0 1) #c(1 1) #c(2 1) #c(3 1) #c(4 1)))
(deftest loop.1.45
(loop for i from 1 to 5 for c from #c(0 1) by 2 collect c)
(#c(0 1) #c(2 1) #c(4 1) #c(6 1) #c(8 1)))
(deftest loop.1.46
(loop for i from 1 to 5 for c downfrom #c(5 1) collect c)
(#c(5 1) #c(4 1) #c(3 1) #c(2 1) #c(1 1)))
(deftest loop.1.47
(loop for i from 1 to 5 for c downfrom #c(10 1) by 2 collect c)
(#c(10 1) #c(8 1) #c(6 1) #c(4 1) #c(2 1)))
(deftest loop.1.48
(loop for i from 1 to 5 for c upfrom #c(0 1) collect c)
(#c(0 1) #c(1 1) #c(2 1) #c(3 1) #c(4 1)))
(deftest loop.1.49
(loop for i from 1 to 5 for c upfrom #c(0 1) by 2 collect c)
(#c(0 1) #c(2 1) #c(4 1) #c(6 1) #c(8 1)))
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