Re: [Caml-list] Strings

2009-04-04 Thread Goswin von Brederlow
Jon Harrop writes: > On Saturday 04 April 2009 22:51:50 Goswin von Brederlow wrote: >> The beauty of ocaml strings is that they are really compact. An ocaml >> string on 32bit is 5-8 bytes longer than the contained string and 9-16 >> bytes on 64bit. > > The ugliness is that 16Mb limit. I assume t

[Caml-list] netplex: calling send_message from processor hangs container

2009-04-04 Thread Serge Sivkov
Hello, the following code hags container as for Netplex_mt as for Netplex_mp parallelizer: method process ~when_done container fd proto_name = let ch = Unix.out_channel_of_descr fd in output_string ch "Hello\n"; flush ch; container#send_message "Sender*" "test-msg" [||]; clos

Re: [Caml-list] Strings

2009-04-04 Thread Edgar Friendly
Jon Harrop wrote: > On Saturday 04 April 2009 22:51:50 Goswin von Brederlow wrote: >> The beauty of ocaml strings is that they are really compact. An ocaml >> string on 32bit is 5-8 bytes longer than the contained string and 9-16 >> bytes on 64bit. > > The ugliness is that 16Mb limit. I assume tho

Re: [Caml-list] Strings

2009-04-04 Thread Jon Harrop
On Saturday 04 April 2009 22:51:50 Goswin von Brederlow wrote: > The beauty of ocaml strings is that they are really compact. An ocaml > string on 32bit is 5-8 bytes longer than the contained string and 9-16 > bytes on 64bit. The ugliness is that 16Mb limit. I assume those limits have been removed

Re: [Caml-list] Strings

2009-04-04 Thread Yaron Minsky
On Sat, Apr 4, 2009 at 5:51 PM, Goswin von Brederlow wrote: > Mutable/Immutable can really nicely done with phantom types and is > independent of the data structure used. It works for strings, lists, > arrays, sets, trees, ... and I think all standard modules should have > it. The official standar

Re: [Caml-list] Strings

2009-04-04 Thread Goswin von Brederlow
Alp Mestan writes: > I think providing both capabilities is the best solution. Phantom types solvethis beautifully with not truntime penalty. GO BATTERIES! > However, let's study Haskell's strings. > They simply are a list of characters. This let the ability to use heavily > list-related funct

Re: [Caml-list] Strings

2009-04-04 Thread Goswin von Brederlow
David Rajchenbach-Teller writes: > I personally can't remember the last time I've needed mutable strings in > OCaml. Only for byte arrays or a buffering module where I String.blit to the string itself instead of into a new string. Saves a mutable. MfG Goswin ___

Re: [Caml-list] Strings

2009-04-04 Thread Jon Harrop
On Saturday 04 April 2009 18:11:20 Kuba Ober wrote: > On Apr 3, 2009, at 1:50 PM, Daniel Bünzli wrote: > > In fact I find the result of the following sequence of operations > > very disappointing for a functional programming language : > > > >Objective Caml version 3.11.0 > > > > # Sys.os_t

Re: Re : [Caml-list] questions

2009-04-04 Thread Kuba Ober
Isn't the book written in French? (I mean "Le langage Caml"...). It could be nice to translate it in English, at least to have a larger base of readers, and adapt the examples from Caml Light to Objective Caml (I don't know how much the syntaxes differ though) It's perhaps a good way to lean

Re: [Caml-list] Strings

2009-04-04 Thread Kuba Ober
On Apr 3, 2009, at 1:50 PM, Daniel Bünzli wrote: Le 3 avr. 09 à 18:52, Martin Jambon a écrit : - I see absolutely no practical advantage of having an immutable "character string" type. In fact I find the result of the following sequence of operations very disappointing for a functional pr

Re: [Caml-list] netplex multi-thread asynchronous processor for passive clients

2009-04-04 Thread Serge Sivkov
Hello, why following code doesn't react to messages sent to container (and to events sent from other service)? exception BeLive exception DataArrived ... method receive_admin_message container name args = container#event_system#add_event (Extra DataArrived) ... method process ~when_done c

Re: [Caml-list] Strings

