Questions tagged [racket-student-languages]

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)

41 questions
1
vote
1 answer

Work with binary search trees in Racket

I want to create a binary search tree in Racket. The structure for tree looks like this: (define-struct tree-node (left right root)) Now I want to add these numbers in the tree: (define ex-list (list 1 4 6 2 7 8)) My Code for the insert…
user5331311
1
vote
2 answers

DrRacket: put two objects into big-bang

How can i put two objects with its own coordinates (define padle1 (rectangle 10 30 "solid" "red")) (define padle2 (rectangle 10 30 "solid" "red")) (define (place-dot-at ... ) ...) into bin-bang function (big-bang ... [to-draw place-dot-at]) Can i…
demsee
  • 53
  • 9
1
vote
1 answer

gcd: this name was defined previously and cannot be re-defined

I have to use DrRacket for this problem but every time I run the code, I get this error message "gcd: this name was defined previously and cannot be re-defined". (also I choose the language as Advanced student [custom] in DrRacket. below is my…
highspeedpog
  • 117
  • 1
  • 1
  • 8
1
vote
2 answers

Return smallest element in a list of numbers in Racket ISL?

I have to write a function in Racket ISL that takes a list of numbers and returns the smallest number in the list. Both min and max are not allowed. I think I have a start here; obviously recursion is needed. Eventually I'll use this function to…
Mark Schauer
  • 105
  • 1
  • 10
1
vote
2 answers

Racket image render

I need to make a function that will display an image under another image only if the Boolean fire? is #true here is my code: (define (render-rocket-fire RocketState FIRE) (cond [(or (rocket-state-fire? #true)) (place-image FIRE …
John C
  • 39
  • 6
1
vote
1 answer

Creating a function that outputs the largest value of a list of two numbers using only basic operators

everybody! So, I am a new student in a computer science class. I really have only been in there for a few weeks so I don't know much but my teacher really threw me a curveball. Just when I thought I was getting the hang of things he tells us to…
May
  • 11
  • 1
1
vote
1 answer

why is this code giving me a ran out of memory error code on racket?

I need to create a defintion that outputs a picture of a traffic light depending on a string either green yellow or red and whatever the string is determines which bulb is solid (define green-light (overlay (above (circle 15 "solid" "green") …
1
vote
2 answers

Why is this expression giving me a function body error?

(define (subtract-1 n) (string-append "Number is: " (number->string n)) (cond [(= n 0) "All done!"] [else (subtract-1(- n 1))])) I keep getting the error: define: expected only one expression for the function body, but found 1 extra…
dotnetN00b
  • 5,021
  • 13
  • 62
  • 95
0
votes
1 answer

How can i specify end of big bang using distance? (racket)

hi all i am working through the hdtp book,currently creating a simple animation which a moves car from left to right at a rate of three pixels per clock tick.i am not sure but i have tried to but not sure how to piece it all together.my objective is…
0
votes
1 answer

Racket/Beginner Student Language Code Error

I am trying to animate a word letter by letter using Beginner Student Language on Racket. However, this code gives me an error "function call: expected a function after the open parenthesis, but found a part". I bolded the part that is giving me…
Atlecx
  • 1
0
votes
1 answer

Racket BSL: How can I combine two instances of a structure in a list that have one common attribute?

I have a list of instances of a structure called "contact", which is basically a phone number and the duration a call with them took. I now want to add together all entries of the same phone number with the total duration of all calls with…
Another Noone
  • 11
  • 1
  • 5
0
votes
1 answer

Finite State Machine Simulation Implementation in ISL+ (Racket)

I'm a newbie working through HTDP2 (Felleisen et al.) on my own but have gotten stuck on question #380 of chapter IV -Intertwined Data. The problem is within the context of creating a DSL but I am first reacquainted with a general FSM Simulator and…
0
votes
1 answer

Counting ALL family members in an ancestry tree above a child - Racket (*SL)

Here's the data definition of a family tree (FT) from How To Design Programs (define-struct no-parent []) (define-struct child [father mother name date eyes]) (define NP (make-no-parent)) ; An FT is one of: ; – NP ; – (make-child FT FT String N…
Atharva Shukla
  • 2,098
  • 8
  • 21
0
votes
2 answers

How to have ball collide with bricks in Breakout (racket)

I've been trying to get Breakout to work in Racket, so far the ball bounces from the paddle (paddle is controlled by mouse) and the bricks are present Here is the full on code: (require 2htdp/image) (require 2htdp/universe) (define WIDTH…
Pompompurin
  • 165
  • 3
  • 14
0
votes
2 answers

Create a list from structures in Racket

I have the following code: (define-struct p (x z)) (define-struct s (p my-symbol)) (define N01 (make-s (make-p 22 'a) 'symbol)) (define N02 (make-s (make-p 25 'b) 'symbol)) (define N03 (make-s (make-p 23 'c) 'symbol)) (define my-list (list N01…
John P
  • 3
  • 1