=====
CS 111 - Week 2 Lecture 2 - 2024-09-05
=====
=====
TODAY WE WILL:
=====
* announcements
* more on identifiers
* more on named constants
* intro to check-expect
* intro to writing your own functions
(and the DESIGN RECIPE)
* prep for next class
=====
SYNTAX of a BSL Racket identifier
=====
* identifier: any name determined by a programmer
* Some examples of identifiers are named constants,
function names, parameter names, and more
* In BSL Racket, syntax for an identifier
is any collection of characters that
does NOT include a blank or tab or newline
AND does NOT include any of the special characters:
( ) [ ] { } " , ' ` # | \
AND ALSO does not follow the syntax rules for
a Racket type
(also: it can't have already been defined in the
current file! 8-) )
* that's SYNTAX.
* there's also STYLE -- we'd like to write programs
that we can read AND others can read
common STYLE for identifiers (also now CS 111 CLASS STYLE STANDARDS)
* identifiers to start with a letter
* chosen to be meaningful, descriptive, and NOT misleading
* named constants should be all-uppercase
* function names should be all-lowercase (or at least
start with a lowercase letter -- camelCase is OK)
* parameter names should be all-lowercase (or at least
start with a lowercase letter -- camelCase is OK)
* reminder: once you define a named constant,
that name is now a simple expression of the defined value
and of the defined type
(define MAX-YOG 35) ; in fahrenheit
* now MAX-YOG is a simple expression of type number,
whose value is 35
* now moving over to DrRacket Definitions window!
(posted along with these notes)