What Does R7RS Change Programming in Scheme?
-
Upload
kazuhiro-hishinuma -
Category
Technology
-
view
6.734 -
download
0
description
Transcript of What Does R7RS Change Programming in Scheme?
.
......
What Does R7RS
Change Programming in Scheme?
Kazuhiro Hishinuma (Twitter: @kazh98)
Department of Computer Science, Meiji University1-1-1 Higashimita, Tama-ku, Kawasaki-shi, Kanagawa, 214-8571 Japan
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. What is the Schemers’ Soul?
Snap out of it, Schemers!
Scheme is the simplest,the smallest, andthe most powerful language!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. What is the Schemers’ Soul?
Snap out of it, Schemers!
Scheme is the simplest,the smallest, andthe most powerful language!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. What is the Programmers’ Utopia?
And..., join us,all lispers and programmers!
Now, the most ideal languageis going to be born!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. What is the Programmers’ Utopia?
And..., join us,all lispers and programmers!
Now, the most ideal languageis going to be born!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. Congratulation!
R7RS-small draftratified by Steering Committee!! 1
1http://lists.scheme-reports.org/pipermail/
scheme-reports/2013-November/003832.htmlK. Hishinuma What Does R7RS Change Programming in Scheme?
.. Congratulation!
R7RS-small draftratified by Steering Committee!! 1
1http://lists.scheme-reports.org/pipermail/
scheme-reports/2013-November/003832.htmlK. Hishinuma What Does R7RS Change Programming in Scheme?
.. R7RS says ...
“Scheme demonstrates that
a very small number of rules
for forming expressions, with no restrictions
on how they are composed.”
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. R7RS says ...
“Scheme demonstrates that
a very small number of rules
for forming expressions,
with no restrictions
on how they are composed.”
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. R7RS says ...
“Scheme demonstrates that
a very small number of rules
for forming expressions, with no restrictions
on how they are composed.”
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. R7RS says ...
“Scheme demonstrates that
a very small number of rules
for forming expressions, with no restrictions
on how they are composed.”
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. So, today.
Let us think what isThe Genuine ProgrammingIn R7RS Scheme.
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. Three Hot Changes1
Record-type (cf. pp.27–)
Library System (cf. pp.28–)
Exceptions (cf. pp.54–)
1from R5RSK. Hishinuma What Does R7RS Change Programming in Scheme?
.. Three Hot Changes1
Record-type (cf. pp.27–)
Library System (cf. pp.28–)
Exceptions (cf. pp.54–)
1from R5RSK. Hishinuma What Does R7RS Change Programming in Scheme?
.. Record-type
� �(define-record-type name(cname f1 f2 ...)pred?(f1 ref-f1 set-f1!)(f2 ref-f2 set-f2!)...)� �name Name of the record to be defined
pred? Name of the predicatior for this record
f1, f2, ... Names of the fields of this record
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. e.g. CONS, CAR, CDR
Existing method:� �(define (cons a b)(lambda (s) (s a b)))
(define (car c)(c (lambda (a b) a)))
(define (cdr c)(c (lambda (a b) b)))
� �(define c (cons ’a ’b))
(car c) ;=> ’a
(cdr c) ;=> ’b
(pair? c) ;=> ?!
(set-car! c ’d)
(car c) ;=> ?!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. e.g. CONS, CAR, CDR
Proposed method:� �(define-record-type <pair>(cons a b)pair?(a car set-car!)(b cdr set-cdr!))� �
(define c (cons ’a ’b))
(car c) ;=> ’a
(cdr c) ;=> ’b
(pair? c) ;=> #t
(set-car! c ’d)
(car c) ;=> ’d
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. define-record-type give Scheme ...
The seed ofObject-Oriented Programming!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. define-record-type give Scheme ...
The seed ofObject-Oriented Programming!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. Three Hot Changes1
Record-type (cf. pp.27–)
Library System (cf. pp.28–)
Exceptions (cf. pp.54–)
1from R5RSK. Hishinuma What Does R7RS Change Programming in Scheme?
.. Good news!
Notation for library systemis standardized!!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. How to load SRFI-1
Gauche (use srfi-1)
Guile (srfi srfi-1)
Racket (require srfi/1)
R7RS (import (srfi 1))
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. How to load SRFI-1
Gauche (use srfi-1)
Guile (srfi srfi-1)
Racket (require srfi/1)
R7RS (import (srfi 1))
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. How to make a library
� �(define-library (name ...)(export ep ...)(import (scheme base) ...)(begin(define (p1 args ...)...) ...))
� �name Name of the library
ep ... List of names to be exported
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. Three Hot Changes1
Record-type (cf. pp.27–)
Library System (cf. pp.28–)
Exceptions (cf. pp.54–)
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. What’s this?
SRFI-34 is includedin R7RS!
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. with-exception-handler
e.g.� �(with-exception-handler(lambda (e) Handler for Exception e)(lambda () Procedure which may raise exception))� �� �
(error ”This is an error message.”)� �
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. Other Changes
Case sensitivity is now the default in
symbols and character names.
Case-lambda (cf. pp.21–)
The call-with-current-continuation
procedure now has the synonym call/cc.
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. Other Changes
Case sensitivity is now the default in
symbols and character names.
Case-lambda (cf. pp.21–)
The call-with-current-continuation
procedure now has the synonym call/cc.
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. Other Changes
Case sensitivity is now the default in
symbols and character names.
Case-lambda (cf. pp.21–)
The call-with-current-continuation
procedure now has the synonym call/cc.
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. Other Changes
Case sensitivity is now the default in
symbols and character names.
Case-lambda (cf. pp.21–)
The call-with-current-continuation
procedure now has the synonym call/cc.
K. Hishinuma What Does R7RS Change Programming in Scheme?
Think in Scheme,write in Scheme,and show your Scheme!
Thanks for your listening.
K. Hishinuma What Does R7RS Change Programming in Scheme?
.. References
[1] J. Cowan: R7RS-small draft ratified by Steering Committee.The public mailing lists on lists.scheme-reports.org, 2013.http://lists.scheme-reports.org/pipermail/
scheme-reports/2013-November/003832.html
[2] A. Shinn, J. Cowan, and A. Gleckler: Revised7 Report on theAlgorithmic Language Scheme. Steering Committee, SchemeWorking Groups, 2013. http://trac.sacrideo.us/wg/
[3] Y. Kurosaki, and K. Hishinuma: Meiji Scheme Shell improved byMOL. Meiji Scheme Project, Mathematical OptimizationLaboratory, Meiji University. https://github.com/meshmol/mesh
[4] K. Sasagawa: Normal Scheme. Scheme, 2013.http://homepage1.nifty.com/~skz/Scheme/normal.html
K. Hishinuma What Does R7RS Change Programming in Scheme?