Questions tagged [ocaml]

OCaml is a strict statically-typed functional programming language, focusing on expressiveness, correctness, and efficiency.

#OCaml

OCaml is a strict statically-typed functional programming language, focusing on expressivity, correctness, and efficiency. These qualities make it the language of choice for complex software and timely go-to-market strategies.

For more information visit, the official OCaml site.

##Resources for OCaml Developers

##Resources for learning OCaml

Stack Overflow OCaml FAQ

  1. Documentation
  1. Editor
  1. The core language
  1. Loops/recursion
  1. Tools
  1. Good practices

#See also:#

7516 questions
20
votes
4 answers

Does OCaml have general map()/reduce() functions?

In Python map() works on any data that follows the sequence protocol. It does The Right Thing^TM whether I feed it a string or a list or even a tuple. Can't I have my cake in OCaml too? Do I really have no other choice but to look at the…
mbac32768
  • 11,453
  • 9
  • 34
  • 40
20
votes
4 answers

Extending an existing type in OCaml

I've been doing some OCaml programming lately to learn the language and to get more acquainted with functional programming. Recently, I've started to think that I'd like to be able to extend an existing type (either built in-or one of my own), for…
aneccodeal
  • 8,531
  • 7
  • 45
  • 74
20
votes
5 answers

Erlang vs OCaml (best niche to fit)

Hi I'd like to pick up one FP language (it's always a pain when you work in a position that does not require you learn much), and after doing some research, I felt Erlang and OCaml are the two that I'd really like to get my feet wet for the…
Charlie Chen
20
votes
4 answers

OCaml map of int keys :: where is the 'simple' int module to use with the Map.Make functor?

I need an OCaml map with keys of type int so I am using Map.Make to create one. However it seems that the standard modules 'only' provide modules like Big_int, Int32, Int64 and Nativeint which require conversions. So I have to do things like: module…
Marcus Junius Brutus
  • 26,087
  • 41
  • 189
  • 331
19
votes
7 answers

Which English tutorial would you advise to learn OCaml?

I want to advertise OCaml to beginners, and I am looking for good tutorials in English; not that you have only heard of, but that you have actually tried and found useful...
Fabrice Le Fessant
  • 4,222
  • 23
  • 36
19
votes
2 answers

Substring check in Ocaml

Can someone help me in coding an effective substring check in OCaml? Given two strings, check whether the first one contains the second one? Using the Str module, can we do this?
priyanka
  • 923
  • 1
  • 9
  • 20
19
votes
1 answer

__memcpy_sse2_unaligned - what does this mean in detail?

While working on my compiler I got this error: Program received signal SIGSEGV, Segmentation fault. __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:33 How do I get details of what went wrong here? I know from the…
Olle Härstedt
  • 3,799
  • 1
  • 24
  • 57
19
votes
1 answer

How to type check recursive definitions using Algorithm W?

I am implementing Algorithm W (the Hindley-Milner type system) in JavaScript: The function which implements the above rules is typecheck and it has the following signature: typecheck :: (Context, Expr) -> Monotype It is defined as…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
19
votes
1 answer

Using Opam to manage project dependencies

I am a complete newbie to OCaml. Other languages I have used (for instance Scala, Clojure, Javascript on Node.js) have package managers that allow one to start a project as a clean slate that has a declared set of dependencies of known versions. I…
Andrea
  • 20,253
  • 23
  • 114
  • 183
19
votes
2 answers

OCaml: Effective Path to GUI Programming?

I have seen a few threads that touch on GUI programming in OCaml but I don't feel they clearly lead to a clear-cut solution when a GUI interface is needed. My question, to be more specific, is as follows: What is the most effective (and easy to…
9codeMan9
  • 802
  • 6
  • 11
  • 25
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
18
votes
5 answers

Is there a way to print user-defined datatypes?

I can't use print_endline because it requires a string, and I don't (think) I have any way to convert my very simple user-defined datatypes to strings. How can I check the values of variables of these datatypes?
tessr
  • 628
  • 1
  • 6
  • 13
18
votes
3 answers

What is the easiest way to add an element to the end of the list?

As:: : 'a -> 'a list -> 'a list is used to add an element to the begin of a list, Could anyone tell me if there is a function to add an element to the end of a list? If not, I guess List.rev (element::(List.rev list)) is the most straightforward way…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
18
votes
3 answers

Creating a doubly linked list from a list in OCaml

I am often told that using the Lazy module in OCaml, one can do everything you can do in a lazy language such as Haskell. To test this claim, I'm trying to write a function that converts a regular list into a static doubly linked list in…
Russell O'Connor
  • 2,222
  • 1
  • 16
  • 16
18
votes
2 answers

What's the difference between -> and |> in reasonml?

A period of intense googling provided me with some examples where people use both types of operators in one code, but generally they look just like two ways of doing one thing, they even have the same name
Crysknight
  • 291
  • 2
  • 8