Quantcast
Browsing all 518 articles
Browse latest View live

If the OCaml debugger is not widely used, what do OCaml developers use to...

For the past few weeks I've been trying to work with ocamldebug, with limited success. Various places online claim that few OCaml developers use it, and that it has not been actively developed in many...

View Article


Ocaml extlib-1.4 installation

I've tried to install extlib-1.4 but got an error(i'm noob)I typed ocaml install.ml and got:File "bitSet.ml", line 23, characters 40-53:23 | let bcreate : int -> intern = Obj.magic String.create...

View Article


About the complexity of Map.remove in OCaml

It seems Map.remove will return a new map structure, leaving the original map the same.How can the complexity still be O(lg n)?

View Article

this expression has type 'a list but an expression was expected of type 'b->'c

As the title says, I can't figure out why the type is incorrect. Any idea?let separe l x = let rec aux l1 l2 l x = match l with |[]->l1 l2 |t::q when t<=x->aux (t::l1) l2 q x |t::q ->aux l1...

View Article

"Prettier" design pattern than nested pattern matching? OCaml

I'm doing a uni course on OCaml and need to parse an s-expr into it's proper AST representation, using the Containers libraryI need to extend the parser to include boolean values but I can't find an...

View Article


How to use `dune test` for a program which reads files from the local directory?

I have a project built in Dune, with the structure| project_dir -| bin | dune | main.ml -| lib | dune | libfile.ml -| test | dune | test.ml | data.csv The libfile.ml reads the data in data.csv just...

View Article

Is there a benefit/penalty in record modification?

In a functional program I have an API that provides functions on complex state implemented as a record:let remove_number nr {counter ; numbers ; foo } = {counter ; numbers = IntSet.remove nr numbers ;...

View Article

Troubleshooting Compilation Error with lwt_ppx in OCaml: Unable to Compile File

I'm encountering an issue while using lwt_ppx and the let%lwt syntax as described in the CS3110 textbook's section on promises (https://cs3110.github.io/textbook/chapters/ds/promises.html).In the code...

View Article


"Prettier" design pattern than nested pattern matching?

I'm doing a uni course on OCaml and need to parse an s-expr into its proper AST representation, using the Containers libraryI need to extend the parser to include boolean values but I can't find an...

View Article


How to access private definition from other library for testing

I have two libraries: lib/ dune src.ml src.mli test/ dune test.mlboth are libraries and I am testing in the test library with ppx_inline_test as i do not want them to be included in the librarydune...

View Article

Circular dependency control in OCaml

My problem is the following :Module A called Map.mllet lst = ref [Instance1_ModuleB; Instance2_ModuleB; ...];;let is_coliding p = DoSomeWork_And_Return_A_Bool ;;.... other things here.Module B called...

View Article

OCaml find number of times n is present in list

I am a beginner with OCmal. I have a list named l and a number stored in N.I need to find the number of times N repeats in l. let l = [1;2;3;4;5;6;7;1;9;10;11];;let n = 1;;I want to write a function...

View Article

trace a nested recursion in Ocaml

I am trying to understand deeply nested recursion in OCaml by using the sorting list algorithm. For this reason I am tracing the below code which has a recursive function sort and calls another...

View Article


Is it possible to sort a Dynarray in OCaml?

From what I can tell, each data type seems to have its own type-specific .sort implementation. This means that, although the stdlib Dynarray uses Array as a backing, I can't actually use the Array.sort...

View Article

What's a stupidly simple way to compile an OCaml project?

I'm toying around with OCaml. The first thing I want to know how to do is build an OCaml project. Right now, I just want something stupidly simple since I'm just learning. Could anyone point me towards...

View Article


ocaml getting syntax error [closed]

I am getting syntax error on the line "module usingTable : TABLE =" and the word usingTable is highlighted red when I try to run this code in oCaml. I want to create table of the format as in the...

View Article

Standard name for operation of type ('a list -> ('a ->'b list) ->'b list...

Is there a "standard" name or a generalized pattern for the following operation (written in OCaml with monadic let binding):let rec combine (xs : 'a list) (f : 'a -> 'b list) : 'b list list = let...

View Article


Image may be NSFW.
Clik here to view.

ocamllsp not recognizing custom modules

So I'm working on a project in which there is an ast.ml file and a compilateur.ml file, the compilateur.ml uses variables and types from ast.ml so i added the lineopen Astat the beginning of my...

View Article

Differences between OCaml compiler and manual

So I was reading http://www.podval.org/~sds/ocaml-sucks.html, which includes this quote (in the context of problems with ocaml):there are actually three mildly different syntaxes:the official one is...

View Article

Pipeline operator in OCaml [closed]

In my practice of programming in OCaml, I have recently discovered that the following pipeline operator is very useful to create functions.let (>|) f g x = g (f x)val ( >| ) : ('a -> 'b) ->...

View Article
Browsing all 518 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>