PasteRack.org
Paste # 99100
2025-02-27 20:43:46

Fork as a new paste.

Paste viewed 656 times.


Embed:

  1. #lang racket
  2.  
  3. ;; The first three lines of this file were inserted by DrRacket. They record metadata
  4. ;; about the language level of this file in a form that our tools can easily process.
  5. #reader(lib "htdp-beginner-reader.ss" "lang")((modname ImageExamples) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
  6. ;The following is like an import statement. The library below is needed for image functions
  7. ;This library is the How to Design Programs library version 2
  8. (require 2htdp/image)
  9.  
  10. ;The following creates a solid green circle of radius 20
  11. (circle 20 "solid" "green")
  12.  
  13. ;The following creates a rectangle outlines with blue
  14. (rectangle 30 60 "outline" "blue")
  15.  
  16. ;The following makes an image out of a string
  17. (text "Hello" 24 "orange")
  18.  
  19. ;The following stacks circles above each other. Sort of seeing them from the side
  20. (above (circle 10 "solid" "red")
  21.        (circle 20 "solid" "green")
  22.        (circle 30 "solid" "blue"))
  23.  
  24. ;The following stacks circles besides each other
  25. (beside (circle 10 "solid" "red")
  26.         (circle 20 "solid" "green")
  27.         (circle 30 "solid" "blue"))
  28.  
  29. ;The following stacks circles within each other.
  30. (overlay (circle 10 "solid" "red")
  31.          (circle 20 "solid" "green")
  32.          (circle 30 "solid" "blue"))

=>