How to learn a new language

Source: Internet
Author: User

How to learn a new language?
1 Purpose of study? Solve the problem.
2 How do I fix a problem? Through the language itself and through and language-related libraries.

Learning is learning the use of language and the use of libraries.

We have generally learned one or several languages, from the process of learning the language we have developed the characteristics of the language. and use it to solve some problems. Then we re-ask these questions, how to solve them in the new language? This is a good practice process.

elements of the language:
language Element(called token in lexical analysis), which is the basic element of the constituent language. There are different rules in different languages. The types of the elements contain keywords, identifiers, and symbols. To know what the keywords in this language are, the constituent rules of identifiers (regular expressions), the meanings of various symbols.
Syntax :
Language is made up of statements or expressions (some functional languages are composed of functions and macros), what is the structure of these statements and expressions? How do you use these expressions?
As an example:
An If expression
In the C + +
IF-STMT:IF exp Stmts [Else STMTS]
If EXP is established then the execution Stmt,else section can be selected with or without
In the Lisp language
(If cond EXP1 [EXP2])
If cond is established then return EXP1 if there is exp2 return EXP2 otherwise nil
Loops
In the C + +
While-stmt:while (exp) stmts
If EXP is established then execute STMTS until exp is not established
Instead of using loop macros in Lisp, the language itself does not provide
When you understand the syntax of each statement or expression, you have mastered its semantics.

With these statements in hand, we can solve some common problems that do not involve libraries, that is, they can only be calculated, not input output and access other devices. These devices are provided for access by specific operating systems, so those libraries are designed to interact with the operating system or other facilities (such as databases, such as XML).
The next step is practice:
We need to grasp the language and grammar, the original problem to experiment.
1 Enter a different score and give a different rating. >90 for [80,90] b [60-80] C
In C language is
if (score >=) return ' A ';
If (score >=80 && score <90) return ' B ';
If (score >=60 && score<) return ' C ';
With Common Lisp
(if (>= score) ' A '
(if (and (>= score) (< score)) ' B '
(if (and (>= score) (<80 score) ' C ')))
2 print out the 9*9 matrix
C + +
for (int i=1;i<=9;i++)
for (int j=1;j<=9;j++)
printf ("%d", i*j);
Lisp
(Loop
For I from 1 to 9
Do (loop
For J from 1 to 9
Do (Format T "~a")))

Library Mastery: Reference books, example programs, experiments



How to learn a new language

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.