Questions tagged [r5rs]

The 5th Revised Report on the Algorithmic Language Scheme

The 5th Revised Report on the Algorithmic Language Scheme, R5RS is a de facto standard for Scheme implementations. Schemers take pride in the fact that at 50 pages the specification is shorter than the index for books on some other languages.

225 questions
4
votes
1 answer

Implementing the built-in scheme function begin() using scheme itself, same code behaves differently in MIT-SCHEME and Racket?

I am reading the r5rs scheme standard and find that the begin() is actually a library syntax, which means that it could be defined by scheme itself, and the standard gives an implementation at the end of the standard. I followed the r5rs to…
Alaya
  • 3,287
  • 4
  • 27
  • 39
3
votes
3 answers

Is it possible to just print the string that was passed into the Scheme macro?

I am working on a language translator in guile scheme, and need to handle the basic case, where you're trying to convert a single word. (define var 5) (translate var) This should return the string var and not the number 5. How do I do this using…
chustar
  • 12,225
  • 24
  • 81
  • 119
3
votes
4 answers

How modulo and remainder should work in Scheme?

I'm reading R5RS spec and it shows this: (modulo 13 4) ===> 1 (remainder 13 4) ===> 1 (modulo -13 4) ===> 3 (remainder -13 4) ===> -1 (modulo 13 -4) ===> …
jcubic
  • 61,973
  • 54
  • 229
  • 402
3
votes
2 answers

How are these nested vectors connected?

I've written a piece of code, which creates a vector 'scoreboard' that contains 3 seperate vectors of size 3, all containing the symbol ? at all indices 0-2. When i now execute a 'vector-set!' on the first vector of scoreboard, to change its first…
TomatoFarmer
  • 463
  • 3
  • 13
3
votes
2 answers

Using a defined procedure as argument yields different result than using a lambda-expression as argument

I'm trying to memoize a procedure in scheme. The code is from SICP I have my procedure fib defined as (define (fib n) (display "computing fib of ") (display n) (newline) (cond ((= n 0) 0) ((= n 1) 1) (else (+ (fib (- n…
toregh
  • 59
  • 1
  • 6
3
votes
2 answers

How does `values` work in Scheme?

From the R5RS standard: Values might be defined as follows: (define (values . things) (call-with-current-continuation (lambda (cont) (apply cont things)))) My first interpretation of this was that an expression like (+ (values 1 2)) is…
Gradient
  • 2,253
  • 6
  • 25
  • 36
3
votes
2 answers

Racket Function with Two Arguments

I'm trying to review my final exam in R5RS, but having trouble with a simple problem. My professor isn't really helpful and I don't know anybody in my class. Can you help me? The function ratio takes in two parameters f (function) and x (a number).…
Laura
  • 31
  • 2
3
votes
1 answer

How to Use "random" function in DrScheme R5RS

I want to use a "random" function in DrScheme R5Rs but it says it does not exist. But it is possible to use in "Advanced student", I need to use it in R5RS, what is the way to do it? Thank you in advance!
Jack Green
  • 141
  • 2
  • 12
3
votes
2 answers

DrRacket, R5RS and the error procedure

I love DrRacket IDE, but currently I'm building a pet project where I would like to be independent from it, meaning i'm commited to use only R5RS standard procedures. The thing is, in DrRacket there's this procedure called "error" which i would like…
Landau
  • 83
  • 1
  • 3
3
votes
1 answer

General memoization procedure in Scheme

I am trying to create a general memoization procedure in Scheme. This is what I have so far (it's almost completely the same as excercise 3.27 in the SICP book): (define (memo proc) (let ((table (make-table))) (lambda (args) (let ((prev…
user16655
  • 1,901
  • 6
  • 36
  • 60
3
votes
1 answer

Implementation of LIFO list in Scheme

I'm having some trouble implementing a LIFO list in Scheme. My code works just fine if I only want to push one element on to the stack, but I want to be able to push several elements. Here is my code: (define (make-stack) (let ((stack '())) …
user16655
  • 1,901
  • 6
  • 36
  • 60
3
votes
1 answer

Is there a Macro to use "λ" character as "lambda" in R5RS Scheme?

Is there a Macro to use "λ" character as "lambda" in R5RS Scheme? From here In Gambit "scheme-r5rs" I tried: (define-syntax λ (syntax-rules () ((_ . more) (lambda . more)))) But I keep getting Ill-formed expression error.
GlassGhost
  • 16,906
  • 5
  • 32
  • 45
3
votes
1 answer

Is there an official documentation standard for Scheme?

Java has javadoc. Python has docstrings. But what about Scheme? I'm wondering if there is any standard way of commenting Scheme programs that allows for later creation of documentation. It's being hard to find it on Google because "Scheme" means a…
Felipe
  • 16,649
  • 11
  • 68
  • 92
3
votes
2 answers

Portable load/include of define-syntax in R5RS Scheme?

I'm trying to write something that works in both DrRacket/plt-r5rs and Gambit/gsi. The problem I'm having is that (load "foo.scm") in Gambit does not load define-syntax-blocks. Using (include "foo.scm") in Gambit works, but of course results in a…
Erik Vesteraas
  • 4,675
  • 2
  • 24
  • 37
3
votes
2 answers

How to implement call-with-values to match the values example in R5RS

R5RS says... Values might be defined as follows: (define (values . things) (call-with-current-continuation (lambda (cont) (apply cont things)))) It doesn’t, however, say how call-with-values might be implemented if values were implemented…
Robert Fisher
  • 578
  • 4
  • 20
1
2
3
14 15