=====
CS 111 - Week 2 Lecture 2 - 2025-09-04
=====

=====
TODAY WE WILL:
=====
*   announcements
*   continue intro to identifiers/defining your own names, part *1*
*   intro to check-expect
*   intro to writing your own functions AND the DESIGN RECIPE
*   prep for next class

=====
*   should be working on Homework 1, submitting those attempts!
    *   at-least-first attempts due by 11:59 pm on Friday, September 5

=====
REMINDER: 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 a consecutive collection of characters that:

    *   does NOT include a blank or tab or newline

    *   does NOT include any of the special characters:

        ( ) [ ] { } " , ' ` # | \

    *   AND ALSO does not follow the syntax rules for
        a Racket data type

    *   (also: it can't have already been defined in the
        current Definitions window/.rkt file! 8-) )

=====
*   REMINDER: some identifier-related CS 111 CLASS STYLE:

    *   make identifier names MEANINGFUL and NON-misleading

    *   start them with a letter (even though BSL Racket syntax does not
        require that...)

    *   write identifiers that are named constants in ALL-UPPERCASE

    *   write identifiers that are function names in all-lowercase 
        (but will also accept camelCase starting with a lowercase letter)

    *   write identifiers that are parameter names in all-lowercase, also
        (but will also accept camelCase starting with a lowercase letter)

=====
*   once you GIVE a value to an identifier, then THAT identifier, by itself, 
    is ALSO a simple expression; 

    *   (of what data type? the data type of its value)

=====
REMINDER: one kind of identifier: a NAMED CONSTANT
=====
*   a named constant is a name representing a value that will
    NOT change in your program

*   define can be used to define several different kinds of
    identifiers, DEPENDING ON HOW ITS ARGUMENTS ARE WRITTEN

*   syntax for a named constant in BSL Racket:

    (define DESIRED-NEW-NAME expression)

*   semantics: define does not return anything!

    *   BUT when define is written using the above syntax,

        it has the SIDE-EFFECT of making DESIRED-NEW-NAME
        a simple expression whose value is the value of
        the given argument expression,

        and its data type is the type of its given argument
        expression

*   reminder: class style: use ALL-UPPERCASE for a named constant's name

    (define MAX-SAFE-TEMP 80)

    ;-----
    ; now MAX-SAFE-TEMP is a simple expression of type number:

    MAX-SAFE-TEMP

    ;-----
    ; ...and MAX-SAFE-TEMP can be used anywhere an expression of
    ;     type number can be used:

    (< 50 MAX-SAFE-TEMP)

=====
check-expect - for TESTING functions
=====
*   BSL Racket provides several functions to allow you to
    write automatic tests for your functions (or just to
    check stuff)

*   syntax:

    (check-expect desired-expr-to-test
                  expected-value-of-desired-expr)

    semantics - rather sophisticated!
    *   it DOES compare the desired-expr-to-test
        and expected-value-of-desired-expr to see if they are equal;

        but Racket does this for ALL the check- expressions in
	the .rkt file, and SUMMARIZES at the END of the Interactions
	window the number passed if all passed;

        and if any fail? it pops up a separate window showing which
	failed, and the values that were expected and gotten;

=====
INTRO to DESIGN RECIPE - see today's posted Racket examples file!
=====