[clean-list] Lists
Willer Alves
willeralves@yahoo.com.br
Tue, 21 May 2002 15:39:51 -0300
--=======FEB3416=======
Content-Type: text/plain; x-avg-checked=avg-ok-6FF027D0; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit
Hello all.
I'm getting in some strange troubles with the implementation of a Real list:
When I use this:
Start = [y\\y<-[1.0,1.1..2.0]]
The system gives the answer: [1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9],
without the last value (2.0). This occurs for any values under 5.0
When I use this:
Start = [y\\y<-[1.0,1.1..5.0]]
The system gives now the correct answer:
[1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4,4.1,4.2,4.3,4.4,4.5,4.6,4.7,4.8,4.9,5]
, with the last value (5.0).
The problem is: The answer is incorrect for any value under 5.0.
On the other hand, I tried this:
makeList x y h
|x==y = x
|otherwise = makeList (x + h) y h
Start = makeList 1.0 2.0 0.1
The answer is an infinity loop. Again, it works with y >= 5.0 (Start =
makeList 1.0 5.0 0.1), or writing (x>=y) instead of (x==y).
What could be the problem?
Best regards,
Willer Alves
Brazil
--=======FEB3416=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-6FF027D0
Content-Disposition: inline
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.362 / Virus Database: 199 - Release Date: 07/05/02
--=======FEB3416=======--
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com