Manipulate GOOPS vtable flags from Scheme, for speed
[bpt/guile.git] / module / srfi / srfi-31.scm
1 ;;; srfi-31.scm --- special form for recursive evaluation
2
3 ;; Copyright (C) 2004, 2006, 2012 Free Software Foundation, Inc.
4 ;;
5 ;; This library is free software; you can redistribute it and/or
6 ;; modify it under the terms of the GNU Lesser General Public
7 ;; License as published by the Free Software Foundation; either
8 ;; version 3 of the License, or (at your option) any later version.
9 ;;
10 ;; This library is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;; Lesser General Public License for more details.
14 ;;
15 ;; You should have received a copy of the GNU Lesser General Public
16 ;; License along with this library; if not, write to the Free Software
17 ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19 ;;; Original author: Rob Browning <rlb@defaultvalue.org>
20
21 (define-module (srfi srfi-31)
22 #:export (rec))
23
24 (cond-expand-provide (current-module) '(srfi-31))
25
26 (define-syntax rec
27 (syntax-rules ()
28 "Return the given object, defined in a lexical environment where
29 NAME is bound to itself."
30 ((_ (name . formals) body ...) ; procedure
31 (letrec ((name (lambda formals body ...)))
32 name))
33 ((_ name expr) ; arbitrary object
34 (letrec ((name expr))
35 name))))