Browse thread
[Caml-list] Unix-Filekind => codexample with questions
-
Oliver Bandel
- Remi VANICAT
-
John Prevost
- Markus Mottl
- Oliver Bandel
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Markus Mottl <markus@o...> |
| Subject: | Re: [Caml-list] Unix-Filekind => codexample with questions |
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