;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname first) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ()))) ;;; Simple operations (+ 2 3) ( - 5 4) (* 2 3) (/ 10 5) (/ 10 3) ; the answer is a periodic number (/ 5 2) (+ 7 8 9) (+ 3.5 1) (* 3.5 2) ;; Some functions that you can use "Results of functions provided in the language:" (sqrt 4) (sqrt 2) ; The answer is an inexact number ;; What if you mistype a function name? ;(srt 5) (expt 10 3) (expt 10 30) ; Will this work? (expt 10 300) (expt 2 20000) ;; Combining opertions into more complex expressions "Evaluating expressions:" (+ (* 5 4) (- 6 (/ 14 2))) ; how do we compute (2 + 3) * 5 - 18 / 0.5 + 2 ? ;; Defining variables "Defining variables" (define a 3) a (+ a 2) a (define b 2) (- b a) (define c (+ b 2)) c ; Will this work? ;(define a 5) ;; Defining functions "Defining functions" (define (double x) (* x 2)) (double 5) (double -1)