<div dir="ltr"><div><div>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.<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 13, 2015 at 9:36 AM, derek riemer <span dir="ltr"><<a href="mailto:driemer.riemer@gmail.com" target="_blank">driemer.riemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi guys,<br>
As a newby to haskell, I was curious, what is the best way to splice an array or do things in the middle?<br>
For example, binary search requires i do in sudocode<br>
define binary search array target.<br>
Find middle element.<br>
If target is middle element then return target<br>
else if target < middle element then<br>
binary search array[0:target]<br>
else<br>
binary search array[target:end]<br>
<br>
How can I get this splicing with haskell?<br>
I can't just use head here.<br>
I can't do array!!n: where n is some number.<br>
<br>
Thanks,<br>
Derek<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>