Loading ...
Sorry, an error occurred while loading the content.

11535Re: "ocaml_beginners"::[] using a list instead of option

Expand Messages
  • Peng Zang
    Nov 2, 2009
    • 0 Attachment
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1

      I'm not sure how to do it on your system, but with a GODI based OCaml
      distribution all you have to do is add "batteries" into your "PACKS"
      definition.

      In my opinion, the only way to use OCaml is through GODI. It makes installing
      and using packages easy. If you haven't tried GODI, I strongly urge you to
      give it a try. It makes a world of difference.

      Peng


      On Monday 02 November 2009 06:26:22 am Martin DeMello wrote:
      > How would I use batteries along with OCamlMakefile? (I tried the
      > ocamlbuild way and got nowhere; I've not been able to get mikmatch and
      > ledit working with ocamlbuild at all.)
      >
      > I have batteries installed in /usr/lib/ocaml/site-lib/batteries
      >
      > Here's my makefile:
      >
      > # ----------------------------------------------------
      > RESULT = varix
      >
      > SOURCES = \
      > utility.ml\
      > dawg.ml bag.ml sset.ml\
      > search.ml \
      > debug.ml \
      > ledit/cursor.ml \
      > ledit/ledit.mli ledit/ledit.ml \
      > varix.ml
      >
      > LIBS = unix bigarray str pcre run_mikmatch_pcre
      > PACKS = unix bigarray str mikmatch_pcre pcre
      > INCDIRS = /usr/lib/ocaml/camlp5 /usr/lib/ocaml/pcre-ocaml
      > /usr/lib/ocaml/site-lib/mikmatch_pcre
      > CREATE_LIB = yes
      > PRE_TARGETS = ledit/pa_local.cmo ledit/pa_def.cmo
      > USE_CAMLP4 = yes
      > PP = ./camlp4find $(PACKS)
      > export PP
      >
      > OCAMLMAKEFILE = OCamlMakefile
      > include $(OCAMLMAKEFILE)
      > # ----------------------------------------------------
      >
      > On Sun, Nov 1, 2009 at 5:18 PM, Lukasz Stafiniak <lukstafi@...> wrote:
      > > You may need some general functions that lack from the basic standard
      > > library:
      > >
      > > let unsome default = function
      > >
      > > | None -> default
      > > | Some v -> v
      > >
      > > let map_some f l =
      > > let rec maps_f accu = function
      > >
      > > | [] -> accu
      > > | a::l -> maps_f (match f a with None -> accu
      > > | Some r -> r::accu) l
      > >
      > > in
      > > List.rev (maps_f [] l)
      > >
      > > etc. (see Batteries).
      > >
      > > On Sun, Nov 1, 2009 at 11:04 AM, Martin DeMello <martindemello@...>
      wrote:
      > > > thinking about it, you're right, i was being silly :) code changed to
      > > > use option type.
      > > >
      > > > martin
      > > >
      > > > On Sat, Oct 31, 2009 at 3:06 PM, Lukasz Stafiniak
      <lukstafi@...>wrote:
      > > > > I think performance-wise the difference is very small. But you should
      > > > > use the option type to express your program's semantics correctly!
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v2.0.7 (GNU/Linux)

      iD8DBQFK7uaCfIRcEFL/JewRAvVSAJ0alMIV9FfjqMh/CxIwIJLbHqHmlQCgglBY
      YHLgW6QiwdVpzZ8NjE89uVg=
      =fXUt
      -----END PGP SIGNATURE-----
    • Show all 6 messages in this topic