fn check_syntax_rules_clause(ctx: &Environment, clause: &Sexp) -> LispResult<(Sexp, Sexp)> {
    let error = format!("invalid syntax-rules clause {}", clause);
    if let List(xs) = clause {
        if !clause.is_list() || clause.list_count() != 2 {
            syntax_error!("syntax-rules", error);
        }
        let pattern = compile_pattern(ctx, clause, &xs[0])?;
        // TODO check template
        let template = xs[1].clone();
        Ok((pattern, template))
    } else {
        syntax_error!("syntax-rules", error);
    }
}
// Check (pattern template) clause
Check (pattern template) clause
Check ( pattern template ) clause
fn check_syntax_rules_clause(ctx: &Environment, clause: &Sexp) -> LispResult<(Sexp, Sexp)> {
    let error = format!("invalid syntax-rules clause {}", clause);
    if let List(xs) = clause {
        if !clause.is_list() || clause.list_count() != 2 {
            syntax_error!("syntax-rules", error);
        }
        let pattern = compile_pattern(ctx, clause, &xs[0])?;
        // TODO check template
        let template = xs[1].clone();
        Ok((pattern, template))
    } else {
        syntax_error!("syntax-rules", error);
    }
}
fn check_syntax_rules_clause ( ctx : & Environment , clause : & Sexp ) -> LispResult < ( Sexp , Sexp ) > { let error = format ! ( " " clause ) ; if let List ( xs ) = clause { if ! clause . is_list ( ) || clause . list_count ( ) != 2 { syntax_error ! ( " " error ) ; } let pattern = compile_pattern ( ctx , clause , & xs [ 0 ] ) ? ; // TODO check template let template = xs [ 1 ] . clone ( ) ; Ok ( ( pattern , template ) ) } else { syntax_error ! ( " " error ) ; } }
Check (pattern template) clause
Check ( pattern template ) clause
ctx
&Environment
clause
&Sexp
ctx
&Environment
clause
&Sexp