summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--chapel.html.markdown2
-rw-r--r--fsharp.html.markdown2
-rw-r--r--json.html.markdown7
-rw-r--r--nim.html.markdown2
-rw-r--r--nl-nl/brainfuck-nl.html.markdown2
-rw-r--r--perl6.html.markdown7
-rw-r--r--swift.html.markdown14
7 files changed, 26 insertions, 10 deletions
diff --git a/chapel.html.markdown b/chapel.html.markdown
index e20be998..7252a3e4 100644
--- a/chapel.html.markdown
+++ b/chapel.html.markdown
@@ -633,7 +633,7 @@ writeln( toThisArray );
// 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
-// the same size, the body of the expression can be though of as an iterator.
+// the same size, the body of the expression can be thought of as an iterator.
// Because iterators can yield nothing, that iterator yields a different number
// of things than the domain of the array or loop, which is not allowed.
diff --git a/fsharp.html.markdown b/fsharp.html.markdown
index 62118006..76318d7d 100644
--- a/fsharp.html.markdown
+++ b/fsharp.html.markdown
@@ -119,7 +119,7 @@ printfn "A string %s, and something generic %A" "hello" [1;2;3;4]
// ================================================
// F# is a true functional language -- functions are first
-// class entities and can be combined easy to make powerful
+// class entities and can be combined easily to make powerful
// constructs
// Modules are used to group functions together
diff --git a/json.html.markdown b/json.html.markdown
index 6aff2ce2..a85cecc4 100644
--- a/json.html.markdown
+++ b/json.html.markdown
@@ -10,8 +10,11 @@ As JSON is an extremely simple data-interchange format, this is most likely goin
to be the simplest Learn X in Y Minutes ever.
JSON in its purest form has no actual comments, but most parsers will accept
-C-style (`//`, `/* */`) comments. For the purposes of this, however, everything is
-going to be 100% valid JSON. Luckily, it kind of speaks for itself.
+C-style (`//`, `/* */`) comments. Some parsers also tolerate a trailing comma
+(i.e. a comma after the last element of an array or the after the last property of an object),
+but they should be avoided for better compatibility.
+
+For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself.
```json
{
diff --git a/nim.html.markdown b/nim.html.markdown
index c9548a1c..79271732 100644
--- a/nim.html.markdown
+++ b/nim.html.markdown
@@ -235,7 +235,7 @@ proc ask(question: string): Answer =
else: echo("Please be clear: yes or no")
proc addSugar(amount: int = 2) = # Default amount is 2, returns nothing
- assert(amount > 0 or amount < 9000, "Crazy Sugar")
+ assert(amount > 0 and amount < 9000, "Crazy Sugar")
for a in 1..amount:
echo(a, " sugar...")
diff --git a/nl-nl/brainfuck-nl.html.markdown b/nl-nl/brainfuck-nl.html.markdown
index cd12b1d0..6062b24c 100644
--- a/nl-nl/brainfuck-nl.html.markdown
+++ b/nl-nl/brainfuck-nl.html.markdown
@@ -15,7 +15,7 @@ minimalistische Turing-complete programmeertaal met maar acht commando's.
```
Elk karakter behalve "><+-.,[]" (en de quotes) wordt genegeerd.
-Brainfuck wordt gerepresenteerd door een array met 30,000 cellen die initieel
+Brainfuck wordt gerepresenteerd door een array met 30.000 cellen die initieel
gevuld is met nullen en een pointer die wijst naar de huidige cel.
Dit zijn de acht commando's:
diff --git a/perl6.html.markdown b/perl6.html.markdown
index 63c0830a..2b45f661 100644
--- a/perl6.html.markdown
+++ b/perl6.html.markdown
@@ -132,7 +132,7 @@ sub with-named($normal-arg, :$named) {
with-named(1, named => 6); #=> 7
# There's one gotcha to be aware of, here:
# If you quote your key, Perl 6 won't be able to see it at compile time,
-# and you'll have a single Pair object as a positional paramater,
+# and you'll have a single Pair object as a positional parameter,
# which means this fails:
with-named(1, 'named' => 6);
@@ -197,7 +197,7 @@ sub mutate($n is rw) {
say "\$n is now $n !";
}
-# If what you want is a copy instead, use `is copy`.
+# If what you want a copy instead, use `is copy`.
# A sub itself returns a container, which means it can be marked as rw:
my $x = 42;
@@ -234,7 +234,7 @@ say "Quite truthy" if True;
# - Ternary conditional, "?? !!" (like `x ? y : z` in some other languages)
my $a = $condition ?? $value-if-true !! $value-if-false;
-# - `given`-`when` looks like other languages `switch`, but much more
+# - `given`-`when` looks like other languages' `switch`, but much more
# powerful thanks to smart matching and thanks to Perl 6's "topic variable", $_.
#
# This variable contains the default argument of a block,
@@ -1461,4 +1461,3 @@ If you want to go further, you can:
- Come along on `#perl6` at `irc.freenode.net`. The folks here are always helpful.
- Check the [source of Perl 6's functions and classes](https://github.com/rakudo/rakudo/tree/nom/src/core). Rakudo is mainly written in Perl 6 (with a lot of NQP, "Not Quite Perl", a Perl 6 subset easier to implement and optimize).
- Read [the language design documents](http://design.perl6.org). They explain P6 from an implementor point-of-view, but it's still very interesting.
-
diff --git a/swift.html.markdown b/swift.html.markdown
index a40e86c8..75535e43 100644
--- a/swift.html.markdown
+++ b/swift.html.markdown
@@ -574,4 +574,18 @@ print(mySquare.sideLength) // 4
// change side length using custom !!! operator, increases size by 3
!!!mySquare
print(mySquare.sideLength) // 12
+
+// Operators can also be generics
+infix operator <-> {}
+func <-><T: Equatable> (inout a: T, inout b: T) {
+ let c = a
+ a = b
+ b = c
+}
+
+var foo: Float = 10
+var bar: Float = 20
+
+foo <-> bar
+print("foo is \(foo), bar is \(bar)") // "foo is 20.0, bar is 10.0"
```