Thank you Raphael !
Indeed, keeping the C encoding underneath strings (and arrays) is a nice
property.
ph.
2011/9/14 Raphael Proust
> Richard Jones described the internals of OCaml quite concisely. The
> difference between char arrays and strings is exposed in part two of
> his series of posts:
On Fri, 16 Sep 2011 22:20:05 +0100
"Richard W.M. Jones" wrote:
> On Wed, Sep 14, 2011 at 10:40:11PM +0200, Basile Starynkevitch wrote:
> > And there is a reason why you cannot match (in Ocaml) on the content
> > of strings (or arrays). It won't be easy to implement efficiently
> > (you would need
On Wed, Sep 14, 2011 at 10:40:11PM +0200, Basile Starynkevitch wrote:
> And there is a reason why you cannot match (in Ocaml) on the content
> of strings (or arrays). It won't be easy to implement efficiently
> (you would need to copy a substring or subarray when matching)
How about just prefix ma
Richard Jones described the internals of OCaml quite concisely. The
difference between char arrays and strings is exposed in part two of
his series of posts:
https://rwmj.wordpress.com/2009/08/05/ocaml-internals-part-2-strings-and-other-types/
There is a pointer to
http://caml.inria.fr/pub/ml-arch
It reminds me of the micmatch/mikmatch project(s),
http://martin.jambon.free.fr/micmatch.html, but never used it, only remember
reading the announce on the hump or this list.
Le 14 sept. 2011 à 22:16, Walter Cazzola a écrit :
> Hi all,
> I'm just trying to write a recursive function that iterat
Hi Walter,
Contrary to Prolog or Haskell, strings in ocaml are not represented as char
lists. They are exactly like char array, but have their own type, operations
and syntax : strings are created with String.make (similar to Array.make),
their length is given by String.length (sim. to Array.lengt
On Wed, 14 Sep 2011 22:16:42 +0200 (CEST)
Walter Cazzola wrote:
>
> Does this mean that I can't write a function on strings by pattern
> matching or is there something I don't know?
No, standard Ocaml 3.12 has no way of doing matching (in the sense of the match
expression) on [the content of] Oc
Hi all,
I'm just trying to write a recursive function that iterates¹ on a string
and I'd like to use pattern matching as in:
let rec iter f s =
match s with
| "" -> unit;
| c^s1 -> f c; iter f s1;;
but the ^ concatenates 2 strings and not a char with a string and above
all seems to