Tagged Questions

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

learn more… | top users | synonyms

1
vote
0answers
25 views

Infix epression evaluation

I'm looking for some feedback on my OCaml implementation of some methods to translate infix expressions to postfix and then evaluate them. I'm very new to OCaml, coming from C#/Java and JavaScript ...
2
votes
1answer
60 views

Which one of these both run-length decoding algorithm is the most optimal?

I'm working on Ocaml.org 99 problems, and I solved the run-length decode one. Here is the solution given by the site: ...
3
votes
0answers
237 views

Solve a maze in the form of a 2D array using BFS

Suggestions for improving coding style are greatly appreciated. ...
5
votes
1answer
65 views

Good OCaml style

I wanted to write a small but non-trivial function in OCaml to test my understanding. I have only a basic understanding of the libraries, and no idea at all of what is considered good style. The ...
1
vote
2answers
44 views

Caml light and finding the prime factors

I wrote the following Caml light code to find prime factors of a number (part of an early Project Euler question). Largest prime factor The prime factors of 13195 are 5, 7, 13 and 29. ...
3
votes
1answer
91 views

I've written remainder(x,y) in OCaml. Is there more efficient than O(n)?

Here's my code: let rem x y = let rec aux acc i n = if i=n then acc else if acc+1=y then aux 0 (i+1) n else aux (acc+1) (i+1) n in aux 0 0 x;; ...
2
votes
1answer
106 views

Functional Programming: int to bignum conversions

I'm doing an exercise where I need to convert int to bignum in OCaml, for example: ...
0
votes
1answer
173 views

Ocaml Functional Programming Tree

I'm writing a function called unzip that turns: [(1,2);(3,4);(5,6)] to ([1;3;5],[2;4;6]) I've got a working implementation ...
2
votes
2answers
145 views

Project Euler 10 - Summation of primes

I'm currently attempting to learn OCaml, and I'm working thought the Project Euler problems to do so. Here's some code I knocked together for problem 10. I am looking for idiomatic feedback rather ...
3
votes
1answer
327 views
4
votes
2answers
549 views

String Trie in OCaml

I'm pretty new to OCaml, so any feedback is appreciated. The goal is to implement a trie that efficiently stores and sorts strings. ...
6
votes
0answers
81 views

Timeoutable computations module

Defines a simple module for timeoutable computations, with the ability to return arbitrary intermediary results on timeout or the final value otherwise. It also allows default return values. The ...