adambard / adambard/learnxinyminutes-docs

Collection Instanciation Error : OCaml

Open
#5,003 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Markdown
Stars
12.3k
Forks
3.7k
Avg merge
13h 10m
Merged PRs (30d)
6

Description

I noticed an error in the `Records/A collection of values with named fields` chapter when instantiating `cow` variable:
```ocaml
type animal =
{
name: string;
color: string;
legs: int;
}
;;

let cow =
{ name: "cow";
color: "black and white";
legs: 4;
}
;;
val cow : animal

cow.name ;;
- : string = "cow"
```
This should be replaced by
```ocaml
type animal =
{
name: string;
color: string;
legs: int;
}
;;

let cow =
{ name = "cow";
color = "black and white";
legs = 4;
}
;;

(*
val cow : animal

cow.name ;;
- : string = "cow"
*)
```

Contributor guide

Open the contributing guide

Research direction

Locate the OCaml chapter section titled “Records/A collection of values with named fields” and search for the shown `cow` example. Verify the record-field syntax and update the example so it evaluates with the expected output; done means the corrected snippet is consistent throughout the section.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.