MathGroup Archive 2004

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

Search the Archive

Re: Boolean Type

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52420] Re: [mg52415] Boolean Type
  • From: DrBob <drbob at bigfoot.com>
  • Date: Fri, 26 Nov 2004 06:20:24 -0500 (EST)
  • References: <200411260604.BAA24200@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Something like this:

Clear@f
f[True]:=one
f[False]:=two
f[x_Real]:=three[x]
f/@{True,False,1,1.2}

{one,two,f[1],three[1.2]}

or this:

Clear@f
f[x:(True|False)]:=one[x]
f[x_Real]:=three[x]
f/@{True,False,1,1.2}

{one[True],one[False],f[1],three[1.2]}

Bobby

On Fri, 26 Nov 2004 01:04:57 -0500 (EST), JMyers6761 <jmyers6761 at aol.com> 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
>
> Thanks for any help.
>
> Al Myers
>
>
>
>
>



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


  • References:
  • Prev by Date: Re: Pattern matching partial derivatives
  • Next by Date: Re: Using the same symbol for different quantities
  • Previous by thread: Boolean Type
  • Next by thread: Re: Boolean Type