diff options
| -rw-r--r-- | awk.html.markdown | 2 | ||||
| -rw-r--r-- | es-es/awk-es.html.markdown | 2 | ||||
| -rw-r--r-- | julia.html.markdown | 84 | ||||
| -rw-r--r-- | pt-br/awk-pt.html.markdown | 2 | ||||
| -rw-r--r-- | python3.html.markdown | 4 | ||||
| -rw-r--r-- | tr-tr/c++-tr.html.markdown | 23 | 
6 files changed, 63 insertions, 54 deletions
diff --git a/awk.html.markdown b/awk.html.markdown index e3ea6318..de26c0a1 100644 --- a/awk.html.markdown +++ b/awk.html.markdown @@ -161,7 +161,7 @@ function arithmetic_functions(a, b, c,     d) {      # Most AWK implementations have some standard trig functions      localvar = sin(a)      localvar = cos(a) -    localvar = atan2(a, b) # arc tangent of b / a +    localvar = atan2(b, a) # arc tangent of b / a      # And logarithmic stuff      localvar = exp(a) diff --git a/es-es/awk-es.html.markdown b/es-es/awk-es.html.markdown index 307ba817..0516ea92 100644 --- a/es-es/awk-es.html.markdown +++ b/es-es/awk-es.html.markdown @@ -166,7 +166,7 @@ function arithmetic_functions(a, b, c,     localvar) {      # trigonométricas estándar      localvar = sin(a)      localvar = cos(a) -    localvar = atan2(a, b) # arcotangente de b / a +    localvar = atan2(b, a) # arcotangente de b / a      # Y cosas logarítmicas      localvar = exp(a) diff --git a/julia.html.markdown b/julia.html.markdown index 9e28452f..a30871eb 100644 --- a/julia.html.markdown +++ b/julia.html.markdown @@ -3,13 +3,14 @@ language: Julia  contributors:      - ["Leah Hanson", "http://leahhanson.us"]      - ["Pranit Bauva", "http://github.com/pranitbauva1997"] +    - ["Daniel YC Lin", "http://github.com/dlintw"]  filename: learnjulia.jl  ---  Julia is a new homoiconic functional language focused on technical computing.  While having the full power of homoiconic macros, first-class functions, and low-level control, Julia is as easy to learn and use as Python. -This is based on Julia 0.4. +This is based on Julia 0.6.4  ```ruby @@ -49,7 +50,7 @@ div(5, 2) # => 2 # for a truncated result, use div  ~2 # => -3   # bitwise not  3 & 5 # => 1 # bitwise and  2 | 4 # => 6 # bitwise or -2 $ 4 # => 6 # bitwise xor +xor(2, 4) # => 6 # bitwise xor  2 >>> 1 # => 1 # logical shift right  2 >> 1  # => 1 # arithmetic shift right  2 << 1  # => 4 # logical/arithmetic shift left @@ -80,25 +81,33 @@ false  2 < 3 < 2 # => false  # Strings are created with " +try  "This is a string." +catch ; end  # Julia has several types of strings, including ASCIIString and UTF8String.  # More on this in the Types section.  # Character literals are written with ' +try  'a' +catch ; end  # Some strings can be indexed like an array of characters +try  "This is a string"[1] # => 'T' # Julia indexes from 1 +catch ; end  # However, this is will not work well for UTF8 strings,  # so iterating over strings is recommended (map, for loops, etc).  # $ can be used for string interpolation: +try  "2 + 2 = $(2 + 2)" # => "2 + 2 = 4" +catch ; end  # You can put any Julia expression inside the parentheses.  # Another way to format strings is the printf macro. -@printf "%d is less than %f" 4.5 5.3 # 4.5 is less than 5.300000 +@printf "%d is less than %f" 4.5 5.3 # 4 is less than 5.300000  # Printing is easy  println("I'm Julia. Nice to meet you!") @@ -405,8 +414,8 @@ f_add(x, y) = x + y # => "f (generic function with 1 method)"  f_add(3, 4) # => 7  # Function can also return multiple values as tuple -f(x, y) = x + y, x - y -f(3, 4) # => (7, -1) +fn(x, y) = x + y, x - y +fn(3, 4) # => (7, -1)  # You can define functions that take a variable number of  # positional arguments @@ -543,7 +552,7 @@ sherekhan = typeof(tigger)(5.6,"fire") # => Tiger(5.6,"fire")  # The other kind of types is abstract types.  # abstract Name -abstract Cat # just a name and point in the type hierarchy +abstract type Cat end # just a name and point in the type hierarchy  # Abstract types cannot be instantiated, but can have subtypes.  # For example, Number is an abstract type @@ -553,30 +562,28 @@ subtypes(Number) # => 2-element Array{Any,1}:  subtypes(Cat) # => 0-element Array{Any,1}  # AbstractString, as the name implies, is also an abstract type -subtypes(AbstractString)    # 8-element Array{Any,1}: -                            #  Base.SubstitutionString{T<:AbstractString} -                            #  DirectIndexString -                            #  RepString -                            #  RevString{T<:AbstractString} -                            #  RopeString -                            #  SubString{T<:AbstractString} -                            #  UTF16String -                            #  UTF8String - -# Every type has a super type; use the `super` function to get it. +subtypes(AbstractString)        # 6-element Array{Union{DataType, UnionAll},1}: +				# Base.SubstitutionString +				# Base.Test.GenericString +				# DirectIndexString       +				# RevString               +				# String                  +				# SubString + +# Every type has a super type; use the `supertype` function to get it.  typeof(5) # => Int64 -super(Int64) # => Signed -super(Signed) # => Integer -super(Integer) # => Real -super(Real) # => Number -super(Number) # => Any -super(super(Signed)) # => Real -super(Any) # => Any +supertype(Int64) # => Signed +supertype(Signed) # => Integer +supertype(Integer) # => Real +supertype(Real) # => Number +supertype(Number) # => Any +supertype(supertype(Signed)) # => Real +supertype(Any) # => Any  # All of these type, except for Int64, are abstract. -typeof("fire") # => ASCIIString -super(ASCIIString) # => DirectIndexString -super(DirectIndexString) # => AbstractString -# Likewise here with ASCIIString +typeof("fire") # => String +supertype(String) # => AbstractString +# Likewise here with String +supertype(DirectIndexString) # => AbstractString  # <: is the subtyping operator  type Lion <: Cat # Lion is a subtype of Cat @@ -670,23 +677,22 @@ fight(l::Lion,c::Cat) = println("The victorious cat says $(meow(c))")  fight(Lion("balooga!"),Panther()) # => prints The victorious cat says grrr  try -  fight(Panther(),Lion("RAWR")) # => ERROR: no method fight(Panther,Lion) -catch +  fight(Panther(),Lion("RAWR")) +catch e +  println(e)  +  # => MethodError(fight, (Panther("green"), Lion("green", "RAWR")), 0x000000000000557b)  end  # Also let the cat go first  fight(c::Cat,l::Lion) = println("The cat beats the Lion") -# => Warning: New definition -#    fight(Cat,Lion) at none:1 -# is ambiguous with -#    fight(Lion,Cat) at none:2. -# Make sure -#    fight(Lion,Lion) -# is defined first. -#fight (generic function with 4 methods)  # This warning is because it's unclear which fight will be called in: -fight(Lion("RAR"),Lion("brown","rarrr")) # => prints The victorious cat says rarrr +try +  fight(Lion("RAR"),Lion("brown","rarrr")) # => prints The victorious cat says rarrr +catch e +  println(e) +  # => MethodError(fight, (Lion("green", "RAR"), Lion("brown", "rarrr")), 0x000000000000557c) +end  # The result may be different in other versions of Julia  fight(l::Lion,l2::Lion) = println("The lions come to a tie") diff --git a/pt-br/awk-pt.html.markdown b/pt-br/awk-pt.html.markdown index 75b73abe..761f5294 100644 --- a/pt-br/awk-pt.html.markdown +++ b/pt-br/awk-pt.html.markdown @@ -171,7 +171,7 @@ function arithmetic_functions(a, b, c,    d) {      # Muitas implementações AWK possuem algumas funções trigonométricas padrão      localvar = sin(a)      localvar = cos(a) -    localvar = atan2(a, b) # arco-tangente de b / a +    localvar = atan2(b, a) # arco-tangente de b / a      # E conteúdo logarítmico      localvar = exp(a) diff --git a/python3.html.markdown b/python3.html.markdown index 019934cb..d6cfbf59 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -138,6 +138,10 @@ len("This is a string")  # => 16  # still use the old style of formatting:  "%s can be %s the %s way" % ("Strings", "interpolated", "old")  # => "Strings can be interpolated the old way" +# You can also format using f-strings or formatted string literals +name = "Reiko" +f"She said her name is {name}." # => "She said her name is Reiko" +  # None is an object  None  # => None diff --git a/tr-tr/c++-tr.html.markdown b/tr-tr/c++-tr.html.markdown index a1318876..f9f22a1d 100644 --- a/tr-tr/c++-tr.html.markdown +++ b/tr-tr/c++-tr.html.markdown @@ -27,12 +27,12 @@ tipten bağımsızlık, exception'lar ve sınıflar gibi yüksek-seviyeli özell  Bu hız ve kullanışlılık C++'ı en çok kullanılan dillerden biri yapar.  ```c++ -////////////////// +//////////////////////  // C ile karşılaştırma -////////////////// +//////////////////////  // C++ _neredeyse_ C'nin bir üstkümesidir, değişken tanımı, basit tipleri -ve fonksiyonları için temelde aynı sözdizimini paylaşır. +// ve fonksiyonları için temelde aynı sözdizimini paylaşır.  // Aynı C gibi, programın başlangıç noktası bir integer döndüren   // main fonksiyonudur. @@ -105,7 +105,7 @@ int main()  ////////////////////////////////  // Default fonksiyon argümanları -/////////////////////////////i// +////////////////////////////////  // Eğer çağırıcı tarafından fonksiyona argüman sağlanmamışsa,  // fonksiyona default argüman verebilirsin @@ -263,7 +263,7 @@ string retVal = tempObjectFun();  // Bu iki satırda aslında ne oluyor:  //   - tempObjectFun fonksiyonundan bir string nesnesi dönüyor  //   - dönmüş olan nesneyle yeni bir string oluşturuyor -/    - dönmüş olan nesne yok ediliyor +//   - dönmüş olan nesne yok ediliyor  // İşte bu dönen nesneye geçici nesne denir. Geçici nesneler fonksiyon nesne  // döndürdüğünde oluşturulur ve ifade işini bitirdiğinde yok edilir (Aslında,  // standard'ın söylediği şey bu ama derleyiciler bu davranışı değiştirmemize  @@ -366,7 +366,6 @@ void WritePreferredCarTypeToFile(ECarTypes InputCarType)  // Sınıfı tanımla.  // Sınıflar genelde header (.h veya .hpp) dosyalarında tanımlanır.  class Dog { -    // Member variables and functions are private by default.      // Üye değişkenler ve fonksiyonlar default olarak private'dir.      std::string name;      int weight; @@ -548,7 +547,7 @@ int main () {  // Şablonlar C++ dilinde tipten bağımsız programlama için kullanılır.  // Zaten aşina olduğun tipten bağımsız programlamayla başladık. Bir tip parametresi -alan fonksiyon veya sınıf tanımlamaık için: +// alan fonksiyon veya sınıf tanımlamaık için:  template<class T>  class Box {  public: @@ -801,9 +800,9 @@ sort(tester.begin(), tester.end(), [](const pair<int, int>& lhs, const pair<int,  // "Tutma listesi", fonksiyon gövdesinde nelerin, ne şekilde erişilebilir olduğunu tanımlar  // Şunlardan biri olabilir:  // 	1. bir değer : [x] -	2. bir referans : [&x] -	3. mevcut scope içindeki herhangi bir değişkene referans ile [&] -	4. 3 ile aynı, ama değer ile [=] +//	2. bir referans : [&x] +//	3. mevcut scope içindeki herhangi bir değişkene referans ile [&] +//	4. 3 ile aynı, ama değer ile [=]  // Mesela:  vector<int> dog_ids;  // number_of_dogs = 3; @@ -842,9 +841,9 @@ for(auto elem: arr) {  	// arr dizisinin elemanlarıyla ilgili bir şeyler yap  } -///////////////////// +////////////////  // Güzel Şeyler -///////////////////// +////////////////  // C++ dilinin bakış açısı yeni başlayanlar için (hatta dili iyi bilenler için bile)  // şaşırtıcı olabilir.   | 
