[please reply to ocaml_beginners@yahoogroups.com] On Wednesday, Aug 6, 2003, at 09:12 US/Pacific, on the main Ocaml ... I would strongly second this advice....
hello i have a problem with Str module : ok for this : # Str.search_forward (Str.regexp "a|b") "grgrgrfr" 0 ;; Exception: Not_found. if i put a "b" in string...
Lam
lam@...
Aug 7, 2003 5:15 pm
1282
... It's because "\" is an escape character in a ocaml string as well as being an escape character in the regular expression. So you have to double it up. #...
... That said, I think they are an indispensable part of the language. I know I have done some things with classes that would have been a major pain to do...
... GUI would be *ahem* interesting to do without classes, IMHO. ... I think classes are a good idea whenever you have a number of functions accessing the same...
Brian Hurt
brian.hurt@...
Aug 8, 2003 5:51 pm
1285
... [snip] ... It's not so bad. There's plenty of GUI code in C, such as the gimp. ... You can also take it a step further and add message passing. Here's a...
My previous message is slightly wrong in that using non-polymorphic variants will lead to problems when trying to simulate multiple inheritance. Here's a demo...
... That's probably a bad example. The GUI code in Gtk is indeed written in C, but it basically implements C++'s vtables using nasty and long-winded C macros. ...
I agree with your assessment of OOP in ocaml. Beginners are well advised to start with the non-OOP aspects of the language before moving on to the OOP...
Hello, I am new to Ocaml and to this list. I have a quick question about the Random module. If I have the following program: Random.self_init;; print_int...
Robert Wills
robert.wills@...
Aug 12, 2003 4:50 pm
1290
That's because self_init is of type unti -> unit, and you forgot to pass someting of type unit into your call to self_init. Do this: Random.self_init ();; ...
I am trying to find out how to use the Shell module. The following example from the README fails: =============== # let s = "d\na\nc\nb\n" in let b =...
Johann Spies
jspies@...
Aug 15, 2003 2:20 pm
1293
... replace cmd "sort" with cmd "sort" [] The empty list added is for arguments of cmd Ciao Ernesto...
... Thanks. Johann -- Johann Spies Telefoon: 021-808 4036 Informasietegnologie, Universiteit van Stellenbosch "But I would not have you to be...
Johann Spies
jspies@...
Aug 20, 2003 12:56 pm
1295
Okay, I'm about to give up on having key-shortcuts for menus in my application, but before I do I guess I should see if anyone else has found a way to do it....
I noticed a strange phenomenon. First create the file like this. (named test.ml) *** test.ml *** let () = print_string "Hello.\n" *** (end) *** Then compile...
Yamagata Yoriyuki
yoriyuki@...
Aug 23, 2003 4:28 am
1297
Hello. I've been fiddling with various things to try and create a recursive directory copying function. Needless to say, I can't get it to work correctly. I've...
... Look at the Unix module: The functions stat, lstat, and fstat will let you determine if an entry is a file or directory. Don't let the name fool you, most...
... Two useful functions on Unix environment: let is_file name = try ((Unix.stat name).Unix.st_kind = Unix.S_REG) with exn -> false ;; let is_dir name = try...
Find out value of max_int without using the the constant max_int ... Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software [Non-text...
... You can try min_int - 1;; Otherwise you can use shift functions (lsl, lsr, ...) or an arithmetic approach: increase an int until its value decreases....
... let rec find_max x = if x + 1 < x then x else find_max (x + 1) ;; find_max 17 ;; (* have a drink *) Cheers. -- Stefano Zacchiroli -- Master in Computer...
... Or on a binary computer ... let rec find_max x = if x * 2 > x then find_max (x * 2) else x * 2 - 1;; print_string (string_of_int (find_max 1) ^ "\n");; ...
... Why? To me this sounds suspiciously like a homework assignment. max_int is in pervasives, you don't even need to preface with Sys.max_int or Int.max_int...
Brian Hurt
brian.hurt@...
Sep 2, 2003 2:10 pm
1305
Warning: I'm very new to OCAML. I may need some patience :) Example: type ratio = {num: int; denum: int};; type number = Int of int | Float of float | Error;; ...
I'm just wondering how you can guarantee that certain imperative effects occur, like adding a name into a symbol table hash. I'm writing a compiler whose...
... Hey, records have little to do with variants. And I think that it is quite personal of you to state "The reason that "Int" is constructor and "num" is not...
... Well, the : mean "have the type", for example: - in {num: int; denum: int} the num field have the type int - in « val foo : bar » the function foo have...