mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-05-05 14:28:31 +00:00
Merge remote-tracking branch 'upstream/master' into scala/de
This commit is contained in:
commit
ca6ea580c7
@ -148,15 +148,10 @@ int main (int argc, char** argv)
|
|||||||
printf("Enter the array size: "); // ask the user for an array size
|
printf("Enter the array size: "); // ask the user for an array size
|
||||||
int size;
|
int size;
|
||||||
fscanf(stdin, "%d", &size);
|
fscanf(stdin, "%d", &size);
|
||||||
char buf[size];
|
int var_length_array[size]; // declare the VLA
|
||||||
fgets(buf, sizeof buf, stdin);
|
|
||||||
|
|
||||||
// strtoul parses a string to an unsigned integer
|
|
||||||
size_t size2 = strtoul(buf, NULL, 10);
|
|
||||||
int var_length_array[size2]; // declare the VLA
|
|
||||||
printf("sizeof array = %zu\n", sizeof var_length_array);
|
printf("sizeof array = %zu\n", sizeof var_length_array);
|
||||||
|
|
||||||
// A possible outcome of this program may be:
|
// Example:
|
||||||
// > Enter the array size: 10
|
// > Enter the array size: 10
|
||||||
// > sizeof array = 40
|
// > sizeof array = 40
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ for (i, j) in zip( toThisArray.domain, -100..#5 ){
|
|||||||
}
|
}
|
||||||
writeln( toThisArray );
|
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;
|
// var iterArray : [1..10] int = [ i in 1..10 ] if ( i % 2 == 1 ) then j;
|
||||||
// exhibits a runtime error.
|
// exhibits a runtime error.
|
||||||
// Even though the domain of the array and the loop-expression are
|
// 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
|
[ val in myBigArray ] val = 1 / val; // Parallel operation
|
||||||
|
|
||||||
// Atomic variables, common to many languages, are ones whose operations
|
// 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.
|
// and can know that their values are safe.
|
||||||
// Chapel atomic variables can be of type bool, int, uint, and real.
|
// Chapel atomic variables can be of type bool, int, uint, and real.
|
||||||
var uranium: atomic int;
|
var uranium: atomic int;
|
||||||
|
108
edn.html.markdown
Normal file
108
edn.html.markdown
Normal file
@ -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/)
|
@ -4,7 +4,7 @@ filename: learnLivescript-fr.ls
|
|||||||
contributors:
|
contributors:
|
||||||
- ["Christina Whyte", "http://github.com/kurisuwhyte/"]
|
- ["Christina Whyte", "http://github.com/kurisuwhyte/"]
|
||||||
translators:
|
translators:
|
||||||
- ["Morgan Bohn", "https://github.com/morganbohn"]
|
- ["Morgan Bohn", "https://github.com/dotmobo"]
|
||||||
lang: fr-fr
|
lang: fr-fr
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ module SequenceExamples =
|
|||||||
// sequences can use yield and
|
// sequences can use yield and
|
||||||
// can contain subsequences
|
// can contain subsequences
|
||||||
let strange = seq {
|
let strange = seq {
|
||||||
// "yield! adds one element
|
// "yield" adds one element
|
||||||
yield 1; yield 2;
|
yield 1; yield 2;
|
||||||
|
|
||||||
// "yield!" adds a whole subsequence
|
// "yield!" adds a whole subsequence
|
||||||
@ -297,7 +297,7 @@ module DataTypeExamples =
|
|||||||
let person1 = {First="John"; Last="Doe"}
|
let person1 = {First="John"; Last="Doe"}
|
||||||
|
|
||||||
// Pattern match to unpack
|
// 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
|
// Union types (aka variants) have a set of choices
|
||||||
@ -426,7 +426,7 @@ module ActivePatternExamples =
|
|||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
// You can create partial matching patterns as well
|
// 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 (|MultOf3|_|) i = if i % 3 = 0 then Some MultOf3 else None
|
||||||
let (|MultOf5|_|) i = if i % 5 = 0 then Some MultOf5 else None
|
let (|MultOf5|_|) i = if i % 5 = 0 then Some MultOf5 else None
|
||||||
|
|
||||||
|
106
hu-hu/coffeescript-hu.html.markdown
Normal file
106
hu-hu/coffeescript-hu.html.markdown
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
---
|
||||||
|
language: coffeescript
|
||||||
|
contributors:
|
||||||
|
- ["Tenor Biel", "http://github.com/L8D"]
|
||||||
|
- ["Xavier Yao", "http://github.com/xavieryao"]
|
||||||
|
translators:
|
||||||
|
- ["Tamás Diószegi", "http://github.com/ditam"]
|
||||||
|
filename: coffeescript-hu.coffee
|
||||||
|
---
|
||||||
|
|
||||||
|
A CoffeeScript egy apró nyelv ami egy-az-egyben egyenértékű Javascript kódra fordul, és így futásidőben már nem szükséges interpretálni.
|
||||||
|
Mint a JavaScript egyik követője, a CoffeeScript mindent megtesz azért, hogy olvasható, jól formázott és jól futó JavaScript kódot állítson elő, ami minden JavaScript futtatókörnyezetben jól működik.
|
||||||
|
|
||||||
|
Rézletekért lásd még a [CoffeeScript weboldalát](http://coffeescript.org/), ahol egy teljes CoffeScript tutorial is található.
|
||||||
|
|
||||||
|
```coffeescript
|
||||||
|
# A CoffeeScript egy hipszter nyelv.
|
||||||
|
# Követi több modern nyelv trendjeit.
|
||||||
|
# Így a kommentek, mint Ruby-ban és Python-ban, a szám szimbólummal kezdődnek.
|
||||||
|
|
||||||
|
###
|
||||||
|
A komment blokkok ilyenek, és közvetlenül '/ *' és '* /' jelekre fordítódnak
|
||||||
|
az eredményül kapott JavaScript kódban.
|
||||||
|
|
||||||
|
Mielőtt tovább olvasol, jobb, ha a JavaScript alapvető szemantikájával
|
||||||
|
tisztában vagy.
|
||||||
|
|
||||||
|
(A kód példák alatt kommentként látható a fordítás után kapott JavaScript kód.)
|
||||||
|
###
|
||||||
|
|
||||||
|
# Értékadás:
|
||||||
|
number = 42 #=> var number = 42;
|
||||||
|
opposite = true #=> var opposite = true;
|
||||||
|
|
||||||
|
# Feltételes utasítások:
|
||||||
|
number = -42 if opposite #=> if(opposite) { number = -42; }
|
||||||
|
|
||||||
|
# Függvények:
|
||||||
|
square = (x) -> x * x #=> var square = function(x) { return x * x; }
|
||||||
|
|
||||||
|
fill = (container, liquid = "coffee") ->
|
||||||
|
"Filling the #{container} with #{liquid}..."
|
||||||
|
#=>var fill;
|
||||||
|
#
|
||||||
|
#fill = function(container, liquid) {
|
||||||
|
# if (liquid == null) {
|
||||||
|
# liquid = "coffee";
|
||||||
|
# }
|
||||||
|
# return "Filling the " + container + " with " + liquid + "...";
|
||||||
|
#};
|
||||||
|
|
||||||
|
# Szám tartományok:
|
||||||
|
list = [1..5] #=> var list = [1, 2, 3, 4, 5];
|
||||||
|
|
||||||
|
# Objektumok:
|
||||||
|
math =
|
||||||
|
root: Math.sqrt
|
||||||
|
square: square
|
||||||
|
cube: (x) -> x * square x
|
||||||
|
#=> var math = {
|
||||||
|
# "root": Math.sqrt,
|
||||||
|
# "square": square,
|
||||||
|
# "cube": function(x) { return x * square(x); }
|
||||||
|
# };
|
||||||
|
|
||||||
|
# "Splat" jellegű függvény-paraméterek:
|
||||||
|
race = (winner, runners...) ->
|
||||||
|
print winner, runners
|
||||||
|
#=>race = function() {
|
||||||
|
# var runners, winner;
|
||||||
|
# winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
||||||
|
# return print(winner, runners);
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Létezés-vizsgálat:
|
||||||
|
alert "I knew it!" if elvis?
|
||||||
|
#=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); }
|
||||||
|
|
||||||
|
# Tömb értelmezések: (array comprehensions)
|
||||||
|
cubes = (math.cube num for num in list)
|
||||||
|
#=>cubes = (function() {
|
||||||
|
# var _i, _len, _results;
|
||||||
|
# _results = [];
|
||||||
|
# for (_i = 0, _len = list.length; _i < _len; _i++) {
|
||||||
|
# num = list[_i];
|
||||||
|
# _results.push(math.cube(num));
|
||||||
|
# }
|
||||||
|
# return _results;
|
||||||
|
# })();
|
||||||
|
|
||||||
|
foods = ['broccoli', 'spinach', 'chocolate']
|
||||||
|
eat food for food in foods when food isnt 'chocolate'
|
||||||
|
#=>foods = ['broccoli', 'spinach', 'chocolate'];
|
||||||
|
#
|
||||||
|
#for (_k = 0, _len2 = foods.length; _k < _len2; _k++) {
|
||||||
|
# food = foods[_k];
|
||||||
|
# if (food !== 'chocolate') {
|
||||||
|
# eat(food);
|
||||||
|
# }
|
||||||
|
#}
|
||||||
|
```
|
||||||
|
|
||||||
|
## További források
|
||||||
|
|
||||||
|
- [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/)
|
||||||
|
- [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read)
|
@ -186,9 +186,9 @@ public class LearnJava {
|
|||||||
// operations perform as could be expected for a
|
// operations perform as could be expected for a
|
||||||
// doubly-linked list.
|
// doubly-linked list.
|
||||||
// Maps - A set of objects that map keys to values. Map is
|
// Maps - A set of objects that map keys to values. Map is
|
||||||
// an interface and therefore cannot be instantiated.
|
// an interface and therefore cannot be instantiated.
|
||||||
// The type of keys and values contained in a Map must
|
// The type of keys and values contained in a Map must
|
||||||
// be specified upon instantiation of the implementing
|
// be specified upon instantiation of the implementing
|
||||||
// class. Each key may map to only one corresponding value,
|
// class. Each key may map to only one corresponding value,
|
||||||
// and each key may appear only once (no duplicates).
|
// and each key may appear only once (no duplicates).
|
||||||
// HashMaps - This class uses a hashtable to implement the Map
|
// HashMaps - This class uses a hashtable to implement the Map
|
||||||
@ -697,6 +697,64 @@ public abstract class Mammal()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Enum Type
|
||||||
|
//
|
||||||
|
// An enum type is a special data type that enables for a variable to be a set of predefined constants. The // variable must be equal to one of the values that have been predefined for it.
|
||||||
|
// Because they are constants, the names of an enum type's fields are in uppercase letters.
|
||||||
|
// In the Java programming language, you define an enum type by using the enum keyword. For example, you would
|
||||||
|
// specify a days-of-the-week enum type as:
|
||||||
|
|
||||||
|
public enum Day {
|
||||||
|
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
|
||||||
|
THURSDAY, FRIDAY, SATURDAY
|
||||||
|
}
|
||||||
|
|
||||||
|
// We can use our enum Day like that:
|
||||||
|
|
||||||
|
public class EnumTest {
|
||||||
|
|
||||||
|
// Variable Enum
|
||||||
|
Day day;
|
||||||
|
|
||||||
|
public EnumTest(Day day) {
|
||||||
|
this.day = day;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tellItLikeItIs() {
|
||||||
|
switch (day) {
|
||||||
|
case MONDAY:
|
||||||
|
System.out.println("Mondays are bad.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FRIDAY:
|
||||||
|
System.out.println("Fridays are better.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SATURDAY:
|
||||||
|
case SUNDAY:
|
||||||
|
System.out.println("Weekends are best.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
System.out.println("Midweek days are so-so.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
EnumTest firstDay = new EnumTest(Day.MONDAY);
|
||||||
|
firstDay.tellItLikeItIs(); // => Mondays are bad.
|
||||||
|
EnumTest thirdDay = new EnumTest(Day.WEDNESDAY);
|
||||||
|
thirdDay.tellItLikeItIs(); // => Midweek days are so-so.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enum types are much more powerful than we show above.
|
||||||
|
// The enum body can include methods and other fields.
|
||||||
|
// You can se more at https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Further Reading
|
## Further Reading
|
||||||
@ -720,7 +778,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)
|
* [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**
|
**Online Practice and Tutorials**
|
||||||
|
|
||||||
|
@ -101,6 +101,10 @@ false;
|
|||||||
// Strings are concatenated with +
|
// Strings are concatenated with +
|
||||||
"Hello " + "world!"; // = "Hello world!"
|
"Hello " + "world!"; // = "Hello world!"
|
||||||
|
|
||||||
|
// ... which works with more than just strings
|
||||||
|
"1, 2, " + 3; // = "1, 2, 3"
|
||||||
|
"Hello " + ["world", "!"] // = "Hello world,!"
|
||||||
|
|
||||||
// and are compared with < and >
|
// and are compared with < and >
|
||||||
"a" < "b"; // = true
|
"a" < "b"; // = true
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ pcolor(A) % Heat-map of matrix: plot as grid of rectangles, coloured by value
|
|||||||
contour(A) % Contour plot of matrix
|
contour(A) % Contour plot of matrix
|
||||||
mesh(A) % Plot as a mesh surface
|
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
|
figure(h) % Makes the figure corresponding to handle h the current figure
|
||||||
close(h) % close figure with handle h
|
close(h) % close figure with handle h
|
||||||
close all % close all open figure windows
|
close all % close all open figure windows
|
||||||
@ -460,7 +460,7 @@ length % length of a vector
|
|||||||
sort % sort in ascending order
|
sort % sort in ascending order
|
||||||
sum % sum of elements
|
sum % sum of elements
|
||||||
prod % product of elements
|
prod % product of elements
|
||||||
mode % modal value
|
mode % modal value
|
||||||
median % median value
|
median % median value
|
||||||
mean % mean value
|
mean % mean value
|
||||||
std % standard deviation
|
std % standard deviation
|
||||||
|
@ -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]
|
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
|
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,
|
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 learnign Python with Python 3.
|
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/).
|
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,
|
It is also possible to write Python code which is compatible with Python 2.7 and 3.x at the same time,
|
||||||
@ -123,8 +123,12 @@ not False # => True
|
|||||||
# A string can be treated like a list of characters
|
# A string can be treated like a list of characters
|
||||||
"This is a string"[0] # => 'T'
|
"This is a string"[0] # => 'T'
|
||||||
|
|
||||||
# % can be used to format strings, like this:
|
#String formatting with %
|
||||||
"%s can be %s" % ("strings", "interpolated")
|
#Even though the % string operator will be deprecated on Python 3.1 and removed
|
||||||
|
#later at some time, it may still be good to know how it works.
|
||||||
|
x = 'apple'
|
||||||
|
y = 'lemon'
|
||||||
|
z = "The items in the basket are %s and %s" % (x,y)
|
||||||
|
|
||||||
# A newer way to format strings is the format method.
|
# A newer way to format strings is the format method.
|
||||||
# This method is the preferred way
|
# This method is the preferred way
|
||||||
|
@ -144,7 +144,7 @@ Clojure, это представитель семейства Lisp-подобн
|
|||||||
;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
; Функция создается специальной формой fn.
|
; Функция создается специальной формой fn.
|
||||||
; "Тело"" функции может состоять из нескольких форм,
|
; "Тело" функции может состоять из нескольких форм,
|
||||||
; но результатом вызова функции всегда будет результат вычисления
|
; но результатом вызова функции всегда будет результат вычисления
|
||||||
; последней из них.
|
; последней из них.
|
||||||
(fn [] "Hello World") ; => fn
|
(fn [] "Hello World") ; => fn
|
||||||
|
@ -420,8 +420,6 @@ include_once 'my-file.php';
|
|||||||
require 'my-file.php';
|
require 'my-file.php';
|
||||||
require_once 'my-file.php';
|
require_once 'my-file.php';
|
||||||
|
|
||||||
// Same as include(), except require() will cause a fatal error if the
|
|
||||||
// file cannot be included.
|
|
||||||
// Действует также как и include(), но если файл не удалось подключить,
|
// Действует также как и include(), но если файл не удалось подключить,
|
||||||
// функция выдает фатальную ошибку
|
// функция выдает фатальную ошибку
|
||||||
|
|
||||||
|
@ -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. 类型声明
|
-- 5. 类型声明
|
||||||
|
@ -405,4 +405,4 @@ class PennyFarthing extends Bicycle {
|
|||||||
|
|
||||||
* [泛型](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
* [泛型](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)
|
||||||
|
Loading…
Reference in New Issue
Block a user