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

Why doesn't the set! function modify the original list in Scheme (r5rs)?

I am trying to write a function which takes a list (x) and a number (y) and deletes every occurance of that number in the list. Ex. (deepdeleting '(0 0 1 2 0 3 0) 0) ===> '(1 2 3) Here's what I have so far: (define (deepdeleting x y) (if…
Kittenmittons
  • 400
  • 3
  • 14
0
votes
1 answer

Parsing lists to determine type of element

I am trying to create a simple recursive function that takes a list, and applies the appropriate functions based on the element of the list. On input: Input: (myfunct '(plus ( minus(5 4) 3 ) ) Output: 4 So I check what the string is, then…
Colton
  • 1,297
  • 14
  • 27
0
votes
1 answer

Define value as variable

How can I define value of variable as variable name? For example I define x as newname (define x 'newname) then I want to define new variable with name of value of x. I want something like (define x 'asd) and if I call newname I get 'asd Is it…
JohnDow
  • 1,242
  • 4
  • 22
  • 40
0
votes
1 answer

Application not a procedure (Scheme map procedure)

I am attempting to write my own simplified map procedure in R5RS. In short, it takes a procedure and two lists, and returns a list with the results of the procedure called on every pair of objects in the two argument lists, until either is…
Henrik Hillestad Løvold
  • 1,213
  • 4
  • 20
  • 46
0
votes
2 answers

How does lambda deal with unbound variables inside its body in scheme?

In this code snippet: (begin (define f '()) ((lambda () (set! f (lambda (x) (g x 5))))) (define (g x y) (+ x y)) (f 5)) when (set! f (lambda...)) is evaluated, the variable g is not bound to any location. As the spec for R5RS (link…
wecing
  • 534
  • 1
  • 3
  • 19
0
votes
3 answers

Scheme lambda and all procedures runs

When trying to run these procedures, it seems everything is fine until I call (set! fib (mem 'memorize fib)) (fib 10) (fib 10) (set! fib (mem 'unmemorize fib)) (fib 4) What happens is after I changed 'memorize TO 'unmemorize is that it does…
0
votes
1 answer

Time or thread function in r5rs

I made a game which uses the time for calculating the effect of gravity in relation of the time (speed and movement). Although the game uses mostly r5rs functions, I used the thread, sleep and other functions to update and remember the time, which…
Arno Moonens
  • 1,163
  • 1
  • 10
  • 19
0
votes
1 answer

Improving a derivatives example in Scheme

I am trying to make a scheme derivatives calculator more accepting of inputs, starting with the sum procedure and eventually the product. I have been trying to modify the procedure to accept inputs in the form of (deriv '(* x y (+ x 3)) 'x) instead…
Slater
  • 21
  • 1
  • 7
0
votes
1 answer

Scheme streams of matrices

I would like to have a stream in scheme that holds a bunch of matrices that have a certain order. The stream-car of this stream would be the matrix [1 6 0 3]; that is, row 1 col 1 is 1, row 1 col 2 is 6, row 2 col 1 is 0, and row 2 col 2 is 3. Each…
Matt
  • 5,408
  • 14
  • 52
  • 79
0
votes
1 answer

Scheme function that returns function is returning unexpected value

I have a function in scheme (define (m-m f) (let ((count 0)) (define (h-m-c?) count) (define (r-c) (begin (set! count 0) count)) (define (m-f m) (cond ((eq? m 'h-m-c?) (h-m-c)) ((eq? m 'r-c) (r-c)) …
Matt
  • 5,408
  • 14
  • 52
  • 79
0
votes
1 answer

Scheme Error, Return Binary Search Tree as Ordered List (R5RS)

I am a noob at Scheme. I have a binary search tree. The format of a node is a list of three elements, the first being the value at the node, the second being the left child node, and the third being the right child node. The "make" function creates…
Ryan C. Stacy
  • 87
  • 1
  • 7
0
votes
3 answers

Scheme recursion function

Hey i've been stuck on the following problem and cant seem to come up with the correct function. Write a recursive function that, given a positive integer k, computes the product k: (1-1/2)(1-1/3)(1-1/k)... as k decreases by one. I cant seem to come…
user1661660
-1
votes
2 answers

Scheme procedure in a list

So imagine i have a list '(+ (* (x) (5)) (2)) How would i make a procedure that changes the x to whichever parameter i give and then evaluates the function inside the list? ((calculate expression x)) I had some ideas but didn't get it to work. These…
E.T.
  • 1
-1
votes
1 answer

Mergesort in Racket in R5RS

I'm trying to write mergesort in Racket (in R5RS). I'm not sure how I'm getting so many syntax errors. So, I've learned from the help of those who commented that I was actually writing in R and not R5RS. I'm new to learning either language so I…
DjMaxLETU
  • 41
  • 1
  • 7
-1
votes
1 answer

Scheme::R5RS. I'm studying lambda and I don't understand these codes

I'm studying lambda for my midterm and I understand the concept. **the lambda function is just a way of defining a function without giving it a name. **the lambda format has to be ((lambda (x y z) (formula) parameter) **please fix me if I'm…
Honolulu
  • 23
  • 3
1 2 3
14
15