Questions tagged [ocaml-batteries]

OCaml Batteries included is a community-driven effort to standardize on a consistent, documented, and comprehensive development platform for the OCaml programming language. Use with [tag:ocaml] and optionally [tag:standard-library] if the question might be related to other standard-libraries, or the concept of standard libraries in general, as well

OCaml Batteries included (or simply "Batteries") is a community-driven effort to standardize on a consistent, documented, and comprehensive development platform for the programming language.

Useful resources

35 questions
40
votes
6 answers

Is there an infix function composition operator in OCaml?

Just a quick question. I'm wondering if there is a infix function composition operator in OCaml defined in the standard library (or in Jane Street's Core or in Batteries) like the (.) function in Haskell which saves us a lot parentheses since we…
tfboy
  • 947
  • 1
  • 10
  • 14
19
votes
2 answers

What is the best module for HttpRequest in OCaml

I wish to use OCaml to access the Yahoo Finance API. Essentially, it will be just a bunch of HTTP requests to get quotes from Yahoo Finance. Which module I should use? I wish to have async HTTP requests.
Jackson Tale
  • 25,428
  • 34
  • 149
  • 271
17
votes
2 answers

How stable and widespread is "OCaml Batteries Included" and is it recommended?

I'm just getting back into OCaml for a new small research project after many years of SML, Haskell and F#. I quickly found myself missing some things when using the OCaml libraries, and I also missed having a syntax for monadic comprehensions. OCaml…
RD1
  • 3,305
  • 19
  • 28
7
votes
1 answer

How can ocamldebug be used with a Batteries Included project?

I have a simple ocamlbuild project which uses Batteries, including syntax extensions. _tags: <*>: pkg_batteries,pkg_threads,pkg_batteries.syntax,syntax_camlp4o something.ml: open Batteries … let () = … It is built for debugging with: $ ocamlbuild…
jrk
  • 2,896
  • 1
  • 22
  • 35
6
votes
1 answer

How can the ocamlfind/ocamlbuild toolchain be used with project-local copies of packages?

I am trying to keep my project self-contained, with all major 3rd party library dependencies built and referenced within the project repository. The main ocaml portions of my project rely on ocamlbuild. But for complex packages like Batteries…
jrk
  • 2,896
  • 1
  • 22
  • 35
4
votes
3 answers

How to find index of an Array element in OCaml

I am trying to find the index of an integer array element in ocaml. How to do this recursively. Example code:let a = [|2; 3; 10|];; suppose I want to return the index of 3 in the array a. Any help appreciated. I am new to OCaml programming
sudheesh ks
  • 351
  • 1
  • 8
  • 15
4
votes
2 answers

Using Batteries in .mly file with ocamlbuild

I have a project with OCaml .ml files and a Menhir .mly file. I use ocamlbuild to compile the project. My _tags file contains this single line: true: use_menhir, package(batteries) Everything works well, except when I want to use Batteries in the…
p4bl0
  • 3,846
  • 1
  • 22
  • 21
3
votes
1 answer

Ocaml TRIE implementation

I'm trying to use this trie implementation for ocaml: http://www.lri.fr/~filliatr/ftp/ocaml/ds/trie.ml.html This is my implementation of module "M": module M = struct type key = int type 'a t = (int * 'a) list let empty = [] …
jsmith
  • 367
  • 1
  • 4
  • 12
3
votes
2 answers

Fast functional data structure for queueing with frequent rescheduling in OCaml

My problem is to select a data structure for an event-based simulation. A number N of future events are maintained together with their time of occurrence. N is fixed or at least bounded, ranging from 10 to maybe 10000. Each event has a unique ID by…
user3240588
  • 1,252
  • 9
  • 16
3
votes
2 answers

Cygwin & OCaml: OPAM + Batteries

I extensively use Cygwin on a Windows 8 environment (I do not want to go ahead and boot/load Linux directly on the machine). I use the OCamlIDE plug-in for Eclipse and have experienced relatively no problems using this workflow setup. However, I…
9codeMan9
  • 802
  • 6
  • 11
  • 25
3
votes
1 answer

Failed compiling ocaml-websocket

Trying to build ocaml-websocket, it fails with: File "lib/websocket.ml", line 202, characters 29-42: Error: The function applied to this argument has type ?buffer_size:int -> (Lwt_io.input_channel * Lwt_io.output_channel)…
Igor Liner
  • 97
  • 1
  • 5
2
votes
1 answer

Include package batteries in makefile for Ocaml

I would like to use functions of module List of Ocaml Batteries. I have installed Batteries, and a trivial code from Getting started works with ocamlfind ocamlc -package batteries -linkpkg euler001.ml -o euler001. Now coming back to my project, I…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
2
votes
1 answer

GODI-Batteries: Installation problems (yet again)

I have asked this question before but it turns out that what I believed to be the solution is not. The Problem I have just started a fresh GODI installation and I am attempting to install the batteries library. I have all dependencies sorted, e.g.…
Surikator
  • 1,463
  • 9
  • 26
2
votes
1 answer

GODI-Batteries: Installation problems

I am trying to install godi-batteries using GODI console. I seem to have all dependencies sorted (like Camomile). I get the following error within Godi's interface: > ocamlfind ocamlopt -shared -linkall -package camomile,num,str -o…
Surikator
  • 1,463
  • 9
  • 26
2
votes
2 answers

How to return void in a function in OCaml?

Simple example: I have some functions and I need to call them all, to modify a structure, only in one function. With these simple functions the task can be made in ways that don't use void, but in others tasks you have to use void. So what can you…
Igna94
  • 75
  • 2
  • 8
1
2 3