Hi,<div>I&#39;m trying to write a generalization of the map function that operates on nested lists, e.g. [[a]] or [[[a]]]. (It should map all elements of type a (not list) with f)</div><div><br></div><div>I was thinking of something along these lines:</div>

<div>mapN f *list of type [a] (where a is not a list type)* = map f l</div><div>mapN f l = (mapN f (head l)):(mapN f (tail l))<br><div><br></div><div>Any suggestions about how to go about this?</div><div><br></div><div>Many thanks,</div>

<div><br></div><div>Ben</div><div><br></div><div><br>-- <br>Ben Derrett<br>Department of Mathematics<br>MIT Class of 2012<br><a href="mailto:bderrett@mit.edu">bderrett@mit.edu</a><br>
</div></div>