Lecture 1
Programming in Text (Mini-Quiz 1)
How to login to PollEverywhere!
On your phone / tablet, either scan the QR code here (or up on the screen) or go to pollev.com/baincs111
Step 1. CLICK LOGIN
Step 2. USE @U.NORTHWESTERN EMAIL ADDRESS
Step 3. CLICK LOGIN WITH NORTHWESTERN
Step 4. Follow sign-in steps with MFA
Step 5. You may need to go back to pollev.com/baincs111 after you've setup your account. Make sure to set your NetID as your Screen Name!!!
Reminders
Big ideas from Data Flow Recorded Lecture
Review 0. (not a question)
Review 1.
Review 2.
exceptions
What’s the output of this diagram?
Exceptions
Wrong number of inputs
What about this one?
What about this one?
concat needs two strings!
What about this one?
What about this one?
Argument type exception
Type signatures
Types and type checking
Argument type
exception
Type signatures
Types and type checking
Programming in Text
The�language question
What’s the best language?
The Racket language
We'll start the quarter using Racket’s Intermediate Student Language
This is ISL+ (intermediate student language)
COMP_SCI 111 Lore
Basics of ISL+
Functionality
Functional Aesthetics
Turning DFD into Text Programs
Let's figure out how to turn this into a text program
Names
Name Type 1: Constants
Examples (we'll see more types later)
Name Type 2: Variables
So that means…
So that means…
constant (number)
constant (number)
variable
(name: +)
(value: the plus function)
How do we call or execute a function?
constant (number)
constant (number)
variable
(name: +)
(value: the plus function)
The call function
Function calls
function input1 … inputn
(function input1 … inputn)
Examples:
Note: + and string-append can allow variable numbers of inputs in Racket (i.e. they are variadic)
Equivalent diagrams
(+ 1 2) means:
or really:
Exercise 0! Getting setup with DrRacket and writing a program.
extra
exercises
Skills to build
Look at a data flow diagram and:
Which of these has problems?
Which of these has problems?
+
1
2
+
4
1
+
2
+
2
4
call
1
+
1
call
1
2
3
+
Bad function
(1 isn’t a function)
Which of these has problems?
Which of these has problems?
call
1
2
+
call
call
+
2
1
call
1
2
+
call
4
+
“woof woof”
prefix
+
5
length
Bad function
(3 isn’t a function)
3
9
14
Index out of range
(string doesn’t have 14 characters)
Bad function
(1 isn’t a function)
Next week on CS 111…