caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus@oefai.at>
To: John Prevost <visigoth@cs.cmu.edu>
Cc: Oliver Bandel <oliver@first.in-berlin.de>, caml-list@inria.fr
Subject: Re: [Caml-list] Unix-Filekind => codexample with questions
Date: Sun, 21 Apr 2002 23:56:38 +0200	[thread overview]
Message-ID: <20020421215637.GA32086@fichte.ai.univie.ac.at> (raw)
In-Reply-To: <86u1q421lf.fsf@laurelin.dementia.org>

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


  reply	other threads:[~2002-04-21 21:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-21 20:50 Oliver Bandel
2002-04-21 21:04 ` Remi VANICAT
2002-04-21 21:17 ` John Prevost
2002-04-21 21:56   ` Markus Mottl [this message]
2002-04-23 14:45   ` Oliver Bandel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020421215637.GA32086@fichte.ai.univie.ac.at \
    --to=markus@oefai.at \
    --cc=caml-list@inria.fr \
    --cc=oliver@first.in-berlin.de \
    --cc=visigoth@cs.cmu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).