[Haskell-beginners] Conditionals where more than one case is true

PATRICK BROWNE patrick.browne at dit.ie
Mon Apr 17 13:27:58 UTC 2017


  Francesco,
 Yes, what I was looking for.
Thanks,
Pat

On 17 April 2017 at 11:54, Francesco Ariis <fa-ml at ariis.it> wrote:

> On Mon, Apr 17, 2017 at 11:26:07AM +0100, PATRICK BROWNE wrote:
> > I can apreciate that the program works when the first guard condition is
> > met (faster Bob Joe).
> > I am not sure why it fails on the second case (faster Bob Joe)
>
> Your `fact` function is the one that is partial
>
>     fact Buffalo Bob = True
>     fact Pig Joe     = True
>     fact Slug Steve  = True
>     -- what if all those patterns fail?
>
> You should add a line to handle "every other case", like
>
>     fact Buffalo Bob = True
>     fact Pig Joe     = True
>     fact Slug Steve  = True
>     fact _    _      = False
>
> Does that help?
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>

-- 


This email originated from DIT. If you received this email in error, please 
delete it from your system. Please note that if you are not the named 
addressee, disclosing, copying, distributing or taking any action based on 
the contents of this email or attachments is prohibited. www.dit.ie

Is ó ITBÁC a tháinig an ríomhphost seo. Má fuair tú an ríomhphost seo trí 
earráid, scrios de do chóras é le do thoil. Tabhair ar aird, mura tú an 
seolaí ainmnithe, go bhfuil dianchosc ar aon nochtadh, aon chóipeáil, aon 
dáileadh nó ar aon ghníomh a dhéanfar bunaithe ar an ábhar atá sa 
ríomhphost nó sna hiatáin seo. www.dit.ie

Tá ITBÁC ag aistriú go Gráinseach Ghormáin – DIT is on the move to 
Grangegorman <http://www.dit.ie/grangegorman>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170417/fcdd1157/attachment.html>


More information about the Beginners mailing list