From: Kjetil Svalastog Matheussen
Subject: [ANN] R7RS Scheme
Date: 
Message-ID: <Pine.LNX.4.64.0704012304050.30279@iannis.localdomain>
R7RS Scheme Draft V2007-4-1
***************************
***************************


About
=====
R7RS Scheme is a Lisp dialect largely inspired by Scheme.


Summary 
=======
R7RS Scheme is a statically scoped and properly tail-recursive dialect of 
the Lisp programming language. It was designed to have an exceptionally 
clear and simple semantics and few different ways to form expressions. A 
wide variety of programming paradigms, including imperative, functional, 
and message passing styles, find convenient expression in R7RS Scheme.


Introduction
============
Programming languages should be designed not by piling feature on top of 
feature, but by removing the weaknesses and restrictions that make 
additional features appear necessary. R7RS Scheme demonstrates that a very 
small number of rules for forming expressions, with no restrictions on how 
they are composed, suffice to form a practical and efficient programming 
language that is flexible enough to support most of the major programming 
paradigms in use today.



Implementation
==============
http://www.notam02.no/~kjetism/r7rs.tar.gz



Changes between R7RS Scheme and Scheme[1]
=========================================

* "define" can be used anywhere in an expression, just like on the top-level:

  (let ((a 1))
     (set! a 2)
     (define a 3)
     a)
  => 3

  (let ((a 1))
     (set! a 2)
     (define (a) (c))
     (define (c) 3)
     (a))
  => 3

  (let ((a 1))
     (set! a 2)
     (define (a) (c))
     (define (c) 3)
     (define a (+ (a) 1))
     a)
  => 4


* "include" includes code from another file:
  (define (cdr-list-copy list)
    (include "srfi-1.scm")
    (cdr (list-copy list)))
	     

