[Haskell-cafe] Re: Tips of Conditional Expression

TOPE KAREM topekarem at gmail.com
Fri Feb 22 09:22:51 EST 2008


Thanks. My question is whether it can call a function (say map) previously
defined elsewhere in the program. Same goes for filter.

Tope

On Fri, Feb 22, 2008 at 6:04 AM, Christian Maeder <Christian.Maeder at dfki.de>
wrote:

> TOPE KAREM wrote:
> > I know the following:
> >
> > [1] That the general form of conditional expression is: if
> > *Boolean_expression* then /exp1/ else /exp2
> > /[2] That a conditional expression must always have both a then and an
> > else expression.
> > [3] That both /exp1/ and /exp2/ must have the same type, which is the
> > type of the entire conditional expression.
> > [4] That /exp1/ must be <true-value> and /exp2/ must be <false-value>
> >
> > Reference: Discrete Mathematics Using Computer by John O'Donnell and et
> > al. (Second Edition)
> >
> > My question: Is it possible that exp1 and exp 2  be different function
> > calls of another functions (separately) elsewhere within the same
> program?
> > Note: My Boolean_expression is Boolean
> >          My /exp1/ is a function call elsewhere within the same program
> > (more like a subroutine)
> >          My /exp2/ is another function call also elsewhere within the
> > same program.
>
> I'm not sure what you're asking, but exp1 and exp2 may have (the same)
> function type:
>
> if <cond> then map else filter :: (Bool -> Bool) -> [Bool] -> [Bool]
>
> HTH Christian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080222/407a1fcb/attachment.htm


More information about the Haskell-Cafe mailing list