summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--chapel.html.markdown4
-rw-r--r--edn.html.markdown108
-rw-r--r--fa-ir/brainfuck-fa.html.markdown (renamed from fa-ir/brainfuck.html.markdown)0
-rw-r--r--fa-ir/javascript-fa.html.markdown (renamed from fa-ir/javascript.html.markdown)0
-rw-r--r--fr-fr/livescript-fr.html.markdown2
-rw-r--r--fsharp.html.markdown6
-rw-r--r--hu-hu/go-hu.html.markdown (renamed from hu-hu/go.html.markdown)0
-rw-r--r--hu-hu/ruby-hu.html.markdown (renamed from hu-hu/ruby.html.markdown)0
-rw-r--r--java.html.markdown8
-rw-r--r--javascript.html.markdown41
-rw-r--r--matlab.html.markdown4
-rw-r--r--python.html.markdown4
-rw-r--r--ta_in/css-ta.html.markdown (renamed from ta_in/css.html.markdown)0
-rw-r--r--ta_in/javascript-ta.html.markdown (renamed from ta_in/javascript.html.markdown)0
-rw-r--r--ta_in/json-ta.html.markdown (renamed from ta_in/json.html.markdown)0
-rw-r--r--ta_in/xml-ta.html.markdown (renamed from ta_in/xml.html.markdown)0
-rw-r--r--zh-cn/haskell-cn.html.markdown6
-rw-r--r--zh-cn/java-cn.html.markdown2
18 files changed, 154 insertions, 31 deletions
diff --git a/chapel.html.markdown b/chapel.html.markdown
index 7252a3e4..866e92d2 100644
--- a/chapel.html.markdown
+++ b/chapel.html.markdown
@@ -629,7 +629,7 @@ for (i, j) in zip( toThisArray.domain, -100..#5 ){
}
writeln( toThisArray );
-// This is all very important in undestanding why the statement
+// This is all very important in understanding why the statement
// var iterArray : [1..10] int = [ i in 1..10 ] if ( i % 2 == 1 ) then j;
// exhibits a runtime error.
// Even though the domain of the array and the loop-expression are
@@ -914,7 +914,7 @@ proc main(){
[ val in myBigArray ] val = 1 / val; // Parallel operation
// Atomic variables, common to many languages, are ones whose operations
- // occur uninterupted. Multiple threads can both modify atomic variables
+ // occur uninterrupted. Multiple threads can both modify atomic variables
// and can know that their values are safe.
// Chapel atomic variables can be of type bool, int, uint, and real.
var uranium: atomic int;
diff --git a/edn.html.markdown b/edn.html.markdown
new file mode 100644
index 00000000..655c20f1
--- /dev/null
+++ b/edn.html.markdown
@@ -0,0 +1,108 @@
+---
+language: edn
+filename: learnedn.edn
+contributors:
+ - ["Jason Yeo", "https://github.com/jsyeo"]
+---
+
+Extensible Data Notation or EDN for short is a format for serializing data.
+
+The notation is used internally by Clojure to represent programs and it also
+used as a data transfer format like JSON. Though it is more commonly used in
+Clojure land, there are implementations of EDN for many other languages.
+
+The main benefit of EDN over JSON and YAML is that it is extensible, which we
+will see how it is extended later on.
+
+```Clojure
+; Comments start with a semicolon.
+; Anythng after the semicolon is ignored.
+
+;;;;;;;;;;;;;;;;;;;
+;;; Basic Types ;;;
+;;;;;;;;;;;;;;;;;;;
+
+nil ; also known in other languages as null
+
+; Booleans
+true
+false
+
+; Strings are enclosed in double quotes
+"hungarian breakfast"
+"farmer's cheesy omelette"
+
+; Characters are preceeded by backslashes
+\g \r \a \c \e
+
+; Keywords start with a colon. They behave like enums. Kind of
+; like symbols in Ruby.
+:eggs
+:cheese
+:olives
+
+; Symbols are used to represent identifiers. They start with #.
+; You can namespace symbols by using /. Whatever preceeds / is
+; the namespace of the name.
+#spoon
+#kitchen/spoon ; not the same as #spoon
+#kitchen/fork
+#github/fork ; you can't eat with this
+
+; Integers and floats
+42
+3.14159
+
+; Lists are sequences of values
+(:bun :beef-patty 9 "yum!")
+
+; Vectors allow random access
+[:gelato 1 2 -2]
+
+; Maps are associative data structures that associates the key with its value
+{:eggs 2
+ :lemon-juice 3.5
+ :butter 1}
+
+; You're not restricted to using keywords as keys
+{[1 2 3 4] "tell the people what she wore",
+ [5 6 7 8] "the more you see the more you hate"}
+
+; You may use commas for readability. They are treated as whitespaces.
+
+; Sets are collections that contain unique elements.
+#{:a :b 88 "huat"}
+
+;;;;;;;;;;;;;;;;;;;;;;;
+;;; Tagged Elements ;;;
+;;;;;;;;;;;;;;;;;;;;;;;
+
+; EDN can be extended by tagging elements with # symbols.
+
+#MyYelpClone/MenuItem {:name "eggs-benedict" :rating 10}
+
+; Let me explain this with a clojure example. Suppose I want to transform that
+; piece of edn into a MenuItem record.
+
+(defrecord MenuItem [name rating])
+
+; To transform edn to clojure values, I will need to use the built in EDN
+; reader, edn/read-string
+
+(edn/read-string "{:eggs 2 :butter 1 :flour 5}")
+; -> {:eggs 2 :butter 1 :flour 5}
+
+; To transform tagged elements, define the reader function and pass a map
+; that maps tags to reader functions to edn/read-string like so
+
+(edn/read-string {:readers {'MyYelpClone/MenuItem map->menu-item}}
+ "#MyYelpClone/MenuItem {:name \"eggs-benedict\" :rating 10}")
+; -> #user.MenuItem{:name "eggs-benedict", :rating 10}
+
+```
+
+# References
+
+- [EDN spec](https://github.com/edn-format/edn)
+- [Implementations](https://github.com/edn-format/edn/wiki/Implementations)
+- [Tagged Elements](http://www.compoundtheory.com/clojure-edn-walkthrough/)
diff --git a/fa-ir/brainfuck.html.markdown b/fa-ir/brainfuck-fa.html.markdown
index ef2bcba3..ef2bcba3 100644
--- a/fa-ir/brainfuck.html.markdown
+++ b/fa-ir/brainfuck-fa.html.markdown
diff --git a/fa-ir/javascript.html.markdown b/fa-ir/javascript-fa.html.markdown
index fe3555af..fe3555af 100644
--- a/fa-ir/javascript.html.markdown
+++ b/fa-ir/javascript-fa.html.markdown
diff --git a/fr-fr/livescript-fr.html.markdown b/fr-fr/livescript-fr.html.markdown
index 9c3b8003..13bbffe5 100644
--- a/fr-fr/livescript-fr.html.markdown
+++ b/fr-fr/livescript-fr.html.markdown
@@ -4,7 +4,7 @@ filename: learnLivescript-fr.ls
contributors:
- ["Christina Whyte", "http://github.com/kurisuwhyte/"]
translators:
- - ["Morgan Bohn", "https://github.com/morganbohn"]
+ - ["Morgan Bohn", "https://github.com/dotmobo"]
lang: fr-fr
---
diff --git a/fsharp.html.markdown b/fsharp.html.markdown
index 76318d7d..b5c47ed7 100644
--- a/fsharp.html.markdown
+++ b/fsharp.html.markdown
@@ -248,7 +248,7 @@ module SequenceExamples =
// sequences can use yield and
// can contain subsequences
let strange = seq {
- // "yield! adds one element
+ // "yield" adds one element
yield 1; yield 2;
// "yield!" adds a whole subsequence
@@ -297,7 +297,7 @@ module DataTypeExamples =
let person1 = {First="John"; Last="Doe"}
// Pattern match to unpack
- let {First=first} = person1 //sets first="john"
+ let {First=first} = person1 //sets first="John"
// ------------------------------------
// Union types (aka variants) have a set of choices
@@ -426,7 +426,7 @@ module ActivePatternExamples =
// -----------------------------------
// You can create partial matching patterns as well
- // Just use undercore in the defintion, and return Some if matched.
+ // Just use underscore in the defintion, and return Some if matched.
let (|MultOf3|_|) i = if i % 3 = 0 then Some MultOf3 else None
let (|MultOf5|_|) i = if i % 5 = 0 then Some MultOf5 else None
diff --git a/hu-hu/go.html.markdown b/hu-hu/go-hu.html.markdown
index 638c9489..638c9489 100644
--- a/hu-hu/go.html.markdown
+++ b/hu-hu/go-hu.html.markdown
diff --git a/hu-hu/ruby.html.markdown b/hu-hu/ruby-hu.html.markdown
index 169f2b8e..169f2b8e 100644
--- a/hu-hu/ruby.html.markdown
+++ b/hu-hu/ruby-hu.html.markdown
diff --git a/java.html.markdown b/java.html.markdown
index aae64ccf..4f5cde38 100644
--- a/java.html.markdown
+++ b/java.html.markdown
@@ -186,9 +186,9 @@ public class LearnJava {
// operations perform as could be expected for a
// doubly-linked list.
// Maps - A set of objects that map keys to values. Map is
- // an interface and therefore cannot be instantiated.
- // The type of keys and values contained in a Map must
- // be specified upon instantiation of the implementing
+ // an interface and therefore cannot be instantiated.
+ // The type of keys and values contained in a Map must
+ // be specified upon instantiation of the implementing
// class. Each key may map to only one corresponding value,
// and each key may appear only once (no duplicates).
// HashMaps - This class uses a hashtable to implement the Map
@@ -720,7 +720,7 @@ The links provided here below are just to get an understanding of the topic, fee
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
-* [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconv-138413.html)
+* [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
**Online Practice and Tutorials**
diff --git a/javascript.html.markdown b/javascript.html.markdown
index cce488e1..cd75b0d2 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -16,9 +16,14 @@ JavaScript isn't just limited to web browsers, though: Node.js, a project that
provides a standalone runtime for Google Chrome's V8 JavaScript engine, is
becoming more and more popular.
+JavaScript has a C-like syntax, so if you've used languages like C or Java,
+a lot of the basic syntax will already be familiar. Despite this, and despite
+the similarity in name, JavaScript's object model is significantly different to
+Java's.
+
```js
-// Comments are like C's. Single-line comments start with two slashes,
-/* and multiline comments start with slash-star
+// Single-line comments start with two slashes.
+/* Multiline comments start with slash-star,
and end with star-slash */
// Statements can be terminated by ;
@@ -36,7 +41,7 @@ doStuff()
// JavaScript has one number type (which is a 64-bit IEEE 754 double).
// Doubles have a 52-bit mantissa, which is enough to store integers
-// up to about 9✕10¹⁵ precisely.
+// up to about 9✕10¹⁵ precisely.
3; // = 3
1.5; // = 1.5
@@ -136,7 +141,7 @@ undefined; // used to indicate a value is not currently present (although
// character.
var someVar = 5;
-// if you leave the var keyword off, you won't get an error...
+// If you leave the var keyword off, you won't get an error...
someOtherVar = 10;
// ...but your variable will be created in the global scope, not in the scope
@@ -145,7 +150,7 @@ someOtherVar = 10;
// Variables declared without being assigned to are set to undefined.
var someThirdVar; // = undefined
-// if you wan't to declare a couple of variables, then you could use a comma
+// If you want to declare a couple of variables, then you could use a comma
// separator
var someFourthVar = 2, someFifthVar = 4;
@@ -194,8 +199,6 @@ myObj.myFourthKey; // = undefined
///////////////////////////////////
// 3. Logic and Control Structures
-// The syntax for this section is almost identical to Java's.
-
// The `if` structure works as you'd expect.
var count = 1;
if (count == 3){
@@ -223,15 +226,15 @@ for (var i = 0; i < 5; i++){
// will run 5 times
}
-//The For/In statement loops iterates over every property across the entire prototype chain
+// The for/in statement iterates over every property across the entire prototype chain.
var description = "";
var person = {fname:"Paul", lname:"Ken", age:18};
for (var x in person){
description += person[x] + " ";
}
-//If only want to consider properties attached to the object itself,
-//and not its prototypes use hasOwnProperty() check
+// To only consider properties attached to the object itself
+// and not its prototypes, use the `hasOwnProperty()` check.
var description = "";
var person = {fname:"Paul", lname:"Ken", age:18};
for (var x in person){
@@ -240,8 +243,9 @@ for (var x in person){
}
}
-//for/in should not be used to iterate over an Array where the index order is important.
-//There is no guarantee that for/in will return the indexes in any particular order
+// For/in should not be used to iterate over an Array where the index order
+// is important, as there is no guarantee that for/in will return the indexes
+// in any particular order.
// && is logical and, || is logical or
if (house.size == "big" && house.colour == "blue"){
@@ -256,7 +260,7 @@ var name = otherName || "default";
// The `switch` statement checks for equality with `===`.
-// use 'break' after each case
+// Use 'break' after each case
// or the cases after the correct one will be executed too.
grade = 'B';
switch (grade) {
@@ -503,6 +507,10 @@ myNumber === myNumberObj; // = false
if (0){
// This code won't execute, because 0 is falsy.
}
+if (new Number(0)){
+ // This code will execute, because wrapped numbers are objects, and objects
+ // are always truthy.
+}
// However, the wrapper objects and the regular builtins share a prototype, so
// you can actually add functionality to a string, for instance.
@@ -547,6 +555,11 @@ of the language.
[JavaScript: The Definitive Guide][6] is a classic guide and reference book.
+[Eloquent Javascript][8] by Marijn Haverbeke is an excellent JS book/ebook with attached terminal
+
+[Javascript: The Right Way][9] is a guide intended to introduce new developers to JavaScript and help experienced developers learn more about its best practices.
+
+
In addition to direct contributors to this article, some content is adapted from
Louie Dinh's Python tutorial on this site, and the [JS Tutorial][7] on the
Mozilla Developer Network.
@@ -559,3 +572,5 @@ Mozilla Developer Network.
[5]: http://bonsaiden.github.io/JavaScript-Garden/
[6]: http://www.amazon.com/gp/product/0596805527/
[7]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
+[8]: http://eloquentjavascript.net/
+[9]: http://jstherightway.org/
diff --git a/matlab.html.markdown b/matlab.html.markdown
index 4d97834c..ad42d9a9 100644
--- a/matlab.html.markdown
+++ b/matlab.html.markdown
@@ -262,7 +262,7 @@ pcolor(A) % Heat-map of matrix: plot as grid of rectangles, coloured by value
contour(A) % Contour plot of matrix
mesh(A) % Plot as a mesh surface
-h = figure % Create new figure object, with handle h
+h = figure % Create new figure object, with handle h
figure(h) % Makes the figure corresponding to handle h the current figure
close(h) % close figure with handle h
close all % close all open figure windows
@@ -460,7 +460,7 @@ length % length of a vector
sort % sort in ascending order
sum % sum of elements
prod % product of elements
-mode % modal value
+mode % modal value
median % median value
mean % mean value
std % standard deviation
diff --git a/python.html.markdown b/python.html.markdown
index 42a52bcf..753d6e8c 100644
--- a/python.html.markdown
+++ b/python.html.markdown
@@ -15,8 +15,8 @@ executable pseudocode.
Feedback would be highly appreciated! You can reach me at [@louiedinh](http://twitter.com/louiedinh) or louiedinh [at] [google's email service]
Note: This article applies to Python 2.7 specifically, but should be applicable
-to Python 2.x. Python 2.7 is reachong end of life and will stop beeign maintained in 2020,
-it is though recommended to start learnign Python with Python 3.
+to Python 2.x. Python 2.7 is reaching end of life and will stop being maintained in 2020,
+it is though recommended to start learning Python with Python 3.
For Python 3.x, take a look at the [Python 3 tutorial](http://learnxinyminutes.com/docs/python3/).
It is also possible to write Python code which is compatible with Python 2.7 and 3.x at the same time,
diff --git a/ta_in/css.html.markdown b/ta_in/css-ta.html.markdown
index 56f94ed0..56f94ed0 100644
--- a/ta_in/css.html.markdown
+++ b/ta_in/css-ta.html.markdown
diff --git a/ta_in/javascript.html.markdown b/ta_in/javascript-ta.html.markdown
index f0b0a36a..f0b0a36a 100644
--- a/ta_in/javascript.html.markdown
+++ b/ta_in/javascript-ta.html.markdown
diff --git a/ta_in/json.html.markdown b/ta_in/json-ta.html.markdown
index d85e0d82..d85e0d82 100644
--- a/ta_in/json.html.markdown
+++ b/ta_in/json-ta.html.markdown
diff --git a/ta_in/xml.html.markdown b/ta_in/xml-ta.html.markdown
index a9bfa9cd..a9bfa9cd 100644
--- a/ta_in/xml.html.markdown
+++ b/ta_in/xml-ta.html.markdown
diff --git a/zh-cn/haskell-cn.html.markdown b/zh-cn/haskell-cn.html.markdown
index 8904970f..b0b1183f 100644
--- a/zh-cn/haskell-cn.html.markdown
+++ b/zh-cn/haskell-cn.html.markdown
@@ -200,13 +200,13 @@ foo 5 -- 75
-- 你可以使用 `$` 来移除多余的括号。
-- 修改前
-(even (fib 7)) -- true
+(even (fib 7)) -- False
-- 修改后
-even . fib $ 7 -- true
+even . fib $ 7 -- False
-- 等价地
-even $ fib 7 -- true
+even $ fib 7 -- False
----------------------------------------------------
-- 5. 类型声明
diff --git a/zh-cn/java-cn.html.markdown b/zh-cn/java-cn.html.markdown
index 12afa59a..a8fd2a4c 100644
--- a/zh-cn/java-cn.html.markdown
+++ b/zh-cn/java-cn.html.markdown
@@ -405,4 +405,4 @@ class PennyFarthing extends Bicycle {
* [泛型](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
-* [Java代码规范](http://www.oracle.com/technetwork/java/codeconv-138413.html)
+* [Java代码规范](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)