* "define-toplevel":

  (let ((a* 1))
    (define-toplevel (a)
      a*))
  (a)
  => 1

  (let ((a* 1)
	(funcname 'a))
    (define-toplevel (,funcname)
      a*))
  (a)
  => 1



* "unquote" and "unquote-splicing" can appear outside quasiquotes:
  (let ((a 1))
     ,'a)
  => 1

  (let ()
    ,(+ 8 5))
  => 14
  ("(+ 8 6)" was calculated at compile time, and not at run time)

  (let ((a 1)
        (b 2))
    ,@(map (lambda (val)
             `(begin
                (display (string-append (symbol->string ',val) "=" (number->string ,val)))
                (newline)))
           '(a b)))
  => "a=1"
     "b=2"



* Arguments are evaluated in order left to right and top to bottom:

  (let ((a 1))
     (list (begin
             (set! a 2)
	     3)
	   a))
  => (3 2)

  (let ((a 1))
    `(,(begin
         (set! a 2)
         3)
      ,a))
  => (3 2)

  (let ((a 1))
    (let ((b (begin
               (set! a 2)
               3))
          (c a))
      (list b c)))
  => (3 2)



* "map" works like "map-in-order" as defined in scheme/srfi-1.



* Calling "car" on the empty list returns the empty list:
  (car '())
  => ()



* Calling "cdr" on the empty list returns the empty list:
  (cdr '())
  => ()



* "eval" takes one argument only:
  (let ((a 1))
     (eval '(+ a 2)))
  => 3



* "letrec*":
  (letrec* ((a d)
            (b (lambda () (c)))
            (c (lambda () a))
            (d 1))
    (b))
  => 1




* Symbols, keywords, syntax and function names are case sensitive.




* "define-macro" does not need to be placed at the top-level.
  However, the following expression does not work:

  (let ((a 1))
    (define-macro (gakk val)
      `(+ ,val a)))
  (gakk 2)
  => Error, undefined varible "a" in expression "(gakk 2) => (+ 2 a)"



* "macroexpand" and "macroexpand-1" are guaranteed to return expressions 
  where the transformations are defined only by the use of "define-macro".

  For example, "define-macro" is not used to implement core functionality 
  such as "cond" or "letrec*". So this will always work in a clean 
  environment:

  (macroexpand '(cond (#t 5)(else 6)))
  => (cond (#t 5)(else 6))



* "(gensym)" returns a unique symbol. Handy for macros.



* Macros can be used as functions:

  (define-macro (add . rest)
     `(+ ,@rest))

  (apply add '(1 2))
  => 3

  (let ((list '(1 2)))
    (apply add list)
  => 3

  (map add '(1 2) '(3 4))
  => '(4 6)


  Max 30 arguments, and the macro must be defined before being referenced.



* Keywords:

  (list :this-is-a-keyword 'this-is-a-symbol)
  => (:this-is-a-keyword this-is-a-symbol)

  (keyword->symbol :gakk)
  => gakk

  (symbol->keyword 'gakk)
  => :gakk

  (keyword->string :gakk)
  => "gakk"

  (string->keyword "gakk")
  => :gakk

  (keyword? :gakk)
  => #t

  (keyword? 'gakk)
  => #f



* No hygenic macros. (Programming languages should be designed not by 
  piling feature on top of feature, but by removing the weaknesses and 
  restrictions that make additional features appear necessary). 




Notes
=====

[1] As defined by the r5rs specification.

From: William D Clinger
Subject: Re: R7RS Scheme
Date: 
Message-ID: <1175474225.157750.173150@y80g2000hsf.googlegroups.com>
Kjetil Svalastog Matheussen wrote:
> R7RS Scheme is a Lisp dialect largely inspired by Scheme.

It's about time for Scheme to inspire a dialect of Lisp.

Will
From: Pascal Bourguignon
Subject: Re: [ANN] R7RS Scheme
Date: 
Message-ID: <87lkhbteo0.fsf@voyager.informatimago.com>
Kjetil Svalastog Matheussen <·······@notam02.no> writes:
> R7RS Scheme Draft V2007-4-1

Sounds good.  Perhaps R9RS will be indistinguishable enough from CL
that I'll be able to use it :-)

-- 
__Pascal Bourguignon__
http://www.informatimago.com
http://pjb.ogamita.org
From: Didier Verna
Subject: Re: [ANN] R7RS Scheme
Date: 
Message-ID: <mux1wj2zd9e.fsf@uzeb.lrde.epita.fr>
Pascal Bourguignon <···@informatimago.com> wrote:

> Kjetil Svalastog Matheussen <·······@notam02.no> writes:
>> R7RS Scheme Draft V2007-4-1
>
> Sounds good.  Perhaps R9RS will be indistinguishable enough from CL
> that I'll be able to use it :-)

        Actually, no way ! Quoting Mike Sperber at that Thai restaurant just 1
hour ago: "R6RS is just, you know, flushing the 80's. Objects are the 90's.
We're not quite there yet..." :-)

I think I'll put that one in my .sig for a while :-)

-- 
Didier Verna, ······@lrde.epita.fr, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire   Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bic�tre, France   Fax.+33 (1) 53 14 59 22   ······@xemacs.org
From: David Rush
Subject: Re: R7RS Scheme
Date: 
Message-ID: <1175681951.510168.233470@d57g2000hsg.googlegroups.com>
On Apr 2, 10:18 pm, Didier Verna <······@lrde.epita.fr> wrote:
> Quoting Mike Sperber at that Thai restaurant just 1
> hour ago: "R6RS is just, you know, flushing the 80's. Objects are the 90's.
> We're not quite there yet..." :-)

Oh no. Please tell me he was just talking shite after drinking too
much Asian beer. I thought that the category-theory people had all
made this abundantly clear during the late 90s ;)

--
The Scheme Underground deals harshly with recidivists. Have your self-
criticism prepared in advance.
From: Matthias Blume
Subject: Re: R7RS Scheme
Date: 
Message-ID: <m1hcrwuu5r.fsf@hana.uchicago.edu>
"David Rush" <········@gmail.com> writes:

> On Apr 2, 10:18 pm, Didier Verna <······@lrde.epita.fr> wrote:
>> Quoting Mike Sperber at that Thai restaurant just 1
>> hour ago: "R6RS is just, you know, flushing the 80's. Objects are the 90's.
>> We're not quite there yet..." :-)
>
> Oh no. Please tell me he was just talking shite after drinking too
> much Asian beer. I thought that the category-theory people had all
> made this abundantly clear during the late 90s ;)

Not to worry.  We are well into the 00's.  Objects are soooo last
millenium...

:-)
From: Michael Sperber
Subject: Re: R7RS Scheme
Date: 
Message-ID: <y9lodm44d2y.fsf@valmont.local>
"David Rush" <········@gmail.com> writes:

> On Apr 2, 10:18 pm, Didier Verna <······@lrde.epita.fr> wrote:
>> Quoting Mike Sperber at that Thai restaurant just 1
>> hour ago: "R6RS is just, you know, flushing the 80's. Objects are the 90's.
>> We're not quite there yet..." :-)
>
> Oh no. Please tell me he was just talking shite after drinking too
> much Asian beer. I thought that the category-theory people had all
> made this abundantly clear during the late 90s ;)

Be that as it may, but you don't have worry, because ...

I WAS SPEAKING AS AN INDIVIDUAL MEMBER OF THE SCHEME COMMUNITY.  I WAS
NOT SPEAKING FOR THE R6RS EDITORS, AND THIS QUOTE SHOULD NOT BE
CONFUSED WITH THE EDITORS' OFFICIAL POSITION.

:-)

-- 
Cheers =8-} Mike
Friede, V�lkerverst�ndigung und �berhaupt blabla
From: William D Clinger
Subject: Re: R7RS Scheme
Date: 
Message-ID: <1175696224.154863.163600@y66g2000hsf.googlegroups.com>
Michael Sperber wrote:
> I WAS SPEAKING AS AN INDIVIDUAL MEMBER OF THE SCHEME COMMUNITY.  I WAS
> NOT SPEAKING FOR THE R6RS EDITORS, AND THIS QUOTE SHOULD NOT BE
> CONFUSED WITH THE EDITORS' OFFICIAL POSITION.
>
> :-)

Indeed, the R6RS editors don't have any official position on
the decade in which they are living.

Will
From: Didier Verna
Subject: Re: R7RS Scheme
Date: 
Message-ID: <muxk5wshxu5.fsf@uzeb.lrde.epita.fr>
Michael Sperber <·······@informatik.uni-tuebingen.de> wrote:

> Be that as it may, but you don't have worry, because ...
>
> I WAS SPEAKING AS AN INDIVIDUAL MEMBER OF THE SCHEME COMMUNITY.  I WAS
> NOT SPEAKING FOR THE R6RS EDITORS, AND THIS QUOTE SHOULD NOT BE
> CONFUSED WITH THE EDITORS' OFFICIAL POSITION.
>
> :-)

        Right :-)


> "David Rush" <········@gmail.com> writes:
>
>> On Apr 2, 10:18 pm, Didier Verna <······@lrde.epita.fr> wrote:
>>> Quoting Mike Sperber at that Thai restaurant just 1
>>> hour ago: "R6RS is just, you know, flushing the 80's. Objects are the 90's.
>>> We're not quite there yet..." :-)
>>
>> Oh no. Please tell me he was just talking shite after drinking too
>> much Asian beer. 

  He was drinking ice tea AFAICR. *I* was drinking too much asian beer :-)

-- 
Didier Verna, ······@lrde.epita.fr, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire   Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bic�tre, France   Fax.+33 (1) 53 14 59 22   ······@xemacs.org