Skip to content
Zhengyuan Zhu
Go back

Riddle of Computer Science by Yin Wang (Ongoing)

Introduction: Riddle of Computer Science

Writing Motivation

Einstein: If you can’t explain a problem to a six-year-old child, you don’t really understand it

Writing Goal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
if(you have read this book):
    while(end of world and computers no longer exist):
        you can build computers from scratch, cool!

Chapter One: First Introduction to Computing

The Essence of Computing

Parallel computing is good, but it also introduces other problems:

(5 - 3) * (4 + (2 * 3 - 5) * 6)
===>
{
    a = 2 * 3
    b = a - 5
    c = b * 6
    d = 4 + c
    e = 5 - 3
    e * d
}

Making the result of statements completely consistent with the original expression. This translation process that preserves the original semantics is called compilation

1
2
3
t->t*2 //This is our fan controller, which is also the simplest function:
f(t) = t*2 //Let's be more formal
f(2)   // value is 4

Branching Consider the following scenario: We want a “beverage selector”

1
2
3
4
5
6
7
8
t-> if(t < 22)
    {
        "hotpot"
    }
    else
    {
        "ice cream"
    }

Summary: Elements of computation

Functions and function calls

Like learning to drive a car, once you master the gas pedal, brakes, gear shifter, steering wheel, and speedometer functions and usage, you’ve learned to drive all cars, regardless of their model.


Share this post on:

Previous Post
Quantitative Investment
Next Post
BUPT Reexamination Written Test Review
Jack the orange tabby cat
I'm Jack 🧡
Luna the tuxedo cat
I'm Luna! 🖤