diff options
77 files changed, 1234 insertions, 255 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..7bc9d01b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +/fr-fr/ @vendethiel
+/ru-ru/ @Menelion
+/uk-ua/ @Menelion
+/zh-cn/ @geoffliu
+/zh-tw/ @geoffliu
diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 96278da9..96278da9 100644 --- a/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index fd9d1b31..6a496409 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,5 @@ - [ ] I solemnly swear that this is all original content of which I am the original author -- [ ] Pull request title is prepended with `[language/lang-code]` +- [ ] Pull request title is prepended with `[language/lang-code]` (example `[python/fr-fr]` or `[java/en]`) - [ ] Pull request touches only one file (or a set of logically related files with similar changes made) - [ ] Content changes are aimed at *intermediate to experienced programmers* (this is a poor format for explaining fundamental programming concepts) - [ ] If you've changed any part of the YAML Frontmatter, make sure it is formatted according to [CONTRIBUTING.md](https://github.com/adambard/learnxinyminutes-docs/blob/master/CONTRIBUTING.markdown) diff --git a/bash.html.markdown b/bash.html.markdown index 7ca4285b..11ce4e74 100644 --- a/bash.html.markdown +++ b/bash.html.markdown @@ -27,12 +27,12 @@ for the GNU operating system and as the default shell on most Linux distros. Nearly all examples below can be a part of a shell script or executed directly in the shell. -[Read more here.](http://www.gnu.org/software/bash/manual/bashref.html) +[Read more here.](https://www.gnu.org/software/bash/manual/bashref.html) ```bash #!/usr/bin/env bash # First line of the script is the shebang which tells the system how to execute -# the script: http://en.wikipedia.org/wiki/Shebang_(Unix) +# the script: https://en.wikipedia.org/wiki/Shebang_(Unix) # As you already figured, comments start with #. Shebang is also a comment. # Simple hello world example: @@ -198,7 +198,7 @@ then fi # Note that =~ only works within double [[ ]] square brackets, # which are subtly different from single [ ]. -# See http://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs for more on this. +# See https://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs for more on this. # Redefine command `ping` as alias to send only 5 packets alias ping='ping -c 5' @@ -325,6 +325,9 @@ echo "#helloworld" | tee output.out >/dev/null # WARNING: `rm` commands cannot be undone rm -v output.out error.err output-and-error.log rm -r tempDir/ # recursively delete +# You can install the `trash-cli` Python package to have `trash` +# which puts files in the system trash and doesn't delete them directly +# see https://pypi.org/project/trash-cli/ if you want to be careful # Commands can be substituted within other commands using $( ): # The following command displays the number of files and directories in the @@ -332,15 +335,15 @@ rm -r tempDir/ # recursively delete echo "There are $(ls | wc -l) items here." # The same can be done using backticks `` but they can't be nested - -#the preferred way is to use $( ). +# the preferred way is to use $( ). echo "There are `ls | wc -l` items here." # Bash uses a `case` statement that works similarly to switch in Java and C++: case "$Variable" in - #List patterns for the conditions you want to meet + # List patterns for the conditions you want to meet 0) echo "There is a zero.";; 1) echo "There is a one.";; - *) echo "It is not null.";; + *) echo "It is not null.";; # match everything esac # `for` loops iterate for as many arguments given: @@ -377,6 +380,13 @@ do cat "$Output" done +# Bash can also accept patterns, like this to `cat` +# all the Markdown files in current directory +for Output in ./*.markdown +do + cat "$Output" +done + # while loop: while [ true ] do @@ -431,6 +441,8 @@ cut -d ',' -f 1 file.txt # replaces every occurrence of 'okay' with 'great' in file.txt # (regex compatible) sed -i 's/okay/great/g' file.txt +# be aware that this -i flag means that file.txt will be changed +# -i or --in-place erase the input file (use --in-place=.backup to keep a back-up) # print to stdout all lines of file.txt which match some regex # The example prints lines which begin with "foo" and end in "bar" @@ -448,7 +460,7 @@ grep -rI "^foo.*bar$" someDir/ # recursively `grep`, but ignore binary files grep "^foo.*bar$" file.txt | grep -v "baz" # if you literally want to search for the string, -# and not the regex, use fgrep (or grep -F) +# and not the regex, use `fgrep` (or `grep -F`) fgrep "foobar" file.txt # The `trap` command allows you to execute a command whenever your script @@ -457,6 +469,7 @@ fgrep "foobar" file.txt trap "rm $TEMP_FILE; exit" SIGHUP SIGINT SIGTERM # `sudo` is used to perform commands as the superuser +# usually it will ask interactively the password of superuser NAME1=$(whoami) NAME2=$(sudo whoami) echo "Was $NAME1, then became more powerful $NAME2" diff --git a/c++.html.markdown b/c++.html.markdown index 948b52ec..6e94e03e 100644 --- a/c++.html.markdown +++ b/c++.html.markdown @@ -2,16 +2,16 @@ language: c++ filename: learncpp.cpp contributors: - - ["Steven Basart", "http://github.com/xksteven"] + - ["Steven Basart", "https://github.com/xksteven"] - ["Matt Kline", "https://github.com/mrkline"] - ["Geoff Liu", "http://geoffliu.me"] - - ["Connor Waters", "http://github.com/connorwaters"] - - ["Ankush Goyal", "http://github.com/ankushg07"] + - ["Connor Waters", "https://github.com/connorwaters"] + - ["Ankush Goyal", "https://github.com/ankushg07"] - ["Jatin Dhankhar", "https://github.com/jatindhankhar"] --- C++ is a systems programming language that, -[according to its inventor Bjarne Stroustrup](http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Keynote), +[according to its inventor Bjarne Stroustrup](https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Keynote), was designed to - be a "better C" @@ -37,7 +37,7 @@ one of the most widely-used programming languages. // Just like in C, your program's entry point is a function called // main with an integer return type. // This value serves as the program's exit status. -// See http://en.wikipedia.org/wiki/Exit_status for more information. +// See https://en.wikipedia.org/wiki/Exit_status for more information. int main(int argc, char** argv) { // Command line arguments are passed in by argc and argv in the same way @@ -483,7 +483,7 @@ public: void setOwner(const std::string& dogsOwner); // Override the behavior of the print function for all OwnedDogs. See - // http://en.wikipedia.org/wiki/Polymorphism_(computer_science)#Subtyping + // https://en.wikipedia.org/wiki/Polymorphism_(computer_science)#Subtyping // for a more general introduction if you are unfamiliar with // subtype polymorphism. // The override keyword is optional but makes sure you are actually @@ -616,7 +616,7 @@ boxOfBox.insert(intBox); // template<typename T> // instead. The 'class' keyword and 'typename' keywords are _mostly_ // interchangeable in this case. For the full explanation, see -// http://en.wikipedia.org/wiki/Typename +// https://en.wikipedia.org/wiki/Typename // (yes, that keyword has its own Wikipedia page). // Similarly, a template function: @@ -660,7 +660,7 @@ printMessage<10>(); // Prints "Learn C++ faster in only 10 minutes!" ///////////////////// // The standard library provides a few exception types -// (see http://en.cppreference.com/w/cpp/error/exception) +// (see https://en.cppreference.com/w/cpp/error/exception) // but any type can be thrown as an exception #include <exception> #include <stdexcept> @@ -1030,7 +1030,7 @@ sort(dog_ids.begin(), dog_ids.end(), [&weight](const int &lhs, const int &rhs) { return weight[lhs] < weight[rhs]; }); // Note we captured "weight" by reference in the above example. -// More on Lambdas in C++ : http://stackoverflow.com/questions/7627098/what-is-a-lambda-expression-in-c11 +// More on Lambdas in C++ : https://stackoverflow.com/questions/7627098/what-is-a-lambda-expression-in-c11 /////////////////////////////// // Range For (C++11 and above) @@ -1106,7 +1106,8 @@ f1 = f2; #include<tuple> -// Conceptually, Tuples are similar to old data structures (C-like structs) but instead of having named data members, +// Conceptually, Tuples are similar to old data structures (C-like structs) +// but instead of having named data members, // its elements are accessed by their order in the tuple. // We start with constructing a tuple. diff --git a/c.html.markdown b/c.html.markdown index a57be1dc..ff396d21 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -224,10 +224,18 @@ int main (int argc, char** argv) (float)i1 / i2; // => 0.5f i1 / (double)i2; // => 0.5 // Same with double f1 / f2; // => 0.5, plus or minus epsilon + // Floating-point numbers and calculations are not exact + // for instance it is not giving mathematically correct results + (0.1 + 0.1 + 0.1) != 0.3; // => 1 (true) + // and it is NOT associative + 1 + (1e123 - 1e123) != (1 + 1e123) - 1e123; // => 1 (true) + // this notation is scientific notations for numbers: 1e123 = 1*10^123 - // Modulo is there as well - 11 % 3; // => 2 + // Modulo is there as well, but be careful if arguments are negative + 11 % 3; // => 2 as 11 = 2 + 3*x (x=3) + (-11) % 3; // => -2, as one would expect + 11 % (-3); // => 2 and not -2, and it's quite counter intuitive // Comparison operators are probably familiar, but // there is no Boolean type in C. We use ints instead. @@ -236,12 +244,12 @@ int main (int argc, char** argv) // operators always yield 0 or 1.) 3 == 2; // => 0 (false) 3 != 2; // => 1 (true) - 3 > 2; // => 1 - 3 < 2; // => 0 + 3 > 2; // => 1 + 3 < 2; // => 0 2 <= 2; // => 1 2 >= 2; // => 1 - // C is not Python - comparisons don't chain. + // C is not Python - comparisons do NOT chain. // Warning: The line below will compile, but it means `(0 < a) < 2`. // This expression is always true, because (0 < a) could be either 1 or 0. // In this case it's 1, because (0 < 1). @@ -349,25 +357,30 @@ int main (int argc, char** argv) break; } /* - using "goto" in C + Using "goto" in C */ typedef enum { false, true } bool; // for C don't have bool as data type before C99 :( bool disaster = false; int i, j; - for(i=0;i<100;++i) - for(j=0;j<100;++j) + for(i=0; i<100; ++i) + for(j=0; j<100; ++j) { if((i + j) >= 150) disaster = true; if(disaster) - goto error; + goto error; // exit both for loops } - error : + error: // this is a label that you can "jump" to with "goto error;" printf("Error occurred at i = %d & j = %d.\n", i, j); /* - https://ideone.com/GuPhd6 - this will print out "Error occurred at i = 51 & j = 99." + https://ideone.com/GuPhd6 + this will print out "Error occurred at i = 51 & j = 99." + */ + /* + it is generally considered bad practice to do so, except if + you really know what you are doing. See + https://en.wikipedia.org/wiki/Spaghetti_code#Meaning */ /////////////////////////////////////// @@ -741,11 +754,12 @@ typedef void (*my_fnp_type)(char *); // Order of Evaluation /////////////////////////////////////// +// From top to bottom, top has higher precedence //---------------------------------------------------// // Operators | Associativity // //---------------------------------------------------// // () [] -> . | left to right // -// ! ~ ++ -- + = *(type)sizeof | right to left // +// ! ~ ++ -- + = *(type) sizeof | right to left // // * / % | left to right // // + - | left to right // // << >> | left to right // @@ -783,8 +797,8 @@ as the C file. /* included into files that include this header. */ #include <string.h> -/* Like c source files macros can be defined in headers and used in files */ -/* that include this header file. */ +/* Like for c source files, macros can be defined in headers */ +/* and used in files that include this header file. */ #define EXAMPLE_NAME "Dennis Ritchie" /* Function macros can also be defined. */ @@ -823,7 +837,7 @@ Best to find yourself a copy of [K&R, aka "The C Programming Language"](https:// It is *the* book about C, written by Dennis Ritchie, the creator of C, and Brian Kernighan. Be careful, though - it's ancient and it contains some inaccuracies (well, ideas that are not considered good anymore) or now-changed practices. -Another good resource is [Learn C The Hard Way](http://learncodethehardway.org/c/). +Another good resource is [Learn C The Hard Way](http://learncodethehardway.org/c/) (not free). If you have a question, read the [compl.lang.c Frequently Asked Questions](http://c-faq.com). @@ -833,4 +847,4 @@ Readable code is better than clever code and fast code. For a good, sane coding Other than that, Google is your friend. -[1] [Why isn't sizeof for a struct equal to the sum of sizeof of each member?](http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member) +[1] [Why isn't sizeof for a struct equal to the sum of sizeof of each member?](https://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member) diff --git a/chapel.html.markdown b/chapel.html.markdown index 7e8fc41a..cfab6f34 100644 --- a/chapel.html.markdown +++ b/chapel.html.markdown @@ -1171,7 +1171,7 @@ You will need to `source util/setchplenv.EXT` from within the Chapel directory (`$CHPL_HOME`) every time your terminal starts so it's suggested that you drop that command in a script that will get executed on startup (like .bashrc). -Chapel is easily installed with Brew for OS X +Chapel is easily installed with Brew for macOS 1. `brew update` 2. `brew install chapel` diff --git a/clojure.html.markdown b/clojure.html.markdown index 16771e25..20812a9b 100644 --- a/clojure.html.markdown +++ b/clojure.html.markdown @@ -298,8 +298,8 @@ keymap ; => {:a 1, :b 2, :c 3} (as-> [1 2 3] input (map inc input);=> You can use last transform's output at the last position (nth input 2) ;=> and at the second position, in the same expression - (conj [4 5 6] input [8 9 10])) ;=> or in the middle ! - + (conj [4 5 6] input 8 9 10)) ;=> or in the middle ! + ; Result: [4 5 6 4 8 9 10] ; Modules diff --git a/cobol.html.markdown b/cobol.html.markdown index 22fcb6e0..1b33f9cc 100644 --- a/cobol.html.markdown +++ b/cobol.html.markdown @@ -44,7 +44,7 @@ organizations. *Let's declare some variables. *We do this in the WORKING-STORAGE section within the DATA DIVISION. - *Each data item (aka variable) with start with a level number, + *Each data item (aka variable) starts with a level number, *then the name of the item, followed by a picture clause *describing the type of data that the variable will contain. *Almost every COBOL programmer will abbreviate PICTURE as PIC. diff --git a/coq.html.markdown b/coq.html.markdown index 4c1ad690..3a924a19 100644 --- a/coq.html.markdown +++ b/coq.html.markdown @@ -61,8 +61,8 @@ Locate "+". (* Calling a function with insufficient number of arguments does not cause an error, it produces a new function. *) -Definition make_inc x y := x + y. (* make_inc is int -> int -> int *) -Definition inc_2 := make_inc 2. (* inc_2 is int -> int *) +Definition make_inc x y := x + y. (* make_inc is nat -> nat -> nat *) +Definition inc_2 := make_inc 2. (* inc_2 is nat -> nat *) Compute inc_2 3. (* Evaluates to 5 *) @@ -370,7 +370,7 @@ Close Scope string_scope. power series and results,...) • Relations : Relations (definitions and basic results) • Sorting : Sorted list (basic definitions and heapsort correctness) -• Strings : 8-bits characters and strings +• Strings : 8-bit characters and strings • Wellfounded : Well-founded relations (basic results) *) @@ -472,7 +472,7 @@ Proof. intros A B ab. destruct ab as [ a b ]. apply a. Qed. -(* We can prove easily prove simple polynomial equalities using the +(* We can easily prove simple polynomial equalities using the automated tactic ring. *) Require Import Ring. diff --git a/de-de/bash-de.html.markdown b/de-de/bash-de.html.markdown index 3a76708a..12da1df8 100644 --- a/de-de/bash-de.html.markdown +++ b/de-de/bash-de.html.markdown @@ -10,7 +10,7 @@ translators: filename: LearnBash-de.sh --- -Bash ist der Name der Unix-Shell, die als Shell des GNU-Betriebssystems und auch als Standard-Shell von Linux und Mac OS X ausgeliefert wurde. +Bash ist der Name der Unix-Shell, die als Shell des GNU-Betriebssystems und auch als Standard-Shell von Linux und macOS ausgeliefert wurde. Beinahe alle der folgenden Beispiele können als Teile eines Shell-Skripts oder direkt in der Shell ausgeführt werden. [Weitere Informationen \(Englisch\)](http://www.gnu.org/software/bash/manual/bashref.html) diff --git a/de-de/elixir-de.html.markdown b/de-de/elixir-de.html.markdown index 29d5132d..254cca51 100644 --- a/de-de/elixir-de.html.markdown +++ b/de-de/elixir-de.html.markdown @@ -35,6 +35,10 @@ viele Features mit. 0x1F # Integer
3.0 # Float
+# Für bessere Lesbarkeit des Codes können Unterstriche "_" als Trennzeichen verwendet werden
+1_000_000 == 1000000 # Integer
+1_000.567 == 1000.567 # Float
+
# Atome, das sind Literale, sind Konstanten mit Namen. Sie starten mit einem
# ':'.
:hello # Atom
diff --git a/de-de/nix-de.html.markdown b/de-de/nix-de.html.markdown index ea02e81d..ffe8dffc 100644 --- a/de-de/nix-de.html.markdown +++ b/de-de/nix-de.html.markdown @@ -356,3 +356,6 @@ with builtins; [ * [Susan Potter - Nix Cookbook - Nix By Example] (https://ops.functionalalgebra.com/nix-by-example/) + +* [Rommel Martinez - A Gentle Introduction to the Nix Family] + (https://web.archive.org/web/20210121042658/https://ebzzry.io/en/nix/#nix) diff --git a/de-de/swift-de.html.markdown b/de-de/swift-de.html.markdown index 08f72a35..5828b5d3 100644 --- a/de-de/swift-de.html.markdown +++ b/de-de/swift-de.html.markdown @@ -11,7 +11,7 @@ filename: learnswift-de.swift lang: de-de --- -Swift ist eine Programmiersprache von Apple für die Entwicklung von iOS und OS X Applikationen. Swift wurde 2014 zu Apples WWDC Entwicklerkonferenz vorgestellt und wurde mit dem Ziel entwickelt, fehlerträchtigen Code zu vermeiden sowie mit Objective-C zu koexistieren. Es wird mit dem LLVM Compiler gebaut und ist ab Xcode 6+ verfügbar. +Swift ist eine Programmiersprache von Apple für die Entwicklung von iOS und macOS Applikationen. Swift wurde 2014 zu Apples WWDC Entwicklerkonferenz vorgestellt und wurde mit dem Ziel entwickelt, fehlerträchtigen Code zu vermeiden sowie mit Objective-C zu koexistieren. Es wird mit dem LLVM Compiler gebaut und ist ab Xcode 6+ verfügbar. Das offizielle [Swift Programming Language](https://itunes.apple.com/us/book/swift-programming-language/id881256329) Buch von Apple ist kostenlos via iBooks verfügbar. diff --git a/docker.html.markdown b/docker.html.markdown index 24f85247..1dad267a 100644 --- a/docker.html.markdown +++ b/docker.html.markdown @@ -3,9 +3,10 @@ language: docker filename: docker.bat
contributors:
- ["Ruslan López", "http://javapro.org/"]
+ - ["Michael Chen", "https://github.com/ML-Chen"]
---
-```
+```bat
:: download, install and run hello-world image
docker run hello-world
@@ -37,12 +38,12 @@ docker run hello-world :: For more examples and ideas, visit:
:: https://docs.docker.com/get-started/
-:: now lets see currently running images
+:: now let's see currently running images
docker ps
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
-:: lets see the images we have ran previously
+:: let's see the images we have ran previously
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
@@ -54,7 +55,7 @@ docker ps -a :: let's remove our previously generated image
docker rm happy_poincare
-:: lets test if it was really deleted
+:: let's test if it was really deleted
docker ps -a
:: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
:: NAMES
@@ -89,7 +90,7 @@ docker ps -a :: test_container
:: as you can see the name is now what we have specified
-:: retireve logs from a named container
+:: retrieve logs from a named container
docker logs test_container
:: Hello from Docker!
:: This message shows that your installation appears to be working correctly.
@@ -143,4 +144,4 @@ docker ps -a :: nifty_goldwasser
docker rm nifty_goldwasser
-```
\ No newline at end of file +```
diff --git a/el-gr/bash-gr.html.markdown b/el-gr/bash-gr.html.markdown index 2989969d..239beaa4 100644 --- a/el-gr/bash-gr.html.markdown +++ b/el-gr/bash-gr.html.markdown @@ -8,7 +8,7 @@ lang: el-gr --- Η λέξη «bash» είναι ένα από τα ονόματα του unix shell (τερματικός), το οποίο -διανέμεται επίσης ως προεπιλεγμένος τερματικός για το λειτουργικό σύστημα GNU, τα Linux και τα Mac OS X. +διανέμεται επίσης ως προεπιλεγμένος τερματικός για το λειτουργικό σύστημα GNU, τα Linux και τα macOS. Σχεδόν όλα τα παραδείγματα που ακολουθούν μπορούν να αποτελέσουν μέρος ενός προγράμματος τερματικού (shell script) ή να εκτελεσθούν απευθείας από τον τερματικό. diff --git a/es-es/bash-es.html.markdown b/es-es/bash-es.html.markdown index fb89b2a0..27070e79 100644 --- a/es-es/bash-es.html.markdown +++ b/es-es/bash-es.html.markdown @@ -18,7 +18,7 @@ Tutorial de Shell en español. Bash es el nombre del shell de unix, el cual también es distribuido como el shell del sistema operativo GNU. También es el shell -por defecto de Linux y Mac OS X. Casi todos los ejemplos abajo pueden +por defecto de Linux y macOS. Casi todos los ejemplos abajo pueden ser parte de un script shell o ser ejecutados directamente en la terminal. [Leer más aquí.](http://www.gnu.org/software/bash/manual/bashref.html) diff --git a/es-es/matlab-es.html.markdown b/es-es/matlab-es.html.markdown index 9f1656bb..faa3dead 100644 --- a/es-es/matlab-es.html.markdown +++ b/es-es/matlab-es.html.markdown @@ -31,7 +31,7 @@ esto % Dos símbolos de porcentaje denotan el comienzo de una nueva sección de código. % Secciones de código individuales pueden ser ejecutadas moviendo el cursor hacia la sección, % seguida por un clic en el botón de “Ejecutar Sección” -% o usando Ctrl+Shift+Enter (Windows) o Cmd+Shift+Return (OS X) +% o usando Ctrl+Shift+Enter (Windows) o Cmd+Shift+Return (macOS) %% Este es el comienzo de una sección de código % Una forma de usar las secciones es separar un código de inicio costoso que no cambia, como cargar datos diff --git a/es-es/objective-c-es.html.markdown b/es-es/objective-c-es.html.markdown index 26cd14d9..28733cfb 100644 --- a/es-es/objective-c-es.html.markdown +++ b/es-es/objective-c-es.html.markdown @@ -9,7 +9,7 @@ translators: lang: es-es filename: LearnObjectiveC-es.m --- -Objective C es el lenguaje de programación principal utilizado por Apple para los sistemas operativos OS X y iOS y sus respectivos frameworks, Cocoa y Cocoa Touch. +Objective C es el lenguaje de programación principal utilizado por Apple para los sistemas operativos macOS y iOS y sus respectivos frameworks, Cocoa y Cocoa Touch. Es un lenguaje de programación para propósito general que le agrega al lenguaje de programación C una mensajería estilo "Smalltalk". diff --git a/es-es/swift-es.html.markdown b/es-es/swift-es.html.markdown index 22e3c532..60af1913 100644 --- a/es-es/swift-es.html.markdown +++ b/es-es/swift-es.html.markdown @@ -11,7 +11,7 @@ lang: es-es filename: learnswift-es.swift --- -Swift es un lenguaje de programación para el desarrollo en iOS y OS X creado +Swift es un lenguaje de programación para el desarrollo en iOS y macOS creado por Apple. Diseñado para coexistir con Objective-C y ser más resistente contra el código erroneo, Swift fue introducido en el 2014 en el WWDC, la conferencia de desarrolladores de Apple. diff --git a/es-es/typescript-es.html.markdown b/es-es/typescript-es.html.markdown index c42da4a4..fbe1290b 100644 --- a/es-es/typescript-es.html.markdown +++ b/es-es/typescript-es.html.markdown @@ -12,7 +12,7 @@ TypeScript es un lenguaje cuyo objetivo es facilitar el desarrollo de aplicacion TypeScript añade conceptos comunes como clases, módulos, interfaces, genéricos y (opcionalmente) tipeo estático a JavaScript. Es un superset de JavaScript: todo el código JavaScript es código válido en TypeScript de manera que se puede integrar fácilmente a cualquier proyecto . El compilador TypeScript emite JavaScript. -Este artículo se enfocará solo en la sintáxis extra de TypeScript, y no en [JavaScript] (../javascript/). +Este artículo se enfocará solo en la sintáxis extra de TypeScript, y no en [JavaScript] (../javascript-es/). Para probar el compilador de TypeScript, diríjase al [Área de Pruebas] (http://www.typescriptlang.org/Playground) donde podrá tipear código, y ver como se auto-completa al tiempo que ve el código emitido JavaScript. diff --git a/fr-fr/asymptotic-notation-fr.html.markdown b/fr-fr/asymptotic-notation-fr.html.markdown index 491dc3c4..fb0a8220 100644 --- a/fr-fr/asymptotic-notation-fr.html.markdown +++ b/fr-fr/asymptotic-notation-fr.html.markdown @@ -67,21 +67,21 @@ f(n) = 3log n + 100 g(n) = log n ``` -Est-ce que `f(n)` O(g(n))? -Est-ce que `3 log n + 100` O(log n)? +Est-ce que `f(n)` est égal à O(g(n))? +Est-ce que `3 log n + 100` est égal à O(log n)? Regardons maintenant la définition de Big-O. ``` 3log n + 100 <= c * log n ``` -Existe t-il une paire de constantes c, n<sub>0</sub> qui satisfait cela pour tout n > <sub>0</sub>? +Existe t-il une paire de constantes c, n<sub>0</sub> qui satisfait cela pour tout n > n<sub>0</sub>? ``` 3log n + 100 <= 150 * log n, n > 2 (Indéfini avec n = 1) ``` -Oui ! La définition de Big-O a été satisfaite, donc `f(n)` is O(g(n)). +Oui ! La définition de Big-O a été satisfaite, donc `f(n)` est égal à O(g(n)). *Exemple 2* @@ -90,15 +90,15 @@ f(n) = 3*n^2 g(n) = n ``` -Est-ce que `f(n)` O(g(n))? -Est-ce que `3 * n^2` O(n)? +Est-ce que `f(n)` est égal à O(g(n))? +Est-ce que `3 * n^2` est égal à O(n)? Regardons de nouveau la définition de Big-O. ``` 3 * n^2 <= c * n ``` -Existe t-il une paire de constantes c, n<sub>0</sub> qui satisfait cela pour tout n > <sub>0</sub>? +Existe t-il une paire de constantes c, n<sub>0</sub> qui satisfait cela pour tout n > n<sub>0</sub>? Non, il n'en existe pas. `f(n)` n'est pas égal à O(g(n)). ### Big-Omega diff --git a/fr-fr/bash-fr.html.markdown b/fr-fr/bash-fr.html.markdown index 0e764d7d..58d01e6a 100644 --- a/fr-fr/bash-fr.html.markdown +++ b/fr-fr/bash-fr.html.markdown @@ -17,7 +17,7 @@ lang: fr-fr --- Bash est le nom du shell UNIX, qui était aussi distribué avec le système -d’exploitation GNU et est le shell par défaut sur Linux et Mac OS X. +d’exploitation GNU et est le shell par défaut sur Linux et macOS. Presque tous les exemples ci-dessous peuvent être écrits dans un script shell ou exécutés directement dans le terminal. diff --git a/fr-fr/java-fr.html.markdown b/fr-fr/java-fr.html.markdown index d6c68343..b72200d6 100644 --- a/fr-fr/java-fr.html.markdown +++ b/fr-fr/java-fr.html.markdown @@ -31,7 +31,7 @@ Les commentaires sur plusieurs lignes ressemblent à ceci. /** * Les commentaires de la JavaDoc ressemblent à ceci. Ils sont utilisés pour * décrire la classe et ses différents attributs. - * Attributs principaux: + * Attributs principaux : * * @author Nom (et information de contact comme l'email) de(s) auteur(s). * @version Version actuelle du programme. @@ -82,7 +82,7 @@ public class JavaFr { */ // Utilisez Scanner pour lire l'entrée - // Nécessite: import java.util.Scanner; + // Nécessite : import java.util.Scanner; Scanner scanner = new Scanner(System.in); // Lire une chaîne de caractères @@ -160,7 +160,7 @@ public class JavaFr { // L est utilisé pour indiquer que la variable est de type long; // le nombre serait traité comme un int sans le L - // Note: byte, short, int et long sont signés. Ils peuvent avoir des + // Note : byte, short, int et long sont signés. Ils peuvent avoir des // valeurs positives et négatives. // Il n'existe pas de variantes non-signées. // char, toutefois, est non-signé sur 16 bits @@ -203,7 +203,7 @@ public class JavaFr { // BigDecimal - entier immuable et positif de taille arbitraire // - // BigDecimal comprend deux parties: une entier de taille arbitraire + // BigDecimal comprend deux parties : une entier de taille arbitraire // (BigInteger) et un entier de 32 bits représantant la position de la // virgule. // @@ -240,13 +240,13 @@ public class JavaFr { // C'est la manière la plus simple et optimisé par le compilateur String plusConcatenated = "Strings can " + "be concatenated " + "via + operator."; System.out.println(plusConcatenated); - // Affiche: Strings can be concatenated via + operator. + // Affiche : Strings can be concatenated via + operator. // #2 - avec StringBuilder // Cette méthode ne nécessite pas d'objet String intermédiaire. Elle // stocke juste les différentes chaînes de caractères et les assemble // lorsque la méthode toString() est appelée. - // Attention: Cette classe n'est pas thread-safe (l'objet ne peut pas être partagé + // Attention : Cette classe n'est pas thread-safe (l'objet ne peut pas être partagé // entre les threads). Une alternative // (avec un impact sur les performances) thread-safe est d'utiliser la // classe StringBuffer. @@ -255,7 +255,7 @@ public class JavaFr { builderConcatenated.append("can use "); builderConcatenated.append("the StringBuilder class."); System.out.println(builderConcatenated.toString()); // only now is the string built - // Affiche: You can use the StringBuilder class. + // Affiche : You can use the StringBuilder class. // StringBuffer est efficace quand la chaîne de caractères n'est pas // utilisée avec la fin de sa construction. @@ -276,7 +276,7 @@ public class JavaFr { // #3 - avec la méthode format() de la classe String. // Une autre alternative. Rapide et lisible. String.format("%s may prefer %s.", "Or you", "String.format()"); - // Affiche: Or you may prefer String.format(). + // Affiche : Or you may prefer String.format(). // Tableau // La taille du tableau doit être précisée à l'instantiation @@ -419,7 +419,7 @@ public class JavaFr { System.out.println("fooFor Value: " + fooFor); // Fin d'une boucle for avec un label - outer: + outer : for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (i == 5 && j ==5) { @@ -433,9 +433,9 @@ public class JavaFr { // La boucle for est également capable d'itérer aussi bien sur un // tableau que sur des objets qui implémentent l'interface Iterable. int[] fooList = {1, 2, 3, 4, 5, 6, 7, 8, 9}; - // De la forme: for (<object> : <iterable>) - // Lu comme: "Pour chaque élément du tableau" - // note: le type doit correspondre à celui de l'objet itérable + // De la forme : for (<object> : <iterable>) + // Lu comme : "Pour chaque élément du tableau" + // note : le type doit correspondre à celui de l'objet itérable for (int bar : fooList) { System.out.println(bar); //Itère 9 fois et affiche les chiffres de 1 à 9 @@ -511,7 +511,7 @@ public class JavaFr { // Convert Integer To String Integer.toString(123); // retourne un object String correspondant à"123" - // Pour les autres conversions, référer vous aux classes suivantes: + // Pour les autres conversions, référer vous aux classes suivantes : // Double // Long // String @@ -537,7 +537,7 @@ public class JavaFr { // Initialisation avec double accolades // Le langage Java ne permet pas de créer des collections statiques d'une - // manière simple. Généralement, on utilise la forme suivante: + // manière simple. Généralement, on utilise la forme suivante : private static final Set<String> COUNTRIES = new HashSet<String>(); static { COUNTRIES.add("DENMARK"); @@ -566,7 +566,7 @@ public class JavaFr { // Cependant, il est préférable de séparer les // classes dans des fichiers différents. -// Syntaxe de déclaration des classes: +// Syntaxe de déclaration des classes : // <public/private/protected> class <Nom de la classe> { // // Les attributs, les constructeurs et les méthodes de la classe vont ici. // // Les functions de classes sont appelées méthode. @@ -575,11 +575,11 @@ public class JavaFr { class Bicycle { // Attributs et variables de la classe Bicycle - public int cadence; // Public: Peut être accesible depuis n'importe où - private int speed; // Private: Accisible depuis la classe - protected int gear; // Protected: Accisible depuis la classe et ses sous- + public int cadence; // Public : Peut être accesible depuis n'importe où + private int speed; // Private : Accisible depuis la classe + protected int gear; // Protected : Accisible depuis la classe et ses sous- // classes - String name; // default: Uniquement accesible depuis ce package + String name; // default : Uniquement accesible depuis ce package static String className; // Variable de classe static // Bloc static @@ -595,7 +595,7 @@ class Bicycle { // Ceci est le constructeur de la classe Bicycle public Bicycle() { // Vous pouvez aussie appeler un autre constructeur. Par exemple en - // appelant le constructeur de la classe mère (voir héritage): + // appelant le constructeur de la classe mère (voir héritage) : // this(1, 50, 5, "Bontrager"); gear = 1; cadence = 50; @@ -665,7 +665,7 @@ class PennyFarthing extends Bicycle { // Ici nous modifions la méthode setGear() de la classe mère. Il faut donc // utiliser l'annotation @Overide. Pour en savoir plus sur les annotations, // consulter la documention officiel (en anglais) : - // out: http://docs.oracle.com/javase/tutorial/java/annotations/ + // out : http://docs.oracle.com/javase/tutorial/java/annotations/ @Override public void setGear(int gear) { this.gear = 0; @@ -719,7 +719,7 @@ public class Fruit implements Edible, Digestible { } // En Java, on peut hériter uniquement d'une classe mais on peut implémenter -// plusieurs interfaces: +// plusieurs interfaces : public class ExampleClass extends ExampleClassParent implements InterfaceOne, InterfaceTwo { @Override @@ -734,7 +734,7 @@ public class ExampleClass extends ExampleClassParent implements InterfaceOne, // Classes abstraites -// Syntaxe de déclaration: +// Syntaxe de déclaration : // <niveau d'accès> abstract class <nom de la classe abstraite> extends <nom de la // classe mère abstraite> { // // Constantes et variables @@ -758,7 +758,7 @@ public abstract class Animal public void eat() { System.out.println("I am an animal and I am Eating."); - // Note: On peut accéder à une variable privée ici. + // Note : On peut accéder à une variable privée ici. age = 30; } @@ -790,7 +790,7 @@ class Dog extends Animal // age = 30; ==> ERREUR! age est privé et n'est pas accesible. } - // NOTE: Vous obtiendrez une erreur si vous utilisé l'annotation @Override + // NOTE : Vous obtiendrez une erreur si vous utilisé l'annotation @Override // ici car Java n'autorise pas la surcharge de méthodes statiques. Ce qui ce // passe est appelé "method hiding". Si vous voulez en savoir plus, // consultez cette discussion (en anglais) : @@ -828,7 +828,7 @@ public final class SaberToothedCat extends Animal // Méthodes final public abstract class Mammal() { - // Syntaxe: + // Syntaxe : // <niveau d'accès> final <type de retour> <nom de la fonction>(<arguments>) // Les méthodes déclarées comme final ne peuvent pas être surchargées par @@ -846,13 +846,13 @@ public abstract class Mammal() // des valeurs pédéfinies pour celle-ci. En Java, les variables constantes sont // notées en majuscules. // On définie un type enum en utilisant le mot clé enum. Par exemple pour les -// jours de l'année: +// jours de la semaine : public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } -// On l'utilise ainsi: +// On l'utilise ainsi : public class EnumTest { // On utilise notre énumération Day day; @@ -889,7 +889,7 @@ public class EnumTest { // Le type enum permet de faire bien plus que ce qui est montré ici. Il ne se // limite pas à une liste de constante mais peut inclure des champs et méthodes. -// Vous pouvez en savoir plus ici (en anglais): +// Vous pouvez en savoir plus ici (en anglais) : //https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html ``` @@ -899,7 +899,7 @@ public class EnumTest { Les liens ci-dessous sont données si vous souhaitez approfondir sur le sujet, n'hésitez pas à consulter Google pour trouver des exemples spécifiques. -**Guides officiels d'Oracle**: +**Guides officiels d'Oracle** : * [Java Tutorial Trail from Sun / Oracle](https://docs.oracle.com/javase/tutorial/index.html) @@ -918,7 +918,7 @@ n'hésitez pas à consulter Google pour trouver des exemples spécifiques. * [Java Code Conventions](https://www.oracle.com/technetwork/java/codeconvtoc-136057.html) -* Nouvelles fonctionnalités Java 8: +* Nouvelles fonctionnalités Java 8 : * [Lambda expressions (functional programming)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html) * [Date and time API (java.time package)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html) @@ -928,7 +928,7 @@ n'hésitez pas à consulter Google pour trouver des exemples spécifiques. * [Codingbat.com](http://codingbat.com/java) -**Livres**: +**Livres** : * [Head First Java](http://www.headfirstlabs.com/books/hfjava/) diff --git a/fr-fr/objective-c-fr.html.markdown b/fr-fr/objective-c-fr.html.markdown index fbe1741e..191cdfb6 100644 --- a/fr-fr/objective-c-fr.html.markdown +++ b/fr-fr/objective-c-fr.html.markdown @@ -10,7 +10,7 @@ filename: LearnObjectiveC-fr.m lang: fr-fr --- -L'Objective-C est un langage de programmation orienté objet réflexif principalement utilisé par Apple pour les systèmes d'exploitations Mac OS X et iOS et leurs frameworks respectifs, Cocoa et Cocoa Touch. +L'Objective-C est un langage de programmation orienté objet réflexif principalement utilisé par Apple pour les systèmes d'exploitations macOS et iOS et leurs frameworks respectifs, Cocoa et Cocoa Touch. ```objective-c // Les commentaires sur une seule ligne commencent par // @@ -30,7 +30,7 @@ ceci #import <Foundation/Foundation.h> #import "MaClasse.h" -// Si vous activez les modules dans les projets iOS >= 7 ou Mac OS X >= 10.9 +// Si vous activez les modules dans les projets iOS >= 7 ou OS X >= 10.9 // dans Xcode 5, vous pouvez importer les frameworks comme cela : @import Foundation; diff --git a/fr-fr/set-theory-fr.html.markdown b/fr-fr/set-theory-fr.html.markdown new file mode 100644 index 00000000..50a4ea30 --- /dev/null +++ b/fr-fr/set-theory-fr.html.markdown @@ -0,0 +1,134 @@ +``` +--- +category: tool +lang: fr-fr +name: Set theory +contributors: + - ["kieutrang", "https://github.com/kieutrang1729"] +--- +La théorie des ensembles est une branche des mathématiques qui étudie les ensembles, leurs opérations et leurs propriétés. + +* Un ensemble est une collection d'éléments disjoints. + +## Symboles de base + +### Opérateurs +* l'opérateur réunion, `∪`, signifie "ou" ; +* l'opérateur intersection, `∩`, signifie "et" ; +* l'opérateur différence, `\`, signifie "sans", (lire "A moins B") ; +* l'opérateur complémentaire, `'`, signifie "le complémentaire de" ; +* l'opérateur croix, `×`, signifie "le produit cartésien de". + +### Autres symboles +* le symbole deux-points, `:`, signifie "tel que" ; +* le symbole d'appartenance, `∈`, signifie "appartient à" ; +* le symbole sous-ensemble, `⊆`, signifie "est un sous-ensemble de" ; +* le symbole sous-ensemble propre, `⊂`, signifie "est un sous-ensemble de mais n'est pas égal à". + +### Ensembles importants +* `∅`, l'ensemble vide, c'est-à-dire l'ensemble ne contenant aucun élément ; +* `ℕ`, l'ensemble des nombres naturels ; +* `ℤ`, l'ensemble des entiers ; +* `ℚ`, l'ensemble des nombres rationnels ; +* `ℝ`, l'ensemble des nombres réels. + +Quelques mise en gardes sur les ensembles definis ci-dessus: +1. Même si l'ensemble vide ne contient aucun élément, il est lui-même un sous-ensemble de n'importe quel ensemble. +2. Il n'y a pas d'accord général sur l'appartenance de zéro dans l'ensemble des nombres naturels, et les livres indiquent explicitment si l'auteur considère le zéro comme nombre naturel ou pas. + + +### Cardinalité + +La cardinalité, ou taille, d'un ensemble est déterminée par le nombre d'éléments dans l'ensemble. L'opérateur de cardinalité s'écrit, `| ... |`. +Par exemple, si `S = { 1, 2, 4 }`, alors `|S| = 3`. + +### L'ensemble vide +* L'ensemble vide peut se définir en comprehension à l'aide d'une propriété qui n'est satisfaite par nul élément, e.g. `∅ = { x : x ≠ x }`, ou `∅ = { x : x ∈ N, x < 0 }`. +* il n'y a qu'un seul ensemble vide. +* l'ensemble vide est sous-ensemble de tout ensemble. +* la cardinalité de l'ensemble vide est 0, ou `|∅| = 0`. + +## Notation ensembliste + +### Définition par extension + +Un ensemble peut être defini en extension par une liste de tous les éléments qui sont contenus dans l'ensemble. Par exemple, `S = { a, b, c, d }`. + +Quand le contexte est clair, on peut raccourcir la liste en utilisant des points de suspension. Par exemple, `E = { 2, 4, 6, 8, ... }` est clairement l'ensemble de tous les nombres pairs, contenant un nombre infini des éléments, même si on a explicitement écrit seulement les quatres premiers. + +### Définition par comprehension + +C'est une notation plus descriptif qui permet de définir un ensemble à l'aide d'un sujet et d'une propriété, et il est noté `S = { sujet : propriété }`. Par exemple, + +``` +A = { x : x est une voyelle } = { a, e, i, o, u, y} +B = { x : x ∈ N, x < 10 } = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } +C = { x : x = 2k, k ∈ N } = { 0, 2, 4, 6, 8, ... } +``` + +On peut même appliquer une fonction au sujet, e.g. + +``` +D = { 2x : x ∈ N } = { 0, 2, 4, 6, 8, ... } +``` + +## Relations + +### Appartenance + +* Si l'élement `a` est dans l'ensemble `A`, on dit que `a` appartient à `A` et on le note `a ∈ A`. +* Si l'élement `a` n'est pas dans l'ensemble `A`, on dit que `a` n'appartient pas à `A` et on le note `a ∉ A`. + +### Égalité + +* On dit que deux ensembles `A` et `B` sont égaux s'ils contiennent les mêmes éléments, et on le note `A = B`. +* Les ensembles n'ont pas de notion d'ordre, par exemple `{ 1, 2, 3, 4 } = { 2, 3, 1, 4 }`. +* Un élément ne peut apparaître qu'au plus une seule fois - il n'y a jamais de répétition, e.g. `{ 1, 2, 2, 3, 4, 3, 4, 2 } = { 1, 2, 3, 4 }`. +* Deux ensembles `A` and `B` sont égaux si et seulement si `A ⊆ B` and `B ⊆ A`. + +## Ensemble puissance +* L'ensemble puissance d'un ensemble `A` est l'ensemble contenant tous les sous-ensembles de `A`. Il est noté `P(A)`. Si la cardinalité d'`A` est `n`, la cardinalité de `P(A)` est `2^n`. + +``` +P(A) = { x : x ⊆ A } +``` + +## Opérations ensemblistes +### Réunion +La réunion de deux ensembles `A` et `B` est l'ensemble contenant tous les éléments qui appartient à `A` ou à `B`. + +``` +A ∪ B = { x : x ∈ A ∪ x ∈ B } +``` + +### Intersection +L'intersection de deux ensembles `A` et `B` est l'ensemble contenant tous les éléments qui appartient à la fois à `A` et à `B`. + +``` +A ∩ B = { x : x ∈ A, x ∈ B } +``` + +### Différence +La différence de deux ensembles `A` et `B` est l'ensemble contenant tous les éléments de l'ensemble `A` qui n'appartient pas à `B`. + +``` +A \ B = { x : x ∈ A, x ∉ B } +``` + +### Différence symétrique +Le différence symétrique de deux ensembles `A` et `B` est l'ensemble contenant tous les éléments de `A` et `B` qui n'apparaissent pas dans leur intersection. + +``` +A △ B = { x : ((x ∈ A) ∩ (x ∉ B)) ∪ ((x ∈ B) ∩ (x ∉ A)) } + +A △ B = (A \ B) ∪ (B \ A) +``` + +### Produit cartésien +Le produit cartésien de deux ensembles `A` et `B` est l'ensemble contenant tous les couples dont la première élément appartient à `A` et la deuxième à `B`. + +``` +A × B = { (x, y) | x ∈ A, y ∈ B } +``` + +``` diff --git a/fr-fr/typescript-fr.html.markdown b/fr-fr/typescript-fr.html.markdown index 52d34650..8a761f61 100644 --- a/fr-fr/typescript-fr.html.markdown +++ b/fr-fr/typescript-fr.html.markdown @@ -12,7 +12,7 @@ TypeScript est un langage visant à faciliter le développement d'applications l TypeScript ajoute des concepts classiques comme les classes, les modules, les interfaces, les génériques et le typage statique (optionnel) à JavaScript. C'est une surcouche de JavaScript : tout le code JavaScript est valide en TypeScript ce qui permet de l'ajouter de façon transparente à n'importe quel projet. Le code TypeScript est transcompilé en JavaScript par le compilateur. -Cet article se concentrera seulement sur la syntaxe supplémentaire de TypeScript, plutôt que celle de [JavaScript] (../javascript/). +Cet article se concentrera seulement sur la syntaxe supplémentaire de TypeScript, plutôt que celle de [JavaScript] (../javascript-fr/). Pour tester le compilateur de TypeScript, rendez-vous au [Playground] (http://www.typescriptlang.org/Playground) où vous pourrez coder, profiter d'une autocomplétion et accéder directement au rendu JavaScript. diff --git a/hd-hd/json-hd.html.markdown b/hd-hd/json-hd.html.markdown new file mode 100644 index 00000000..dd1657cd --- /dev/null +++ b/hd-hd/json-hd.html.markdown @@ -0,0 +1,86 @@ +--- +language: json +contributors: + - ["Anna Harren", "https://github.com/iirelu"] + - ["Marco Scannadinari", "https://github.com/marcoms"] + - ["himanshu", "https://github.com/himanshu81494"] + - ["Michael Neth", "https://github.com/infernocloud"] + - ["Athanasios Emmanouilidis", "https://github.com/athanasiosem"] +translators: + - ["Namami Shanker", "https://github.com/NamamiShanker"] +lang: hd-hd +--- + +जैसन(JSON) इस अत्यंत सरल डाटा-इंटरचेंज फॉर्मेट है| जैसा [json.org](https://json.org) कहती है, ये इंसानो के पढ़ने और लिखने के लिए भी आसान है और और मशीन के लिए इसे पार्स और उतपन्न करना भी बेहद सरल है| + +जैसन(JSON) के एक अंश को इनमे से किसी एक का प्रतिनिधित्व(represent) करना चाहिए: + +* एक नाम/वैल्यू जोड़े का कलेक्शन (`{ }`). कई दूसरी भाषाओ में इसे ऑब्जेक्ट, रिकॉर्ड, स्ट्रक्ट, डिक्शनरी, हैश टेबल, कीड लिस्ट, या असोसिएटिव ऐरे का भी नाम दिया जाता है| +* वैल्यूज की एक व्यवस्थित लिस्ट(ordered list) (`[ ]`). कई दूसरी भाषाओ में इसे ऐरे, वेक्टर, लिस्ट, या सीक्वेंस भी कहा जाता है| + +जैसन(JSON) अपने शुद्धतम रूप में कमैंट्स सपोर्ट नहीं करता है, पर ज़्यादातर पारसर C स्टाइल की कमैंट्स (`//`, `/* */`) सपोर्ट करेंगे| कुछ पारसर्स अंतिम कॉमा भी स्वीकार करते हैं (जब आप किसी ऐरे के अंतिम एलिमेंट या किसी ऑब्जेक्ट की अंतिम प्रॉपर्टी के बार एक कॉमा छोड़ देते हैं), पर ऐसी गलतियों से बचना चाहिए बेहतर कम्पेटिबिलिटी के लिए| + + ये उदाहरण १०० प्रतिशत मान्य जैसन(JSON) है| किस्मत से, जैसन(JSON) डॉक्यूमेंट को पढ़ के ही आप इसे समझ जायेंगे| + +समर्थित डाटा टाइप्स: + +* स्ट्रिंग्स(Strings): `"नमस्ते"`, `"\"एक उद्धरण\""`, `"\u0abe"`, `"नयी पंक्ति|\n"` +* अंक(Numbers): `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` +* ऑब्जेक्ट्स(Objects): `{ "की": "मूल्य" }` +* ऐरे(Arrays): `["बहुत सारे मूल्य"]` +* विविध(Miscellaneous): `true`, `false`, `null` + +```json +{ + "की": "मूल्य", + + "की": "हमेशा दोहरे उद्धरण चिह्नों में संलग्न होना चाहिए", + "अंक": 0, + "स्ट्रिंग्स": "नमस्ते| यूनिकोड और \"एस्केप\" सीक्वेंस की अनुमति है|", + "बूलियन है?": true, + "शून्यता ": null, + + "बड़े अंक": 1.2e+100, + + "ऑब्जेक्ट्स": { + "टिप्पणी": "आपके जैसन(JSON) ऑब्जेक्ट को ज़्यादातर ऑब्जेक्ट से ही ढांचा मिलेगा|", + + "ऐरे": [0, 1, 2, 3, "ऐरे में आप कुछ भी रख सकते हैं|", 5], + + "एक और ऑब्जेक्ट": { + "टिप्पणी": "आप एक ऑब्जेक्ट दूसरे ऑब्जेक्ट के अंदर रख सकते हैं| ये बहुत उपयोगी होता है|" + } + }, + + "फ़र्ज़ी": [ + { + "पोटेशियम के स्रोत": ["केला"] + }, + [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, "नव"], + [0, 0, 0, 1] + ] + ], + + "वैकल्पिक शैली": { + "टिप्पणी": "ये देखिये!" + , "कॉमा के स्थान": "से फरक नहीं पड़ता, अगर आपने उसे अगली की से पहले लगाया है तो वो मान्य है|" + , "एक और टिप्पणी": "कितनी अच्छी बात है" + }, + + + + "खाली स्थान": "से फरक नहीं पड़ता", + + + + "ये काफी छोटा था :>": "और ख़तम| अब आपको जैसन(JSON) के बारे में सब कुछ पता है|" +} +``` + +## और जानकारी के लिए + +* [JSON.org](https://json.org) पूरा जैसन(JSON) फ्लोचार्ट के माध्यम से खूबसूरत तरह से दर्शित| +* [JSON Tutorial](https://www.youtube.com/watch?v=wI1CWzNtE-M) जैसन(JSON) का एक संक्षिप्त परिचय| diff --git a/images/solidity/copy-address.png b/images/solidity/copy-address.png Binary files differnew file mode 100644 index 00000000..b0a698ee --- /dev/null +++ b/images/solidity/copy-address.png diff --git a/images/solidity/metamask-kovan.png b/images/solidity/metamask-kovan.png Binary files differnew file mode 100644 index 00000000..c5d5ae4b --- /dev/null +++ b/images/solidity/metamask-kovan.png diff --git a/images/solidity/remix-add-token.png b/images/solidity/remix-add-token.png Binary files differnew file mode 100644 index 00000000..a1c2f1ac --- /dev/null +++ b/images/solidity/remix-add-token.png diff --git a/images/solidity/remix-choose-file.png b/images/solidity/remix-choose-file.png Binary files differnew file mode 100644 index 00000000..6a16afc8 --- /dev/null +++ b/images/solidity/remix-choose-file.png diff --git a/images/solidity/remix-compile.png b/images/solidity/remix-compile.png Binary files differnew file mode 100644 index 00000000..7afd0d7c --- /dev/null +++ b/images/solidity/remix-compile.png diff --git a/images/solidity/remix-deploy.png b/images/solidity/remix-deploy.png Binary files differnew file mode 100644 index 00000000..7f855f48 --- /dev/null +++ b/images/solidity/remix-deploy.png diff --git a/images/solidity/remix-interact.png b/images/solidity/remix-interact.png Binary files differnew file mode 100644 index 00000000..79f89ae9 --- /dev/null +++ b/images/solidity/remix-interact.png diff --git a/images/solidity/remix-solidity.png b/images/solidity/remix-solidity.png Binary files differnew file mode 100644 index 00000000..f4500967 --- /dev/null +++ b/images/solidity/remix-solidity.png diff --git a/images/solidity/remix-testnet.png b/images/solidity/remix-testnet.png Binary files differnew file mode 100644 index 00000000..6cc845ea --- /dev/null +++ b/images/solidity/remix-testnet.png diff --git a/images/solidity/send-link.png b/images/solidity/send-link.png Binary files differnew file mode 100644 index 00000000..1cd9188e --- /dev/null +++ b/images/solidity/send-link.png diff --git a/it-it/bash-it.html.markdown b/it-it/bash-it.html.markdown index cfe58f30..dd55b84c 100644 --- a/it-it/bash-it.html.markdown +++ b/it-it/bash-it.html.markdown @@ -22,7 +22,7 @@ translators: lang: it-it --- -Bash è il nome della shell di unix, la quale è stata distribuita anche come shell del sistema oprativo GNU e la shell di default su Linux e Mac OS X. +Bash è il nome della shell di unix, la quale è stata distribuita anche come shell del sistema oprativo GNU e la shell di default su Linux e macOS. Quasi tutti gli esempi sottostanti possono fare parte di uno shell script o eseguiti direttamente nella shell. [Per saperne di più.](http://www.gnu.org/software/bash/manual/bashref.html) diff --git a/ja-jp/vim-jp.html.markdown b/ja-jp/vim-jp.html.markdown new file mode 100644 index 00000000..1d9867ca --- /dev/null +++ b/ja-jp/vim-jp.html.markdown @@ -0,0 +1,275 @@ +--- +category: tool +tool: vim +contributors: + - ["RadhikaG", "https://github.com/RadhikaG"] +translators: + - ["Kota Kato", "https://github.com/kato-k"] +filename: LearnVim-jp.txt +lang: ja-jp +--- + + +[Vim](http://www.vim.org) +(Vi IMproved) は、Unix用の人気なエディタである vi のクローンです。 +これは、速度と生産性を高めることを目的に設計されたエディタであり、 +ほとんどのUnix互換のシステムに組込まれています。 +ファイル内の特定の位置に移動したり、素早く編集したりするための多数のキーバインドを持ちます。 + +`vimtutor`はあなたに`Vim`の使い方を教える素晴しいアプリケーションです。 +Vimパッケージのインストール時に一緒に付属しますので、 +コマンドラインで「vimtutor」を実行するだけで、このチュートリアルを開けるはずです。 +これは、`vim`の全ての主要機能を説明します。 + +訳注) 日本語で`vimtutor`を利用するには、「vimtutor ja」を実行しなければならない場合があります。 + +## 基本のVim操作 + +``` + vim <filename> # <filename>をVimで開く + :help <topic> # <topic>についての組み込みドキュメントが存在する場合、 + # それを開く + :q # Vimを終了する + :w # 編集中のファイルを保存する + :wq # ファイルを保存して、Vimを終了する + ZZ # ファイルを保存して、Vimを終了する。:xと同様 + :q! # ファイルを保存せずにVimを終了する + # :q を ! *強制的に* 実行するため保存せずにVimが終了します + ZQ # ファイルを保存せずにVimを終了する + :x # 変更点がある時、ファイルを保存してVimを終了する + + u # Undo + CTRL+R # Redo + + h # 左に一文字移動 + j # 一行下に移動 + k # 一行上に移動 + l # 右に一文字移動 + + Ctrl+B # ウィンドウを一画面上に移動 + Ctrl+F # ウィンドウを一画面下に移動 + Ctrl+D # ウィンドウを半画面上に移動 + Ctrl+U # ウィンドウを半画面下に移動 + + # 行内を移動する + + 0 # 行頭に移動 + $ # 行末に移動 + ^ # 行の初めの非空白文字に移動 + + # テキストの検索 + + /word # カーソル以降に出現する全ての一致をハイライト + ?word # カーソル以前に出現する全ての一致をハイライト + n # カーソルを次の一致に移動 + N # カーソルを前の一致に移動 + + :%s/foo/bar/g # 全ての行について「foo」を「bar」に置換 + :s/foo/bar/g # 現在の行について「foo」を「bar」に置換 + :%s/\n/\r/g # 改行文字の置換 + + # 文字への移動 + + f<character> # 前方の<character>に移動する + t<character> # 前方の<character>の一文字前に移動する + + # 例 + f< # 前方の < に移動 + t< # 前方の < の一文字前に移動 + + # 単語ごとの移動 + + w # 一単語前に移動 + b # 一単語後ろに移動 + e # 現在の単語の後部に移動 + + # 移動のためのキーバインド + + gg # ファイルの先頭に移動 + G # ファイルの最後に移動 + :NUM # ファイルのNUM行に移動(NUMは任意の行数) + H # カーソルをウィンドウ上部に移動 + M # カーソルをウィンドウ中央に移動 + L # カーソルをウィンドウ下部に移動 +``` + +## ヘルプドキュメント: + +Vimには`:help <topic>`でアクセスできるヘルプドキュメントが組込まれています。 +例えば、`:help navigation`はカーソルを移動する方法についてのドキュメントを開きます。 + +`:help`はオプション無しでも利用できます。 +これにより、Vimにより親しみやすくすることを目的としたデフォルトのヘルプダイアログが開かれます。 + +## モード: + +Vimは**モード**の概念に基づいています。 + +- Command Mode - Vimはこのモードで起動し、移動とコマンドの実行に使われます +- Insert Mode - ファイルに変更を加えるのに使われます +- Visual Mode - テキストをハイライトしてオペレータを適用するために使われます +- Ex Mode - コマンドを入力するための「:」プロンプトで使われます + +``` + i # カーソル位置の前からInsert Modeに入る + a # カーソル位置の後ろからInsert Modeに入る + v # Visual Modeに入る + : # Ex Modeに入る + <esc> # 現在のモードからコマンドモードに「脱出」 + + # テキストのコピーと貼り付け + + y # 選択された対象をヤンクする + yy # 現在の行をヤンクする + d # 選択された対象を削除する + dd # 現在の行を削除する + p # ヤンクされたテキストをカーソルの後ろに貼り付ける + P # ヤンクされたテキストをのカーソルの前に貼り付ける + x # カーソル位置の文字を削除 +``` + +## Vimの「文法」 + +Vimの操作は「動詞・修飾子・名詞」形式のコマンドとして考えることができます。 + +- 動詞 - 動作 +- 修飾子 - 動作の実行方法 +- 名詞 - 動作が作用するオブジェクト + +「動詞・修飾子・名詞」関するいくつかの重要な例: + +``` + # '動詞' + + d # 削除 + c # 変更 + y # ヤンク (コピー) + v # ビジュアル選択 + + # '修飾子' + + i # 内部 + a # 周り + NUM # 回数 (NUMは任意の番号) + f # 任意の一文字まで + t # 任意の一文字の手前まで + / # カーソル以降の任意の文字列まで + ? # カーソル以前の任意の文字列まで + + # '名詞' + + w # 単語 + s # 文 + p # 段落 + b # ブロック + + # 「文」の例 + + d2w # 削除 2 単語 (2単語を削除) + cis # 変更 内部 文 (文の内部を変更) + yip # ヤンク 内部 段落 (段落の内部をヤンク) + ct< # 変更 手前 < (<の手前まで変更) + d$ # 削除 行末まで (行末まで削除) +``` + +## いくつかのショートカットと小技 + + <!--TODO: Add more!--> +``` + > # 選択部を1ブロックインデント + < # 選択部を1ブロックデインデント + :earlier 15m # ファイルを15分前の状態に戻す + :later 15m # 上記のコマンドの逆 + ddp # 連続する行を入れ替え + . # 前回の動作を繰り返す + :w !sudo tee % # 編集中のファイルを管理者として保存 + :set syntax=c # 「C言語」のシンタックスハイライトを利用する + :sort # 全ての行をソートする + :sort! # 全ての行を降順にソートする + :sort u # 全ての行をソートして重複を削除する + ~ # 選択部分の大文字小文字を入れ替える + u # 選択部分を小文字にする + U # 選択部分を大文字にする + J # 現在の行と次の行を結合する + + # テキストの折り畳み + zf # 選択したテキストを折り畳む + zo # 折り畳みを開く + zc # 折り畳みを閉じる + zR # 全ての折り畳みを開く + zM # 全ての折り畳みを閉じる +``` + +## マクロ + +マクロは基本的に記録可能なアクションです。 +マクロの記録を開始すると、記録を停止するまで**全て**の操作とコマンドが記録されます。 +マクロを呼びだすと、まったく同じ一連の操作とコマンドが文書に再度適用されます。 + +``` + qa # 「a」という名前のマクロの記録を開始する + q # 記録を停止する + @a # 「a」マクロを再生する +``` + +### ~/.vimrc の設定 + +ファイル.vimrcは起動時にVimの設定として利用されます + +次は~/.vimrcファイルのサンプルです + +``` +" Example ~/.vimrc +" 2015.10 + +" Required for vim to be iMproved +set nocompatible + +" 自動インデントなどを利用するために、ファイル名からファイルタイプを決定する +filetype indent plugin on + +" シンタックスハイライトを利用する +syntax on + +" より良いコマンドライン補完 +set wildmenu + +" 大文字を利用しない場合、検索で大文字・小文字を区別しない +set ignorecase +set smartcase + +" ファイル固有のインデントが有効でない場合、現在行のインデントを継続する +set autoindent + +" 行番号の表示 +set number + +" インデントに関するオプション + +" TAB文字の幅 +set tabstop=4 + +" 編集中TABキーを押した際の挙動 +set softtabstop=4 + +" << >> を利用した再インデント時のスペースの数 +set shiftwidth=4 + +" TABキーをスペースに変換する +set expandtab + +" 賢いTAB機能を有効にする +set smarttab +``` + +### 参考文献 + +[Vim | Home](http://www.vim.org/index.php) + +`$ vimtutor` + +[A vim Tutorial and Primer](https://danielmiessler.com/study/vim/) + +[What are the dark corners of Vim your mom never told you about? (Stack Overflow thread)](http://stackoverflow.com/questions/726894/what-are-the-dark-corners-of-vim-your-mom-never-told-you-about) + +[Arch Linux Wiki](https://wiki.archlinux.org/index.php/Vim) diff --git a/julia.html.markdown b/julia.html.markdown index 5e9ef1b8..4d8eb497 100644 --- a/julia.html.markdown +++ b/julia.html.markdown @@ -11,7 +11,7 @@ Julia is a new homoiconic functional language focused on technical computing. While having the full power of homoiconic macros, first-class functions, and low-level control, Julia is as easy to learn and use as Python. -This is based on Julia 1.0.0 +This is based on Julia version 1.0.0. ```julia # Single line comments start with a hash (pound) symbol. @@ -83,7 +83,7 @@ false 1 > 10 # => false 2 <= 2 # => true 2 >= 2 # => true -# Comparisons can be chained +# Comparisons can be chained, like in Python but unlike many other languages 1 < 2 < 3 # => true 2 < 3 < 2 # => false @@ -93,28 +93,29 @@ false # Character literals are written with ' 'a' -# Strings are UTF8 encoded. Only if they contain only ASCII characters can -# they be safely indexed. -ascii("This is a string")[1] +# Strings are UTF8 encoded, so strings like "π" or "☃" are not directly equivalent +# to an array of single characters. +# Only if they contain only ASCII characters can they be safely indexed. +ascii("This is a string")[1] # => 'T' # => 'T': ASCII/Unicode U+0054 (category Lu: Letter, uppercase) -# Julia indexes from 1 +# Beware, Julia indexes everything from 1 (like MATLAB), not 0 (like most languages). # Otherwise, iterating over strings is recommended (map, for loops, etc). -# String can be compared lexicographically -"good" > "bye" # => true +# String can be compared lexicographically, in dictionnary order: +"good" > "bye" # => true "good" == "good" # => true "1 + 2 = 3" == "1 + 2 = $(1 + 2)" # => true -# $ can be used for string interpolation: +# $(..) can be used for string interpolation: "2 + 2 = $(2 + 2)" # => "2 + 2 = 4" # You can put any Julia expression inside the parentheses. # Printing is easy -println("I'm Julia. Nice to meet you!") # => I'm Julia. Nice to meet you! +println("I'm Julia. Nice to meet you!") # => I'm Julia. Nice to meet you! # Another way to format strings is the printf macro from the stdlib Printf. -using Printf -@printf "%d is less than %f\n" 4.5 5.3 # => 5 is less than 5.300000 +using Printf # this is how you load (or import) a module +@printf "%d is less than %f\n" 4.5 5.3 # => 5 is less than 5.300000 #################################################### @@ -123,7 +124,7 @@ using Printf # You don't declare variables before assigning to them. someVar = 5 # => 5 -someVar # => 5 +someVar # => 5 # Accessing a previously unassigned variable is an error try @@ -137,9 +138,10 @@ end SomeOtherVar123! = 6 # => 6 # You can also use certain unicode characters +# here ☃ is a Unicode 'snowman' characters, see http://emojipedia.org/%E2%98%83%EF%B8%8F if it displays wrongly here ☃ = 8 # => 8 -# These are especially handy for mathematical notation -2 * π # => 6.283185307179586 +# These are especially handy for mathematical notation, like the constant π +2 * π # => 6.283185307179586 # A note on naming conventions in Julia: # @@ -171,7 +173,7 @@ matrix = [1 2; 3 4] # => 2×2 Array{Int64,2}: [1 2; 3 4] b = Int8[4, 5, 6] # => 3-element Array{Int8,1}: [4, 5, 6] # Add stuff to the end of a list with push! and append! -# By convention, the exclamation mark '!'' is appended to names of functions +# By convention, the exclamation mark '!' is appended to names of functions # that modify their arguments push!(a, 1) # => [1] push!(a, 2) # => [1,2] @@ -202,10 +204,10 @@ a # => [7,2,4,3,4,5,6] # Function names that end in exclamations points indicate that they modify # their argument. arr = [5,4,6] # => 3-element Array{Int64,1}: [5,4,6] -sort(arr) # => [4,5,6] -arr # => [5,4,6] -sort!(arr) # => [4,5,6] -arr # => [4,5,6] +sort(arr) # => [4,5,6] +arr # => [5,4,6] +sort!(arr) # => [4,5,6] +arr # => [4,5,6] # Looking out of bounds is a BoundsError try @@ -238,7 +240,7 @@ a = [1:5;] # => 5-element Array{Int64,1}: [1,2,3,4,5] a2 = [1:5] # => 1-element Array{UnitRange{Int64},1}: [1:5] # You can look at ranges with slice syntax. -a[1:3] # => [1, 2, 3] +a[1:3] # => [1, 2, 3] a[2:end] # => [2, 3, 4, 5] # Remove elements from an array by index with splice! @@ -276,15 +278,15 @@ in(2, tup) # => true # You can unpack tuples into variables a, b, c = (1, 2, 3) # => (1,2,3) -a # => 1 -b # => 2 -c # => 3 +a # => 1 +b # => 2 +c # => 3 # Tuples are created even if you leave out the parentheses d, e, f = 4, 5, 6 # => (4,5,6) -d # => 4 -e # => 5 -f # => 6 +d # => 4 +e # => 5 +f # => 6 # A 1-element tuple is distinct from the value it contains (1,) == 1 # => false @@ -292,8 +294,8 @@ f # => 6 # Look how easy it is to swap two values e, d = d, e # => (5,4) -d # => 5 -e # => 4 +d # => 5 +e # => 4 # Dictionaries store mappings emptyDict = Dict() # => Dict{Any,Any} with 0 entries @@ -375,7 +377,8 @@ end # Iterable types include Range, Array, Set, Dict, and AbstractString. for animal = ["dog", "cat", "mouse"] println("$animal is a mammal") - # You can use $ to interpolate variables or expression into strings + # You can use $ to interpolate variables or expression into strings. + # In this special case, no need for parenthesis: $animal and $(animal) give the same end # => dog is a mammal # => cat is a mammal @@ -408,7 +411,7 @@ end let x = 0 while x < 4 println(x) - x += 1 # Shorthand for x = x + 1 + x += 1 # Shorthand for in place increment: x = x + 1 end end # => 0 diff --git a/kotlin.html.markdown b/kotlin.html.markdown index 5bbf6847..12008074 100644 --- a/kotlin.html.markdown +++ b/kotlin.html.markdown @@ -180,7 +180,7 @@ fun helloWorld(val name : String) { // destructuring in "for" loop for ((a, b, c) in listOf(fooData)) { - println("$a $b $c") // => 1 100 4 + println("$a $b $c") // => 1 2 4 } val mapData = mapOf("a" to 1, "b" to 2) @@ -426,7 +426,7 @@ data class Counter(var value: Int) { operator fun invoke() = println("The value of the counter is $value") } -/* You can also overload operators through an extension methods */ +/* You can also overload operators through extension methods */ // overload -Counter operator fun Counter.unaryMinus() = Counter(-this.value) diff --git a/latex.html.markdown b/latex.html.markdown index 49200968..29a9f638 100644 --- a/latex.html.markdown +++ b/latex.html.markdown @@ -2,7 +2,7 @@ language: latex contributors: - ["Chaitanya Krishna Ande", "http://icymist.github.io"] - - ["Colton Kohnke", "http://github.com/voltnor"] + - ["Colton Kohnke", "https://github.com/voltnor"] - ["Sricharan Chiruvolu", "http://sricharan.xyz"] - ["Ramanan Balakrishnan", "https://github.com/ramananbalakrishnan"] - ["Svetlana Golubeva", "https://attillax.github.io/"] @@ -181,7 +181,9 @@ Summations and Integrals are written with sum and int commands: \section{Figures} Let's insert a figure. Figure placement can get a little tricky. +Basic options are [t] for top, [b] for bottom, [h] for here (approximately). I definitely have to lookup the placement options each time. +% See https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions for more details \begin{figure}[H] % H here denoted the placement option. \centering % centers the figure on the page @@ -198,13 +200,21 @@ We can also insert Tables in the same way as figures. \begin{table}[H] \caption{Caption for the Table.} % the {} arguments below describe how each row of the table is drawn. - % Again, I have to look these up. Each. And. Every. Time. - \begin{tabular}{c|cc} + % The basic is simple: one letter for each column, to control alignment: + % basic options are: c, l, r and p for centered, left, right and paragraph + % optionnally, you can add a | for a vertical line + % See https://en.wikibooks.org/wiki/LaTeX/Tables for more details + \begin{tabular}{c|cc} % here it means "centered | vertical line, centered centered" Number & Last Name & First Name \\ % Column rows are separated by & \hline % a horizontal line 1 & Biggus & Dickus \\ 2 & Monty & Python \end{tabular} + % it will approximately be displayed like this + % Number | Last Name First Name + % -------|--------------------------- % because of \hline + % 1 | Biggus Dickus + % 2 | Monty Python \end{table} \section{Getting \LaTeX{} to not compile something (i.e.\ Source Code)} @@ -218,7 +228,8 @@ environment. \begin{verbatim} print("Hello World!") a%b; % look! We can use % signs in verbatim. - random = 4; #decided by fair random dice roll + random = 4; #decided by fair random dice roll, https://www.xkcd.com/221/ + See https://www.explainxkcd.com/wiki/index.php/221:_Random_Number \end{verbatim} \section{Compiling} @@ -244,6 +255,7 @@ Step 2 is still happening behind the scenes\footnote{In cases, where you use references (like Eqn.~\ref{eq:pythagoras}), you may need to run Step 2 multiple times, to generate an intermediary *.aux file.}. % Also, this is how you add footnotes to your document! +% with a simple \footnote{...} command. They are numbered ¹, ², ... by default. You write all your formatting information in plain text in Step 1. The compilation part in Step 2 takes care of producing the document in the @@ -265,6 +277,27 @@ There exists two main types of links: visible URL \\ This package also produces list of thumbnails in the output pdf document and active links in the table of contents. +\section{Writing in ASCII or other encodings} + +By default, historically LaTeX accepts inputs which are pure ASCII (128), +not even extened ASCII, meaning without accents (à, è etc.) and non-Latin symbols. + +It is easy to insert accents and basic Latin symbols, with backslash shortcuts +Like \,c, \'e, \`A, \ae and \oe etc. % for ç, é, À, etc +% See https://en.wikibooks.org/wiki/LaTeX/Special_Characters#Escaped_codes for more + +To write directly in UTF-8, when compiling with pdflatex, use +\begin{verbatim} + \usepackage[utf8]{inputenc} +\end{verbatim} +The selected font has to support the glyphs used for your document, you have to add +\begin{verbatim} + \usepackage[T1]{fontenc} +\end{verbatim} + +Not that there also exists LuaTeX and XeLaTeX that were designed to have builtin +support for UTF-8 and case ease your life if you don't write in a latin alphabet. + \section{End} That's all for now! diff --git a/lua.html.markdown b/lua.html.markdown index 53e396be..4a470623 100644 --- a/lua.html.markdown +++ b/lua.html.markdown @@ -395,7 +395,7 @@ g() -- Prints out 343; nothing printed before now. I was excited to learn Lua so I could make games with the <a href="http://love2d.org/">Love 2D game engine</a>. That's the why. -I started with <a href="http://nova-fusion.com/2012/08/27/lua-for-programmers-part-1/">BlackBulletIV's Lua for programmers</a>. +I started with <a href="https://ebens.me/post/lua-for-programmers-part-1/">BlackBulletIV's Lua for programmers</a>. Next I read the official <a href="http://www.lua.org/pil/contents.html">Programming in Lua</a> book. That's the how. diff --git a/matlab.html.markdown b/matlab.html.markdown index 4ca31857..ecf2fc96 100644 --- a/matlab.html.markdown +++ b/matlab.html.markdown @@ -28,7 +28,7 @@ this % Two percent signs denote the start of a new code section % Individual code sections can be run by moving the cursor to the section followed by % either clicking the "Run Section" button -% or using Ctrl+Shift+Enter (Windows) or Cmd+Shift+Return (OS X) +% or using Ctrl+Shift+Enter (Windows) or Cmd+Shift+Return (macOS) %% This is the start of a code section % One way of using sections is to separate expensive but unchanging start-up code like loading data diff --git a/ms-my/bash-my.html.markdown b/ms-my/bash-my.html.markdown index e4e55b2c..a97e651c 100644 --- a/ms-my/bash-my.html.markdown +++ b/ms-my/bash-my.html.markdown @@ -17,7 +17,7 @@ translators: lang: ms-my --- -Bash adalah nama daripada unix shell, yang mana telah diagihkan sebagai shell untuk sistem operasi GNU dan sebagai shell lalai pada Linux dan Mac OS X. Hampir semua contoh di bawah boleh menjadi sebahagian daripada skrip shell atau dijalankan terus dalam shell. +Bash adalah nama daripada unix shell, yang mana telah diagihkan sebagai shell untuk sistem operasi GNU dan sebagai shell lalai pada Linux dan macOS. Hampir semua contoh di bawah boleh menjadi sebahagian daripada skrip shell atau dijalankan terus dalam shell. [Baca lebih lanjut di sini.](http://www.gnu.org/software/bash/manual/bashref.html) diff --git a/nl-nl/bash-nl.html.markdown b/nl-nl/bash-nl.html.markdown index af4a8cc8..8d127c57 100644 --- a/nl-nl/bash-nl.html.markdown +++ b/nl-nl/bash-nl.html.markdown @@ -17,7 +17,7 @@ lang: nl-nl filename: LearnBash-nl.sh --- -Bash is de naam van de unix shell, deze wordt gebruikt voor het GNU operating system en is de standaard shell op Linux en Mac OS X. +Bash is de naam van de unix shell, deze wordt gebruikt voor het GNU operating system en is de standaard shell op Linux en macOS. Bijna alle voorbeelden hieronder kunnen deel uitmaken van een shell script of kunnen uitgevoerd worden in de shell. [Lees er meer over hier.](http://www.gnu.org/software/bash/manual/bashref.html) diff --git a/no-nb/bash-no.html.markdown b/no-nb/bash-no.html.markdown index 481aecbd..9affaa21 100644 --- a/no-nb/bash-no.html.markdown +++ b/no-nb/bash-no.html.markdown @@ -17,7 +17,7 @@ lang: no-nb --- Bash er navnet på unix skallet, som også var distribuert som skallet for GNU operativsystemet og som standard skall på de fleste Linux distribusjoner og -Mac OS X. +macOS. [Les mer her.](http://www.gnu.org/software/bash/manual/bashref.html) diff --git a/objective-c.html.markdown b/objective-c.html.markdown index de3884af..c029c5fb 100644 --- a/objective-c.html.markdown +++ b/objective-c.html.markdown @@ -9,7 +9,7 @@ contributors: filename: LearnObjectiveC.m --- -Objective-C is the main programming language used by Apple for the OS X and iOS operating systems and their respective frameworks, Cocoa and Cocoa Touch. +Objective-C is the main programming language used by Apple for the macOS and iOS operating systems and their respective frameworks, Cocoa and Cocoa Touch. It is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. ```objective-c diff --git a/pt-br/bash-pt.html.markdown b/pt-br/bash-pt.html.markdown index 988e8e7d..ab003a18 100644 --- a/pt-br/bash-pt.html.markdown +++ b/pt-br/bash-pt.html.markdown @@ -17,7 +17,7 @@ lang: pt-br Tutorial de shell em português Bash é o nome do shell do Unix, que também é distribuído como shell do sistema -operacional GNU e como shell padrão para Linux e Mac OS X. Praticamente todos +operacional GNU e como shell padrão para Linux e macOS. Praticamente todos os exemplos abaixo podem fazer parte de um shell script e pode ser executados diretamente no shell. diff --git a/pt-br/swift-pt.html.markdown b/pt-br/swift-pt.html.markdown index bf410352..96b96427 100644 --- a/pt-br/swift-pt.html.markdown +++ b/pt-br/swift-pt.html.markdown @@ -10,7 +10,7 @@ lang: pt-br --- -Swift é uma linguagem de programação para desenvolvimento de aplicações no iOS e OS X criada pela Apple. Criada para +Swift é uma linguagem de programação para desenvolvimento de aplicações no iOS e macOS criada pela Apple. Criada para coexistir com Objective-C e para ser mais resiliente a código com erros, Swift foi apresentada em 2014 na Apple's developer conference WWDC. Foi construída com o compilador LLVM já incluído no Xcode 6 beta. diff --git a/pt-br/typescript-pt.html.markdown b/pt-br/typescript-pt.html.markdown index ed76959c..7d28bf53 100644 --- a/pt-br/typescript-pt.html.markdown +++ b/pt-br/typescript-pt.html.markdown @@ -12,7 +12,7 @@ Typescript é uma linguagem que visa facilitar o desenvolvimento de aplicações Typescript acrescenta conceitos comuns como classes, módulos, interfaces, genéricos e (opcional) tipagem estática para JavaScript. É um super conjunto de JavaScript: todo o código JavaScript é TypeScript válido então ele pode ser adicionado diretamente a qualquer projeto. O compilador emite TypeScript JavaScript. -Este artigo irá se concentrar apenas na sintaxe extra do TypeScript, ao contrário de [JavaScript](javascript-pt.html.markdown). +Este artigo irá se concentrar apenas na sintaxe extra do TypeScript, ao contrário de [JavaScript](../javascript-pt/). Para testar o compilador TypeScript, vá para o [Playground](http://www.typescriptlang.org/Playground), onde você vai ser capaz de escrever código, ter auto conclusão e ver diretamente o JavaScript emitido. diff --git a/pt-pt/swift-pt.html.markdown b/pt-pt/swift-pt.html.markdown index 6b263942..a8d3e1ab 100644 --- a/pt-pt/swift-pt.html.markdown +++ b/pt-pt/swift-pt.html.markdown @@ -12,7 +12,7 @@ translators: lang: pt-pt --- -Swift é uma linguagem de programação criada pela Apple para o desenvolvimento em iOS e OS X. +Swift é uma linguagem de programação criada pela Apple para o desenvolvimento em iOS e macOS. Desenhada de forma a coexistir com Objective-C e ser mais resiliente contra código errôneo, a linguagem Swift foi introduzida em 2014 na conferência para desenvolvedores WWDC da Apple. Swift usa o compilador LLVM incluido no XCode 6+. diff --git a/purescript.html.markdown b/purescript.html.markdown index 6b74ac64..c848c2a4 100644 --- a/purescript.html.markdown +++ b/purescript.html.markdown @@ -6,19 +6,20 @@ contributors: - ["Thimoteus", "https://github.com/Thimoteus"] --- -PureScript is a small strongly, statically typed language compiling to Javascript. +PureScript is a small strongly, statically typed language compiling to JavaScript. -* Learn more at [http://www.purescript.org/](http://www.purescript.org/) -* Documentation: [http://pursuit.purescript.org/](http://pursuit.purescript.org/) -* Book: Purescript by Example, [https://leanpub.com/purescript/](https://leanpub.com/purescript/) +* Learn more at [https://www.purescript.org/](https://www.purescript.org/) +* Documentation: [https://pursuit.purescript.org/](https://pursuit.purescript.org/) +* Book: Purescript by Example, [https://book.purescript.org/](https://book.purescript.org/) -All the noncommented lines of code can be run in the PSCI REPL, though some will -require the `--multi-line-mode` flag. +All the noncommented lines of code can be run in the PSCi REPL, though some +will require "paste" mode (`:paste` followed by multiple lines, terminated by +^D). ```haskell -- --- 1. Primitive datatypes that corresponds to their Javascript +-- 1. Primitive datatypes that corresponds to their JavaScript -- equivalents at runtime. import Prelude @@ -39,7 +40,7 @@ import Prelude 3.0 % 2.0 -- 1.0 4.0 % 2.0 -- 0.0 -- Inspect the type of an expression in psci -:t 9.5/2.5 + 4.4 -- Prim.Number +:t 9.5/2.5 + 4.4 -- Number -- Booleans true :: Boolean -- true @@ -59,7 +60,7 @@ true && (9 >= 19 || 1 < 2) -- true -- Strings "Hellow" :: String -- "Hellow" --- Multiline string without newlines, to run in psci use the --multi-line-mode flag +-- Multiline string without newlines, to run in PSCi use "paste" mode. "Hellow\ \orld" -- "Helloworld" -- Multiline string with newlines @@ -69,26 +70,26 @@ world""" -- "Hello\nworld" "such " <> "amaze" -- "such amaze" -- --- 2. Arrays are Javascript arrays, but must be homogeneous +-- 2. Arrays are JavaScript arrays, but must be homogeneous [1,1,2,3,5,8] :: Array Int -- [1,1,2,3,5,8] [1.2,2.0,3.14] :: Array Number -- [1.2,2.0,3.14] [true, true, false] :: Array Boolean -- [true,true,false] -- [1,2, true, "false"] won't work --- `Cannot unify Prim.Int with Prim.Boolean` +-- `Cannot unify Int with Boolean` + +-- Requires purescript-arrays (Data.Array) -- Cons (prepend) 1 : [2,4,3] -- [1,2,4,3] --- Requires purescript-arrays (Data.Array) -- and purescript-maybe (Data.Maybe) - -- Safe access return Maybe a -head [1,2,3] -- Just (1) -tail [3,2,1] -- Just ([2,1]) -init [1,2,3] -- Just ([1,2]) -last [3,2,1] -- Just (1) +head [1,2,3] -- (Just 1) +tail [3,2,1] -- (Just [2,1]) +init [1,2,3] -- (Just [1,2]) +last [3,2,1] -- (Just 1) -- Array access - indexing -[3,4,5,6,7] !! 2 -- Just (5) +[3,4,5,6,7] !! 2 -- (Just 5) -- Range 1..5 -- [1,2,3,4,5] length [2,2,2] -- 3 @@ -97,31 +98,30 @@ take 3 [5,4,3,2,1] -- [5,4,3] append [1,2,3] [4,5,6] -- [1,2,3,4,5,6] -- --- 3. Records are Javascript objects, with zero or more fields, which +-- 3. Records are JavaScript objects, with zero or more fields, which -- can have different types. --- In psci you have to write `let` in front of the function to get a --- top level binding. -let book = {title: "Foucault's pendulum", author: "Umberto Eco"} +book = {title: "Foucault's pendulum", author: "Umberto Eco"} -- Access properties book.title -- "Foucault's pendulum" -let getTitle b = b.title +getTitle b = b.title -- Works on all records with a title (but doesn't require any other field) getTitle book -- "Foucault's pendulum" getTitle {title: "Weekend in Monaco", artist: "The Rippingtons"} -- "Weekend in Monaco" -- Can use underscores as shorthand _.title book -- "Foucault's pendulum" -- Update a record -let changeTitle b t = b {title = t} +changeTitle b t = b {title = t} getTitle (changeTitle book "Ill nome della rosa") -- "Ill nome della rosa" -- -- 4. Functions --- In psci's multiline mode -let sumOfSquares :: Int -> Int -> Int - sumOfSquares x y = x*x + y*y +-- In PSCi's paste mode +sumOfSquares :: Int -> Int -> Int +sumOfSquares x y = x*x + y*y sumOfSquares 3 4 -- 25 -let myMod x y = x % y + +myMod x y = x % y myMod 3.0 2.0 -- 1.0 -- Infix application of function 3 `mod` 2 -- 1 @@ -131,48 +131,47 @@ myMod 3.0 2.0 -- 1.0 sumOfSquares 3 4 * sumOfSquares 4 5 -- 1025 -- Conditional -let abs' n = if n>=0 then n else -n +abs' n = if n>=0 then n else -n abs' (-3) -- 3 -- Guarded equations -let abs'' n | n >= 0 = n - | otherwise = -n +-- In PSCi's paste mode +abs'' n | n >= 0 = n + | otherwise = -n -- Pattern matching -- Note the type signature, input is a list of numbers. The pattern matching -- destructures and binds the list into parts. --- Requires purescript-lists (Data.List) -let first :: forall a. List a -> a - first (Cons x _) = x -first (toList [3,4,5]) -- 3 -let second :: forall a. List a -> a - second (Cons _ (Cons y _)) = y -second (toList [3,4,5]) -- 4 -let sumTwo :: List Int -> List Int - sumTwo (Cons x (Cons y rest)) = x + y : rest -fromList (sumTwo (toList [2,3,4,5,6])) :: Array Int -- [5,4,5,6] - --- sumTwo doesn't handle when the list is empty or there's only one element in --- which case you get an error. -sumTwo [1] -- Failed pattern match +-- Requires purescript-lists (Data.List) and purescript-maybe (Data.Maybe) +first :: forall a. List a -> Maybe a +first (x : _) = Just x +first Nil = Nothing +first (fromFoldable [3,4,5]) -- (Just 3) + +second :: forall a. List a -> Maybe a +second Nil = Nothing +second (_ : Nil) = Nothing +second (_ : (y : _)) = Just y +second (fromFoldable [3,4,5]) -- (Just 4) -- Complementing patterns to match -- Good ol' Fibonacci -let fib 1 = 1 - fib 2 = 2 - fib x = fib (x-1) + fib (x-2) +fib 1 = 1 +fib 2 = 2 +fib x = fib (x-1) + fib (x-2) fib 10 -- 89 -- Use underscore to match any, where you don't care about the binding name -let isZero 0 = true - isZero _ = false +isZero 0 = true +isZero _ = false +isZero 9 -- false -- Pattern matching on records -let ecoTitle {author = "Umberto Eco", title = t} = Just t - ecoTitle _ = Nothing +ecoTitle {author: "Umberto Eco", title: t} = Just t +ecoTitle _ = Nothing -ecoTitle book -- Just ("Foucault's pendulum") +ecoTitle {title: "Foucault's pendulum", author: "Umberto Eco"} -- (Just "Foucault's pendulum") ecoTitle {title: "The Quantum Thief", author: "Hannu Rajaniemi"} -- Nothing -- ecoTitle requires both field to type check: ecoTitle {title: "The Quantum Thief"} -- Object lacks required property "author" @@ -180,13 +179,13 @@ ecoTitle {title: "The Quantum Thief"} -- Object lacks required property "author" -- Lambda expressions (\x -> x*x) 3 -- 9 (\x y -> x*x + y*y) 4 5 -- 41 -let sqr = \x -> x*x +sqr = \x -> x*x -- Currying -let myAdd x y = x + y -- is equivalent with -let myAdd' = \x -> \y -> x + y -let add3 = myAdd 3 -:t add3 -- Prim.Int -> Prim.Int +myAdd x y = x + y -- is equivalent with +myAdd' = \x -> \y -> x + y +add3 = myAdd 3 +:t add3 -- Int -> Int -- Forward and backward function composition -- drop 3 followed by taking 5 @@ -195,7 +194,7 @@ let add3 = myAdd 3 (drop 3 <<< take 5) (1..20) -- [4,5] -- Operations using higher order functions -let even x = x `mod` 2 == 0 +even x = x `mod` 2 == 0 filter even (1..10) -- [2,4,6,8,10] map (\x -> x + 11) (1..5) -- [12,13,14,15,16] diff --git a/python.html.markdown b/python.html.markdown index e21d7dde..39e60455 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -482,7 +482,7 @@ except (TypeError, NameError): pass # Multiple exceptions can be handled together, if required. else: # Optional clause to the try/except block. Must follow all except blocks print("All good!") # Runs only if the code in try raises no exceptions -finally: # Execute under all circumstances +finally: # Execute under all circumstances print("We can clean up resources here") # Instead of try/finally to cleanup resources you can use a with statement @@ -735,7 +735,7 @@ class Human: return "*grunt*" # A property is just like a getter. - # It turns the method age() into an read-only attribute of the same name. + # It turns the method age() into a read-only attribute of the same name. # There's no need to write trivial getters and setters in Python, though. @property def age(self): diff --git a/r.html.markdown b/r.html.markdown index 3e855602..79af40ce 100644 --- a/r.html.markdown +++ b/r.html.markdown @@ -255,16 +255,16 @@ c('Z', 'o', 'r', 'r', 'o') == "Z" # TRUE FALSE FALSE FALSE FALSE # FACTORS # The factor class is for categorical data -# Factors can be ordered (like childrens' grade levels) or unordered (like gender) -factor(c("female", "female", "male", NA, "female")) -# female female male <NA> female -# Levels: female male +# Factors can be ordered (like childrens' grade levels) or unordered (like colors) +factor(c("blue", "blue", "green", NA, "blue")) +# blue blue green <NA> blue +# Levels: blue green # The "levels" are the values the categorical data can take # Note that missing data does not enter the levels -levels(factor(c("male", "male", "female", NA, "female"))) # "female" "male" +levels(factor(c("green", "green", "blue", NA, "blue"))) # "blue" "green" # If a factor vector has length 1, its levels will have length 1, too -length(factor("male")) # 1 -length(levels(factor("male"))) # 1 +length(factor("green")) # 1 +length(levels(factor("green"))) # 1 # Factors are commonly seen in data frames, a data structure we will cover later data(infert) # "Infertility after Spontaneous and Induced Abortion" levels(infert$education) # "0-5yrs" "6-11yrs" "12+ yrs" diff --git a/ro-ro/bash-ro.html.markdown b/ro-ro/bash-ro.html.markdown index 32a878b2..de946861 100644 --- a/ro-ro/bash-ro.html.markdown +++ b/ro-ro/bash-ro.html.markdown @@ -12,7 +12,7 @@ lang: ro-ro filename: LearnBash-ro.sh --- -Bash este numele shell-ului UNIX, care a fost de asemenea distribuit drept shell pentru sistemul de operare GNU și ca shell implicit pentru Linux si Mac OS X. +Bash este numele shell-ului UNIX, care a fost de asemenea distribuit drept shell pentru sistemul de operare GNU și ca shell implicit pentru Linux si macOS. Aproape toate exemplele de mai jos pot fi parte dintr-un script sau pot fi executate direct in linia de comanda. [Citește mai multe:](http://www.gnu.org/software/bash/manual/bashref.html) diff --git a/ru-ru/bash-ru.html.markdown b/ru-ru/bash-ru.html.markdown index ce918340..9978380a 100644 --- a/ru-ru/bash-ru.html.markdown +++ b/ru-ru/bash-ru.html.markdown @@ -26,7 +26,7 @@ lang: ru-ru Bash — это командная оболочка unix, которая распространялась как оболочка для операционной системы GNU и используется в качестве оболочки по умолчанию -для Linux и Mac OS X. +для Linux и macOS. Почти все нижеприведённые примеры могут быть частью shell-скриптов или исполнены напрямую в shell. diff --git a/ru-ru/c-ru.html.markdown b/ru-ru/c-ru.html.markdown index ba3c19ee..cc68d620 100644 --- a/ru-ru/c-ru.html.markdown +++ b/ru-ru/c-ru.html.markdown @@ -353,7 +353,7 @@ int main() { // Это не работает, если строка является массивом // (потенциально задаваемой с помощью строкового литерала) - // который находиться в перезаписываемой части памяти: + // который находится в перезаписываемой части памяти: char foo[] = "foo"; foo[0] = 'a'; // это выполнится и строка теперь "aoo" diff --git a/ru-ru/forth-ru.html.markdown b/ru-ru/forth-ru.html.markdown index 05316578..2fc4ad7c 100644 --- a/ru-ru/forth-ru.html.markdown +++ b/ru-ru/forth-ru.html.markdown @@ -12,9 +12,10 @@ lang: ru-ru Внимание: эта материал использует реализацию Форта - Gforth, но большая часть написанного будет работать в других средах. + ``` \ Это комментарий -( Это тоже комментарий, но использыется для предоределённых слов ) +( Это тоже комментарий, но используется для предоределённых слов ) \ --------------------------------- Прекурсор -------------------------------- diff --git a/ru-ru/objective-c-ru.html.markdown b/ru-ru/objective-c-ru.html.markdown index 3baa15f8..092c3e2f 100644 --- a/ru-ru/objective-c-ru.html.markdown +++ b/ru-ru/objective-c-ru.html.markdown @@ -12,7 +12,7 @@ lang: ru-ru --- Objective-C — основной язык программирования, используемый корпорацией Apple -для операционных систем OS X и iOS и их соответствующих фреймворках Cocoa и +для операционных систем macOS и iOS и их соответствующих фреймворках Cocoa и Cocoa Touch. Он является объектно-ориентированным языком программирования общего назначения, который добавляет обмен сообщениями в Smalltalk-стиле к языку программирования C. diff --git a/ru-ru/swift-ru.html.markdown b/ru-ru/swift-ru.html.markdown index f2b1fd36..b1931f9a 100644 --- a/ru-ru/swift-ru.html.markdown +++ b/ru-ru/swift-ru.html.markdown @@ -13,7 +13,7 @@ lang: ru-ru --- Swift - это язык программирования, созданный компанией Apple, для приложений -под iOS и OS X. Разработанный, чтобы сосуществовать с Objective-C и +под iOS и macOS. Разработанный, чтобы сосуществовать с Objective-C и быть более устойчивым к ошибочному коду, Swift был представлен в 2014 году на конференции разработчиков Apple, WWDC. Приложения на Swift собираются с помощью LLVM-компилятора, включенного в Xcode 6+. diff --git a/set-theory.html.markdown b/set-theory.html.markdown index 6be7aa00..c6e72960 100644 --- a/set-theory.html.markdown +++ b/set-theory.html.markdown @@ -41,7 +41,7 @@ The cardinality, or size, of a set is determined by the number of items in the s For example, if `S = { 1, 2, 4 }`, then `|S| = 3`. ### The Empty Set -* The empty set can be constructed in set builder notation using impossible conditions, e.g. `∅ = { x : x =/= x }`, or `∅ = { x : x ∈ N, x < 0 }`; +* The empty set can be constructed in set builder notation using impossible conditions, e.g. `∅ = { x : x ≠ x }`, or `∅ = { x : x ∈ N, x < 0 }`; * the empty set is always unique (i.e. there is one and only one empty set); * the empty set is a subset of all sets; * the cardinality of the empty set is 0, i.e. `|∅| = 0`. @@ -87,7 +87,7 @@ D = { 2x : x ∈ N } = { 0, 2, 4, 6, 8, ... } ## Special Sets ### The Power Set -* Let `A` be any set. The set that contains all possible subsets of `A` is called a "power set" and is written as `P(A)`. If the set `A` contains `n` elements, then `P(A)` contains `2^N` elements. +* Let `A` be any set. The set that contains all possible subsets of `A` is called a "power set" and is written as `P(A)`. If the set `A` contains `n` elements, then `P(A)` contains `2^n` elements. ``` P(A) = { x : x ⊆ A } diff --git a/sk-sk/bash-sk.html.markdown b/sk-sk/bash-sk.html.markdown index e9d1490c..1b0f48d4 100644 --- a/sk-sk/bash-sk.html.markdown +++ b/sk-sk/bash-sk.html.markdown @@ -19,7 +19,7 @@ filename: LearnBash-sk.sh Bash je pomenovanie pre unix shell (príkazový interpreter), ktorý bol tiež distribuovaný ako shell pre GNU operačné systémy a ako predvolený -shell pre Linux a Mac OS X. +shell pre Linux a macOS. Takmer všetky príklady uvedené nižšie môžu byť súčasťou shell skriptu alebo vykonané priamo v shelli. diff --git a/solidity.html.markdown b/solidity.html.markdown index cc719ec7..251e9008 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -6,6 +6,7 @@ contributors: - ["Joseph Chow", ""] - ["Bhoomtawath Plinsut", "https://github.com/varshard"] - ["Shooter", "https://github.com/liushooter"] + - ["Patrick Collins", "https://gist.github.com/PatrickAlphaC"] --- Solidity lets you program on [Ethereum](https://www.ethereum.org/), a @@ -18,7 +19,7 @@ state variables, functions, and common data types. Contract-specific features include modifier (guard) clauses, event notifiers for listeners, and custom global variables. -Some Ethereum contract examples include crowdfunding, voting, and blind auctions. +Some Ethereum contract examples include crowdfunding, voting, [decentralized finance](https://defipulse.com/), and blind auctions. There is a high risk and high cost of errors in Solidity code, so you must be very careful to test and slowly rollout. WITH THE RAPID CHANGES IN ETHEREUM, THIS DOCUMENT IS UNLIKELY TO STAY UP TO @@ -32,6 +33,66 @@ popular design patterns. As Solidity and Ethereum are under active development, experimental or beta features are typically marked, and subject to change. Pull requests welcome. +# Working with Remix and Metamask + +One of the easiest ways to build, deploy, and test solidity code is by using the: + +1. [Remix Web IDE](https://remix.ethereum.org/) +2. [Metamask wallet](https://metamask.io/). + +To get started, [download the Metamask Browser Extension](https://metamask.io/). + +Once installed, we will be working with Remix. The below code will be pre-loaded, but before we head over there, let's look at a few tips to get started with remix. Load it all by [hitting this link](https://remix.ethereum.org/#version=soljson-v0.6.6+commit.6c089d02.js&optimize=false&evmVersion=null&gist=f490c0d51141dd0515244db40bbd0c17&runs=200). + +1. Choose the Solidity compiler + +![Solidity-in-remix](images/solidity/remix-solidity.png) + +2. Open the file loaded by that link + +![Solidity-choose-file](images/solidity/remix-choose-file.png) + +3. Compile the file + +![Solidity-compile](images/solidity/remix-compile.png) + +4. Deploy + +![Solidity-deploy](images/solidity/remix-deploy.png) + +5. Play with contracts + +![Solidity-deploy](images/solidity/remix-interact.png) + +You've deployed your first contract! Congrats! + +You can test out and play with the functions defined. Check out the comments to learn about what each does. + + +## Working on a testnet + +Deploying and testing on a testnet is the most accurate way to test your smart contracts in solidity. +To do this let's first get some testnet ETH from the Kovan testnet. + +[Pop into this Gitter Channel](https://gitter.im/kovan-testnet/faucet) and drop your metamask address in. + +In your metamask, you'll want to change to the `Kovan` testnet. + +![Solidity-in-remix](images/solidity/metamask-kovan.png) + +You'll be given some free test Ethereum. Ethereum is needed to deploy smart contracts when working with a testnet. + +In the previous example, we didn't use a testnet, we deployed to a fake virtual environment. +When working with a testnet, we can actually see and interact with our contracts in a persistent manner. + +To deploy to a testnet, on the `#4 Deploy` step, change your `environment` to `injected web3`. +This will use whatever network is currently selected in your metamask as the network to deploy to. + +![Solidity-in-remix](images/solidity/remix-testnet.png) + +For now, please continue to use the `Javascript VM` unless instructed otherwise. When you deploy to a testnet, metamask will pop up to ask you to "confirm" the transaction. Hit yes, and after a delay, you'll get the same contract interface at the bottom of your screen. + + ```javascript // First, a simple Bank contract // Allows deposits, withdrawals, and balance checks @@ -40,7 +101,7 @@ features are typically marked, and subject to change. Pull requests welcome. /* **** START EXAMPLE **** */ // Declare the source file compiler version -pragma solidity ^0.4.19; +pragma solidity ^0.6.6; // Start with Natspec comment (the three slashes) // used for documentation - and as descriptive data for UI elements/actions @@ -67,7 +128,7 @@ contract SimpleBank { // CapWords event LogDepositMade(address accountAddress, uint amount); // Constructor, can receive one or many variables here; only one allowed - function SimpleBank() public { + constructor() public { // msg provides details about the message that's sent to the contract // msg.sender is contract caller (address of contract creator) owner = msg.sender; @@ -84,7 +145,7 @@ contract SimpleBank { // CapWords // no "this." or "self." required with state variable // all values set to data type's initial value by default - LogDepositMade(msg.sender, msg.value); // fire event + emit LogDepositMade(msg.sender, msg.value); // fire event return balances[msg.sender]; } @@ -92,7 +153,7 @@ contract SimpleBank { // CapWords /// @notice Withdraw ether from bank /// @dev This does not return any excess ether sent to it /// @param withdrawAmount amount you want to withdraw - /// @return The balance remaining for the user + /// @return remainingBal function withdraw(uint withdrawAmount) public returns (uint remainingBal) { require(withdrawAmount <= balances[msg.sender]); @@ -153,7 +214,8 @@ assert(c >= a); // assert tests for internal invariants; require is used for use // https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol -// No random functions built in, use other contracts for randomness +// No random functions built in, you can get a pseduo-random number by hashing the current blockhash, or get a truely random number using something like Chainlink VRF. +// https://docs.chain.link/docs/get-a-random-number // Type casting int x = int(b); @@ -584,9 +646,35 @@ reveal(100, "mySecret"); // All data to start of time is stored in blockchain, so // anyone can observe all previous data and changes +// E. Oracles and External Data +// Oracles are ways to interact with your smart contracts outside the blockchain. +// They are used to get data from the real world, send post requests, to the real world +// or vise versa. + +// Time-based implementations of contracts are also done through oracles, as +// contracts need to be directly called and can not "subscribe" to a time. +// Due to smart contracts being decentralized, you also want to get your data +// in a decentralized manner, other your run into the centralized risk that +// smart contract design matter prevents. + +// To easiest way get and use pre-boxed decentralized data is with Chainlink Data Feeds +// https://docs.chain.link/docs/get-the-latest-price +// We can reference on-chain reference points that have already been aggregated by +// multiple sources and delivered on-chain, and we can use it as a "data bank" +// of sources. + +// You can see other examples making API calls here: +// https://docs.chain.link/docs/make-a-http-get-request + +// And you can of course build your own oracle network, just be sure to know +// how centralized vs decentralized your application is. + +// Setting up oracle networks yourself + // D. Cron Job // Contracts must be manually called to handle time-based scheduling; can create external // code to regularly ping, or provide incentives (ether) for others to +// // E. Observer Pattern // An Observer Pattern lets you register as a subscriber and @@ -628,23 +716,26 @@ contract SomeOracle { // F. State machines // see example below for State enum and inState modifier +``` +Work with the full example below using the [`Javascript VM` in remix here.](https://remix.ethereum.org/#version=soljson-v0.6.6+commit.6c089d02.js&optimize=false&evmVersion=null&gist=3d12cd503dcedfcdd715ef61f786be0b&runs=200) +```javascript // *** EXAMPLE: A crowdfunding example (broadly similar to Kickstarter) *** // ** START EXAMPLE ** // CrowdFunder.sol -pragma solidity ^0.4.19; +pragma solidity ^0.6.6; /// @title CrowdFunder /// @author nemild contract CrowdFunder { // Variables set on create by creator address public creator; - address public fundRecipient; // creator may be different than recipient + address payable public fundRecipient; // creator may be different than recipient, and must be payable uint public minimumToRaise; // required to tip, else everyone gets refund string campaignUrl; - byte constant version = 1; + byte version = "1"; // Data structures enum State { @@ -654,7 +745,7 @@ contract CrowdFunder { } struct Contribution { uint amount; - address contributor; + address payable contributor; } // State variables @@ -684,10 +775,10 @@ contract CrowdFunder { _; } - function CrowdFunder( + function crowdFund( uint timeInHoursForFundraising, - string _campaignUrl, - address _fundRecipient, + string memory _campaignUrl, + address payable _fundRecipient, uint _minimumToRaise) public { @@ -712,7 +803,7 @@ contract CrowdFunder { ); totalRaised += msg.value; - LogFundingReceived(msg.sender, msg.value, totalRaised); + emit LogFundingReceived(msg.sender, msg.value, totalRaised); checkIfFundingCompleteOrExpired(); return contributions.length - 1; // return id @@ -736,7 +827,7 @@ contract CrowdFunder { public inState(State.Successful) { - fundRecipient.transfer(this.balance); + fundRecipient.transfer(address(this).balance); LogWinnerPaid(fundRecipient); } @@ -766,6 +857,11 @@ contract CrowdFunder { } // ** END EXAMPLE ** +``` + +Some more functions. + +```javascript // 10. OTHER NATIVE FUNCTIONS // Currency units @@ -837,18 +933,27 @@ someContractAddress.callcode('function_name'); ## Additional resources - [Solidity Docs](https://solidity.readthedocs.org/en/latest/) +- [Chainlink Beginner Tutorials](https://docs.chain.link/docs/beginners-tutorial) - [Smart Contract Best Practices](https://github.com/ConsenSys/smart-contract-best-practices) - [Superblocks Lab - Browser based IDE for Solidity](https://lab.superblocks.com/) - [EthFiddle - The JsFiddle for Solidity](https://ethfiddle.com/) - [Browser-based Solidity Editor](https://remix.ethereum.org/) - [Gitter Solidity Chat room](https://gitter.im/ethereum/solidity) - [Modular design strategies for Ethereum Contracts](https://docs.erisindustries.com/tutorials/solidity/) +- [Chainlink Documentation](https://docs.chain.link/docs/getting-started) + +## Smart Contract Development Frameworks +- [Hardhat](https://hardhat.org/) +- [Brownie](https://github.com/eth-brownie/brownie) +- [Truffle](https://www.trufflesuite.com/) ## Important libraries -- [Zeppelin](https://github.com/OpenZeppelin/zeppelin-solidity/): Libraries that provide common contract patterns (crowdfuding, safemath, etc) +- [Zeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts): Libraries that provide common contract patterns (crowdfuding, safemath, etc) +- [Chainlink](https://github.com/smartcontractkit/chainlink): Code that allows you to interact with external data ## Sample contracts - [Dapp Bin](https://github.com/ethereum/dapp-bin) +- [Defi Example](https://github.com/PatrickAlphaC/chainlink_defi) - [Solidity Baby Step Contracts](https://github.com/fivedogit/solidity-baby-steps/tree/master/contracts) - [ConsenSys Contracts](https://github.com/ConsenSys/dapp-store-contracts) - [State of Dapps](http://dapps.ethercasts.com/) @@ -862,6 +967,7 @@ someContractAddress.callcode('function_name'); - [Solidity Style Guide](http://solidity.readthedocs.io/en/latest/style-guide.html): Ethereum's style guide is heavily derived from Python's [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide. ## Editors +- [Remix](https://remix.ethereum.org/) - [Emacs Solidity Mode](https://github.com/ethereum/emacs-solidity) - [Vim Solidity](https://github.com/tomlion/vim-solidity) - Editor Snippets ([Ultisnips format](https://gist.github.com/nemild/98343ce6b16b747788bc)) diff --git a/sv-se/nix-sv.html.markdown b/sv-se/nix-sv.html.markdown index 15d9456b..647575fe 100644 --- a/sv-se/nix-sv.html.markdown +++ b/sv-se/nix-sv.html.markdown @@ -365,4 +365,7 @@ with builtins; [ (https://medium.com/@MrJamesFisher/nix-by-example-a0063a1a4c55) * [Susan Potter - Nix Cookbook - Nix By Example] - (http://funops.co/nix-cookbook/nix-by-example/) + (https://ops.functionalalgebra.com/nix-by-example/) + +* [Rommel Martinez - A Gentle Introduction to the Nix Family] + (https://web.archive.org/web/20210121042658/https://ebzzry.io/en/nix/#nix) diff --git a/swift.html.markdown b/swift.html.markdown index 3981a4ce..39a5cc52 100644 --- a/swift.html.markdown +++ b/swift.html.markdown @@ -12,7 +12,7 @@ contributors: filename: learnswift.swift --- -Swift is a programming language for iOS and OS X development created by Apple. Designed to coexist with Objective-C and to be more resilient against erroneous code, Swift was introduced in 2014 at Apple's developer conference WWDC. It is built with the LLVM compiler included in Xcode 6+. +Swift is a programming language for iOS and macOS development created by Apple. Designed to coexist with Objective-C and to be more resilient against erroneous code, Swift was introduced in 2014 at Apple's developer conference WWDC. It is built with the LLVM compiler included in Xcode 6+. The official _[Swift Programming Language](https://itunes.apple.com/us/book/swift-programming-language/id881256329)_ book from Apple is now available via iBooks. It goes into much more detail than this guide, and if you have the time and patience to read it, it's recommended. Some of these examples are from that book. diff --git a/vi-vn/objective-c-vi.html.markdown b/vi-vn/objective-c-vi.html.markdown index 8bc334ab..4656cf38 100644 --- a/vi-vn/objective-c-vi.html.markdown +++ b/vi-vn/objective-c-vi.html.markdown @@ -7,7 +7,7 @@ lang: vi-vn filename: LearnObjectiveC-vi.m
---
-Objective-C là ngôn ngữ lập trình chính được sử dụng bởi Apple cho các hệ điều hành OS X, iOS và các framework tương ứng của họ, Cocoa và Cocoa Touch.
+Objective-C là ngôn ngữ lập trình chính được sử dụng bởi Apple cho các hệ điều hành macOS, iOS và các framework tương ứng của họ, Cocoa và Cocoa Touch.
Nó là một ngôn ngữ lập trình mục đích tổng quát, hướng đối tượng có bổ sung thêm kiểu truyền thông điệp giống Smalltalk vào ngôn ngữ lập trình C.
```objective-c
diff --git a/zh-cn/bash-cn.html.markdown b/zh-cn/bash-cn.html.markdown index d85e5b8f..225df06b 100644 --- a/zh-cn/bash-cn.html.markdown +++ b/zh-cn/bash-cn.html.markdown @@ -18,7 +18,7 @@ filename: LearnBash-cn.sh lang: zh-cn --- -Bash 是一个为 GNU 计划编写的 Unix shell,是 Linux 和 Mac OS X 下的默认 shell。 +Bash 是一个为 GNU 计划编写的 Unix shell,是 Linux 和 macOS 下的默认 shell。 以下大多数例子可以作为脚本的一部分运行,也可直接在 shell 下交互执行。 [更多信息](http://www.gnu.org/software/bash/manual/bashref.html) diff --git a/zh-cn/c-cn.html.markdown b/zh-cn/c-cn.html.markdown index 7286fa9f..dbad5030 100644 --- a/zh-cn/c-cn.html.markdown +++ b/zh-cn/c-cn.html.markdown @@ -616,7 +616,7 @@ typedef void (*my_fnp_type)(char *); 如果你有问题,请阅读[compl.lang.c Frequently Asked Questions](http://c-faq.com/)。 -使用合适的空格、缩进,保持一致的代码风格非常重要。可读性强的代码比聪明的代码、高速的代码更重要。可以参考下[Linux内核编码风格](https://www.kernel.org/doc/Documentation/CodingStyle) +使用合适的空格、缩进,保持一致的代码风格非常重要。可读性强的代码比聪明的代码、高速的代码更重要。可以参考下[Linux内核编码风格](https://www.kernel.org/doc/Documentation/process/coding-style.rst) 。 除了这些,多多Google吧 diff --git a/zh-cn/go-cn.html.markdown b/zh-cn/go-cn.html.markdown index 37b4b137..2953acf3 100644 --- a/zh-cn/go-cn.html.markdown +++ b/zh-cn/go-cn.html.markdown @@ -40,7 +40,7 @@ import ( func main() { // 往标准输出打印一行。 // 用包名fmt限制打印函数。 - fmt.Println("天坑欢迎你!") + fmt.Println("你好世界") // 调用当前包的另一个函数。 beyondHello() diff --git a/zh-cn/java-cn.html.markdown b/zh-cn/java-cn.html.markdown index 27003f3e..1de7f3e6 100644 --- a/zh-cn/java-cn.html.markdown +++ b/zh-cn/java-cn.html.markdown @@ -297,8 +297,8 @@ class Bicycle { // Bicycle 类的成员变量和方法 public int cadence; // Public: 任意位置均可访问 private int speed; // Private: 只在同类中可以访问 - protected int gear; // Protected: 可以在同类与子类中可以访问 - String name; // default: 可以在包内中可以访问 + protected int gear; // Protected: 可以在同类与子类中访问 + String name; // default: 可以在包内访问 // 构造函数是初始化一个对象的方式 // 以下是一个默认构造函数 diff --git a/zh-cn/perl-cn.html.markdown b/zh-cn/perl-cn.html.markdown index 4421da6e..46c54618 100644 --- a/zh-cn/perl-cn.html.markdown +++ b/zh-cn/perl-cn.html.markdown @@ -146,7 +146,7 @@ perlfaq有很多常见问题和相应回答,也经常有对优秀CPAN模块的 #### 深入阅读 - - [perl-tutorial](http://perl-tutorial.org/) - - [www.perl.com的learn站点](http://www.perl.org/learn.html) - - [perldoc](http://perldoc.perl.org/) - - 以及 perl 内置的: `perldoc perlintro` +- [perl-tutorial](http://perl-tutorial.org/) +- [www.perl.com的learn站点](http://www.perl.org/learn.html) +- [perldoc](http://perldoc.perl.org/) +- 以及 perl 内置的: `perldoc perlintro` diff --git a/zh-cn/qt-cn.html.markdown b/zh-cn/qt-cn.html.markdown new file mode 100644 index 00000000..8681c85b --- /dev/null +++ b/zh-cn/qt-cn.html.markdown @@ -0,0 +1,160 @@ +--- +category: tool +tool: Qt Framework +language: c++ +filename: learnqt-cn.cpp +contributors: + - ["Aleksey Kholovchuk", "https://github.com/vortexxx192"] +translators: + - ["GengchenXU", "https://github.com/GengchenXU"] +lang: zh-cn + +--- + +**Qt** Qt是一个广为人知的框架,用于开发跨平台软件,该软件可以在各种软件和硬件平台上运行,代码几乎没有变化,同时具有本机应用程序的能力和速度。虽然**Qt**最初是用*C*++,但也有其他语言的端口: *[PyQt](https://learnxinyminutes.com/docs/pyqt/)*, *QtRuby*, *PHP-Qt*, 等等. + +**Qt** 非常适合使用图形用户界面 (GUI) 创建应用程序。本教程是关于如何用*C++*去实现。 + +```c++ +/* + * 让我们从最经典的开始 + */ + +// Qt框架的所有标头均以大写字母'Q'开头 +#include <QApplication> +#include <QLineEdit> + +int main(int argc, char *argv[]) { + // 创建一个对象来管理应用程序范围内的资源 + QApplication app(argc, argv); + + // 创建行编辑widgets并在屏幕上显示 + QLineEdit lineEdit("Hello world!"); + lineEdit.show(); + + // 启动应用程序的事件循环 + return app.exec(); +} +``` + +**Qt**与 GUI 相关的部分与*widgets*及其之间的*connection*有关。 + +[阅读更多有关widgets的信息](http://doc.qt.io/qt-5/qtwidgets-index.html) + +```c++ +/* + * 让我们创建一个标签和一个按钮。 + * 按下按钮时应显示一个标签。 + * Qt代码本身就可以说明问题。 + */ + +#include <QApplication> +#include <QDialog> +#include <QVBoxLayout> +#include <QPushButton> +#include <QLabel> + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QDialog dialogWindow; + dialogWindow.show(); + + // 添加垂直布局 + QVBoxLayout layout; + dialogWindow.setLayout(&layout); + + QLabel textLabel("Thanks for pressing that button"); + layout.addWidget(&textLabel); + textLabel.hide(); + + QPushButton button("Press me"); + layout.addWidget(&button); + + // 按下按钮时显示隐藏标签 + QObject::connect(&button, &QPushButton::pressed, + &textLabel, &QLabel::show); + + return app.exec(); +} +``` + +注意,*QObject :: connect*部分。 此方法用于将一个对象的*SIGNAL*连接到另一个对象的*SLOTS*。 + +**Signals** 会被发出当对象发生某些事情时,例如当用户按下QPushButton对象时会发出*push*的信号。 + +**Slots** 是可以响应于接收到的信号而执行的*action*。 + +[阅读有关SLOTS和SIGNALS的更多信息](http://doc.qt.io/qt-5/signalsandslots.html) + + +接下来,让我们了解到我们不仅可以使用标准的wigets,而且可以通过继承扩展其行为。 让我们创建一个按钮并计算其被按下的次数。 为此,我们定义了自己的类* CounterLabel *。 由于特定的Qt体系结构,必须在单独的文件中声明它。 + +```c++ +// counterlabel.hpp + +#ifndef COUNTERLABEL +#define COUNTERLABEL + +#include <QLabel> + +class CounterLabel : public QLabel { + Q_OBJECT // 在每个自定义wiget中必须存在的Qt定义的宏 + +public: + CounterLabel() : counter(0) { + setText("Counter has not been increased yet"); // QLabel方法 + } + +public slots: + // 将响应按钮按下而调用的操作 + void increaseCounter() { + setText(QString("Counter value: %1").arg(QString::number(++counter))); + } + +private: + int counter; +}; + +#endif // COUNTERLABEL +``` + +```c++ +// main.cpp +// 与前面的示例几乎相同 + +#include <QApplication> +#include <QDialog> +#include <QVBoxLayout> +#include <QPushButton> +#include <QString> +#include "counterlabel.hpp" + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QDialog dialogWindow; + dialogWindow.show(); + + QVBoxLayout layout; + dialogWindow.setLayout(&layout); + + CounterLabel counterLabel; + layout.addWidget(&counterLabel); + + QPushButton button("Push me once more"); + layout.addWidget(&button); + QObject::connect(&button, &QPushButton::pressed, + &counterLabel, &CounterLabel::increaseCounter); + + return app.exec(); +} +``` + +当然,Qt框架比本教程介绍的部分要复杂得多,因此请仔细阅读和练习。 + +## 进一步阅读 +- [Qt 4.8 tutorials](http://doc.qt.io/qt-4.8/tutorials.html) +- [Qt 5 tutorials](http://doc.qt.io/qt-5/qtexamplesandtutorials.html) + +祝你好运,生活愉快! diff --git a/zh-cn/set-theory-cn.html.markdown b/zh-cn/set-theory-cn.html.markdown new file mode 100644 index 00000000..13ba2c80 --- /dev/null +++ b/zh-cn/set-theory-cn.html.markdown @@ -0,0 +1,138 @@ +--- +category: Algorithms & Data Structures +name: Set theory +contributors: +translators: + - ["Tianchen Xu", "https://github.com/lo0b0o"] +lang: zh-cn +--- +集合论是数学的一个分支,研究集合、它们的运算和它们的性质。 + +* 集合由不重复的项组成。 + +## 基本符号 + +### 运算符 +* 并运算符,`∪`,表示“或”; +* 交运算符,`∩`,表示“且”; +* 差运算符,`\`,表示“不包括”; +* 补运算符,`'`,表示补集; +* 叉积运算符,`×`,表示笛卡尔积。 + +### 限定词 +* 冒号限定词,`:`,表示“使得”; +* 从属限定词,`∈`,表示“属于”; +* 子集限定词,`⊆`,表示“是……的子集”; +* 真子集限定词,`⊂`,表示“是……的真子集”。 + +### 重要的集合 +* `∅`,空集,即不包含任何元素的集合; +* `ℕ`,自然数集; +* `ℤ`,整数集; +* `ℚ`,有理数集; +* `ℝ`,实数集。 + +关于以上集合,有如下几点需要注意: +1. 空集是其本身的子集(并且也是任何其他集合的子集),即便空集不包含任何项; +2. 数学家们对于零是否为自然数的看法通常并不统一,教科书一般会明确说明作者是否认为零是自然数。 + +### 基数 + +集合的基数,或者说大小,由该集合中的项目数量决定。基数运算符为 `|...|`。 + +例如,若 `S = { 1, 2, 4 }`,则 `|S| = 3`。 + +### 空集 + +* 可以在集合符号中使用不成立的条件来构造空集,例如,`∅ = { x : x ≠ x }`,或 `∅ = { x : x ∈ N, x < 0 }`; +* 空集总是唯一的(即,有且只有一个空集); +* 空集是所有集合的子集; +* 空集的基数为 0,即 `|∅| = 0`。 + +## 集合的表示 + +### 集合的逐项构造 + +集合可以通过包含其全部项的列表逐项生成。例如,`S = { a, b, c, d }`。 + +只要构成集合的项清楚,长列表可以用省略号缩短。例如,`E = { 2, 4, 6, 8, ... }` 显然为所有偶数构成的集合,它包含无穷多项,虽然我们只显式写出了其中四项。 + +### 集合构造器 + +集合构造器符号是构造集合的一种更具描述性的方式。它依赖于一个主语和一个谓词,使得 `S = { 主语 : 谓词 }`。 例如, + +``` +A = { x : x 是元音字母 } = { a, e, i, o, u, y} +B = { x : x ∈ N, x < 10 } = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } +C = { x : x = 2k, k ∈ N } = { 0, 2, 4, 6, 8, ... } +``` + +有时,谓词可能会 "漏 "到主语中,例如, + +``` +D = { 2x : x ∈ N } = { 0, 2, 4, 6, 8, ... } +``` + +## 关系 + +### 从属关系 + +* 如果值 `a` 包含在集合 `A` 中,那么我们说 `a` 属于 `A`,并用符号表示为 `a ∈ A`。 +* 如果值 `a` 不包含于集合 `A` 中,那么我们说 `a` 不属于 `A`,并用符号表示为 `a ∉ A`。 + +### 相等关系 + +* 如果两个集合包括相同的项,那么我们说这两个集合相等,例如,`A = B`。 +* 集合的相等关系于顺序无关,例如 `{ 1, 2, 3, 4 } = { 2, 3, 1, 4 }`。 +* 集合中的元素不能重复,例如 `{ 1, 2, 2, 3, 4, 3, 4, 2 } = { 1, 2, 3, 4 }`。 +* 集合 `A` 与 `B` 相等当且仅当 `A ⊆ B` 且 `B ⊆ A`。 + +## 特殊集合 + +### 幂集 + +* 令 `A` 为任意集合。幂集指的是包括了 `A` 的所有子集的集合,记作 `P(A)`。如果集合 `A` 由 `2n` 个元素组成,那么 `P(A)` 中有 `2^n` 个元素。 + +``` +P(A) = { x : x ⊆ A } +``` + +## 两个集合的运算 +### 并 + +给定集合 `A` 和 `B`,两个集合的并由出现在 `A` 或 `B` 中的项构成,记作 `A ∪ B`。 + +``` +A ∪ B = { x : x ∈ A ∪ x ∈ B } +``` + +### 交 + +给定集合 `A` 和 `B`,两个集合的交由出现在 `A` 和 `B` 中的项构成,记作 `A ∩ B`。 + +``` +A ∩ B = { x : x ∈ A, x ∈ B } +``` + +### 差 +给定集合 `A` 和 `B`,`A` 对于 `B` 的集合差指的是属于 `A` 但不属于 `B` 的每一项。 + +``` +A \ B = { x : x ∈ A, x ∉ B } +``` + +### 对称差 +给定集合 `A` 和 `B`,对称差指的是属于 `A` 或 `B` 但不属于它们交集的所有项。 + +``` +A △ B = { x : ((x ∈ A) ∩ (x ∉ B)) ∪ ((x ∈ B) ∩ (x ∉ A)) } + +A △ B = (A \ B) ∪ (B \ A) +``` + +### 笛卡尔积 +给定集合 `A` 和 `B`,`A` 和 `B` 的笛卡尔积由 `A` 和 `B` 的项的所有组合构成。 + +``` +A × B = { (x, y) | x ∈ A, y ∈ B } +``` diff --git a/zh-cn/swift-cn.html.markdown b/zh-cn/swift-cn.html.markdown index 18bc52ed..c56a0d33 100644 --- a/zh-cn/swift-cn.html.markdown +++ b/zh-cn/swift-cn.html.markdown @@ -10,7 +10,7 @@ translators: lang: zh-cn --- -Swift 是 Apple 开发的用于 iOS 和 OS X 开发的编程语言。Swift 于2014年 Apple WWDC (全球开发者大会)中被引入,用以与 Objective-C 共存,同时对错误代码更具弹性。Swift 由 Xcode 6 beta 中包含的 LLVM 编译器编译。 +Swift 是 Apple 开发的用于 iOS 和 macOS 开发的编程语言。Swift 于2014年 Apple WWDC (全球开发者大会)中被引入,用以与 Objective-C 共存,同时对错误代码更具弹性。Swift 由 Xcode 6 beta 中包含的 LLVM 编译器编译。 Swift 的官方语言教程 [Swift Programming Language](https://itunes.apple.com/us/book/swift-programming-language/id881256329) 可以从 iBooks 免费下载. diff --git a/zh-tw/bash-tw.html.markdown b/zh-tw/bash-tw.html.markdown index 78b39f2d..5136d513 100644 --- a/zh-tw/bash-tw.html.markdown +++ b/zh-tw/bash-tw.html.markdown @@ -23,7 +23,7 @@ filename: LearnBash-tw.sh lang: zh-tw --- -Bash 是一個爲 GNU 計劃編寫的 Unix shell,是 Linux 和 Mac OS X 下預設的 shell。 +Bash 是一個爲 GNU 計劃編寫的 Unix shell,是 Linux 和 macOS 下預設的 shell。 以下大多數例子可以作爲腳本的一部分運行,也可直接在 shell 下互動執行。 [更多資訊](http://www.gnu.org/software/bash/manual/bashref.html) |