1 / 14

GBK Programming 1

GBK Programming 1. Jordan Johnson Introducing DrRacket. Today’s plan. Greetings GBK Today Class Web site DrRacket and programming Assignments Clean-up. DrRacket : Anatomy. Evaluate the definitions. Definitions. Interactions. Important Terms. Definitions area:

dimaia
Download Presentation

GBK Programming 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GBK Programming 1 Jordan Johnson Introducing DrRacket

  2. Today’s plan Greetings GBK Today Class Web site DrRacketand programming Assignments Clean-up

  3. DrRacket: Anatomy Evaluate the definitions Definitions Interactions

  4. Important Terms • Definitions area: • area for writing programs • “Save” saves its contents • “Run” computes the results of its contents • Interactions area: • area for testing & experimentation • DrRacket prompts you for a program… • …and then returns your program’s result. • Programs consist of expressions

  5. Simple programs in BSL • (BSL = “Beginning Student Language”) • Expressions are one of the following: • something simple (a number), or • ( …more than one thing… ) • Compound expressions always start & end with parens.

  6. Simple programs (refined) • Expressionsare one of the following: • something simple (a number), or • (AN-OPERATION AN-EXPRESSION …) • AN-OPERATION stands for the name of some operation like +, *, sin, and so on… • When you see a “(“, the thing afterwards is always* an operation.

  7. “Something simple”:more than numbers • Other types of data: • strings: • “howdy there” • “55” • booleans: • true • false • images:

  8. Operations • On numbers: • +, -, *, /, expt, sin, … • <, >, <=, >=, = • On strings: • string-length • string-append • substring • On booleans: • and • Or

  9. Practice • Use the Interactions window to try some operations: • Multiply three or four numbers • Take the square root of a number • Add two numbers and convert the result to a string • Append several strings together • Compute the length of a string

  10. Expressions inside expressions • As the definition of expressions suggests, we can nest them: • (number->string (string-length “potato”))  “6” • (sqrt (+ (* 5 5) (* 12 12)))  13

  11. Definitions • The top half of the window is the Definitions area. • Executed when you click “Run”. • Contents remain saved. • Can contain expressions and definitions. • Example definitions: • (define x 8) • (define y 36)

  12. To Learn More The Help Desk lets you search for particular functions. If your cursor is on a function name, pressing F1 looks up the function’s help info.

  13. Due Date Reminders • By tomorrow: • Sign & return syllabus • Email me your HW #1 • All instructions are on the class website.

  14. Clean-up • Before you leave, please . . . • Log out. • Push in your chair. • Make sure you’ve got everything. • Make sure all trash ends up in the trash can.

More Related