Macro holmes::bind_match [] [src]

macro_rules! bind_match {
    ($vars:ident, $n:ident, [ $bm:tt ]) => { ... };
    ($vars:ident, $n:ident, {$($bm:tt),*}) => { ... };
    ($vars:ident, $n:ident, $cm:tt) => { ... };
}

Constructs a bind match outer object.

Args:

  • $vars:ident is a mutable HashMap from variable name to variable number, to be updated as more variables are created, or referenced to re-use existing variable numberings.
  • $n:ident is a mutable Var, intended to be used as an allocator for the next unused variable. It should have a value equal to the next unallocated variable
  • The last parameter is the bind expression, it can be structured as:
    • [bind_expression] -> do a list destructure/iteration, similar to the list monad
    • {bind_expression0, bind_expression1} -> do a tuple destructure
    • a clause_match! compatible expression (see clause_match docs)