Skip to main content
Filter by
Sorted by
Tagged with
3 votes
2 answers
91 views

I was creating a simple concat, and thought that this might work. (** [foldl fun init lst] the [fun] gets applied, left to right: {[foldl fun init [e1;e2;e3;e4] -> fun e4 (fun e3 (fun e2 (fun e1 ...
Ashok Kimmel's user avatar
0 votes
1 answer
96 views

This seems like it should be obvious bug how do I have a conditional dependency in dune-project? Specifically I want to depend on a library but only on Unix-like systems: (package (name foo) (...
Timmmm's user avatar
  • 99.1k
0 votes
0 answers
80 views

I am developing a server with Ocaml/Dream. The server can be installed with Opam and called from anywhere in the disk. For the server icon, I use : Dream.get (favicon_path) (fun request -> ...
Abdelghani's user avatar
0 votes
1 answer
42 views

I'm trying to build the incr_dom examples from here. I've succeeded with text_input, now I've moved on to ts_gui. I copied the ts_gui directory into a directory outside of the incr_dom repo, added the ...
ixb's user avatar
  • 72
1 vote
0 answers
54 views

I'm trying to port an open source existing ocaml app from Makefiles to dune. The application includes some C and C++ stubs. I tried to add a test.c file in a library like this: (library (name cdk) ...
Luca Carlon's user avatar
1 vote
1 answer
73 views

Coming from Java, it's useful to be able to pass PrintStream instances around instead of directly writing to System.out or System.err deep in a call stack. That way output can either be captured in a ...
user avatar
0 votes
0 answers
40 views

Is there a way in the OCaml Z3 API to detect, after optimizing a problem and getting a model, to check if the objective was actually unbounded? One method I see is to add a constraint "I want ...
David Monniaux's user avatar
1 vote
0 answers
62 views

I'm trying to install things to start doing stuff using OCaml, but somehow on Windows 11 it can't find "git" that is apparently installed I've tried a lot of stuff: installing stuff from ...
Illia Shuldieshov's user avatar
1 vote
1 answer
43 views

I want to load a file with multiple sexp and get a list of sexp, and convert the list to a list of some custom type. I know that Core.Sexp.load_sexp_conv_exn filename ty_of_sexp can load a file with a ...
Cs_J's user avatar
  • 141
0 votes
0 answers
71 views

Having some trouble using [Core] library in windows. For 5.x.x I'm getting the following error with open Core: File "bin/dune", line 3, characters 7-11: 3 | (name main) ^^^^ ** ...
G L's user avatar
  • 820
4 votes
1 answer
130 views

I'm handling a string with special characters and I want to split it into Unicode characters, but apparently OCaml strings are encoded in utf-8 while OCaml chars are 1-byte values, and it appears that ...
user8203231's user avatar
1 vote
1 answer
55 views

I have a file, parser.mly, which has the following %{ open Ast %} (* Ast holds the abstract syntax tree type definitions. *) %token EOF %token OR %left OR %start <Ast.prog> prog %% prog: ...
Addem's user avatar
  • 4,013
0 votes
2 answers
161 views

I try to figure out the type of the OCaml function below: let subst = fun x -> fun y -> fun z -> x z (y z) (* Or more concisely *) let subst x y z = x z (y z) Here's my derivation. Step 1, ...
smwikipedia's user avatar
1 vote
1 answer
77 views

I want to make a program that prompts the user to enter something with an introduction text. Something like "Please write something". But if there is a text from a pipe, the result is ...
Ploumploum's user avatar
1 vote
1 answer
100 views

I have a let.ml containing below 2 lines: let x = 1 in x + 1 let y = 1 in y + 1 When compile them with ocamlc, it says below error: File "let.ml", line 2, characters 10-12: 2 | let y = 1 in ...
smwikipedia's user avatar
0 votes
2 answers
54 views

I am trying to write a simple executable code in OCaml below. open Printf open Lwt open Cohttp open Cohttp_lwt_unix open Yojson let () = let ip = "8.8.8.8" in let key = "" in ...
Vlam's user avatar
  • 1,790
-1 votes
1 answer
64 views

(I am learning the OCaml and this may be a naive question.) I use below code to define a named function a: utop # let a = fun x -> x+1;; val a : int -> int = <fun> Note that the leading ...
smwikipedia's user avatar
1 vote
1 answer
70 views

I am new to OCaml and I am struggling a bit with understanding how module types work. module type I = sig type t end module EQ (M : I) = struct let equal (x : M.t) (y : M.t) = x = y end (* ...
Kon's user avatar
  • 13
-1 votes
2 answers
68 views

I'm learning Monad in OCaml, but it doesn't compile. I reduced the code to reproduce the problem at easiest way : file try.ml: module type TRY = sig type 'a t val return : 'a -> 'a t end ...
Jaja's user avatar
  • 61
2 votes
1 answer
82 views

I don't anderstand the behaviour of the try ... with ... feature of OCaml. here is a little sample to reproduce my problem : let () = try int_of_string "4" with | Failure -> -1 | n -...
Jaja's user avatar
  • 61
0 votes
1 answer
208 views

let read_file path = In_channel.with_open_bin path In_channel.input_all let solve input = input let () = read_file "input.txt" |> solve |> print_endline I am currently trying ...
Thedudeabides's user avatar
0 votes
0 answers
60 views

I cloned this repo https://github.com/cucapra/gator and tried to run the makefile as per the first instruction in README. It seems to have already setup a dune project and just needs a build but I ...
Thedudeabides's user avatar
3 votes
1 answer
185 views

If I have a function returning a tuple (a * b * c) and I want to immediately pass it into another function with type a -> b -> c -> T, is there a way to do it other than tediously expanding ...
Timmmm's user avatar
  • 99.1k
2 votes
1 answer
181 views

I often find myself using the |> operator when constructing functions to pass as parameters to methods like List.find. For example, I have this code snippet: let parse_test_header (header : string ...
user avatar
1 vote
1 answer
99 views

I understand that its return type is the string that is read but why does it need the parameter of type unit?
Arjun Viswanathan's user avatar

1
2 3 4 5
154