adambard / adambard/learnxinyminutes-docs
Collection Instanciation Error : OCaml
- 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
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