Re: [Caml-list] from if...else to pattern matching
On Sat, 2010-10-02 at 16:04 +0200, ben kuin wrote: hi I try to transform an if-else clause into pattern matching, I think I've tried a lot of approaches, but apperently I'm doing something fundemently wrong. ~ (** Define behaviors against a constang 'x = c' with if...else and pattern matching. I want to see how to match a value against funtion **) (* defining a '=' operator *) let (=) a b = if a b then true else if a == b then true else false;; let if_test c = if ( 4 = c )then true else false ;; (* and now use the operator in pattern matching * ) let match_test c = match ( _ = c ) (* pseudocode *) | 4 - true | _ - false ;; ~~~ thanks in advance ben whoa, thats hard, try: # let t x = match x with a when x=4 - true | _ - false;; btw, there is a beginner-list and irc-channel, Philip ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] new emacs tuareg mode release
On Mon, 2010-05-24 at 12:36 -0400, Sam Steingold wrote: Hi, The original author of the alternative Emacs mode for editing Ocaml code (tuareg-mode), Albert Cohen, has stopped development some time ago. Now, with his blessing, Jane Street Capital took over maintenance of the code from him, and released Tuareg Mode v. 2.0.0. It is available for download at http://www.janestreet.com/ocaml/tuareg.tgz. It is still released under the GNU General Public License (GPL) v2. Please report bugs and submit patches to the dedicated public mailing list at http://groups.google.com/group/tuareg-mode. Happy hacking! Sam Hi, i get an error: phi...@io:~/Desktop/tuareg$ make emacs -batch -q -f batch-byte-compile tuareg.el Loading 00debian-vars... No /etc/mailname. Reverting to default... Loading /etc/emacs/site-start.d/50a2ps.el (source)... Error while loading 50a2ps: Symbol's value as variable is void: a2ps-region Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)... Loading debian-ispell... Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)... Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)... Loading /etc/emacs/site-start.d/50festival.el (source)... Loading /etc/emacs/site-start.d/50git-core.el (source)... Loading /etc/emacs/site-start.d/50ocaml-mode.el (source)... Loading /etc/emacs/site-start.d/50psvn.el (source)... Loading /etc/emacs/site-start.d/51tuareg-mode.el (source)... In toplevel form: tuareg.el:1933:1:Error: Invalid modifier in string make: *** [tuareg.elc] Error 1 -philip ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] new emacs tuareg mode release
On Mon, 2010-05-24 at 16:09 -0400, Sam Steingold wrote: Error 1 what is your emacs version? Hi, GNU Emacs 22.2.1 ,ubuntu 10.04 could you please add --no-site-file to the emacs invocations: diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ EMACS = emacs -BATCH = -batch -q --load tuareg.elc +BATCH = -batch -q --no-site-file --load tuareg.elc RM = rm -rf CP = cp -f LN = ln @@ -21,7 +21,7 @@ elc : $(ELC) %.elc : %.el - $(EMACS) -batch -q -f batch-byte-compile $ + $(EMACS) -batch -q --no-site-file -f batch-byte-compile $ camldebug.elc : camldebug.el tuareg.elc done, but same error: phi...@io:~/Desktop/tuareg$ make emacs -batch -q --no-site-file -f batch-byte-compile append-tuareg.el Wrote /home/philip/Desktop/tuareg/append-tuareg.elc emacs -batch -q --no-site-file -f batch-byte-compile tuareg.el In toplevel form: tuareg.el:1933:1:Error: Invalid modifier in string make: *** [tuareg.elc] Error 1 ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] general question, was Re: OCaml is broken
On Mon, 2009-12-21 at 15:19 +0100, Keyan wrote: Hi, i have a large project written in C++, for which i am planing to write add-ons and tools in ocaml, e.g. different tools to analyse my code (dependency stuff), an interpreter for a script-language i plan to include, etc, etc. form my time at the uni i remembered that ocaml allows to compile libraries which can be included in c/c++ program, and i know people who use it extensively in other projects. therefore, i decided to give ocaml a try. i like functional programming, and my first steps with ocaml are very promising. following this discussion, i am not so sure anymore, if ocaml is a good decision. may be i got this discussion wrong, but if ocaml is dying out, i might have to look for another functional programming language to use with my project. Functional programming languages will never become mainstream. There is a thread on haskell-mailing-list from time to time. What language you chose should depend always on your (your team) skills, tools and tasks. -Philip please dont take this email as an offence. i am just curious. at this point, i can still easily look for an alternative to ocaml, so its best to ask now. regards, keyan ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Why don't you use batteries?
maybe its the wrong question. what about: how (ie in which projects, success-stories) do you use batteries? Philip On Thu, 2009-09-03 at 09:05 -0400, Edgar Friendly wrote: It seems like batteries' adoption isn't quite as thorough as expected. We in the batteries devel team would love to know why you don't use batteries. Here's some of our guesses: 1) I *do* use batteries 2) It's not 1.0 yet, I'll try it then 3) It makes my executables too big 4) It's too hard to install (dependencies, godi failures) 5) It's difficult to compile against 6) It doesn't work on my platform 7) It uses camlp4 8) Other (please explain) Respond in public if appropriate, respond directly to me if you want. Now's a good time to think about where batteries is going and how it's getting there. E ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Documentation to start
On Thu, 2009-09-03 at 23:36 +0200, vernade wrote: Hello, I just downloaded ocaml (and caml-light) . I am looking for documentation on pdf or any format that I can easily download , read and print. I need basic information. All I found was on line and the help didn't come with the file I downloaded to install ocaml and caml-light. Didier Hi Didier, a first place to start is: http://caml.inria.fr/pub/docs/manual-ocaml/ http://www.ocaml-tutorial.org/ Installation is quite easy on fedora 11: just do a 'yum install' greetings, Philip ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] caml trading
On Mon, 2009-03-16 at 12:01 -0500, aditya siram wrote: Thanks for this awesome video! I was unaware that the Caml compiler did not optimize source code before generating native code. Now I am a little less afraid to study the actual compiler! Your point about a lack of GUI libraries is great - however it seems as though they are not as important as they once were. The amazing javascript toolkits [1] that have sprung up over the last year (along with the Ocsigen and OBrower project [2]) have filled most of that vaccum. As long as there are libraries that provide an easy way to hook up with a web client is there still a compelling reason to develop native GUI toolkits? Regards -Aditya Siram It is very easy to interface ocaml with an gui-toolkit like qt, living in its own process. The communication is done via localhost/ http. -Philip ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs