Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

R6RS: Simplest way to export all definitions but for one

20 views
Skip to first unread message

Grant Rettke

unread,
Nov 2, 2008, 11:57:17 PM11/2/08
to
Hi folks,

For sake of example, I would like to be able to, rather than writing
this:

(import (except (rnrs) set!))
(define x 10)
(display x) (newline)
(set! x 20)
(display x) (newline)

just define a language that exports everything from rnrs base but for
set!.

What is the easiest way to get a list of every definition in rnrs base
so that I can easily define my exports?

Best wishes,

Grant

Abdulaziz Ghuloum

unread,
Nov 3, 2008, 12:33:18 AM11/3/08
to
Grant Rettke wrote:

> What is the easiest way to get a list of every definition in rnrs base
> so that I can easily define my exports?

There is no portable way. In Ikarus, you can do:

> (environment-symbols (environment '(rnrs)))

which gives the following list (might be missing a few):

Aziz,,,


(bitwise-xor record-type-uid i/o-encoding-error?
open-file-input/output-port fltan
make-no-infinities-violation car rational? numerator
assertion-violation bytevector-s32-native-ref
who-condition? bound-identifier=? i/o-encoding-error-char
parent-rtd integer-valued? cadddr fxrotate-bit-field
make-record-type-descriptor acos nongenerative char>?
opaque warning? flcos char-alphabetic?
make-custom-textual-input/output-port sealed
i/o-decoding-error? &i/o-file-already-exists protocol
bytevector-ieee-single-set! vector-set! &undefined
violation? append assoc cdaddr bytevector-copy!
hashtable-size standard-error-port list-ref fl+ not
fxdiv0-and-mod0 open-input-file apply => port? floor flsin
undefined-violation? free-identifier=?
bitwise-arithmetic-shift-left record-field-mutable?
make-custom-binary-input/output-port bytevector-u64-set!
hashtable-equivalence-function imag-part error string>=?
&no-nans number? string-ci>=? get-u8 file-options
syntax-violation? caaddr &violation bytevector-sint-set!
standard-output-port command-line record-type-parent
enum-set-member? fldiv0-and-mod0 zero? raise equal-hash
port-transcoder fxmax hashtable-update! fixnum->flonum
bitwise-arithmetic-shift-right syntax-violation-subform
bytevector-u64-native-set! char<=? real-part pair? fl-
bytevector-u32-native-ref open-output-file for-each length
cddadr standard-input-port flmax record-type-name fl>=?
output-port? syntax-violation-form assv
fxreverse-bit-field make-message-condition greatest-fixnum
fxcopy-bit-field char-downcase flnegative? string-ci>?
string-ci<=? flabs make-lexical-violation input-port?
bitwise-copy-bit open-bytevector-output-port
make-who-condition fl/ _ &i/o-file-is-read-only nan?
enum-set-universe make-error cadadr vector-for-each
hashtable-copy make-i/o-error ... char-numeric?
bitwise-reverse-bit-field asin flzero? record-rtd angle
flpositive? put-char make-i/o-write-error &error
sint-list->bytevector serious-condition? syntax->datum
string->symbol enum-set=? bytevector=? make-i/o-read-error
bytevector-ieee-double-set! odd? identifier?
get-bytevector-some &no-infinities native-eol-style cdaadr
call-with-bytevector-output-port vector-length
open-file-output-port string-ci<? char<? fxmin newline
make-i/o-file-already-exists-error
non-continuable-violation? infinite?
bitwise-rotate-bit-field fxcopy-bit string->utf8
hashtable-set! &syntax make-i/o-file-is-read-only-error
flsqrt string>? fxmod exact message-condition?
least-fixnum make-i/o-file-protection-error caaadr
make-variable-transformer string->bytevector assp
make-enumeration char-title-case? with-exception-handler
even? buffer-mode make-i/o-file-does-not-exist-error
real->flonum record-predicate else magnitude fl<=?
bytevector-s16-native-ref string-ci=? fx-/carry display
hashtable-contains? make-undefined-violation syntax-case
finite? bytevector-copy make-warning flmod0 fl>? fxodd?
cdddar error-handling-mode open-bytevector-input-port
syntax-rules bytevector-uint-set! vector-sort
&i/o-file-protection fllog list? immutable
open-string-input-port make-violation make-i/o-port-error
put-string &serious case fx+/carry mutable char=? flexpt
open-file-input-port fxdiv flmin enum-set-subset?
define-syntax bitwise-not bytevector-s16-native-set!
eol-style symbol->string fxeven? get-char put-datum
inexact? for-all caddar generate-temporaries delete-file
make-i/o-invalid-position-error eqv? lambda hashtable?
char-upper-case? lcm read get-bytevector-n!
bitwise-bit-set? fixnum-width hashtable-clear! begin
fx*/carry &lexical map native-transcoder assq
make-syntax-violation hashtable-ref
transcoder-error-handling-mode + or
record-constructor-descriptor condition-accessor
bytevector-ieee-single-ref make-i/o-filename-error
fxnegative? utf16->string open-string-output-port exact?
vector-ref u8-list->bytevector cdadar and write-char
make-serious-condition negative?
bytevector-u16-native-set! tan bytevector->string cons
list if uint-list->bytevector record-type-descriptor
enum-set-indexer string<=? get-line char->integer
define-condition-type bytevector-s64-set! char-upcase
bitwise-length exit fxdiv-and-mod record-mutator
fxpositive? enum-set-constructor string-for-each <= fldiv0
= fixnum? make-custom-textual-output-port caadar string?
case-lambda char-lower-case? bytevector? integer?
current-input-port &warning fxbit-set? fl=? abs
make-rectangular enum-set->list positive? set!
string-titlecase symbol? bytevector-u16-native-ref
current-output-port fold-left lookahead-u8 get-string-all
call-with-port bytevector-s64-native-set! eq? define
string-length fx>=? flfinite? current-error-port
vector-sort! string<? integer->char fxarithmetic-shift
cddaar cond bytevector->sint-list port-eof? find
&i/o-filename fx* make-irritants-condition
bytevector->u8-list make-hashtable fx- let-values gcd
fxlength - bytevector-u8-set! flinfinite?
make-implementation-restriction-violation boolean=?
hashtable-mutable? let* with-input-from-file
get-bytevector-n cadaar make-i/o-encoding-error
bitwise-arithmetic-shift &implementation-restriction
make-polar list-sort char-whitespace? record-constructor
vector? make-custom-textual-input-port >= write
make-non-continuable-violation letrec-syntax string=?
read-char make-i/o-decoding-error fxnot
bytevector-ieee-double-ref transcoder-eol-style char-ci>=?
bytevector-s16-set! let-syntax cdaaar fldiv-and-mod
hashtable-keys bytevector-s8-set! &i/o-encoding
enum-set-projection cos define-enumeration expt letrec*
flinteger? lexical-violation? call/cc values
bytevector-s16-ref string-normalize-nfc
fxarithmetic-shift-left min memp guard letrec
call-with-current-continuation &message record-accessor
call-with-values caaaar irritants-condition? char-foldcase
make-assertion-violation put-bytevector fx>?
bitwise-bit-count filter endianness bytevector-u8-ref sqrt
string-normalize-nfkd record-type-descriptor? let
char-ci>? implementation-restriction-violation?
get-string-n! string-ref fxzero? simple-conditions assert
bytevector->uint-list equal? cdddr char-titlecase exp
unsyntax-splicing boolean? &non-continuable error?
string->utf16 bytevector-s64-ref string-ci-hash
file-exists? &i/o-invalid-position bytevector-s8-ref
unsyntax flodd? transcoder-codec flmod quasisyntax
make-custom-binary-output-port condition-who
string-normalize-nfd enum-set-complement close-output-port
caddr syntax member peek-char latin-1-codec flexp
quasiquote procedure? exact-integer-sqrt &i/o-decoding
symbol=? fx<=? bytevector-ieee-single-native-set!
char-ci=? utf-8-codec string-hash call-with-input-file
unquote-splicing identifier-syntax bytevector-length
hashtable-entries utf-16-codec * unquote buffer-mode?
make-vector cdadr condition-message quote
bytevector-s32-set! < fxarithmetic-shift-right fltruncate
syntax-violation bytevector-u64-ref mod0 fleven?
symbol-hash close-input-port binary-port? string-copy
unless flonum? complex? condition
make-record-constructor-descriptor utf8->string flceiling
condition-irritants bytevector-s32-ref bytevector-uint-ref
sin bytevector-ieee-double-native-set! lookahead-char
caadr when bytevector-fill! remp char-ci<=? memv
i/o-write-error? fldiv vector-map record?
make-custom-binary-input-port cons* with-syntax
call-with-output-file truncate fx<? raise-continuable
&i/o-write get-string-n max fold-right i/o-read-error?
fxmod0 textual-port? cddar &who put-u8
bytevector-s64-native-ref utf32->string fx+
assertion-violation? div0 bytevector-s32-native-set!
make-eqv-hashtable get-datum i/o-port-error? bitwise-ior
bytevector-ieee-single-native-ref number->string flfloor
round substring condition? char-ci<? fxbit-count
enum-set-difference string-append record-type-field-names
cadar string-downcase memq flnan?
i/o-invalid-position-error? fxif bitwise-bit-field
flush-output-port &i/o-port bytevector-u64-native-ref
datum->syntax string-normalize-nfkc let*-values
i/o-filename-error? bitwise-if remove fx=? cdaar parent
hashtable-delete! bytevector-u32-native-set! div0-and-mod0
fldenominator char-general-category make-transcoder
bytevector-ieee-double-native-ref bitwise-first-bit-set
make-eq-hashtable bitwise-copy-bit-field
i/o-file-protection-error? enum-set-intersection log
get-bytevector-all fxxor fields bytevector-sint-ref
&i/o-read caaar port-has-port-position? exists vector
close-port condition-predicate
i/o-file-is-read-only-error? cadr null? rationalize
record-type-generative? list->string enum-set-union
&condition call-with-string-output-port do
set-port-position! inexact flnumerator
i/o-file-does-not-exist-error? cddr / flatan
bytevector-u32-set! &irritants mod eof-object?
real-valued? string string-foldcase
i/o-file-already-exists-error? record-type-opaque? remv
bytevector-u32-ref port-position ceiling partition reverse
flround rational-valued? i/o-error?
&i/o-file-does-not-exist fxand transcoded-port char>=?
fxbit-field flacos port-has-set-port-position!?
string-upcase hashtable-hash-function no-nans-violation?
cdar atan i/o-error-position record-type-sealed?
dynamic-wind div fxdiv0 > &i/o list->vector vector-fill!
string->list bytevector-u16-set! bitwise-and
no-infinities-violation? i/o-error-port native-endianness
real? define-record-type with-output-to-file caar
output-port-buffer-mode make-bytevector flasin
string->utf32 fxfirst-bit-set cdr string->number
make-string bytevector-u16-ref eof-object denominator
i/o-error-filename make-no-nans-violation list-tail
div-and-mod cddddr fl<? fxior vector->list fl* char? remq
&assertion)

Grant Rettke

unread,
Nov 3, 2008, 11:36:44 PM11/3/08
to
On Nov 2, 11:33 pm, Abdulaziz Ghuloum <aghul...@cee.ess.indiana.edu>
wrote:

> There is no portable way.  In Ikarus, you can do:

Thanks Aziz.

William D Clinger

unread,
Nov 4, 2008, 9:59:48 AM11/4/08
to
Grant Rettke asked:

> What is the easiest way to get a list of every definition in rnrs base
> so that I can easily define my exports?

As Aziz answered, there is no portable way. Aziz gave a list
of the exports from the (rnrs) library, but Grant was asking
about the (rnrs base) library. I'll give that list below.

In Larceny, the (rnrs) library is defined in the lib/rnrs.sls file.
Its export list begins with the exports from (rnrs base), and
is followed by exports from the other libraries it combines.
I mention that as one possible resource for people who are
putting together their own custom composite libraries.

The identifiers exported by (rnrs base) are:


;; Macros defined in core expander:

begin if lambda quote set! and or
define define-syntax let-syntax letrec-syntax
_ ...

;; Derived syntax:

let let* letrec letrec* let-values let*-values
case cond else =>
assert
quasiquote unquote unquote-splicing
syntax-rules identifier-syntax

;; R5RS primitives:

* + - / < <= = > >= abs acos angle append apply asin atan
boolean? call-with-current-continuation
call-with-values car cdr caar cadr cdar cddr
caaar caadr cadar caddr cdaar cdadr cddar cdddr
caaaar caaadr caadar caaddr cadaar cadadr caddar
cadddr cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr
ceiling char? char->integer char=? char<? char>? char<=? char>=?
complex? cons cos
denominator dynamic-wind
eq? equal? eqv? even? exact? exp expt floor for-each
gcd imag-part inexact? integer->char integer?
lcm length list list->string
list->vector list-ref list-tail list? log magnitude make-polar
make-rectangular make-string make-vector map max min
negative? not null? number->string number? numerator
odd? pair?
positive? procedure? rational? rationalize
real-part real? reverse round
sin sqrt string string->list string->number string->symbol
string-append
string-copy string-length string-ref string<=? string<?
string=? string>=? string>? string? substring symbol->string
symbol? tan
truncate values vector vector->list
vector-fill! vector-length vector-ref vector-set! vector? zero?

;; R6RS additional procedures:

real-valued? rational-valued? integer-valued?
exact inexact finite? infinite?
nan? div mod div-and-mod div0 mod0 div0-and-mod0
exact-integer-sqrt boolean=?
symbol=? string-for-each vector-map vector-for-each
error assertion-violation
call/cc

Will

leppie

unread,
Nov 4, 2008, 11:22:53 AM11/4/08
to

A shorter way on Ikarus, IronScheme, Mosh:

(environment-symbols (scheme-report-environment 5))

:)

Derick Eddington

unread,
Nov 4, 2008, 12:55:37 PM11/4/08
to
On Nov 4, 8:22 am, leppie <xacc....@gmail.com> wrote:
> A shorter way on Ikarus, IronScheme, Mosh:
>
> (environment-symbols (scheme-report-environment 5))

No:

> (import (xitomatl srfi lists))
> (lset= eq?
(environment-symbols (scheme-report-environment 5))
(environment-symbols (environment '(rnrs base))))
#f
> (lset-difference eq?
(environment-symbols (scheme-report-environment 5))
(environment-symbols (environment '(rnrs base))))
(set-cdr! char-upper-case? read-char with-input-from-file
string-ci>=? modulo with-output-to-file input-port?
current-output-port char-ci<? open-output-file read
char-ci<=? member char-numeric? current-input-port
char-lower-case? write-char peek-char inexact->exact
string-fill! string-ci<? interaction-environment
string-ci=? call-with-output-file string-set! set-car!
assq quotient char-ci=? char-whitespace? memq do
close-input-port char-downcase delay force
scheme-report-environment eval eof-object
close-output-port null-environment char-ci>? eof-object?
remainder exact->inexact call-with-input-file newline
char-ci>=? output-port? assoc char-alphabetic? char-upcase
display write open-input-file assv string-ci>?
string-ci<=? memv)
>
> (lset-difference eq?
(environment-symbols (environment '(rnrs base)))
(environment-symbols (scheme-report-environment
5)))
(let*-values rational-valued? mod0 div0 let-values div nan?
vector-map div0-and-mod0 exact-integer-sqrt letrec* assert
vector-for-each finite? div-and-mod boolean=? exact
inexact string-for-each integer-valued? symbol=? call/cc
identifier-syntax assertion-violation error real-valued? _
mod infinite?)
>


--
: Derick
----------------------------------------------------------------

leppie

unread,
Nov 4, 2008, 1:09:28 PM11/4/08
to
On Nov 4, 7:55 pm, Derick Eddington <derick.edding...@gmail.com>
wrote:

Oops :-O For some reason I was thinking he wanted the R5RS
environment! Doh, not sure what I was thinking, hehe!

Cheers

leppie

Grant Rettke

unread,
Nov 4, 2008, 2:40:57 PM11/4/08
to
On Nov 4, 8:59 am, William D Clinger <cesur...@yahoo.com> wrote:
> In Larceny, the (rnrs) library is defined in the lib/rnrs.sls file.
> Its export list begins with the exports from (rnrs base), and
> is followed by exports from the other libraries it combines.
> I mention that as one possible resource for people who are
> putting together their own custom composite libraries.

Perfect, thanks!

William D Clinger

unread,
Nov 4, 2008, 2:56:41 PM11/4/08
to
I wrote:
> In Larceny, the (rnrs) library is defined in the lib/rnrs.sls file.

Sorry, that should have been lib/R6RS/rnrs.sls

Will

0 new messages