Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
OCaml is a strict statically-typed functional programming language, focusing on expressivity, correctness and efficiency.
1
vote
Making the basic accumulator in Real World OCaml use Async
It is totally idiomatic and pretty code. My personal style is to put the pipe operators to the end, as they are, at their essence, just functional semicolons, e.g.,
let read_and_accumulate () =
Rea …
5
votes
Accepted
Print last Sunday of each month in a given year
Also, just FYI, you can have arrays in OCaml indexed from one, e.g., let days = Bigarray.(Array1.create int fortran_layout 12). Although, using them here would be overkill, I think. …
2
votes
Accepted
Optimize hash OCaml
The caml_page_table_lookup is an internal OCaml function for memory management (it also uses hashing, but it doesn't call caml_hash function). …
7
votes
Accepted
Client Server code in OCaml style
Using semicolons is OK. The IO is imperative and side-effectfull by default, so there is nothing to do here. By saying Lwt_unix.listen sock max_pending_request you're just setting a property inside th …
1
vote
Accepted
Streaming learning OCaml
But, I assume, that it is a toy project, with the main purpose to learn OCaml, and to understand its internals.
So let's start with math. The dot_product is fine, except the name. … The pow function is not need, surprisingly OCaml already has one - pow x y = x**y
In read_tools it looks like that a more straightforward code without a stream, would be more readable (and efficient) …