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
-1
votes
1 answer

How do I write the test case for this code?

I've just started learning about trees and heaps and I'm unsure about how to go about writing the test case. These codes are from my lesson slides. Although they give codes, they sadly don't provide test cases of said codes, so I am confused on how…
seaweed
  • 21
  • 2
-1
votes
3 answers

Scheme: + is not a procedure?

I'm trying to learn scheme (more specifically R5RS), and I want to define a procedure that takes as input a list with 3 elements, for example: '(5 + 2), where the middle argument always is an operator, and the 1st and 3rd are always…
Bjørn Olav Jalborg
  • 373
  • 1
  • 3
  • 14
-1
votes
1 answer

writing a closure that applies an procedure to a series

I am trying to write a procedure that returns a closure. I want to be able to apply any procedure to my series. This is what I have so far and it is not working for me. (define (forAll n m) (lambda (op start) (op (op n start) (+ n 1)…
user8866063
-1
votes
1 answer

Writing a forAll procedure that takes two arguments: the start and end values of a series and applies a given procedure to that series

I am trying to write a forAll procedure that takes two arguments: the start and end values of a series. The resulting closure expects two arguments as well: an operation to apply to all elements in the series, as well as an initial value. This is…
user8866063
-1
votes
1 answer

Scheme definition error(short)

This is part of an interpreter I am making. I keep getting this error: define not allowed in an expression context in: (define ret1 (list->string wl)) I am using DrScheme version 371, language Standard (R5RS). (define (read-command) (set! com '(…
zero6142
  • 1
  • 2
-1
votes
1 answer

Change literal dynamically in scheme

I want to write a method that takes a literal, lets say turn end returns something like this (my turn) So, after that, if I call eval, scheme will call defined method my with parameter turn. I did manage just to return some another literal or…
JohnDow
  • 1,242
  • 4
  • 22
  • 40
-1
votes
3 answers

Using map in scheme, a strange thing happens when I use the display function

in scheme (I'm using racket R5RS) when I call this procedure (map display '(1 2 3 4 5)) it returns 12345(# # # # #) Why is that? What's up with the void?
Arash Saidi
  • 2,228
  • 20
  • 36
-1
votes
2 answers

implement length in r5rs scheme (drracket)

Is it possible to implement the R5RS scheme function "length" using the car and cdr family of functions? If so could someone post the implementation? Thanks,
MLD_Saturn
  • 87
  • 1
  • 1
  • 7
-2
votes
2 answers

Scheme R5RS contract violation

The code below is the answer given by the professor for a question in my intro to scheme course but it comes out with an error. Cannot see why. #!r5rs (define (make-complex a b) (cons a b)) (define (real x) (car x)) (define (imag x) (cdr…
Michael C
  • 1
  • 1
-2
votes
1 answer

Recursive call from Condition Branch

I'm starting to get to grips with Lisp and I'm trying to write a procedure to approximate pi using the Leibniz formula at the moment; I think I'm close but I'm not sure how to proceed. The current behavior is that it makes the first calculation…
I2obiN
  • 181
  • 3
  • 18
-2
votes
3 answers

How do I use and/or instead of if/cond?

I'm new to Scheme programming and I've gotten this task that I just can't find out how to work correctly. I'm supposed to define a procedure with one parameter (a number). If the number is positive I want 1 to be returned, -1 if the number is…
J. Doe
  • 1
-3
votes
1 answer

List splicing in racket

I want to create a procedure called (splice L i n A) where L is a list, i is an index, n is the number of elements and A is another list. So i is the index at which I would like to insert the list A into the list L and n is the number of elements…
-3
votes
1 answer

I am doing something wrong at DrRacket

So I read that DrRacket is a good IDE for common lisp. I downloaded it and have set the language as R5RS and written the following function definition: (defun f (x) (+ 5 5)) However it's returning an error defun: undefined; cannot reference…
Ren
  • 4,594
  • 9
  • 33
  • 61
-3
votes
2 answers

How to program this in R5RS?

I need help coding this in the syntax of r5rs in dr racket. Adapt the function so that it computes the sum of the first n even numbers
-4
votes
1 answer

R5RS Scheme, Huffman tree function

The goal was to create a huffman tree (google if you do not know what it is) whose output does not contain the weight of the value, just the values located in leaves held by the placeholder "internal" with. I have created a working function that…
MitchG
  • 1
1 2 3
14
15