Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Subsequence references or substrings in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1998-12-21 (10:17)
From: Brian Rogoff <bpr@b...>
Subject: Subsequence references or substrings in OCaml

I've been doing a lot of string processing lately and trying to determine
the correct "functional" approach to string processing. In SML '97 (hey,
you've got to look at the competition ;-) the Basis Library has a
signature SUBSTRING which has a substring type, whose values are just 
triples (s,i,n) where i is the starting index and n the size of the string
s. It turns out that many algorithms are simplified by using this kind of 
representation for strings. 

It also turns out that similar string representations have been used
before; if you hop over to you'll see
that "subsequence references" are pretty much the same thing. 

Its simple enough to implement subsequence references as a user defined
type in OCaml, as I've done, but I am curious about whether anyone else
who has used similar libraries would find a built-in substring or 
subsequence ref library useful. 

-- Brian