Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
reynir opened this issue May 23, 2018 · 0 comments

Comments

@reynir
Copy link

reynir commented May 23, 2018

Someone on IRC asked a question about the following snippet of code:

let concat ?sep x y =
let sep = match sep with None -> "" | Some x -> x in
x ^ sep ^ y
;;

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant