4 Data Manipulation - Basic Tools
4.1 Data Sci Data
read
Map add1 over a list of numbers from 1 and 5 to get the numbers 2 through 6.
code
#lang data-sci (map add1 (list 1 2 3 4 5))
4.2 Data Sci Data
read
Map sub1 over the numbers from 0 to 100 to get the numbers -1 through 98.
code
#lang data-sci (map sub1 (range 100))
4.3 Data Sci Data
read
Map the circle function over the range of numbers from 10 to 100, skipping every 10 numbers. You should get back a list of circles of increasing size.
code
#lang data-sci (map circle (range 10 100 10))
4.4 Data Sci Data
read
Map the rectangle function over two lists of numbers between 0 and 10, getting a list of squares.
code
#lang data-sci (map rectangle (range 10) (range 10))
4.5 Data Sci Data
read
Map the string-upcase function over a list of six lowercase strings of your choice.
code
#lang data-sci (map string-upcase '("apple" "dog" "banana" "cat" "orange" "fish"))
4.6 Data Sci Data
read
Map the string-downcase function over a list of six uppercase strings of your choice.
code
#lang data-sci (map string-downcase '("APPLE" "DOG" "BANANA" "CAT" "ORANGE" "FISH"))
4.7 Data Sci Data
read
Map the even? function over a list of numbers from 0 to 99.
code
#lang data-sci (map even? (range 100))
4.8 Data Sci Data
read
Map the not function over three booleans.
code
#lang data-sci (map not '(#f #t #f))
4.9 Data Sci Data
read
Find the sum of all the numbers from 0 to 99.
code
#lang data-sci (apply + (range 100))