[erlang-bugs] Trivial typos in HTML doc/programming_examples/funs.html
Mon Sep 24 21:43:16 CEST 2007
In the documentation file file:///usr/local/lib/erlang/doc/
the text "within within" should be "within"
Further down the same 2.4 section, the text refers to 'the first
clause of F':
"The rules for importing variables into a fun has the consequence
that certain pattern matching operations have to be moved into guard
expressions and cannot be written in the head of the fun. For
example, we might write the following code if we intend the first
clause of F to be evaluated when the value of its argument is Y:"
Is followed by two examples:
Y = ...
map(fun(X) when X == Y ->
Y = ...
This is unclear to me. Either the text could read 'the first clause
of f' as there is no 'F', but I believe this is incorrect. IMHO the
intent is to say 'the first clause of the fun' - it may be improved
if that is qualified with 'the first clause of the fun in in "map
(fun ...end, ...)"'.
Finally, it isn't immediately clear which of the two examples is
correct (until you understand what is being explained :-)
So, extend 'instead of' say something more definitive like: 'instead
of this incorrect form, where the parameter Y in fun(Y) hides the
variable bound in Y=.., and hence that clause of the fun is called
irresepctive of whether the parameter is the variable Y or not.'
These Erlang manuals and papers are very useful documentation. Well
done, and thank you.
More information about the erlang-bugs