Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Serious bug in MatchQ causes crashes and incorrect results

  • To: mathgroup at
  • Subject: [mg28325] Re: Serious bug in MatchQ causes crashes and incorrect results
  • From: Jens-Peer Kuska <kuska at>
  • Date: Wed, 11 Apr 2001 02:01:03 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <9aem2g$> <X4cz6.18682$> <9argur$>
  • Sender: owner-wri-mathgroup at


> The reason I use 'Abort[]' is to stop the Kernal from generating
> hundreds of useless error messages after I know something has failed.
> I have used it quite a bit on both the Mac and under Solaris with no
> problems.  I sometimes do use 'Throw[]'.

I still can't understand how the functions are written. If
some test failed the function should terminate smooth with
some nice message.

> The file names are generally being entered manually, not returned by
> 'FileNames[]' so they do need to be checked. 

And a

getFile[fname_String] /; 

> The approach of checking
> argument patterns and aborting if they don't match came out of
> difficulty in defining both complex patterns and default values for the
> arguments.  I still don't understand the syntax for some of the
> suggested solutions.  If I could define complex patterns with default
> arguments could I then define a version of the function to match all
> invalid argument patterns such as:
> getFile[___]:= CompoundExpression[Message[]; Throw[]/Abort[] ];  ?
>                                 -Jeff DuMonthier

What is so complicate to define a function

getFile[fname_String]/; StringMatchQ[fname,"*.dat"]:=Print["Filename:

or what is so difficult to make a test like

getFile[fname_String, filepatt_, dirs_:{$HomeDirectory}] :=
    flst = 
      Select[FileNames[filepatt, dirs], StringMatchQ[#, "*" <> fname]
    If[flst === {},
      Message[getfile::notfound, fname];
    ByteCount /. FileInformation[fname]

Can you tell me "what" you don't understand ?


  • Prev by Date: Re: Special Matrix
  • Next by Date: RE: Graphics Bug (or anomaly anyway)
  • Previous by thread: Re: Serious bug in MatchQ causes crashes and incorrect results
  • Next by thread: Notebooks do not display correctly in 1024X768