realworldocaml / examples

All the examples in Real World OCaml
The Unlicense
376 stars 81 forks source link

Code snippet in chapter "Variables and Functions" exercises scoping and shadowing #51

Open reynir opened 6 years ago

reynir commented 6 years ago

Someone on IRC asked a question about the following snippet of code: https://github.com/realworldocaml/examples/blob/32ea926861a0b728813a29b0e4cf20dd15eb486e/code/variables-and-functions/main.topscript#L183-L186

I noticed the snippet exercises non-recursive let-bindings, scoping, and shadowing, and I think a newcomer would easily find it confusing to read. The user mentioned it might have been to reinforce earlier-learned concepts. If so, then maybe it would be a good idea to mention this :-)

Relevant logs from IRC: https://irclog.whitequark.org/ocaml/2018-05-23#1527056651-1527058456;