Shah Namrata Abhaykumar writes:

>       Hence , if (e2-e1) >= 0 and e3 < e1,
>
>       enumFromThenTo e1 e2 e3 will generate the list [e1,e2,..]
>
>       (if you dont agree with what I say, then here is the
>       proof to it :
>
..

>       The condition (<=e3) x, where x belongs to [e1,e2..] will
>       always be true.
>
>       Hence TakeWhile (<=e3) [e1,e2..] = [e1,e2..]
>
>       Hence enumFromThenTo e1 e2 e3 = [e1,e2..]
>
>       ( Hope by now you haven't forgotten that e2-e1 >= 0 and e3<e1)


But you have!  if e3 < e1, then takeWhile (<= e3) (e1:anylist) == [] !

I just ran some of your examples in Gofer, which uses the same prelude
definitions for takeWhile, enumFromThen and enumFromThenTo, and
got the desired results:

? [1,2..1]
[1]
(20 reductions, 38 cells)
? [2,5..1]
[]
(10 reductions, 27 cells)


It looks like the prelude works just the way you want it to.


-- Emery

---
Emery Berger ([EMAIL PROTECTED])    "It is best to get out of any way
Applied Research Laboratories          not the way of wine."
University of Texas at Austin                           -- Omar Khayyam

Reply via email to