One problem you might run into is:

a = 4
b = 5
splitAt (a - b) [1..]

If you don't know what a or b are beforehand, you might be opening up a can of uncomputable worms.

Tom

On Sep 6, 2012 1:25 PM, "Stayvoid" <stayvoid@gmail.com> wrote:
Hello,

Could you explain this behaviour?

> splitAt (-1) "Foobar"
("","Foobar")
> splitAt (-100) "Foobar"
("","Foobar")

I don't understand why splitAt (-1) "Foobar" doesn't output this:
("r", "Fooba")
or this:
("", "Fooba")

How does it work?

Python's list slicing looks similar, but results for negative values differ:
>>> a = "Foobar"
>>> a[:-1]
>>> 'Fooba'

Thanks

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners