;;; Code that accompanies ``The Reasoned Schemer''
     ,    and  
  MIT Press , Cambridge , MA , 2005
;;;
;;; Extra forms appearing in the framenotes of the book.
;;;
  run * is a convenient macro ( see frame 10 on page 4 of chapter 1 )
  ( run * ( q ) ... ) is identical to ( run # f ( q ) ... )
  See frame 40 on page 68 of chapter 5 for a description of ' lambda - limited ' .
  See frame 47 on page 138 of chapter 9 for a description of ' project ' .
;;;
;;; This file was generated by writeminikanren.pl
  Generated at 2005 - 08 - 12 11:27:16

(define-syntax run*
  (syntax-rules ()
    ((_ (x) g ...) (run #f (x) g ...))))

(define-syntax lambda-limited
  (syntax-rules ()
    ((_ n formals g)                                          
     (let ((x (var 'x)))                                               
       (lambda formals
         (ll n x g))))))

(define ll
  (lambda (n x g)
    (lambdag@ (s)
      (let ((v (walk x s)))
        (cond
          ((var? v) (g (ext-s x 1 s)))
          ((< v n) (g (ext-s x (+ v 1) s)))
          (else (fail s)))))))

(define-syntax project 
  (syntax-rules ()
    ((_ (x ...) g ...)  
     (lambdag@ (s)
       (let ((x (walk* x s)) ...)
         ((all g ...) s))))))

 Code that accompanies ``The Reasoned Schemer''

 Extra forms appearing in the framenotes of the book.


 This file was generated by writeminikanren.pl
     ,    and  
  MIT Press , Cambridge , MA , 2005
  run * is a convenient macro ( see frame 10 on page 4 of chapter 1 )
  ( run * ( q ) ... ) is identical to ( run # f ( q ) ... )
  See frame 40 on page 68 of chapter 5 for a description of ' lambda - limited ' .
  See frame 47 on page 138 of chapter 9 for a description of ' project ' .
  Generated at 2005 - 08 - 12 11:27:16

(define-syntax run*
  (syntax-rules ()
    ((_ (x) g ...) (run #f (x) g ...))))

(define-syntax lambda-limited
  (syntax-rules ()
    ((_ n formals g)                                          
     (let ((x (var 'x)))                                               
       (lambda formals
         (ll n x g))))))

(define ll
  (lambda (n x g)
    (lambdag@ (s)
      (let ((v (walk x s)))
        (cond
          ((var? v) (g (ext-s x 1 s)))
          ((< v n) (g (ext-s x (+ v 1) s)))
          (else (fail s)))))))

(define-syntax project 
  (syntax-rules ()
    ((_ (x ...) g ...)  
     (lambdag@ (s)
       (let ((x (walk* x s)) ...)
         ((all g ...) s))))))
