title: Erlang List filter question
body: <p>I have record in which one field is list:</p>
  
  <pre><code>-record(state, {
          rcpt :: list()
              }).
  </code></pre>
  
  <p>Rcpt field has some values = </p>
  
  <blockquote>
    <p>["localhost", "admin"]</p>
  </blockquote>
  
  <p>I need filter this list. For example i need field localhost.</p>
  
  <p>I try:</p>
  
  <pre><code>List = lists:filter(fun(X) -&gt; LocalHost =:= X end, State#state.rcpt),
  </code></pre>
  
  <p>but List is empty.</p>
  
  <p>What's wrong i do?</p>
  
  <p>I don't understand it. Look:</p>
  
  <pre><code>io:format(State#state.rcpt),
      %% output: localhost
  HaveRcpt = lists:member("localhost", State#state.rcpt ),
  io:format(HaveRcpt);
      %% output false
  </code></pre>
  
  <p>But if i use:</p>
  
  <pre><code>io:format(State#state.rcpt),
  HaveRcpt = lists:member("localhost", lists:nth(1,State#state.rcpt) ),
  io:format(HaveRcpt);
  %% true
  </code></pre>
  
  <p>Thank you.</p>