From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA22656; Sun, 21 Apr 2002 23:56:45 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA22651 for ; Sun, 21 Apr 2002 23:56:44 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3LLuh104315 for ; Sun, 21 Apr 2002 23:56:43 +0200 (MET DST) Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.9.3/8.9.3/Debian 8.9.3-21) id XAA32188; Sun, 21 Apr 2002 23:56:38 +0200 Date: Sun, 21 Apr 2002 23:56:38 +0200 From: Markus Mottl To: John Prevost Cc: Oliver Bandel , caml-list@inria.fr Subject: Re: [Caml-list] Unix-Filekind => codexample with questions Message-ID: <20020421215637.GA32086@fichte.ai.univie.ac.at> Mail-Followup-To: John Prevost , Oliver Bandel , caml-list@inria.fr References: <86u1q421lf.fsf@laurelin.dementia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86u1q421lf.fsf@laurelin.dementia.org> User-Agent: Mutt/1.3.26i Organization: Austrian Research Institute for Artificial Intelligence Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, 21 Apr 2002, John Prevost wrote: > How about: > > let is_regularfile name = > try (match Unix.stat name with > | {Unix.st_kind = Unix.S_REG} -> true > | _ -> false) > with > _ -> false Or even shorter: let is_regularfile name = try (Unix.stat name).Unix.st_kind = Unix.S_REG with _ -> false Some people would prefer opening the Unix-module first for brevity: open Unix let is_regularfile name = try (stat name).st_kind = S_REG with _ -> false Regards, Markus Mottl -- Markus Mottl markus@oefai.at Austrian Research Institute for Artificial Intelligence http://www.oefai.at/~markus ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners