Source/NFX.Erlang/ErlPatternMatcher.cs
/// <summary>
/// Match a term against the patterns in the collection.
/// The first successful match will result in invocation of the func
/// associated with the pattern, and storing func result in the term
/// </summary>
/// <param name="term">Term to match against patterns</param>
/// <param name="args">Arguments to be passed to an func on successful pattern match</param>
/// <returns>ID of the pattern that matched, or -1 if there were no matches</returns>
Match a term against the patterns in the collection.
The first successful match will result in invocation of the func
associated with the pattern, and storing func result in the term
Match a term against the patterns in the collection . The first successful match will result in invocation of the func associated with the pattern and storing func result in the term
public int Match(ref IErlObject term, params object[] args)
    {
      var binding = new ErlVarBind();
      foreach (var p in m_patterns)
      {
        if (p.Term.Match(term, binding))
        {
          term = p.Func(p, term, binding, args);
          return p.ID;
        }
        binding.Clear();
      }
      return -1;
    }
public int Match ( ref IErlObject term , params object [ ] args ) { var binding = new ErlVarBind ( ) ; foreach ( var p in m_patterns ) { if ( p . Term . Match ( term , binding ) ) { term = p . Func ( p , term , binding , args ) ; return p . ID ; } binding . Clear ( ) ; } return - 1 ; }
Match a term against the patterns in the collection.
Match a term against the patterns in the collection .
ID of the pattern that matched, or -1 if there were no matches
ID of the pattern that matched or - 1 if there were no matches
IErlObject
ref
term
Term to match against patterns
Term to match against patterns
args
Arguments to be passed to an func on successful pattern match
Arguments to be passed to an func on successful pattern match