Version française
Home     About     Download     Resources     Contact us    
Browse thread
Unexpected behaviour of strings initialized with quotes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin_jambon@e...>
Subject: Re: [Caml-list] Unexpected behaviour of strings initialized with quotes
On Wed, 23 Nov 2005, Arthur Chargueraud wrote:

> I am surprized by a difference of behaviour between the strings
> "bbbb" and (String.make 4 'b').

...

> This is not a real problem, since it is not usual to modify
> strings initialized with quotes, but I am just wandering
> about the reason of such a behaviour...

It's actually easier to write String.copy "abc" instead of "abc"
than:
let f =
   let constant = "abc"
   fun x ->
      ...
      do_something_with constant
      ...

instead of:
let f x =
   ...
   do_something_with "abc"
   ...

which happens all the time.

--
Martin Jambon, PhD
http://martin.jambon.free.fr

Store and share your bioinformatics tips at http://wikiomics.org