Questions tagged [r7rs]

A project to provide a new standard for Scheme implementations.

Definition:

R7RS is a project that provides a new standard for Scheme implementations.

The R7RS small language specification was approved in May 2013.

There are two working groups; the Small Language group's goal is a specification for a compact, core implementation, while the Large Language group plan to work on a substantial set of library modules.

Important Links:

31 questions
1
vote
2 answers

Why might the Scheme `filter` form not process list elements 'in order'?

(filter procedure list) applies procedure to each element of list and returns a new list containing only the elements for which procedure returns true. (R. Kent Dybvig The Scheme Programming Language) (online) What may not be apparent from this…
mnemenaut
  • 684
  • 2
  • 11
1
vote
1 answer

Can every letrec be replaced with letrec*?

For every 100% compliant R7RS-small program that does not rely on any implementation-specific or undefined behavior, is it true that every instance of letrec in the program can be replaced with letrec* without causing any change in behavior? In…
Flux
  • 9,805
  • 5
  • 46
  • 92
1
vote
1 answer

How to define two R7RS libraries in Guile

I have these two R7RS libraries, which I enter into the Guile REPL one by one: (define-library (example one) (import (scheme base)) (export f) (begin (define (f x) (+ x 1)))) (define-library (example two) (import (scheme base)) …
Flux
  • 9,805
  • 5
  • 46
  • 92
1
vote
1 answer

Scheme: list all bindings in scope

In R7RS or chibi-scheme, is there a function I can call to get a list of symbols containing all bindings in the current scope? As a comparison, in Python, I can use functions globals() and locals() to see what names are available in the current…
math4tots
  • 8,540
  • 14
  • 58
  • 95
1
vote
2 answers

Why does Scheme need the special notion of procedure's location tag?

Why does Scheme need the special notion of procedure's location tag? The standard says: Each procedure created as the result of evaluating a lambda expression is (conceptually) tagged with a storage location, in order to make eqv? and eq? work on…
Des Nerger
  • 167
  • 2
  • 5
0
votes
1 answer

Which identifier am I supposed to use to close my library in R7RS/Scheme?

I'm trying to write a R7RS library which will reverse a list in a destructive manner, I currently have written this code; #lang r7rs (define-library (in-place-reverse!) (export reverse!) (import (scheme base)) (ignore the code below) ; …
Hakamex
  • 1
  • 2
0
votes
0 answers

How to export the same code as both an R6RS and R7RS library

I have written some procedures that I want to package as both an R6RS library and an R7RS library. The procedures are in a file named mylib.scm: (define (multiplier n) ; Private (lambda (x) (* n x))) (define double (multiplier 2)) ;…
Flux
  • 9,805
  • 5
  • 46
  • 92
0
votes
1 answer

Why can't I write a byte to the current-output-port in the REPL?

Why does (write-u8 49 current-output-port) fail with an error when I evaluate it in an REPL? chibi-scheme 0.10.0: > (write-u8 49 current-output-port) ERROR in "write-u8": invalid type, expected Output-Port: # Guile…
Flux
  • 9,805
  • 5
  • 46
  • 92
0
votes
2 answers

Can R7RS-small implementations allow only one define-library per file?

Are compliant R7RS-small implementations allowed to impose a restriction on the number of define-library per file? Some R7RS-small implementations such as Guile 3.0.7 only allow one define-library per file. Is this a deviation from the standard, or…
Flux
  • 9,805
  • 5
  • 46
  • 92
0
votes
1 answer

R7RS-small: equivalence of quasiquoted expressions

The R7RS-small standard, section 4.2.8 Quasiquotation on page 20-21 says that (let ((a 3)) `((1 2) ,a ,4 ,'five 6)) is equivalent to `((1 2) 3 4 five 6) and (let ((a 3)) (cons '(1 2) (cons a (cons 4 (cons 'five '(6)))))) But not…
Flux
  • 9,805
  • 5
  • 46
  • 92
0
votes
2 answers

How to consume only the first returned value in Scheme?

Given a Scheme function returning multiple values, for example: (exact-integer-sqrt 5) ⇒ 2 1 How can I use only the first returned value, ignoring the other ones?
Danilo Piazzalunga
  • 7,590
  • 5
  • 49
  • 75
0
votes
1 answer

How to define a procedure that returns multiple values in R7RS

TL;DR: How to define a procedure foobar which can be used as (let-values ((foo bar) (foobar)) ...). R7RS defines two procedures floor/ and truncate, which computes the quotient and remainder of two numbers divided. I find this really tricky because…
Vursc
  • 21
  • 4
0
votes
1 answer

Is the cdr of a list always eqv?

I am writing an interpreter for R7RS Scheme to gain a more complete understanding of the Scheme programming language. From my understanding, eqv? must return #t if both list arguments denote the same location in memory. However, I am not sure if the…
Flux
  • 9,805
  • 5
  • 46
  • 92
0
votes
2 answers

Hygienic macro r7rs : Return second expression value

I'm currently learning some r7rs and I am trying to implement a macro 'begin' as following : (begin0 expr0 expr1 ... expr2) With expr being a regular expression (Like (set! x (+ x 1))) And begin0 as a macro that evaluates all the expression but…
Lucas M
  • 13
  • 4
0
votes
1 answer

Redefine a scheme built-in, but only when used as an argument to a specific procedure?

How can I redefine the procedure and only when it is called as an argument to the procedure fetch? For example: ; this `and` returns #f (and #t #f) ; this `and` returns "and a b" (fetch (foo (bar (and "a" "b")))) I would like to write a macro to…
nickloewen
  • 15
  • 4