[
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: | 2004-05-25 (08:46) |
From: | Alex Baretta <alex@b...> |
Subject: | Re: [Caml-list] unix.chop_extension |
skaller wrote: > # Filename.chop_extension "x.y/z";; > - : string = "x" This is a terrible consequence of not having (* functional *) support for regexps in the language or standard library. The Filename library uses the very weak functions of the String library to find the rightmost dot in the filename (* or path *), which is obviously correct only under a very stringent precondition, which is not the most general possible precondition for this function. The Str module has a very clever implementation, but it cannot be used systematically in Ocaml because it is not *functional*. I'm sure that if we had a functional version of Str, the author of the Filename module would rewrite it using regular expressions instead of the rindex function. *** There's one extra thing I'd like to point out. We have the chop_extension function. Why in the world is there no find_extension function? find_extension "foo.bar" --> "bar" Alex ------------------- 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