How to generalize input in Haskell
<p>I am just starting to learn Haskell and I am using <a href="http://learnyouahaskell.com/" rel="nofollow">learnyouahaskell.com</a> as the guide, and I am using <code>ghci</code> as interpreter. I have a question regarding lists. On the website they specify the function:</p>

<pre><code>boomBangs xs = [ if x &lt; 10 then "BOOM!" else "BANG!" | x &lt;- xs, odd x]
</code></pre>

<p>This works only for lists. Whereas </p>

<pre><code>boomBangs x = [ if x &lt; 10 then "BOOM!" else "BANG!" | odd x]
</code></pre>

<p>Only works for single inputs, i.e. </p>

<pre><code>boomBangs 21
boomBangs 7
</code></pre>

<p>Is there a way to write this statement so that it doesn't matter whether I put </p>

<pre><code>boomBangs [2,5,6,7,1]
</code></pre>

<p>or</p>

<pre><code>boomBangs 7
</code></pre>

<p>without the need of an if statement?</p>