<div dir="ltr">Or instead of [&#39;a&#39;, &#39;e&#39;, &#39;i&#39;, &#39;o&#39;, &#39;u&#39;] use &quot;aeiou&quot;. However, I think the case statement, while my verbose, is also clearer. But that&#39;s purely a style choice.<br>
<br>Michael<br><br><div class="gmail_quote">On Sun, Oct 4, 2009 at 8:55 PM, Robert Ziemba <span dir="ltr">&lt;<a href="mailto:rziemba@gmail.com">rziemba@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You can also do something like this instead of the case statement (this is using GHCI).  <div><br></div><div><div>Prelude&gt; let exclude = [&#39;a&#39;, &#39;e&#39;, &#39;i&#39;, &#39;o&#39;, &#39;u&#39;]</div><div><div>
Prelude&gt; let f excl letter | letter `elem` excl = &#39;x&#39; | otherwise = letter</div>
<div>Prelude&gt; map (f exclude) &quot;hello&quot;</div><div>&quot;hxllx&quot;</div></div><div><br></div><div>Rob Ziemba</div></div><div><div></div><div class="h5"><div><br><div class="gmail_quote">On Sun, Oct 4, 2009 at 9:10 AM, Colin Paul Adams <span dir="ltr">&lt;<a href="mailto:colin@colina.demon.co.uk" target="_blank">colin@colina.demon.co.uk</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt;&gt;&gt;&gt;&gt; &quot;John&quot; == John Moore &lt;<a href="mailto:john.moore54@gmail.com" target="_blank">john.moore54@gmail.com</a>&gt; writes:<br>


<br>
    John&gt; Hi, I am now writing a function that replaces vowels with<br>
    John&gt; the letter x.  eg.put in a string &quot;help&quot; and out comes hxlp.<br>
    John&gt; I tried this:<br>
<br>
    John&gt; f x = case x of<br>
<br>
    John&gt;       {&#39;a&#39; -&gt; &#39;x&#39;;&#39;e&#39; -&gt; &#39;x&#39;;&#39;i&#39; -&gt; &#39;x&#39;;&#39;o&#39; -&gt; &#39;x&#39;;&#39;u&#39; -&gt;<br>
    John&gt; &#39;x&#39;;_ -&gt; x}<br>
<br>
    John&gt; but this wont work on strings, only on the individual<br>
    John&gt; letters. Any direction would be very welcome.<br>
<br>
You need to call<br>
<br>
map f &quot;whatever&quot;<br>
<br>
where f is your function for replacing a character (as above).<br>
<font color="#888888">--<br>
Colin Adams<br>
Preston Lancashire<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</font></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>