mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-01-15 05:35:59 +00:00
Merge pull request #2807 from HairyFotr/typos
[all/en] Fix a bunch of typos
This commit is contained in:
commit
2694c89c33
@ -235,12 +235,12 @@ sqr ;; => #<procedure (sqr x)>
|
|||||||
(= 2 1) ;; => #f
|
(= 2 1) ;; => #f
|
||||||
|
|
||||||
;; 'eq?' returns #t if two arguments refer to the same object in memory
|
;; 'eq?' returns #t if two arguments refer to the same object in memory
|
||||||
;; In other words, it's a simple pointer comparision.
|
;; In other words, it's a simple pointer comparison.
|
||||||
(eq? '() '()) ;; => #t ;; there's only one empty list in memory
|
(eq? '() '()) ;; => #t ;; there's only one empty list in memory
|
||||||
(eq? (list 3) (list 3)) ;; => #f ;; not the same object
|
(eq? (list 3) (list 3)) ;; => #f ;; not the same object
|
||||||
(eq? 'yes 'yes) ;; => #t
|
(eq? 'yes 'yes) ;; => #t
|
||||||
(eq? 3 3) ;; => #t ;; don't do this even if it works in this case
|
(eq? 3 3) ;; => #t ;; don't do this even if it works in this case
|
||||||
(eq? 3 3.0) ;; => #f ;; it's better to use '=' for number comparisions
|
(eq? 3 3.0) ;; => #f ;; it's better to use '=' for number comparisons
|
||||||
(eq? "Hello" "Hello") ;; => #f
|
(eq? "Hello" "Hello") ;; => #f
|
||||||
|
|
||||||
;; 'eqv?' is same as 'eq?' all datatypes except numbers and characters
|
;; 'eqv?' is same as 'eq?' all datatypes except numbers and characters
|
||||||
|
@ -264,7 +264,7 @@ function io_functions( localvar) {
|
|||||||
# automatically for you.
|
# automatically for you.
|
||||||
|
|
||||||
# You can probably guess there are other $ variables. Every line is
|
# You can probably guess there are other $ variables. Every line is
|
||||||
# implicitely split before every action is called, much like the shell
|
# implicitly split before every action is called, much like the shell
|
||||||
# does. And, like the shell, each field can be access with a dollar sign
|
# does. And, like the shell, each field can be access with a dollar sign
|
||||||
|
|
||||||
# This will print the second and fourth fields in the line
|
# This will print the second and fourth fields in the line
|
||||||
|
@ -336,10 +336,10 @@ int main (int argc, char** argv)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
error :
|
error :
|
||||||
printf("Error occured at i = %d & j = %d.\n", i, j);
|
printf("Error occurred at i = %d & j = %d.\n", i, j);
|
||||||
/*
|
/*
|
||||||
https://ideone.com/GuPhd6
|
https://ideone.com/GuPhd6
|
||||||
this will print out "Error occured at i = 52 & j = 99."
|
this will print out "Error occurred at i = 52 & j = 99."
|
||||||
*/
|
*/
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
@ -242,7 +242,7 @@ do {
|
|||||||
} while (j <= 10000);
|
} while (j <= 10000);
|
||||||
writeln(jSum);
|
writeln(jSum);
|
||||||
|
|
||||||
// for loops are much like those in python in that they iterate over a
|
// for loops are much like those in Python in that they iterate over a
|
||||||
// range. Ranges (like the 1..10 expression below) are a first-class object
|
// range. Ranges (like the 1..10 expression below) are a first-class object
|
||||||
// in Chapel, and as such can be stored in variables.
|
// in Chapel, and as such can be stored in variables.
|
||||||
for i in 1..10 do write(i, ", ");
|
for i in 1..10 do write(i, ", ");
|
||||||
@ -1064,14 +1064,14 @@ proc main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heres an example using atomics and a sync variable to create a
|
// Here's an example using atomics and a sync variable to create a
|
||||||
// count-down mutex (also known as a multiplexer).
|
// count-down mutex (also known as a multiplexer).
|
||||||
var count: atomic int; // our counter
|
var count: atomic int; // our counter
|
||||||
var lock$: sync bool; // the mutex lock
|
var lock$: sync bool; // the mutex lock
|
||||||
|
|
||||||
count.write(2); // Only let two tasks in at a time.
|
count.write(2); // Only let two tasks in at a time.
|
||||||
lock$.writeXF(true); // Set lock$ to full (unlocked)
|
lock$.writeXF(true); // Set lock$ to full (unlocked)
|
||||||
// Note: The value doesnt actually matter, just the state
|
// Note: The value doesn't actually matter, just the state
|
||||||
// (full:unlocked / empty:locked)
|
// (full:unlocked / empty:locked)
|
||||||
// Also, writeXF() fills (F) the sync var regardless of its state (X)
|
// Also, writeXF() fills (F) the sync var regardless of its state (X)
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ are used in the usual way.
|
|||||||
# - cmake ..
|
# - cmake ..
|
||||||
# - make
|
# - make
|
||||||
#
|
#
|
||||||
# With those steps, we will follow the best pratice to compile into a subdir
|
# With those steps, we will follow the best practice to compile into a subdir
|
||||||
# and the second line will request to CMake to generate a new OS-dependant
|
# and the second line will request to CMake to generate a new OS-dependent
|
||||||
# Makefile. Finally, run the native Make command.
|
# Makefile. Finally, run the native Make command.
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -215,7 +215,7 @@ Range.new(1, 10).class #=> Range(Int32, Int32)
|
|||||||
# possibly different types.
|
# possibly different types.
|
||||||
{1, "hello", 'x'}.class #=> Tuple(Int32, String, Char)
|
{1, "hello", 'x'}.class #=> Tuple(Int32, String, Char)
|
||||||
|
|
||||||
# Acces tuple's value by its index
|
# Access tuple's value by its index
|
||||||
tuple = {:key1, :key2}
|
tuple = {:key1, :key2}
|
||||||
tuple[1] #=> :key2
|
tuple[1] #=> :key2
|
||||||
tuple[2] #=> syntax error : Index out of bound
|
tuple[2] #=> syntax error : Index out of bound
|
||||||
|
@ -20,7 +20,7 @@ Nodes
|
|||||||
It's an empty *node*, to indicate that there is a *node*, but it's not relevant for the query.
|
It's an empty *node*, to indicate that there is a *node*, but it's not relevant for the query.
|
||||||
|
|
||||||
```(n)```
|
```(n)```
|
||||||
It's a *node* refered by the variable **n**, reusable in the query. It begins with lowercase and uses camelCase.
|
It's a *node* referred by the variable **n**, reusable in the query. It begins with lowercase and uses camelCase.
|
||||||
|
|
||||||
```(p:Person)```
|
```(p:Person)```
|
||||||
You can add a *label* to your node, here **Person**. It's like a type / a class / a category. It begins with uppercase and uses camelCase.
|
You can add a *label* to your node, here **Person**. It's like a type / a class / a category. It begins with uppercase and uses camelCase.
|
||||||
@ -53,7 +53,7 @@ Relationships (or Edges)
|
|||||||
It's a *relationship* with the *label* **KNOWS**. It's a *label* as the node's label. It begins with uppercase and use UPPER_SNAKE_CASE.
|
It's a *relationship* with the *label* **KNOWS**. It's a *label* as the node's label. It begins with uppercase and use UPPER_SNAKE_CASE.
|
||||||
|
|
||||||
```[k:KNOWS]```
|
```[k:KNOWS]```
|
||||||
The same *relationship*, refered by the variable **k**, reusable in the query, but it's not necessary.
|
The same *relationship*, referred by the variable **k**, reusable in the query, but it's not necessary.
|
||||||
|
|
||||||
```[k:KNOWS {since:2017}]```
|
```[k:KNOWS {since:2017}]```
|
||||||
The same *relationship*, with *properties* (like *node*), here **since**.
|
The same *relationship*, with *properties* (like *node*), here **since**.
|
||||||
@ -244,6 +244,6 @@ Special hints
|
|||||||
---
|
---
|
||||||
|
|
||||||
- There is just single-line comments in Cypher, with double-slash : // Comments
|
- There is just single-line comments in Cypher, with double-slash : // Comments
|
||||||
- You can execute a Cypher script stored in a **.cql** file directly in Neo4j (it's an import). However, you can't have multiple statements in this file (separed by **;**).
|
- You can execute a Cypher script stored in a **.cql** file directly in Neo4j (it's an import). However, you can't have multiple statements in this file (separated by **;**).
|
||||||
- Use the Neo4j shell to write Cypher, it's really awesome.
|
- Use the Neo4j shell to write Cypher, it's really awesome.
|
||||||
- The Cypher will be the standard query language for all graph databases (known as **OpenCypher**).
|
- The Cypher will be the standard query language for all graph databases (known as **OpenCypher**).
|
||||||
|
@ -32,7 +32,7 @@ false
|
|||||||
"hungarian breakfast"
|
"hungarian breakfast"
|
||||||
"farmer's cheesy omelette"
|
"farmer's cheesy omelette"
|
||||||
|
|
||||||
; Characters are preceeded by backslashes
|
; Characters are preceded by backslashes
|
||||||
\g \r \a \c \e
|
\g \r \a \c \e
|
||||||
|
|
||||||
; Keywords start with a colon. They behave like enums. Kind of
|
; Keywords start with a colon. They behave like enums. Kind of
|
||||||
@ -42,7 +42,7 @@ false
|
|||||||
:olives
|
:olives
|
||||||
|
|
||||||
; Symbols are used to represent identifiers. They start with #.
|
; Symbols are used to represent identifiers. They start with #.
|
||||||
; You can namespace symbols by using /. Whatever preceeds / is
|
; You can namespace symbols by using /. Whatever precedes / is
|
||||||
; the namespace of the name.
|
; the namespace of the name.
|
||||||
#spoon
|
#spoon
|
||||||
#kitchen/spoon ; not the same as #spoon
|
#kitchen/spoon ; not the same as #spoon
|
||||||
|
@ -286,7 +286,7 @@ leftmostElement tree =
|
|||||||
-- Put this at the top of the file. If omitted, you're in Main.
|
-- Put this at the top of the file. If omitted, you're in Main.
|
||||||
module Name where
|
module Name where
|
||||||
|
|
||||||
-- By default, everything is exported. You can specify exports explicity.
|
-- By default, everything is exported. You can specify exports explicitly.
|
||||||
module Name (MyType, myValue) where
|
module Name (MyType, myValue) where
|
||||||
|
|
||||||
-- One common pattern is to export a union type but not its tags. This is known
|
-- One common pattern is to export a union type but not its tags. This is known
|
||||||
|
@ -54,7 +54,7 @@ public class LearnJava {
|
|||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ouput
|
* Output
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Use System.out.println() to print lines.
|
// Use System.out.println() to print lines.
|
||||||
|
@ -6,7 +6,7 @@ filename: learnfortran.f95
|
|||||||
---
|
---
|
||||||
|
|
||||||
Fortran is one of the oldest computer languages. It was developed in the 1950s
|
Fortran is one of the oldest computer languages. It was developed in the 1950s
|
||||||
by IBM for numeric calculations (Fortran is an abreviation of "Formula
|
by IBM for numeric calculations (Fortran is an abbreviation of "Formula
|
||||||
Translation"). Despite its age, it is still used for high-performance computing
|
Translation"). Despite its age, it is still used for high-performance computing
|
||||||
such as weather prediction. However, the language has changed considerably over
|
such as weather prediction. However, the language has changed considerably over
|
||||||
the years, although mostly maintaining backwards compatibility; well known
|
the years, although mostly maintaining backwards compatibility; well known
|
||||||
@ -242,7 +242,7 @@ program example !declare a program called example.
|
|||||||
close(12)
|
close(12)
|
||||||
|
|
||||||
! There are more features available than discussed here and alternative
|
! There are more features available than discussed here and alternative
|
||||||
! variants due to backwards compatability with older Fortran versions.
|
! variants due to backwards compatibility with older Fortran versions.
|
||||||
|
|
||||||
|
|
||||||
! Built-in Functions
|
! Built-in Functions
|
||||||
|
@ -276,7 +276,7 @@ i // Montre la valeur de i. Notez que while est une boucle au sens classique.
|
|||||||
i = 0
|
i = 0
|
||||||
// La boucle do while
|
// La boucle do while
|
||||||
do {
|
do {
|
||||||
println("x is still less then 10");
|
println("x is still less than 10");
|
||||||
i += 1
|
i += 1
|
||||||
} while (i < 10)
|
} while (i < 10)
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ Stashing takes the dirty state of your working directory and saves it on a
|
|||||||
stack of unfinished changes that you can reapply at any time.
|
stack of unfinished changes that you can reapply at any time.
|
||||||
|
|
||||||
Let's say you've been doing some work in your git repo, but you want to pull
|
Let's say you've been doing some work in your git repo, but you want to pull
|
||||||
from the remote. Since you have dirty (uncommited) changes to some files, you
|
from the remote. Since you have dirty (uncommitted) changes to some files, you
|
||||||
are not able to run `git pull`. Instead, you can run `git stash` to save your
|
are not able to run `git pull`. Instead, you can run `git stash` to save your
|
||||||
changes onto a stack!
|
changes onto a stack!
|
||||||
|
|
||||||
@ -521,7 +521,7 @@ $ git reset --hard
|
|||||||
$ git reset 31f2bb1
|
$ git reset 31f2bb1
|
||||||
|
|
||||||
# Moves the current branch tip backward to the specified commit
|
# Moves the current branch tip backward to the specified commit
|
||||||
# and makes the working dir match (deletes uncommited changes and all commits
|
# and makes the working dir match (deletes uncommitted changes and all commits
|
||||||
# after the specified commit).
|
# after the specified commit).
|
||||||
$ git reset --hard 31f2bb1
|
$ git reset --hard 31f2bb1
|
||||||
```
|
```
|
||||||
|
@ -257,7 +257,7 @@ class InvalidFooSubclass extends ConsistentFoo
|
|||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using the __Override annotation on a non-overriden method will cause a
|
// Using the __Override annotation on a non-overridden method will cause a
|
||||||
// type checker error:
|
// type checker error:
|
||||||
//
|
//
|
||||||
// "InvalidFooSubclass::otherMethod() is marked as override; no non-private
|
// "InvalidFooSubclass::otherMethod() is marked as override; no non-private
|
||||||
@ -299,7 +299,7 @@ $cat instanceof KittenInterface === true; // True
|
|||||||
## More Information
|
## More Information
|
||||||
|
|
||||||
Visit the [Hack language reference](http://docs.hhvm.com/manual/en/hacklangref.php)
|
Visit the [Hack language reference](http://docs.hhvm.com/manual/en/hacklangref.php)
|
||||||
for detailed explainations of the features Hack adds to PHP, or the [official Hack website](http://hacklang.org/)
|
for detailed explanations of the features Hack adds to PHP, or the [official Hack website](http://hacklang.org/)
|
||||||
for more general information.
|
for more general information.
|
||||||
|
|
||||||
Visit the [official HHVM website](http://hhvm.com/) for HHVM installation instructions.
|
Visit the [official HHVM website](http://hhvm.com/) for HHVM installation instructions.
|
||||||
|
@ -36,7 +36,7 @@ $ haml input_file.haml output_file.html
|
|||||||
To write a multi line comment, indent your commented code to be
|
To write a multi line comment, indent your commented code to be
|
||||||
wrapped by the forward slash
|
wrapped by the forward slash
|
||||||
|
|
||||||
-# This is a silent comment, which means it wont be rendered into the doc at all
|
-# This is a silent comment, which means it won't be rendered into the doc at all
|
||||||
|
|
||||||
|
|
||||||
/ -------------------------------------------
|
/ -------------------------------------------
|
||||||
|
@ -466,7 +466,7 @@ class LearnHaxe3{
|
|||||||
The untyped keyword operates on entire *blocks* of code, skipping
|
The untyped keyword operates on entire *blocks* of code, skipping
|
||||||
any type checks that might be otherwise required. This keyword should
|
any type checks that might be otherwise required. This keyword should
|
||||||
be used very sparingly, such as in limited conditionally-compiled
|
be used very sparingly, such as in limited conditionally-compiled
|
||||||
situations where type checking is a hinderance.
|
situations where type checking is a hindrance.
|
||||||
|
|
||||||
In general, skipping type checks is *not* recommended. Use the
|
In general, skipping type checks is *not* recommended. Use the
|
||||||
enum, inheritance, or structural type models in order to help ensure
|
enum, inheritance, or structural type models in order to help ensure
|
||||||
|
@ -102,7 +102,7 @@ True ; => True
|
|||||||
(apply something-fancy ["My horse" "amazing"] { "mane" "spectacular" })
|
(apply something-fancy ["My horse" "amazing"] { "mane" "spectacular" })
|
||||||
|
|
||||||
; anonymous functions are created using `fn' or `lambda' constructs
|
; anonymous functions are created using `fn' or `lambda' constructs
|
||||||
; which are similiar to `defn'
|
; which are similar to `defn'
|
||||||
(map (fn [x] (* x x)) [1 2 3 4]) ;=> [1 4 9 16]
|
(map (fn [x] (* x x)) [1 2 3 4]) ;=> [1 4 9 16]
|
||||||
|
|
||||||
;; Sequence operations
|
;; Sequence operations
|
||||||
|
@ -119,7 +119,7 @@ echo 'Multiple', 'Parameters', 'Valid';
|
|||||||
define("FOO", "something");
|
define("FOO", "something");
|
||||||
|
|
||||||
// 定義した名前をそのまま($はつけずに)使用することで、定数にアクセスできます
|
// 定義した名前をそのまま($はつけずに)使用することで、定数にアクセスできます
|
||||||
// access to a constant is possible by direct using the choosen name
|
// access to a constant is possible by direct using the chosen name
|
||||||
echo 'This outputs '.FOO;
|
echo 'This outputs '.FOO;
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class LearnJava {
|
|||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ouput
|
* Output
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Use System.out.println() to print lines.
|
// Use System.out.println() to print lines.
|
||||||
|
@ -6,7 +6,7 @@ contributors:
|
|||||||
filename: learnkdb.q
|
filename: learnkdb.q
|
||||||
---
|
---
|
||||||
|
|
||||||
The q langauge and its database component kdb+ were developed by Arthur Whitney
|
The q language and its database component kdb+ were developed by Arthur Whitney
|
||||||
and released by Kx systems in 2003. q is a descendant of APL and as such is
|
and released by Kx systems in 2003. q is a descendant of APL and as such is
|
||||||
very terse and a little strange looking for anyone from a "C heritage" language
|
very terse and a little strange looking for anyone from a "C heritage" language
|
||||||
background. Its expressiveness and vector oriented nature make it well suited
|
background. Its expressiveness and vector oriented nature make it well suited
|
||||||
@ -301,7 +301,7 @@ l:1+til 9 / til is a useful shortcut for generating ranges
|
|||||||
-5#l / => 5 6 7 8 9
|
-5#l / => 5 6 7 8 9
|
||||||
/ drop the last 5
|
/ drop the last 5
|
||||||
-5_l / => 1 2 3 4
|
-5_l / => 1 2 3 4
|
||||||
/ find the first occurance of 4
|
/ find the first occurrence of 4
|
||||||
l?4 / => 3
|
l?4 / => 3
|
||||||
l[3] / => 4
|
l[3] / => 4
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ key d / => `a`b`c
|
|||||||
/ and value the second
|
/ and value the second
|
||||||
value d / => 1 2 3
|
value d / => 1 2 3
|
||||||
|
|
||||||
/ Indexing is indentical to lists
|
/ Indexing is identical to lists
|
||||||
/ with the first list as a key instead of the position
|
/ with the first list as a key instead of the position
|
||||||
d[`a] / => 1
|
d[`a] / => 1
|
||||||
d[`b] / => 2
|
d[`b] / => 2
|
||||||
@ -406,7 +406,7 @@ k!t
|
|||||||
/ We can also use this shortcut for defining keyed tables
|
/ We can also use this shortcut for defining keyed tables
|
||||||
kt:([id:1 2 3]c1:1 2 3;c2:4 5 6;c3:7 8 9)
|
kt:([id:1 2 3]c1:1 2 3;c2:4 5 6;c3:7 8 9)
|
||||||
|
|
||||||
/ Records can then be retreived based on this key
|
/ Records can then be retrieved based on this key
|
||||||
kt[1]
|
kt[1]
|
||||||
/ => c1| 1
|
/ => c1| 1
|
||||||
/ => c2| 4
|
/ => c2| 4
|
||||||
@ -428,7 +428,7 @@ kt[`id!1]
|
|||||||
f:{x+x}
|
f:{x+x}
|
||||||
f[2] / => 4
|
f[2] / => 4
|
||||||
|
|
||||||
/ Functions can be annonymous and called at point of definition
|
/ Functions can be anonymous and called at point of definition
|
||||||
{x+x}[2] / => 4
|
{x+x}[2] / => 4
|
||||||
|
|
||||||
/ By default the last expression is returned
|
/ By default the last expression is returned
|
||||||
@ -440,7 +440,7 @@ f[2] / => 4
|
|||||||
|
|
||||||
/ Function arguments can be specified explicitly (separated by ;)
|
/ Function arguments can be specified explicitly (separated by ;)
|
||||||
{[arg1;arg2] arg1+arg2}[1;2] / => 3
|
{[arg1;arg2] arg1+arg2}[1;2] / => 3
|
||||||
/ or if ommited will default to x, y and z
|
/ or if omitted will default to x, y and z
|
||||||
{x+y+z}[1;2;3] / => 6
|
{x+y+z}[1;2;3] / => 6
|
||||||
|
|
||||||
/ Built in functions are no different, and can be called the same way (with [])
|
/ Built in functions are no different, and can be called the same way (with [])
|
||||||
@ -472,7 +472,7 @@ a / => 1
|
|||||||
/ Functions cannot see nested scopes (only local and global)
|
/ Functions cannot see nested scopes (only local and global)
|
||||||
{local:1;{:local}[]}[] / throws error as local is not defined in inner function
|
{local:1;{:local}[]}[] / throws error as local is not defined in inner function
|
||||||
|
|
||||||
/ A function can have one or more of it's arguments fixed (projection)
|
/ A function can have one or more of its arguments fixed (projection)
|
||||||
f:+[4]
|
f:+[4]
|
||||||
f[4] / => 8
|
f[4] / => 8
|
||||||
f[5] / => 9
|
f[5] / => 9
|
||||||
@ -483,7 +483,7 @@ f[6] / => 10
|
|||||||
////////// q-sql //////////
|
////////// q-sql //////////
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
|
|
||||||
/ q has it's own syntax for manipulating tables, similar to standard SQL
|
/ q has its own syntax for manipulating tables, similar to standard SQL
|
||||||
/ This contains the usual suspects of select, insert, update etc.
|
/ This contains the usual suspects of select, insert, update etc.
|
||||||
/ and some new functionality not typically available
|
/ and some new functionality not typically available
|
||||||
/ q-sql has two significant differences (other than syntax) to normal SQL:
|
/ q-sql has two significant differences (other than syntax) to normal SQL:
|
||||||
@ -682,7 +682,7 @@ aj[`time`sym;trades;quotes]
|
|||||||
/ where possible functionality should be vectorized (i.e. operations on lists)
|
/ where possible functionality should be vectorized (i.e. operations on lists)
|
||||||
/ adverbs supplement this, modifying the behaviour of functions
|
/ adverbs supplement this, modifying the behaviour of functions
|
||||||
/ and providing loop type functionality when required
|
/ and providing loop type functionality when required
|
||||||
/ (in q functions are sometimes refered to as verbs, hence adverbs)
|
/ (in q functions are sometimes referred to as verbs, hence adverbs)
|
||||||
/ the "each" adverb modifies a function to treat a list as individual variables
|
/ the "each" adverb modifies a function to treat a list as individual variables
|
||||||
first each (1 2 3;4 5 6;7 8 9)
|
first each (1 2 3;4 5 6;7 8 9)
|
||||||
/ => 1 4 7
|
/ => 1 4 7
|
||||||
@ -762,7 +762,7 @@ select from splayed / (the columns are read from disk on request)
|
|||||||
/ kdb+ is typically used for data capture and analysis.
|
/ kdb+ is typically used for data capture and analysis.
|
||||||
/ This involves using an architecture with multiple processes
|
/ This involves using an architecture with multiple processes
|
||||||
/ working together. kdb+ frameworks are available to streamline the setup
|
/ working together. kdb+ frameworks are available to streamline the setup
|
||||||
/ and configuration of this architecuture and add additional functionality
|
/ and configuration of this architecture and add additional functionality
|
||||||
/ such as disaster recovery, logging, access, load balancing etc.
|
/ such as disaster recovery, logging, access, load balancing etc.
|
||||||
/ https://github.com/AquaQAnalytics/TorQ
|
/ https://github.com/AquaQAnalytics/TorQ
|
||||||
```
|
```
|
||||||
|
@ -353,7 +353,7 @@ double_input(6) % ans = 12
|
|||||||
% anonymous function. Useful when quickly defining a function to pass to
|
% anonymous function. Useful when quickly defining a function to pass to
|
||||||
% another function (eg. plot with fplot, evaluate an indefinite integral
|
% another function (eg. plot with fplot, evaluate an indefinite integral
|
||||||
% with quad, find roots with fzero, or find minimum with fminsearch).
|
% with quad, find roots with fzero, or find minimum with fminsearch).
|
||||||
% Example that returns the square of it's input, assigned to the handle sqr:
|
% Example that returns the square of its input, assigned to the handle sqr:
|
||||||
sqr = @(x) x.^2;
|
sqr = @(x) x.^2;
|
||||||
sqr(10) % ans = 100
|
sqr(10) % ans = 100
|
||||||
doc function_handle % find out more
|
doc function_handle % find out more
|
||||||
|
@ -76,7 +76,7 @@ let myDrink = drinks[2]
|
|||||||
# static typing powerful and useful.
|
# static typing powerful and useful.
|
||||||
|
|
||||||
type
|
type
|
||||||
Name = string # A type alias gives you a new type that is interchangable
|
Name = string # A type alias gives you a new type that is interchangeable
|
||||||
Age = int # with the old type but is more descriptive.
|
Age = int # with the old type but is more descriptive.
|
||||||
Person = tuple[name: Name, age: Age] # Define data structures too.
|
Person = tuple[name: Name, age: Age] # Define data structures too.
|
||||||
AnotherSyntax = tuple
|
AnotherSyntax = tuple
|
||||||
@ -109,7 +109,7 @@ when compileBadCode:
|
|||||||
|
|
||||||
type
|
type
|
||||||
Color = enum cRed, cBlue, cGreen
|
Color = enum cRed, cBlue, cGreen
|
||||||
Direction = enum # Alternative formating
|
Direction = enum # Alternative formatting
|
||||||
dNorth
|
dNorth
|
||||||
dWest
|
dWest
|
||||||
dEast
|
dEast
|
||||||
|
@ -786,7 +786,7 @@ MyClass *newVar = [classVar retain]; // If classVar is released, object is still
|
|||||||
// Automatic Reference Counting (ARC)
|
// Automatic Reference Counting (ARC)
|
||||||
// Because memory management can be a pain, Xcode 4.2 and iOS 4 introduced Automatic Reference Counting (ARC).
|
// Because memory management can be a pain, Xcode 4.2 and iOS 4 introduced Automatic Reference Counting (ARC).
|
||||||
// ARC is a compiler feature that inserts retain, release, and autorelease automatically for you, so when using ARC,
|
// ARC is a compiler feature that inserts retain, release, and autorelease automatically for you, so when using ARC,
|
||||||
// you must not use retain, relase, or autorelease
|
// you must not use retain, release, or autorelease
|
||||||
MyClass *arcMyClass = [[MyClass alloc] init];
|
MyClass *arcMyClass = [[MyClass alloc] init];
|
||||||
// ... code using arcMyClass
|
// ... code using arcMyClass
|
||||||
// Without ARC, you will need to call: [arcMyClass release] after you're done using arcMyClass. But with ARC,
|
// Without ARC, you will need to call: [arcMyClass release] after you're done using arcMyClass. But with ARC,
|
||||||
|
@ -447,7 +447,7 @@ False ~~ True; # True
|
|||||||
# http://perlcabal.org/syn/S03.html#Smart_matching
|
# http://perlcabal.org/syn/S03.html#Smart_matching
|
||||||
|
|
||||||
# You also, of course, have `<`, `<=`, `>`, `>=`.
|
# You also, of course, have `<`, `<=`, `>`, `>=`.
|
||||||
# Their string equivalent are also avaiable : `lt`, `le`, `gt`, `ge`.
|
# Their string equivalent are also available : `lt`, `le`, `gt`, `ge`.
|
||||||
3 > 4;
|
3 > 4;
|
||||||
|
|
||||||
## * Range constructors
|
## * Range constructors
|
||||||
@ -618,7 +618,7 @@ my @arrayplus3 = map(*+3, @array); # `*+3` is the same as `{ $_ + 3 }`
|
|||||||
my @arrayplus3 = map(*+*+3, @array); # Same as `-> $a, $b { $a + $b + 3 }`
|
my @arrayplus3 = map(*+*+3, @array); # Same as `-> $a, $b { $a + $b + 3 }`
|
||||||
# also `sub ($a, $b) { $a + $b + 3 }`
|
# also `sub ($a, $b) { $a + $b + 3 }`
|
||||||
say (*/2)(4); #=> 2
|
say (*/2)(4); #=> 2
|
||||||
# Immediatly execute the function Whatever created.
|
# Immediately execute the function Whatever created.
|
||||||
say ((*+3)/5)(5); #=> 1.6
|
say ((*+3)/5)(5); #=> 1.6
|
||||||
# works even in parens !
|
# works even in parens !
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ sub call_say_dyn {
|
|||||||
my $*dyn_scoped_1 = 25; # Defines $*dyn_scoped_1 only for this sub.
|
my $*dyn_scoped_1 = 25; # Defines $*dyn_scoped_1 only for this sub.
|
||||||
$*dyn_scoped_2 = 100; # Will change the value of the file scoped variable.
|
$*dyn_scoped_2 = 100; # Will change the value of the file scoped variable.
|
||||||
say_dyn(); #=> 25 100 $*dyn_scoped 1 and 2 will be looked for in the call.
|
say_dyn(); #=> 25 100 $*dyn_scoped 1 and 2 will be looked for in the call.
|
||||||
# It uses he value of $*dyn_scoped_1 from inside this sub's lexical
|
# It uses the value of $*dyn_scoped_1 from inside this sub's lexical
|
||||||
# scope even though the blocks aren't nested (they're call-nested).
|
# scope even though the blocks aren't nested (they're call-nested).
|
||||||
}
|
}
|
||||||
say_dyn(); #=> 1 10
|
say_dyn(); #=> 1 10
|
||||||
@ -816,7 +816,7 @@ $class-obj.other-attrib = 10; # This, however, works, because the public
|
|||||||
# Perl 6 also has inheritance (along with multiple inheritance)
|
# Perl 6 also has inheritance (along with multiple inheritance)
|
||||||
# While `method`'s are inherited, `submethod`'s are not.
|
# While `method`'s are inherited, `submethod`'s are not.
|
||||||
# Submethods are useful for object construction and destruction tasks,
|
# Submethods are useful for object construction and destruction tasks,
|
||||||
# such as BUILD, or methods that must be overriden by subtypes.
|
# such as BUILD, or methods that must be overridden by subtypes.
|
||||||
# We will learn about BUILD later on.
|
# We will learn about BUILD later on.
|
||||||
|
|
||||||
class Parent {
|
class Parent {
|
||||||
@ -840,7 +840,7 @@ $Richard.talk; #=> "Hi, my name is Richard"
|
|||||||
# # $Richard is able to access the submethod, he knows how to say his name.
|
# # $Richard is able to access the submethod, he knows how to say his name.
|
||||||
|
|
||||||
my Child $Madison .= new(age => 1, name => 'Madison');
|
my Child $Madison .= new(age => 1, name => 'Madison');
|
||||||
$Madison.talk; # prints "Goo goo ga ga" due to the overrided method.
|
$Madison.talk; # prints "Goo goo ga ga" due to the overridden method.
|
||||||
# $Madison.favorite-color does not work since it is not inherited
|
# $Madison.favorite-color does not work since it is not inherited
|
||||||
|
|
||||||
# When you use `my T $var`, `$var` starts off with `T` itself in it,
|
# When you use `my T $var`, `$var` starts off with `T` itself in it,
|
||||||
@ -1054,7 +1054,7 @@ say why-not[^5]; #=> 5 15 25 35 45
|
|||||||
|
|
||||||
## * `state` (happens at run time, but only once)
|
## * `state` (happens at run time, but only once)
|
||||||
# State variables are only initialized one time
|
# State variables are only initialized one time
|
||||||
# (they exist in other langages such as C as `static`)
|
# (they exist in other languages such as C as `static`)
|
||||||
sub fixed-rand {
|
sub fixed-rand {
|
||||||
state $val = rand;
|
state $val = rand;
|
||||||
say $val;
|
say $val;
|
||||||
@ -1105,7 +1105,7 @@ PRE {
|
|||||||
say "If this block doesn't return a truthy value,
|
say "If this block doesn't return a truthy value,
|
||||||
an exception of type X::Phaser::PrePost is thrown.";
|
an exception of type X::Phaser::PrePost is thrown.";
|
||||||
}
|
}
|
||||||
# exemple:
|
# example:
|
||||||
for 0..2 {
|
for 0..2 {
|
||||||
PRE { $_ > 1 } # This is going to blow up with "Precondition failed"
|
PRE { $_ > 1 } # This is going to blow up with "Precondition failed"
|
||||||
}
|
}
|
||||||
@ -1204,7 +1204,7 @@ say (1, 10, (20, 10) ).flat; #> (1 10 20 10) Now the iterable is flat
|
|||||||
|
|
||||||
# - `lazy` - Defer actual evaluation until value is fetched (forces lazy context)
|
# - `lazy` - Defer actual evaluation until value is fetched (forces lazy context)
|
||||||
my @lazy-array = (1..100).lazy;
|
my @lazy-array = (1..100).lazy;
|
||||||
say @lazy-array.is-lazy; #> True # Check for lazyness with the `is-lazy` method.
|
say @lazy-array.is-lazy; #> True # Check for laziness with the `is-lazy` method.
|
||||||
say @lazy-array; #> [...] List has not been iterated on!
|
say @lazy-array; #> [...] List has not been iterated on!
|
||||||
my @lazy-array { .print }; # This works and will only do as much work as is
|
my @lazy-array { .print }; # This works and will only do as much work as is
|
||||||
# needed.
|
# needed.
|
||||||
@ -1599,7 +1599,7 @@ so 'ayc' ~~ / a [ b | y ] c /; # `True`. Obviously enough ...
|
|||||||
# To decide which part is the "longest", it first splits the regex in two parts:
|
# To decide which part is the "longest", it first splits the regex in two parts:
|
||||||
# The "declarative prefix" (the part that can be statically analyzed)
|
# The "declarative prefix" (the part that can be statically analyzed)
|
||||||
# and the procedural parts.
|
# and the procedural parts.
|
||||||
# Declarative prefixes include alternations (`|`), conjuctions (`&`),
|
# Declarative prefixes include alternations (`|`), conjunctions (`&`),
|
||||||
# sub-rule calls (not yet introduced), literals, characters classes and quantifiers.
|
# sub-rule calls (not yet introduced), literals, characters classes and quantifiers.
|
||||||
# The latter include everything else: back-references, code assertions,
|
# The latter include everything else: back-references, code assertions,
|
||||||
# and other things that can't traditionnaly be represented by normal regexps.
|
# and other things that can't traditionnaly be represented by normal regexps.
|
||||||
@ -1755,10 +1755,10 @@ If you want to go further, you can:
|
|||||||
This will give you a dropdown menu of all the pages referencing your search
|
This will give you a dropdown menu of all the pages referencing your search
|
||||||
term (Much better than using Google to find Perl 6 documents!)
|
term (Much better than using Google to find Perl 6 documents!)
|
||||||
- Read the [Perl 6 Advent Calendar](http://perl6advent.wordpress.com/). This
|
- Read the [Perl 6 Advent Calendar](http://perl6advent.wordpress.com/). This
|
||||||
is a great source of Perl 6 snippets and explainations. If the docs don't
|
is a great source of Perl 6 snippets and explanations. If the docs don't
|
||||||
describe something well enough, you may find more detailed information here.
|
describe something well enough, you may find more detailed information here.
|
||||||
This information may be a bit older but there are many great examples and
|
This information may be a bit older but there are many great examples and
|
||||||
explainations. Posts stopped at the end of 2015 when the language was declared
|
explanations. Posts stopped at the end of 2015 when the language was declared
|
||||||
stable and Perl 6.c was released.
|
stable and Perl 6.c was released.
|
||||||
- Come along on `#perl6` at `irc.freenode.net`. The folks here are always helpful.
|
- 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).
|
- 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).
|
||||||
|
@ -122,9 +122,9 @@ echo 'Multiple', 'Parameters', 'Valid'; // Returns 'MultipleParametersValid'
|
|||||||
// followed by any number of letters, numbers, or underscores.
|
// followed by any number of letters, numbers, or underscores.
|
||||||
define("FOO", "something");
|
define("FOO", "something");
|
||||||
|
|
||||||
// access to a constant is possible by calling the choosen name without a $
|
// access to a constant is possible by calling the chosen name without a $
|
||||||
echo FOO; // Returns 'something'
|
echo FOO; // Returns 'something'
|
||||||
echo 'This outputs ' . FOO; // Returns 'This ouputs something'
|
echo 'This outputs ' . FOO; // Returns 'This outputs something'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -837,7 +837,7 @@ try {
|
|||||||
// Handle exception
|
// Handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
// When using try catch blocks in a namespaced enviroment use the following
|
// When using try catch blocks in a namespaced environment use the following
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Do something
|
// Do something
|
||||||
@ -854,7 +854,7 @@ try {
|
|||||||
$condition = true;
|
$condition = true;
|
||||||
|
|
||||||
if ($condition) {
|
if ($condition) {
|
||||||
throw new MyException('Something just happend');
|
throw new MyException('Something just happened');
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (MyException $e) {
|
} catch (MyException $e) {
|
||||||
|
@ -647,7 +647,7 @@ Se você tem uma pergunta, leia [compl.lang.c Frequently Asked Questions](http:/
|
|||||||
|
|
||||||
É importante usar espaços e indentação adequadamente e ser consistente com seu estilo de código em geral.
|
É importante usar espaços e indentação adequadamente e ser consistente com seu estilo de código em geral.
|
||||||
Código legível é melhor que código 'esperto' e rápido. Para adotar um estilo de código bom e são, veja
|
Código legível é melhor que código 'esperto' e rápido. Para adotar um estilo de código bom e são, veja
|
||||||
[Linux kernel coding stlye](https://www.kernel.org/doc/Documentation/CodingStyle).
|
[Linux kernel coding style](https://www.kernel.org/doc/Documentation/CodingStyle).
|
||||||
|
|
||||||
Além disso, Google é teu amigo.
|
Além disso, Google é teu amigo.
|
||||||
[1] http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member
|
[1] http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member
|
||||||
|
@ -104,7 +104,7 @@ import matplotlib as mpl
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
%matplotlib inline
|
%matplotlib inline
|
||||||
|
|
||||||
# To do data vizualization in Python, use matplotlib
|
# To do data visualization in Python, use matplotlib
|
||||||
|
|
||||||
plt.hist(pets.age);
|
plt.hist(pets.age);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ lang: en
|
|||||||
|
|
||||||
```c++
|
```c++
|
||||||
/*
|
/*
|
||||||
* Let's start clasically
|
* Let's start classically
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// all headers from Qt framework start with capital letter 'Q'
|
// all headers from Qt framework start with capital letter 'Q'
|
||||||
@ -79,7 +79,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
Notice that *QObject::connect* part. This method is used to connect *SIGNALS* of one objects to *SLOTS* of another.
|
Notice that *QObject::connect* part. This method is used to connect *SIGNALS* of one objects to *SLOTS* of another.
|
||||||
|
|
||||||
**Signals** are being emited when certain things happen with objects, like *pressed* signal is emited when user presses on QPushButton object.
|
**Signals** are being emitted when certain things happen with objects, like *pressed* signal is emitted when user presses on QPushButton object.
|
||||||
|
|
||||||
**Slots** are *actions* that might be performed in response to received signals.
|
**Slots** are *actions* that might be performed in response to received signals.
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ class(-Inf) # "numeric"
|
|||||||
2.0 * 2L # 4 # numeric times integer gives numeric
|
2.0 * 2L # 4 # numeric times integer gives numeric
|
||||||
3L / 4 # 0.75 # integer over numeric gives numeric
|
3L / 4 # 0.75 # integer over numeric gives numeric
|
||||||
3 %% 2 # 1 # the remainder of two numerics is another numeric
|
3 %% 2 # 1 # the remainder of two numerics is another numeric
|
||||||
# Illegal arithmetic yeilds you a "not-a-number":
|
# Illegal arithmetic yields you a "not-a-number":
|
||||||
0 / 0 # NaN
|
0 / 0 # NaN
|
||||||
class(NaN) # "numeric"
|
class(NaN) # "numeric"
|
||||||
# You can do arithmetic on two vectors with length greater than 1,
|
# You can do arithmetic on two vectors with length greater than 1,
|
||||||
@ -662,7 +662,7 @@ require(plyr)
|
|||||||
#########################
|
#########################
|
||||||
|
|
||||||
# "pets.csv" is a file on the internet
|
# "pets.csv" is a file on the internet
|
||||||
# (but it could just as easily be be a file on your own computer)
|
# (but it could just as easily be a file on your own computer)
|
||||||
pets <- read.csv("http://learnxinyminutes.com/docs/pets.csv")
|
pets <- read.csv("http://learnxinyminutes.com/docs/pets.csv")
|
||||||
pets
|
pets
|
||||||
head(pets, 2) # first two rows
|
head(pets, 2) # first two rows
|
||||||
|
@ -51,7 +51,7 @@ comment {
|
|||||||
; no need to restrict this to a 'main' function.
|
; no need to restrict this to a 'main' function.
|
||||||
|
|
||||||
; Valid variable names start with a letter and can contain numbers,
|
; Valid variable names start with a letter and can contain numbers,
|
||||||
; variables containing only capital A thru F and numbers and ending with 'h'
|
; variables containing only capital A through F and numbers and ending with 'h'
|
||||||
; are forbidden, because that is how hexadecimal numbers are expressed in Red
|
; are forbidden, because that is how hexadecimal numbers are expressed in Red
|
||||||
; and Red/System.
|
; and Red/System.
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ void str_reverse_through_pointer(char *str_in) {
|
|||||||
|
|
||||||
Очень важно использовать правильные отступы и ставить пробелы в нужных местах.
|
Очень важно использовать правильные отступы и ставить пробелы в нужных местах.
|
||||||
Читаемый код лучше чем красивый или быстрый код.
|
Читаемый код лучше чем красивый или быстрый код.
|
||||||
Чтобы научиться писать хороший код, почитайте [Linux kernel coding stlye](https://www.kernel.org/doc/Documentation/CodingStyle).
|
Чтобы научиться писать хороший код, почитайте [Linux kernel coding style](https://www.kernel.org/doc/Documentation/CodingStyle).
|
||||||
|
|
||||||
Также не забывайте, что [Google](http://google.com) и [Яндекс](http://yandex.ru) – ваши хорошие друзья.
|
Также не забывайте, что [Google](http://google.com) и [Яндекс](http://yandex.ru) – ваши хорошие друзья.
|
||||||
|
|
||||||
|
@ -781,7 +781,7 @@ MyClass *newVar = [classVar retain]; // Если classVar освободится
|
|||||||
// автоматический подсчет ссылок (ARC).
|
// автоматический подсчет ссылок (ARC).
|
||||||
// ARC - это особенность компилятора, который помещает "retain", "release"
|
// ARC - это особенность компилятора, который помещает "retain", "release"
|
||||||
// и "autorelease" автоматически за вас тогда, когда используется ARC,
|
// и "autorelease" автоматически за вас тогда, когда используется ARC,
|
||||||
// вам не нужно больше обращаться к "retain", "relase" или "autorelease"
|
// вам не нужно больше обращаться к "retain", "release" или "autorelease"
|
||||||
MyClass *arcMyClass = [[MyClass alloc] init];
|
MyClass *arcMyClass = [[MyClass alloc] init];
|
||||||
// ... код, использующий объект arcMyClass
|
// ... код, использующий объект arcMyClass
|
||||||
// Без ARC, вам нужно было бы вызвать: [arcMyClass release] после того, как вы
|
// Без ARC, вам нужно было бы вызвать: [arcMyClass release] после того, как вы
|
||||||
|
@ -128,7 +128,7 @@ define("FOO", "something");
|
|||||||
|
|
||||||
// Доступ к константе возможен через прямое указание её имени без знака $
|
// Доступ к константе возможен через прямое указание её имени без знака $
|
||||||
echo FOO; // печатает 'something'
|
echo FOO; // печатает 'something'
|
||||||
echo 'This outputs ' . FOO; // печатает 'This ouputs something'
|
echo 'This outputs ' . FOO; // печатает 'This outputs something'
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
* Массивы
|
* Массивы
|
||||||
|
@ -88,7 +88,7 @@ implementation.
|
|||||||
to have stopped since Microsoft pulled their support.
|
to have stopped since Microsoft pulled their support.
|
||||||
|
|
||||||
Ruby implementations may have their own release version numbers, but they always
|
Ruby implementations may have their own release version numbers, but they always
|
||||||
target a specific version of MRI for compatability. Many implementations have
|
target a specific version of MRI for compatibility. Many implementations have
|
||||||
the ability to enter different modes (for example, 1.8 or 1.9 mode) to specify
|
the ability to enter different modes (for example, 1.8 or 1.9 mode) to specify
|
||||||
which MRI version to target.
|
which MRI version to target.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ filename: learnshutit.html
|
|||||||
|
|
||||||
ShutIt is an shell automation framework designed to be easy to use.
|
ShutIt is an shell automation framework designed to be easy to use.
|
||||||
|
|
||||||
It is a wrapper around a python-based expect clone (pexpect).
|
It is a wrapper around a Python-based expect clone (pexpect).
|
||||||
|
|
||||||
You can look at it as 'expect without the pain'.
|
You can look at it as 'expect without the pain'.
|
||||||
|
|
||||||
@ -167,8 +167,8 @@ session2.logout()
|
|||||||
Here you use the 'send\_and\_get\_output' method to retrieve the output of the
|
Here you use the 'send\_and\_get\_output' method to retrieve the output of the
|
||||||
capacity command (df).
|
capacity command (df).
|
||||||
|
|
||||||
There are much more elegant ways to do the above (eg have a dictionary of the
|
There are much more elegant ways to do the above (e.g. have a dictionary of the
|
||||||
servers to iterate over), but it's up to you how clever you need the python to
|
servers to iterate over), but it's up to you how clever you need the Python to
|
||||||
be.
|
be.
|
||||||
|
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ over a minute to complete (using the 'wait' method).
|
|||||||
|
|
||||||
Again, this is trivial, but imagine you have hundreds of servers to manage like
|
Again, this is trivial, but imagine you have hundreds of servers to manage like
|
||||||
this and you can see the power it can bring in a few lines of code and one
|
this and you can see the power it can bring in a few lines of code and one
|
||||||
python import.
|
Python import.
|
||||||
|
|
||||||
|
|
||||||
## Learn More
|
## Learn More
|
||||||
|
@ -907,7 +907,7 @@ b := String isWords. true if index instan
|
|||||||
Object withAllSubclasses size. "get total number of class entries"
|
Object withAllSubclasses size. "get total number of class entries"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Debuging:
|
## Debugging:
|
||||||
```
|
```
|
||||||
| a b x |
|
| a b x |
|
||||||
x yourself. "returns receiver"
|
x yourself. "returns receiver"
|
||||||
|
@ -191,7 +191,7 @@ string n = "hello"; // stored in UTF8, note double quotes, not single
|
|||||||
// string utility functions to be added in future
|
// string utility functions to be added in future
|
||||||
// prefer bytes32/bytes, as UTF8 uses more storage
|
// prefer bytes32/bytes, as UTF8 uses more storage
|
||||||
|
|
||||||
// Type inferrence
|
// Type inference
|
||||||
// var does inferred typing based on first assignment,
|
// var does inferred typing based on first assignment,
|
||||||
// can't be used in functions parameters
|
// can't be used in functions parameters
|
||||||
var a = true;
|
var a = true;
|
||||||
@ -487,7 +487,7 @@ contract MyContract is abc, def("a custom argument to def") {
|
|||||||
function z() {
|
function z() {
|
||||||
if (msg.sender == owner) {
|
if (msg.sender == owner) {
|
||||||
def.z(); // call overridden function from def
|
def.z(); // call overridden function from def
|
||||||
super.z(); // call immediate parent overriden function
|
super.z(); // call immediate parent overridden function
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -807,7 +807,7 @@ someContractAddress.callcode('function_name');
|
|||||||
// else should be placed on own line
|
// else should be placed on own line
|
||||||
|
|
||||||
|
|
||||||
// 14. NATSPEC COMENTS
|
// 14. NATSPEC COMMENTS
|
||||||
// used for documentation, commenting, and external UIs
|
// used for documentation, commenting, and external UIs
|
||||||
|
|
||||||
// Contract natspec - always above contract definition
|
// Contract natspec - always above contract definition
|
||||||
|
@ -395,7 +395,7 @@ fun failing_function [] = raise Empty (* used for empty lists *)
|
|||||||
| failing_function xs = raise Fail "This list is too long!"
|
| failing_function xs = raise Fail "This list is too long!"
|
||||||
|
|
||||||
(* We can pattern match in 'handle' to make sure
|
(* We can pattern match in 'handle' to make sure
|
||||||
a specfic exception was raised, or grab the message *)
|
a specific exception was raised, or grab the message *)
|
||||||
val err_msg = failing_function [1,2] handle Fail _ => "Fail was raised"
|
val err_msg = failing_function [1,2] handle Fail _ => "Fail was raised"
|
||||||
| Domain => "Domain was raised"
|
| Domain => "Domain was raised"
|
||||||
| Empty => "Empty was raised"
|
| Empty => "Empty was raised"
|
||||||
|
@ -281,7 +281,7 @@ testGuard()
|
|||||||
|
|
||||||
// Variadic Args
|
// Variadic Args
|
||||||
func setup(numbers: Int...) {
|
func setup(numbers: Int...) {
|
||||||
// its an array
|
// it's an array
|
||||||
let _ = numbers[0]
|
let _ = numbers[0]
|
||||||
let _ = numbers.count
|
let _ = numbers.count
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ discipline of exposing all programmatic functionality as routines, including
|
|||||||
things like looping and mathematical operations that are usually baked into the
|
things like looping and mathematical operations that are usually baked into the
|
||||||
syntax of other languages, allows it to fade into the background of whatever
|
syntax of other languages, allows it to fade into the background of whatever
|
||||||
domain-specific functionality a project needs. Its syntax, which is even
|
domain-specific functionality a project needs. Its syntax, which is even
|
||||||
lighter that that of Lisp, just gets out of the way.
|
lighter than that of Lisp, just gets out of the way.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ lighter that that of Lisp, just gets out of the way.
|
|||||||
## 2. Syntax
|
## 2. Syntax
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# A script is made up of commands delimited by newlines or semiclons. Each
|
# A script is made up of commands delimited by newlines or semicolons. Each
|
||||||
# command is a call to a routine. The first word is the name of a routine to
|
# command is a call to a routine. The first word is the name of a routine to
|
||||||
# call, and subsequent words are arguments to the routine. Words are delimited
|
# call, and subsequent words are arguments to the routine. Words are delimited
|
||||||
# by whitespace. Since each argument is a word in the command it is already a
|
# by whitespace. Since each argument is a word in the command it is already a
|
||||||
@ -99,7 +99,7 @@ set greeting $part1$part2[set part3]
|
|||||||
|
|
||||||
|
|
||||||
# An embedded script may be composed of multiple commands, the last of which provides
|
# An embedded script may be composed of multiple commands, the last of which provides
|
||||||
# the result for the substtution:
|
# the result for the substitution:
|
||||||
set greeting $greeting[
|
set greeting $greeting[
|
||||||
incr i
|
incr i
|
||||||
incr i
|
incr i
|
||||||
@ -377,7 +377,7 @@ set amount [lindex $amounts 1]
|
|||||||
set inventory {"item 1" item\ 2 {item 3}}
|
set inventory {"item 1" item\ 2 {item 3}}
|
||||||
|
|
||||||
|
|
||||||
# It's generally a better idea to use list routines when modifing lists:
|
# It's generally a better idea to use list routines when modifying lists:
|
||||||
lappend inventory {item 1} {item 2} {item 3}
|
lappend inventory {item 1} {item 2} {item 3}
|
||||||
|
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ proc while {condition script} {
|
|||||||
# and then calls that routine. "yield" suspends evaluation in that stack and
|
# and then calls that routine. "yield" suspends evaluation in that stack and
|
||||||
# returns control to the calling stack:
|
# returns control to the calling stack:
|
||||||
proc countdown count {
|
proc countdown count {
|
||||||
# send something back to the creater of the coroutine, effectively pausing
|
# send something back to the creator of the coroutine, effectively pausing
|
||||||
# this call stack for the time being.
|
# this call stack for the time being.
|
||||||
yield [info coroutine]
|
yield [info coroutine]
|
||||||
|
|
||||||
|
@ -592,7 +592,7 @@ while ( $#lst )
|
|||||||
shift lst
|
shift lst
|
||||||
end
|
end
|
||||||
echo 'options =' $options
|
echo 'options =' $options
|
||||||
echo 'paramaters =' $params
|
echo 'parameters =' $params
|
||||||
|
|
||||||
#### REPEAT
|
#### REPEAT
|
||||||
# Syntax: repeat count command
|
# Syntax: repeat count command
|
||||||
|
@ -481,7 +481,7 @@ Diğer bir iyi kaynak ise [Learn C the hard way](http://c.learncodethehardway.or
|
|||||||
|
|
||||||
It's very important to use proper spacing, indentation and to be consistent with your coding style in general.
|
It's very important to use proper spacing, indentation and to be consistent with your coding style in general.
|
||||||
Readable code is better than clever code and fast code. For a good, sane coding style to adopt, see the
|
Readable code is better than clever code and fast code. For a good, sane coding style to adopt, see the
|
||||||
[Linux kernel coding stlye](https://www.kernel.org/doc/Documentation/CodingStyle).
|
[Linux kernel coding style](https://www.kernel.org/doc/Documentation/CodingStyle).
|
||||||
|
|
||||||
Diğer taraftan google sizin için bir arkadaş olabilir.
|
Diğer taraftan google sizin için bir arkadaş olabilir.
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ function bigHorribleAlert(): void {
|
|||||||
// Functions are first class citizens, support the lambda "fat arrow" syntax and
|
// Functions are first class citizens, support the lambda "fat arrow" syntax and
|
||||||
// use type inference
|
// use type inference
|
||||||
|
|
||||||
// The following are equivalent, the same signature will be infered by the
|
// The following are equivalent, the same signature will be inferred by the
|
||||||
// compiler, and same JavaScript will be emitted
|
// compiler, and same JavaScript will be emitted
|
||||||
let f1 = function (i: number): number { return i * i; }
|
let f1 = function (i: number): number { return i * i; }
|
||||||
// Return type inferred
|
// Return type inferred
|
||||||
|
@ -40,9 +40,9 @@ specific points in the file, and for fast editing.
|
|||||||
|
|
||||||
# Searching in the text
|
# Searching in the text
|
||||||
|
|
||||||
/word # Highlights all occurences of word after cursor
|
/word # Highlights all occurrences of word after cursor
|
||||||
?word # Highlights all occurences of word before cursor
|
?word # Highlights all occurrences of word before cursor
|
||||||
n # Moves cursor to next occurence of word after search
|
n # Moves cursor to next occurrence of word after search
|
||||||
N # Moves cursor to previous occerence of word
|
N # Moves cursor to previous occerence of word
|
||||||
|
|
||||||
:%s/foo/bar/g # Change 'foo' to 'bar' on every line in the file
|
:%s/foo/bar/g # Change 'foo' to 'bar' on every line in the file
|
||||||
|
@ -12,7 +12,7 @@ Module Module1
|
|||||||
'A Quick Overview of Visual Basic Console Applications before we dive
|
'A Quick Overview of Visual Basic Console Applications before we dive
|
||||||
'in to the deep end.
|
'in to the deep end.
|
||||||
'Apostrophe starts comments.
|
'Apostrophe starts comments.
|
||||||
'To Navigate this tutorial within the Visual Basic Complier, I've put
|
'To Navigate this tutorial within the Visual Basic Compiler, I've put
|
||||||
'together a navigation system.
|
'together a navigation system.
|
||||||
'This navigation system is explained however as we go deeper into this
|
'This navigation system is explained however as we go deeper into this
|
||||||
'tutorial, you'll understand what it all means.
|
'tutorial, you'll understand what it all means.
|
||||||
|
@ -27,7 +27,7 @@ another_key: Another value goes here.
|
|||||||
a_number_value: 100
|
a_number_value: 100
|
||||||
scientific_notation: 1e+12
|
scientific_notation: 1e+12
|
||||||
# The number 1 will be interpreted as a number, not a boolean. if you want
|
# The number 1 will be interpreted as a number, not a boolean. if you want
|
||||||
# it to be intepreted as a boolean, use true
|
# it to be interpreted as a boolean, use true
|
||||||
boolean: true
|
boolean: true
|
||||||
null_value: null
|
null_value: null
|
||||||
key with spaces: value
|
key with spaces: value
|
||||||
@ -132,7 +132,7 @@ python_complex_number: !!python/complex 1+2j
|
|||||||
# We can also use yaml complex keys with language specific tags
|
# We can also use yaml complex keys with language specific tags
|
||||||
? !!python/tuple [5, 7]
|
? !!python/tuple [5, 7]
|
||||||
: Fifty Seven
|
: Fifty Seven
|
||||||
# Would be {(5, 7): 'Fifty Seven'} in python
|
# Would be {(5, 7): 'Fifty Seven'} in Python
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# EXTRA YAML TYPES #
|
# EXTRA YAML TYPES #
|
||||||
|
@ -77,7 +77,7 @@ Module Module1
|
|||||||
' 使用 private subs 声明函数。
|
' 使用 private subs 声明函数。
|
||||||
Private Sub HelloWorldOutput()
|
Private Sub HelloWorldOutput()
|
||||||
' 程序名
|
' 程序名
|
||||||
Console.Title = "Hello World Ouput | Learn X in Y Minutes"
|
Console.Title = "Hello World Output | Learn X in Y Minutes"
|
||||||
' 使用 Console.Write("") 或者 Console.WriteLine("") 来输出文本到屏幕上
|
' 使用 Console.Write("") 或者 Console.WriteLine("") 来输出文本到屏幕上
|
||||||
' 对应的 Console.Read() 或 Console.Readline() 用来读取键盘输入
|
' 对应的 Console.Read() 或 Console.Readline() 用来读取键盘输入
|
||||||
Console.WriteLine("Hello World")
|
Console.WriteLine("Hello World")
|
||||||
|
Loading…
Reference in New Issue
Block a user