syntax-begin0


When you want to evaluate a series of expression in order, use BEGIN (many contexts form an implicit BEGIN). The last result of evaluating the last expression will be returned from the whole BEGIN expression. When you want to return the first result instead, use the common macro BEGIN0:

 (define-syntax begin0 
   (syntax-rules () 
     ((_ expr0 expr1 ...) 
      (let ((return expr0)) 
        expr1 ... 
        return)))) 

Usage:

 (begin0 (car some-list) (set! some-list (cdr some-list))) 

category-code