Home
Explore
Exams
Search for anything
Login
Get started
Home
Engineering
Computer Science
CS 135 (Module 7: Natural Numbers)
0.0
(0)
Rate it
Studied by 4 people
0.0
(0)
Rate it
Call Kai
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Knowt Play
Card Sorting
1/15
Earn XP
Description and Tags
Computer Science
University/Undergrad
Add tags
Study Analytics
All Modes
Learn
Practice Test
Matching
Spaced Repetition
Name
Mastery
Learn
Test
Matching
Spaced
No study sessions yet.
16 Terms
View all (16)
Star these 16
1
New cards
empty is a
(listof Int)
2
New cards
Is 0 a natural number?
Yes
3
New cards
What do logicians use to define the natural numbers?
Peano axioms
4
New cards
What do the Peano axioms include?
1. 0 is a natural number
2. For every natural number n, S(n) is a natural number
5
New cards
What is S(n) called?
The successor function
6
New cards
What is a successor function?
It is a function that consumes a natural number, and returns the next
7
New cards
What does the successor function produce?
The "next" natural number
8
New cards
What Racket function is used as the successor function?
add1
9
New cards
What is the inverse function of add1?
sub1
10
New cards
A Nat is one of:
- 0
- (add1 Nat)
11
New cards
What happens if (zero? n) is false?
Then n has the value (add1 k) for some k
12
New cards
How do we compute k?
We subtract 1 from n, using the built-in sub1 function
13
New cards
What do it mean to "go along for the ride"?
It is an informal CS135 expression for an argument that is passed unchanged in the recursive application.
14
New cards
What is the function for counting down?
;; requires: n >= base
(define (countdown-to n base)
(cond [(= n base) (cons base empty)]
[else (cons n (countdown-to (sub1 n)
base))]))
15
New cards
What does countdown-to require?
It requires for the relationship n>=b to hold.
16
New cards
What about counting up to b?
;; requires: n
Explore top notes
Transaction processing
Updated 928d ago
Note
Preview
AP World 1.4 - State Building in the Americas
Updated 805d ago
Note
Preview
Unit 8.1 The Mole
Updated 873d ago
Note
Preview
Coordination and Response (2.45-2.53)
Updated 1210d ago
Note
Preview
Chapter 3: Nations and Society
Updated 944d ago
Note
Preview
Chapter 20: Chemical Bonds
Updated 895d ago
Note
Preview
NOUNS
Updated 959d ago
Note
Preview
Chapter 10 Notes - Cell Growth and Division
Updated 1008d ago
Note
Preview
Transaction processing
Updated 928d ago
Note
Preview
AP World 1.4 - State Building in the Americas
Updated 805d ago
Note
Preview
Unit 8.1 The Mole
Updated 873d ago
Note
Preview
Coordination and Response (2.45-2.53)
Updated 1210d ago
Note
Preview
Chapter 3: Nations and Society
Updated 944d ago
Note
Preview
Chapter 20: Chemical Bonds
Updated 895d ago
Note
Preview
NOUNS
Updated 959d ago
Note
Preview
Chapter 10 Notes - Cell Growth and Division
Updated 1008d ago
Note
Preview
Explore top flashcards
ANAPHY: U13.1 Digestive System (Gastrointestinal Tract)
Updated 29d ago
Flashcards (167)
Preview
FLVS Chemistry: Module 3 Notes (w/ Flashcards)
Updated 499d ago
Flashcards (37)
Preview
BIO 171 - Chapter 6 Campbell Flashcards
Updated 789d ago
Flashcards (78)
Preview
Idiomatic Expressions
Updated 1077d ago
Flashcards (25)
Preview
BIOL 1442 Ch 47 The Biodiversity Crisis
Updated 923d ago
Flashcards (37)
Preview
Currencies Around the World
Updated 620d ago
Flashcards (199)
Preview
ANFS 101 Exam 4 Practice Questions
Updated 689d ago
Flashcards (154)
Preview
Comptia A+
Updated 419d ago
Flashcards (462)
Preview
ANAPHY: U13.1 Digestive System (Gastrointestinal Tract)
Updated 29d ago
Flashcards (167)
Preview
FLVS Chemistry: Module 3 Notes (w/ Flashcards)
Updated 499d ago
Flashcards (37)
Preview
BIO 171 - Chapter 6 Campbell Flashcards
Updated 789d ago
Flashcards (78)
Preview
Idiomatic Expressions
Updated 1077d ago
Flashcards (25)
Preview
BIOL 1442 Ch 47 The Biodiversity Crisis
Updated 923d ago
Flashcards (37)
Preview
Currencies Around the World
Updated 620d ago
Flashcards (199)
Preview
ANFS 101 Exam 4 Practice Questions
Updated 689d ago
Flashcards (154)
Preview
Comptia A+
Updated 419d ago
Flashcards (462)
Preview