The Racket Student Languages are a set of small languages meant to be used with the book How to Design Programs. They include Beginning Student Language (BSL and BSL+), Intermediate Student Language (ISL), Intermediate Student Language with Lambda (ISL+), and Advanced Student Language (ASL)
Questions tagged [racket-student-languages]
41 questions
7
votes
2 answers
How to set language to htdp/bsl in REPL
I have the following htdp/bsl program saved as example.rkt:
#lang htdp/bsl
(+ 1 1)
When the above is run using racket example.rkt, the output is as expected (i.e. 2).
However, when I try to start an REPL with htdp/bsl as the language (racket -I…

Flux
- 9,805
- 5
- 46
- 92
4
votes
1 answer
New to programming, question about exercise in Prologue of HTDP
This may be a silly question but I'm completely new to programming. I'm towards the bottom of the Prologue in "How to Design Programs" (2nd ed) and there are 4 changes that you are challenged to make to the "Rocket Landing" program in DrRacket.
I'm…

Asif Kazmi
- 43
- 4
3
votes
2 answers
BSL (How to Design Programs): how to import code from a separate file into definitions area?
I'm having an issue with BSL. I want to divide my code into separate auxiliary files and use
(require "auxiliary-function.rkt")
at the beginning to import the separated code into the definitions area. However it doesn't work as supposed. Though…

dekross
- 104
- 1
- 7
3
votes
2 answers
scheme how to return a form symbol + *
How can I define on scheme language this function that return if x>0 + else *
like:
plus_or_muliti(int x) {
if (x>0) return +;
else return *;
}
i try this and it not work on racket:
(define (plus_or_multi x)
(if (>= x 0) + *))
i got this…

Yaniv Valotker
- 31
- 1
2
votes
1 answer
What makes my image look half as wide as intended?
I am trying to place a vertically positioned rectangle and another object on an empty-scene using place-images in Beginning Student Language. However, when I run the function, the rectangle only takes up half the scene horizontally when its width is…

O1G
- 71
- 1
- 7
2
votes
0 answers
Is it possible to use `provide` in Racket's Student Language?
2.rkt has the following definition:
(provide plus)
(define (plus a b)
(+ a b))
and 1.rkt has:
(require "2.rkt")
(plus 3 4)
Both are in "Beginning Student Language" level (so no #lang line required) and are in the same directory.
This leads to…

Atharva Shukla
- 2,098
- 8
- 21
2
votes
2 answers
Programming Breakout in Racket (BSL) using big-bang. Running into an error upon placing the paddle
The goal is to make the game Breakout and doing it by steps. I'm already having problems with the first step which is implementing a paddle. The ball and bouncing of the ball was already predefined and given. I wish to put it in the (define (render…

Pompompurin
- 165
- 3
- 14
2
votes
2 answers
place-image not defined in Dr-Racket
I wrote a simple code in Dr-Racket and it is not working. Here is the code:
(place-image (circle 5 "solid" "green")
50 80
(empty-scene 100 100))
I have selected the BSL language for compiling but it is giving me the…

user590849
- 11,655
- 27
- 84
- 125
1
vote
1 answer
DrRacket - render every structure in a list
(define SCENE (empty-scene 500 500))
(define-struct pos (x y))
(define-struct ball (img pos))
;(define (render lst))
(define game (list
(make-ball (circle 10 "solid" "blue") (make-pos 250 250))
(make-ball (circle 10…

tim123908
- 21
- 2
1
vote
1 answer
How to make DrRacket give me exact numbers as fractions and not decimals?
I'm currently working with the beginning student language in DrRacket while reading through a book called "How to design programs". Currently if I type something like (/ 1 2) I get 0.5 as the answer, but the book seems to imply that there's an…

zlaaemi
- 113
- 4
1
vote
1 answer
Why does the list result returned by my function look funny?
(define (evenList xs)
(cond
((null? xs) '())
((eq? (cdr xs) '()) '())
(else (cons (cadr xs) (evenList (cddr xs))))))
I'm using this code but it doesn't create the list the way I want it. (evenList (list 1 2 3 4))…

DarKing
- 13
- 2
1
vote
2 answers
How to optimize runtime on recursive Racket function to determine maximum of element in list?
here is my wonderful & working LISP racket "intermediate with lambda" style recursive function to determine the symbol with the highest value of symbols in a list.
(define maximum
(lambda [x]
(cond
[(empty? x) 0]
[(cons? x)
…

ABC
- 189
- 9
1
vote
1 answer
Dr racket define error in student language. define: expected only one expression for the function body, but found 3 extra parts
When I write code in Dr Racket, I got error message
unsaved-editor:8:2: define: expected only one expression for the
function body, but found 3 extra parts in: (define (improve guess x)
(average guess (/ x guess)))
But this code can run in…

Namk0207
- 45
- 5
1
vote
2 answers
calculate the sum of proper divisors of a given number in Racket BSL
Design a Racket function named findProperDivisor that takes a natural number and calculates the sum of all its proper divisors. A proper divisor of a natural number is the divisor that is strictly less than the number.
Examples:
Input: 20
Output:…

İrem Sözen
- 21
- 4
1
vote
1 answer
Functions operating on two lists
I am working on a Racket program for a class and I am totally stumped as to
how to implement one of the features.
The program uses Big-Bang and is supposed to implement a simple Space Invaders game.
I have everything working except one piece, and…

julieb
- 43
- 1
- 5