I want to implement a loop from -1 to 1 with step 0.1. It should take around 21 step to complete. Like this:
(do ((i -1 (+ i 0.1)))
((= i 1) i)
(display i))
But then I'm starting this code my compiler goes wild. There are much more then 21 step as I mentioned.
I also tried this one:
(do ((i -1.0 (+ i 0.1)))
((= i 1.0) i)
(display i))
And end up with this:
(do ((i -1
(string->number (~r (+ i 0.1) #:precision 1))
))
((= i 1) i)
(display i))
I just wanted to do something like this in C++:
for (double x=-1; x<=1; x+=0.1) {
cout<<x<<endl;
}
This C++ code makes 21 step.