diff options
Diffstat (limited to 'julia.html.markdown')
| -rw-r--r-- | julia.html.markdown | 18 | 
1 files changed, 9 insertions, 9 deletions
diff --git a/julia.html.markdown b/julia.html.markdown index 3a52018c..66329feb 100644 --- a/julia.html.markdown +++ b/julia.html.markdown @@ -8,13 +8,13 @@ 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 the current development version of Julia, as of October 18th, 2013. +This is based on Julia 0.3.  ```ruby  # Single line comments start with a hash (pound) symbol.  #= Multiline comments can be written -   by putting '#=' before the text  and '=#'  +   by putting '#=' before the text  and '=#'     after the text. They can also be nested.  =# @@ -91,7 +91,7 @@ false  # $ can be used for string interpolation:  "2 + 2 = $(2 + 2)" # => "2 + 2 = 4" -# You can put any Julia expression inside the parenthesis. +# 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 # 5 is less than 5.300000 @@ -190,7 +190,7 @@ end  # inside the julia folder to find these files.  # You can initialize arrays from ranges -a = [1:5] # => 5-element Int64 Array: [1,2,3,4,5] +a = [1:5;] # => 5-element Int64 Array: [1,2,3,4,5]  # You can look at ranges with slice syntax.  a[1:3] # => [1, 2, 3] @@ -264,7 +264,7 @@ in(("two", 3), filled_dict) # => false  haskey(filled_dict, "one") # => true  haskey(filled_dict, 1) # => false -# Trying to look up a non-existant key will raise an error +# Trying to look up a non-existent key will raise an error  try      filled_dict["four"] # => ERROR: key not found: four in getindex at dict.jl:489  catch e @@ -670,7 +670,7 @@ square_area(l) = l * l      # square_area (generic function with 1 method)  square_area(5) #25  # What happens when we feed square_area an integer? -code_native(square_area, (Int32,))   +code_native(square_area, (Int32,))  	#	    .section    __TEXT,__text,regular,pure_instructions  	#	Filename: none  	#	Source line: 1              # Prologue @@ -703,10 +703,10 @@ code_native(square_area, (Float64,))  	#	    vmulsd  XMM0, XMM0, XMM0 # Scalar double precision multiply (AVX)  	#	    pop RBP  	#	    ret -	#	 +	#  # Note that julia will use floating point instructions if any of the  # arguements are floats. -# Let's calculate the area of a circle  +# Let's calculate the area of a circle  circle_area(r) = pi * r * r     # circle_area (generic function with 1 method)  circle_area(5)                  # 78.53981633974483 @@ -737,7 +737,7 @@ code_native(circle_area, (Float64,))  	#	    vmulsd  XMM0, XMM1, XMM0  	#	    pop RBP  	#	    ret -	#	 +	#  ```  ## Further Reading  | 
