Browse Source

Erroneous code example in documentation of select/2

Ulf Wiger 11 years ago
parent
commit
6f7f6c32e1
3 changed files with 9 additions and 9 deletions
  1. 4 4
      doc/gproc.md
  2. 1 1
      doc/gproc_dist.md
  3. 4 4
      src/gproc.erl

+ 4 - 4
doc/gproc.md

@@ -1456,10 +1456,10 @@ Note that limiting the context is just a convenience function, allowing you
 to write a simpler select pattern and still avoid searching the entire
 registry. Whenever variables are used in the head pattern, this will result
 in a wider scan, even if the values are restricted through a guard (e.g.
-`select([{'$1','$2','$3'}, [{'==', '$1', p}], ...])` will count as a wild
-pattern on the key and result in a full scan). In this case, specifying a
-Context will allow gproc to perform some variable substitution and ensure
-that the scan is limited.
+`select([{'$1','$2','$3'}, [{'==', {element,1,'$1'}, p}], ...])`
+will count as a wild pattern on the key and result in a full scan).
+In this case, specifying a Context will allow gproc to perform some
+variable substitution and ensure that the scan is limited.
 <a name="select-3"></a>
 
 ### select/3 ###

+ 1 - 1
doc/gproc_dist.md

@@ -7,7 +7,7 @@
 
 
 Extended process registry.
-__Behaviours:__ [`gen_leader`](/Users/uwiger/FL/git/gen_leader/doc/gen_leader.md).
+__Behaviours:__ [`gen_leader`](gen_leader.md).
 
 __Authors:__ Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)).
 <a name="description"></a>

+ 4 - 4
src/gproc.erl

@@ -1220,10 +1220,10 @@ select(Pat) ->
 %% to write a simpler select pattern and still avoid searching the entire
 %% registry. Whenever variables are used in the head pattern, this will result
 %% in a wider scan, even if the values are restricted through a guard (e.g.
-%% <code>select([{'$1','$2','$3'}, [{'==', '$1', p}], ...])</code> will count as a wild
-%% pattern on the key and result in a full scan). In this case, specifying a
-%% Context will allow gproc to perform some variable substitution and ensure
-%% that the scan is limited.
+%% <code>select([{'$1','$2','$3'}, [{'==', {element,1,'$1'}, p}], ...])</code>
+%% will count as a wild pattern on the key and result in a full scan).
+%% In this case, specifying a Context will allow gproc to perform some
+%% variable substitution and ensure that the scan is limited.
 %% @end
 select(Context, Pat) ->
     ets:select(?TAB, pattern(Pat, Context)).