Essential SiC Primer

Source: Internet
Author: User
Tags mathematical functions
Summary

This book uses the lisp language itself as an example to illustrate the various metaphysical problems of "computer programs:

  • Elements of the language itself (primitive, combination, and abstraction)

  • Program Computing Model (substitution model, environment model, iteration, recursion)

  • World View of the Program (Object and function)

  • How programs multiply and evolve (meta-language abstraction)

  • How to execute the program (compile and explain)

Several Key Technologies commonly used in programming are described as follows:

  • Register and stack usage (Basic abstraction of most computers)

  • Data-oriented and general-purpose computing (involving the unification of high-level processes and data and processes)

  • Concurrent Programming (conflicts between models and time series)

  • History Memory (cache)

  • Application order and regularizedorder, and the method of inertia and delay Evaluation

  • Iteration and tail recursive Conversion

The last two seem to be just an optimization technology. In fact, they involve the legitimacy of the program and the predictability of the running results.

There are also several special programming techniques:

  • Simulation of non-deterministic computing of time forks

  • Logical Program Design for logical reasoning Simulation

  • Design of a constraint system for simulating mathematical formulas

I. Language Elements

Each powerful language provides three mechanisms:

  • Basic ExpressionsUsed to represent the simplest individual concerned with the language

  • Combination MethodThey can be used to construct composite elements from simple things.

  • Abstract MethodYou can use them to name composite objects and operate them as cells.

Ii. Unification of data and processes

First-level element privileges:

  • You can use the variable name.

  • Can be provided to the process as a parameter

  • It can be returned as a result through a process.

  • Can be included in the data structure

Lisp gives the process a complete first-level State. In general, we can define the data:

  • A set of appropriate Constructor (required) and function Selection (required) and Function Change (optional)

  • To make these functions a set of valid representations, they must meet a set of specific conditions.

In this way, the data and process are completely unified in lisp.

Iii. concurrency, time and communication

The basic phenomenon of concurrency is that the shared state is synchronized between different processes, or the events generated by inter-process communication are forced to proceed in a specific order. In essence, in concurrency control, any concept of time must have an internal relationship with communication. Interestingly, this relationship between time and communication also appears in relativity, the speed of light there (the fastest signal that may be used for synchronization events) is a basic constant related to time and space; the complexity we encounter in the computing model field during processing time and status, in fact, it may be a reflection of the most basic complexity in the physical world.

Iv. Object Model and functional model

From the perspective of a part of a complex process, other parts seem to change over time, and they have hidden local states that change over time; if we want to write programs, when a computer uses a certain structure to simulate such natural decomposition in the real world, it will make some objects that are not functional-they must change over time; we use local state variables to simulate the state, and assign values to these variables to simulate state changes. In doing so, it is to use the computing execution time to simulate the time in our world, that is, to put the "object" into the computer.

It is powerful and intuitive to use objects for simulation. The main cause of this situation is that it is very consistent with our views on the world in which we are in and communicating with them. However, as we have already seen over and over again, this model also produces dependencies on the order of events and the thorny issue of synchronizing multiple processes; the possibility of avoiding these problems promotes the development of functional programming languages, which do not provide assignment or change objects at all. In such languages, all processes implement well-defined mathematical functions on their parameters, and their behavior will not change. This is also an example in the physical world. When we observe a moving particle, we say that the position (State) of the particle is changing. However, from the perspective of the particle's world line, there is no change involved here.

However, if we look closely at it, we will see that time-related problems have also penetrated into the functional model, the reason is that the function model has nothing to do with time. It pushes the responsibility for providing temporal and temporal information to the user. When the user cannot provide temporal information, we need to re-introduce the same issue of functional style to eliminate.

We can simulate this world as a set of mutually isolated, time-constrained, locally stateful, and interactive objects, or we can also regard the world as a big function, it is a single, time-free, stateless unity. The approximation of an object model to the world lies in dividing it into independent parts, the functional model is not modularized along the boundary between objects. When the State of an object that is not shared is much greater than the state it shares, the object model is particularly useful. One thing that fails with this object view is quantum mechanics, where an object can be seen as an independent particle, resulting in paradox and confusion. The unification of object viewpoint and function viewpoint may have little to do with program design, but is related to basic epistemology. Each view has its own strong advantages, but there is no way for it to be completely satisfactory, and we are still looking forward to the emergence of a big unification.

V. Meta-language abstraction and General Machine

The profound idea here is that any valuer can simulate other valuers; in this way, the concept of "what can be computed in principle" (ignoring all practical questions about time and space) is irrelevant to languages or computers; it reflects a basic concept of "testability", which was first elaborated by Turing; turing provides a simple computing model-now known as a Turing Machine-and claims that any "effective process" can be described as a program of such a machine; turing then implemented a general machine, that is, a Turing machine, which acts like a valuer for all the Turing Machine programs.

Vi. Compilation and interpretation

Compilation can greatly improve the efficiency of program execution. The explanation provides a more powerful environment for Program Development and troubleshooting, because the source code to be executed is available during running, it can be checked and modified. In addition, because the entire database for basic operations is there, we can construct new programs during troubleshooting and add them to the system at any time;

Due to the complementary advantages of compilation and interpretation, the modern program development environment promotes a hybrid strategy, so that the explanatory program and compilation program can call each other; this allows programmers to compile those parts that they think have already ruled out errors, so as to achieve the efficiency advantage of the compilation method, and let those that are in interactive development and troubleshooting, the execution of constantly changing programs is still maintained in the interpretation mode. It also enables programmers to select the most appropriate language based on their actual problems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.