the programming language Caml, extended with some object-orientation

learn more… | top users | synonyms

2
votes
0answers
46 views

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

Suggestions for improving coding style are greatly appreciated. ...
4
votes
1answer
46 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 ...
0
votes
1answer
27 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
60 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
87 views

Functional Programming Critique Ocaml

I'm doing an exercise where I need to convert 'ints' to 'bignums' in ocaml, for example: 123456789 -> {neg:false; coeffs:[123;456;789]} There were a lot of things going inside my head when writing ...
0
votes
1answer
129 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
98 views

Project Euler problem in ocaml. Looking for idiom feedback rather than algorithmic

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 ...
3
votes
3answers
643 views

Is this use of (let … and …) in OCaml poor style?

In other languages, I prefer to arrange source files so that simpler and more widely useful concepts are introduced before implementation details, and I try where possible to make complex ...
3
votes
1answer
278 views
4
votes
2answers
480 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. ...
5
votes
0answers
76 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 ...