1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Define top-level bindings for aux syntax: else, =>, _, ...

* module/ice-9/boot-9.scm (else, =>, ..., _): New definitions.  These
  are specified by the r6rs and the r7rs.
* module/ice-9/sandbox.scm (core-bindings): Include the aux syntax
  definitions.
* module/rnrs/base.scm:
* module/rnrs.scm: Re-export aux syntax.
This commit is contained in:
Andy Wingo 2019-09-12 21:50:51 +02:00
parent 4e89d0c061
commit 374c1e5807
4 changed files with 21 additions and 4 deletions

View file

@ -416,6 +416,22 @@ If returning early, return the return value of F."
(define-syntax-rule (unless test stmt stmt* ...) (define-syntax-rule (unless test stmt stmt* ...)
(if (not test) (begin stmt stmt* ...))) (if (not test) (begin stmt stmt* ...)))
(define-syntax else
(lambda (x)
(syntax-violation 'else "bad use of 'else' syntactic keyword" x x)))
(define-syntax =>
(lambda (x)
(syntax-violation '=> "bad use of '=>' syntactic keyword" x x)))
(define-syntax ...
(lambda (x)
(syntax-violation '... "bad use of '...' syntactic keyword" x x)))
(define-syntax _
(lambda (x)
(syntax-violation '_ "bad use of '_' syntactic keyword" x x)))
(define-syntax cond (define-syntax cond
(lambda (whole-expr) (lambda (whole-expr)
(define (fold f seed xs) (define (fold f seed xs)

View file

@ -314,6 +314,7 @@ allocation limit is exceeded, an exception will be thrown to the
;; ;;
(define core-bindings (define core-bindings
'(((guile) '(((guile)
else => _ ...
and and
begin begin
apply apply

View file

@ -1,6 +1,6 @@
;;; rnrs.scm --- The R6RS composite library ;;; rnrs.scm --- The R6RS composite library
;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. ;; Copyright (C) 2010, 2011, 2019 Free Software Foundation, Inc.
;; ;;
;; This library is free software; you can redistribute it and/or ;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public ;; modify it under the terms of the GNU Lesser General Public
@ -73,7 +73,7 @@
vector-map vector-for-each error assertion-violation assert vector-map vector-for-each error assertion-violation assert
call-with-current-continuation call/cc call-with-values dynamic-wind call-with-current-continuation call/cc call-with-values dynamic-wind
values apply quasiquote unquote unquote-splicing let-syntax values apply quasiquote unquote unquote-splicing let-syntax
letrec-syntax syntax-rules identifier-syntax letrec-syntax syntax-rules identifier-syntax else => _ ...
;; (rnrs bytevectors) ;; (rnrs bytevectors)

View file

@ -1,6 +1,6 @@
;;; base.scm --- The R6RS base library ;;; base.scm --- The R6RS base library
;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. ;; Copyright (C) 2010, 2011, 2019 Free Software Foundation, Inc.
;; ;;
;; This library is free software; you can redistribute it and/or ;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public ;; modify it under the terms of the GNU Lesser General Public
@ -23,7 +23,7 @@
define define-syntax syntax-rules lambda let let* let-values define define-syntax syntax-rules lambda let let* let-values
let*-values letrec letrec* begin let*-values letrec letrec* begin
quote lambda if set! cond case quote lambda if set! cond case else => _ ...
or and not or and not