Created
January 27, 2020 22:22
-
-
Save kmicinski/257c8214f5a6e8ab9a5af76f968fb3d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
;; Write a function that takes a list l, of numbers, | |
;; and returns a hash which maps each number to its | |
;; square | |
;; | |
;; hint: use a recursive (or tail-recursive) function | |
;; to loop over the elements of l and build up a hash | |
;; from each element, e, to (* e e). Finally, return | |
;; the hash. | |
(define (make-squares l) | |
;; correct type, but wrong result (no values) | |
(hash)) | |
;; This should return #t if you're correct | |
(equal? (make-squares '(1 2 3)) (hash 1 1 2 4 3 9)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment