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
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Card Sorting
1/15
Earn XP
Description and Tags
Computer Science
University/Undergrad
Add tags
Study Analytics
All
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
explo psych + neuroscience
Updated 320d ago
Note
Preview
Hitler's Germany
Updated 67d ago
Note
Preview
Nutrition Assessment
Updated 584d ago
Note
Preview
ap bio: unit 6 notes
Updated 115d ago
Note
Preview
Introduction to the Legal System
Updated 281d ago
Note
Preview
Plant Tissue
Updated 784d ago
Note
Preview
english 2 tfa test stuff
Updated 793d ago
Note
Preview
Reproductive System
Updated 350d ago
Note
Preview
Explore top flashcards
A&P
Updated 920d ago
Flashcards (51)
Preview
Días de la semana
Updated 229d ago
Flashcards (20)
Preview
Intro To Quantitative Analysis - Decision Analysis
Updated 83d ago
Flashcards (55)
Preview
Urinary System
Updated 188d ago
Flashcards (53)
Preview
Product Design Modelling Test
Updated 113d ago
Flashcards (26)
Preview
J,K,L
Updated 920d ago
Flashcards (20)
Preview
AP Psych - Unit 5
Updated 45d ago
Flashcards (120)
Preview
Vocabulaire pour Thème 2.
Updated 930d ago
Flashcards (130)
Preview