You can use the various splitAts in Data.List, Data.Vector to split a list at an index.  You can also use drop and take to get a splice ie. drop 4 (take 2) is a splice from 3:5.

On Sat, Jun 13, 2015 at 9:36 AM, derek riemer <driemer.riemer@gmail.com> wrote:
Hi guys,
As a newby to haskell, I was curious, what is the best way to splice an array or do things in the middle?
For example, binary search requires i do in sudocode
define binary search array target.
Find middle element.
If target is middle element then return target
else if target < middle element then
    binary search array[0:target]
else
    binary search array[target:end]

How can I get this splicing with haskell?
I can't just use head here.
I can't do array!!n: where n is some number.

Thanks,
Derek
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners