https://github.com/nitin42/nitin-blog
Welcome to my blog!
https://github.com/nitin42/nitin-blog
Last synced: 4 months ago
JSON representation
Welcome to my blog!
- Host: GitHub
- URL: https://github.com/nitin42/nitin-blog
- Owner: nitin42
- Created: 2017-12-22T12:27:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-28T17:09:39.000Z (over 7 years ago)
- Last Synced: 2025-01-12T23:11:22.229Z (5 months ago)
- Homepage:
- Size: 1.95 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Jotting-about-programming
> My personal record that includes some brief notes about the programming, computation models and techniques, mostly taken from the books I've read so far.### Elements of programming
* **Expressions** - Simple operation a language is concerned with.
* **Composition** - Building compound elements from simpler elements.
* **Abstraction** - Manipulating and constructing the compounds elements with a name and evaluating them as a unit.
### Reliably constructing a program
Knowing the different elements of programming is not enough to reason about the procedures and processes. To construct a program, we should be able to visualize the process which is generated by a procedure, study its effects and its behaviour.
> From SICP, ***A procedure is a pattern for the local evolution of a computational process.***
### Evaluations
* **Normal order evaluation** - Fully expand an expression and then reduce to generate the result
* **Applicative order evaluation** - Evaluate the subexpressions or the arguments and then apply the procedure (operations like +, -, *)
### Processes
One or more process may compute same problem on the same domain but they may evolve differently with time and space.
* **Recursive process** - Expansion and then contraction. It can be represented as a chain of deferred operations (computation that will be performed later) called expansion and then performing those operations, contraction. Example 👇 - `n!(n-1)!`
```lisp
(factorial 3)
(* 3 (factorial 2)
(* 3 (* 2 (factorial 1)))
(* 3 (* 2 1))
(* 3 2)
6
```* **Linear recursive process** - When the amount of time and space grows linearly with n!
* **Iterative process** - A process that describes how state should be updated by a fixed number of state parameters as the process moves from one state to another state. An iterative process is terminated by an end test specific condition.
In **iterative process**, we can capture the state at any point of the time but same is not in the case of recursive process. A recursive process maintains some hidden state as the deferred chain grows linearly.
* **Tail-call recursive process** - An iterative process that takes constant space. In other words, avoid creation of a new stack frame.