MathGroup Archive 2002

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

Search the Archive

Re: Error Testing a List on input

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37699] Re: Error Testing a List on input
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 9 Nov 2002 00:28:55 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <aqfptu$7g3$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

myfunc[a : {__Integer}] /; And @@ ((# >= 0 && # <= 9) & /@ a) := "blub"

myfunc[_] := Print["incorrect input"]

Regards
  Jens

flip wrote:
> 
> Hello,
> 
> I was wondering if there is an easy way to do this.
> 
> I want to input a list of nine numbers. I would like to test each element in
> the list prior to acting upon it.
> 
> This ends up being a sort of error check on the list prior to manipulating
> it, if it is wrong, produce an error message or do nothing with the module.
> 
> So, I would like to test each element to be a. an integer, b. >= 0, c. <= 9.
> 
> Is there a way to test this list at the input prior to acting upon it?
> 
> Thanks, Flip


  • Prev by Date: Re: Plotting a circle...
  • Next by Date: How to use error message return values
  • Previous by thread: Re: Error Testing a List on input
  • Next by thread: RE: Error Testing a List on input