31.sld 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ;;; 31.scm --- SRFI 31: A special form `rec' for recursive evaluation
  2. ;; Copyright (C) 2014 Taylan Ulrich Bayırlı/Kammer
  3. ;; Author: Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
  4. ;; Keywords: srfi 31 srfi-31 rec recursive
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU Lesser General Public License as
  7. ;; published by the Free Software Foundation, either version 3 of the
  8. ;; License, or (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU Lesser General Public License for more details.
  13. ;; You should have received a copy of the GNU Lesser General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;;
  17. ;;; Code:
  18. (define-library (srfi 31)
  19. (export rec)
  20. (import (scheme base))
  21. (begin
  22. (define-syntax rec
  23. (syntax-rules ()
  24. ((rec (name . args) body ...)
  25. (letrec ((name (lambda args body ...)))
  26. name))
  27. ((rec name expr)
  28. (letrec ((name expr))
  29. name))))))
  30. ;;; 31.scm ends here