2009-04-04 Thread David Rajchenbach-Teller
On Sat, 2009-04-04 at 12:40 +0100, Jon Harrop wrote: > On Saturday 04 April 2009 12:12:52 David Teller wrote: > > The bad thing is that, whenever you have to return text in an otherwise > > functional program, you need to enter "mutable array of bytes" land. You > > can't just assume that the user

Re: [Caml-list] Strings

2009-04-04 Thread Jon Harrop
On Saturday 04 April 2009 12:12:52 David Teller wrote: > The bad thing is that, whenever you have to return text in an otherwise > functional program, you need to enter "mutable array of bytes" land. You > can't just assume that the user isn't going to modify that string, > because, they can, possi

Re: [Caml-list] Strings

2009-04-04 Thread David Teller
The bad thing is that, whenever you have to return text in an otherwise functional program, you need to enter "mutable array of bytes" land. You can't just assume that the user isn't going to modify that string, because, they can, possibly by accident, and any invariant relying on the fact that you

Re: [Caml-list] Strings

2009-04-04 Thread blue storm
On Sat, Apr 4, 2009 at 11:26 AM, Alp Mestan wrote: > However, let's study Haskell's strings. > They simply are a list of characters. This let the ability to use heavily > list-related functions (take, takeWhile, drop, dropWhile, map, etc.). On the > other hand, OCaml's standard library lacks of ma

Re: [Caml-list] Strings

2009-04-04 Thread Jon Harrop
On Friday 03 April 2009 16:03:25 Daniel Bünzli wrote: > Le 3 avr. 09 à 16:46, Jon Harrop a écrit : > > Just because my OCaml programs were mutating strings and translating > > that into > > F# is non-trivial if the string is shared or big. In essence, I've > > always > > used OCaml's strings as a m

Re: [Caml-list] Strings

2009-04-04 Thread Jon Harrop
On Friday 03 April 2009 20:46:26 Paolo Donadeo wrote: > > You clearly want both, but each with its own type and strings as > > immutable. Individual character mutability is rarely needed in text > > processing > > I can agree with you on this argument, but a question still remains: > > why should y

Re: [Caml-list] Strings

2009-04-04 Thread Jon Harrop
On Friday 03 April 2009 21:41:26 Harrison, John R wrote: > | I can agree with you on this argument, but a question still remains: > | > | why should you ever do things like: > | > # s.[0] <- 'a';; > > The point is that it might not be your own code that does it, but a > function written by someone

Re: [Caml-list] Strings

2009-04-04 Thread Jon Harrop
On Saturday 04 April 2009 10:14:34 David Rajchenbach-Teller wrote: > Note that Batteries provides > * regular OCaml strings > * strings with capabilities (i.e. strings which, depending on their > type, can be read-only/write-only/read-write) -- sometimes faster than > regular strings, never slower

Re: [Caml-list] Strings

2009-04-04 Thread Alp Mestan
On Sat, Apr 4, 2009 at 11:14 AM, David Rajchenbach-Teller < david.tel...@ens-lyon.org> wrote: > I personally can't remember the last time I've needed mutable strings in > OCaml. Neither do I. > On the other hand, I can remember a handful of times where, to > return a constant string, I had to

Re: [Caml-list] Strings

2009-04-04 Thread David Rajchenbach-Teller
On Fri, 2009-04-03 at 12:56 +0100, Jon Harrop wrote: > I read that batteries included provides first-class rope-based strings and I > was just reading up on some horror stories about immutable strings on > StackOverflow. This made me wonder what people's thoughts are about mutable > vs immutabl

Re: [Caml-list] Strings

2009-04-04 Thread David Rajchenbach-Teller
On Fri, 2009-04-03 at 23:44 +0200, Goswin von Brederlow wrote: > It wouldn't be too hard to change the string module to allow for both > mutable and immutable strings: [...] Done in Batteries. # "foo";; (*OCaml base string*) - : string = "foo" # ro"foo";;(*Read-only string*) - : [ `Read ] Bat

Re: [Caml-list] Fwd: User Group for functional programmers and scientific computing; Monday, April 6th

2009-04-04 Thread Alp Mestan
I guess nobody would be interested for doing so in South of France, right ? On Sat, Apr 4, 2009 at 3:08 AM, Mike Lin wrote: > This might be of interest to anyone else in the Boston area. > > > -- Forwarded message -- > From: Anne Hunter > Date: Fri, Apr 3, 2009 at 7:40 PM > Subj