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

Deleting n elements of a List

I am writing a program that does some list manipulations in scheme (R5RS). I am trying to create a procedure that will remove n items at index i of a list L. I have written procedures that return all but the first n items in L and a procedure that…
user53073
  • 51
  • 7
0
votes
2 answers

Explanation of evaluation for this Scheme procedure using lambdas

I was wondering how the following code evaluates to 3. (define (foo y) ((lambda (x) y) ((lambda (y)(* y y)) y))) (foo 3) I have been looking at it for a while and cannot seem to understand why the evaluation does not result in 9. Could someone…
MastRofDsastR
  • 131
  • 1
  • 11
0
votes
0 answers

Scheme program that evaluates a list of numbers into subsets

This is my first attempt at Scheme & I seem to be stuck at the end of the line. This program is to take a list of numbers, two-subsets and pull numbers that equal the same sum. ie; 5 + 2 = 7 and 4 + 3 = 7. The program should print the two subsets {5…
wackyred
  • 1
  • 1
0
votes
2 answers

Writing a Division Function in Scheme

I'm trying to create a Division function using only subtraction. What I have so far is enough to handle positive numbers. What keeps tricking me up is handling it for negative numbers. I can go ahead and just grab the absolute value of x and y and…
Devyn Hedin
  • 37
  • 3
  • 7
0
votes
2 answers

Scheme program not evaluating nested lists?

I'm writing a scheme program that evaluates a list with the operator on the end. Example: (evaluate '(1 2 +)) --> 3 I have the function working for basic operators (+, -, *, /) but the issue comes in when I have a nested list. Example: (evaluate…
0
votes
1 answer

How to write to a file in append mode -scheme R5RS?

(call-with-output-file "b.txt" (lambda (output-port) (display "hello, world" output-port))) How to open the b.txt in append mode. So that, my results will be appended in the text file. I have found some answer in the following. But that's not what…
vishnu
  • 891
  • 2
  • 11
  • 20
0
votes
2 answers

Scheme: Not a procedure (Dr. Racket)

I'm running this program in Dr. Racket using R5RS scheme and am getting this error on the line (+ 1 IntDivide((- x y) y)): "application: not a procedure; expected a procedure that can be applied to arguments given: 5 arguments...:" The…
Knight Artorias
  • 105
  • 1
  • 6
0
votes
1 answer

How to get system date in R5Rs in Scheme/DrRacket

In DrRacket IDE, I was able to get the system date in the following manner when the language setting was 'Swindle': (define currentMonth 0) (let ((date (seconds->date (current-seconds)))) (set! currentMonth (date-month date)) ) Now, I need to…
Roy
  • 763
  • 2
  • 8
  • 18
0
votes
2 answers

Scheme - Lambda as a Bad Function Object

I'm working on a metacircular evaluator in Scheme for homework, and I need to allow the user to install special forms by adding them to a table. The idea is that, when the user enters something like (square 5), the evaluator will look up forms named…
JazzBullets
  • 63
  • 1
  • 10
0
votes
1 answer

In scheme (racket, R5RS) how can I call my function like this

I am calculating a continuous fraction (The golden ratio for now) and this is my code: (define cont-frac (lambda (n d k) (define res (+ (/ n d) n)) (if (= k 0) res (cont-frac n res (- k 1))))) And i call it like…
pootyy
  • 55
  • 6
0
votes
2 answers

SCHEME Mutable Functions

I've been self-teaching myself Scheme R5RS for the past few months and have just started learning about mutable functions. I've did a couple of functions like this, but seem to find my mistake for this one. (define (lst-functions) (let ((lst…
Sara
  • 3
  • 2
0
votes
1 answer

Reference implementation of Scheme macro system

Does there exist a reference implementation of the Scheme macro system? That is, an open source implementation of RxRS macros, that's written in portable Scheme rather than in terms of compiler internals?
rwallace
  • 31,405
  • 40
  • 123
  • 242
0
votes
3 answers

R5RS scheme code find sum of the even elements in a list(recursive and higher order abstractions)?

(define mylist (list 1 2 3 5 8 9 10)) ;;sum of the squares of the even elements of mylist (define (evens lis) (cond (;; Check stop condition 1 (null? lis) '()) (;; Check stop condition 2: list of length = 1 …
Joe Knight
  • 11
  • 3
0
votes
1 answer

Streams and procedures with variable number of arguments in Scheme

I'm trying to create a stream version of map that takes a variable number of streams as argument. The problem I have is that I want it to handle streams of various size, and that it will terminate when one of them is empty. If i was dealing with…
user16655
  • 1,901
  • 6
  • 36
  • 60
0
votes
1 answer

Do you have to use display to output stuff using r6rs?

Background: I am new to scheme, and am using DrScheme to write my programs. The following program outputs 12345 when I run the program as r5rs: 12345 However the following program outputs nothing (it's an r6rs program): #!r6rs (import…
Cam
  • 14,930
  • 16
  • 77
  • 128