Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Boolean Type

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52472] Re: [mg52451] Re: Boolean Type
  • From: DrBob <drbob at bigfoot.com>
  • Date: Sun, 28 Nov 2004 01:07:09 -0500 (EST)
  • References: <200411270641.BAA17218@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

>> Simply writing the functions as above will work.

No, because Boolean isn't the Head of True and False.

func[x:(True|False)] := ...

works in that case.

Bobby

On Sat, 27 Nov 2004 01:41:22 -0500 (EST), Bill Rowe <readnewsciv at earthlink.net> wrote:

> On 11/26/04 at 1:04 AM, jmyers6761 at aol.com (JMyers6761) wrote:
>
>> All, I would like to define a function wich would work (in
>> different ways) for both real and boolean input argruments. How
>> should I best implement a function which would implement the
>> following intent?
>
>> func[x_Real]:= some function involving a real varialble x
>
>> func[x_Boolean]:= some function involving a boolean variable x
>
> Simply writing the functions as above will work. For example,
>
> f[x_Real]:=x/2
> f[x_Integer]:= 2 x
>
> f[3.14]
> 1.57
>
> f[4]
> 8
> --
> To reply via email subtract one hundred and four
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: How to prevent from simplification?
  • Next by Date: Re: Re: Non-algebraic solution
  • Previous by thread: Re: Boolean Type
  • Next by thread: Re: Boolean Type