grift_macros 1.3.0

Procedural macros for Grift Scheme standard library
Documentation

Procedural macros for grift_parser standard library

This crate provides the include_stdlib! macro which parses a .scm file containing function definitions and transforms them into the format expected by the define_stdlib! macro.

Example

Given a file stdlib.scm:

;;; (map f lst) - Apply f to each element of lst
(define (map f lst) (if (null? lst) '() (cons (f (car lst)) (map f (cdr lst)))))

The macro:

include_stdlib!("stdlib.scm");

Expands to:

define_stdlib! {
    /// (map f lst) - Apply f to each element of lst
    Map("map", ["f", "lst"], "(if (null? lst) '() (cons (f (car lst)) (map f (cdr lst))))"),
}