Source/NFX.Erlang/ErlPatternMatcher.cs
/// <summary>
/// Add a matching pattern to the collection
/// </summary>
/// <typeparam name="TContext">Type of context passed to func</typeparam>
/// <param name="context">Context passed to func</param>
/// <param name="pattern">Compiled pattern containing variables to match</param>
/// <param name="func">Function to invoke on successful match</param>
/// <returns>ID of the newly added pattern</returns>
Add a matching pattern to the collection
Add a matching pattern to the collection
public int Add<TContext>(TContext context, IErlObject pattern, PatternMatchFunc<TContext> func)
    {
      int id = ++m_lastID;
      var pt = new Pattern(id, (p, t, b, args) => func(context, p, t, b, args), pattern);
      m_patterns.Add(pt);
      return id;
    }
public int Add < TContext > ( TContext context , IErlObject pattern , PatternMatchFunc < TContext > func ) { int id = ++ m_lastID ; var pt = new Pattern ( id , ( p , t , b , args ) => func ( context , p , t , b , args ) , pattern ) ; m_patterns . Add ( pt ) ; return id ; }
Add a matching pattern to the collection
Add a matching pattern to the collection
ID of the newly added pattern
ID of the newly added pattern
context
TContext
Context passed to func
Context passed to func
pattern
IErlObject
Compiled pattern containing variables to match
Compiled pattern containing variables to match
func
PatternMatchFunc<TContext>
Function to invoke on successful match
Function to invoke on successful match
typeparam
Type of context passed to func
Type of context passed to func