
On 12/29/06, Conor McBride
Or is your issue more superficial? Is it just that
* (my-flatten '(1 (2 (3 4) 5))) (1 2 3 4 5)
looks shorter than
so *Main> flat [E 1, S[E 2, S[E 3, E 4], E 5]] [1,2,3,4,5]
Speaking as a relative newbie to Haskell, the thing that tripped me up was the fact that you can't have nested lists like the Lisp '(1 (2 (3 4) 5)) example in Haskell, because its type is not well-defined. Haskell lists are homogeneous, where Lisp ones aren't. I don't know whether the OP was confused by the same thing as me, but it felt to me that stating the problem was the hard part, rather than implementing a solution. OTOH, it's not entirely clear to me if the issue would come up in "real" code. Slinging about arbitrarily nested lists feels quite natural in Lisp, but isn't really idiomatic Haskell. Cheers, Paul.