
On Dec 28, 2007 4:24 PM, Benja Fallenstein
Right; I misspoke. What I meant was that you would want a split such that
intercalate a (split a xs) = a
for finite, total (a,xs) (and, since it's achievable, even for infinite xs). Of course, (split a xs = [xs]) satisfies that, but if we add the requirement that split is also supposed to do its job :-) then I think split is fully specified except for whether (split a [] = []) or (split a [] = [[]]).
I take that back; it doesn't specify whether (split "xx" "xxx") should be ["","x"] or ["x",""]. I prefer the former, because working left-to-right seems natural, and because it makes split more lazy (it can yield ("":_) before evaluating the input enough to see the third 'x').
The latter seems better to me; e.g., it satisfies
split a (x ++ a ++ y) = split a x ++ split a y
I take that back, too: split "xx" "xxxx" = ["","",""] split "xx" "x" ++ split "xx" "xxx" = ["x"] ++ ["","x"] ("...but, still..." :-)) - Benja