Update syntax for in calls

The call was flipped from how it is in the current documentation: http://docs.julialang.org/en/latest/stdlib/base/#Base.in
This commit is contained in:
supernullset 2013-11-04 19:21:17 -08:00
parent 9f0ae279d8
commit 2a60ecbb8d

View File

@ -201,7 +201,7 @@ b = [1,2,3]
append!(a,b) # Now a is [1, 2, 3, 4, 5, 1, 2, 3] append!(a,b) # Now a is [1, 2, 3, 4, 5, 1, 2, 3]
# Check for existence in a list with in # Check for existence in a list with in
in(a,1) #=> true in(1, a) #=> true
# Examine the length with length # Examine the length with length
length(a) #=> 8 length(a) #=> 8
@ -218,7 +218,7 @@ end
# Many list functions also work on tuples # Many list functions also work on tuples
length(tup) #=> 3 length(tup) #=> 3
tup[1:2] #=> (1,2) tup[1:2] #=> (1,2)
in(tup,2) #=> true in(2, tup) #=> true
# You can unpack tuples into variables # You can unpack tuples into variables
a, b, c = (1, 2, 3) #=> (1,2,3) # a is now 1, b is now 2 and c is now 3 a, b, c = (1, 2, 3) #=> (1,2,3) # a is now 1, b is now 2 and c is now 3
@ -255,8 +255,8 @@ values(filled_dict)
# Note - Same as above regarding key ordering. # Note - Same as above regarding key ordering.
# Check for existence of keys in a dictionary with in, haskey # Check for existence of keys in a dictionary with in, haskey
in(filled_dict, ("one", 1)) #=> true in(("one", 1), filled_dict) #=> true
in(filled_dict, ("two", 3)) #=> false in(("two", 3), filled_dict) #=> false
haskey(filled_dict, "one") #=> true haskey(filled_dict, "one") #=> true
haskey(filled_dict, 1) #=> false haskey(filled_dict, 1) #=> false
@ -281,8 +281,8 @@ filled_set = Set(1,2,2,3,4) #=> Set{Int64}(1,2,3,4)
push!(filled_set,5) #=> Set{Int64}(5,4,2,3,1) push!(filled_set,5) #=> Set{Int64}(5,4,2,3,1)
# Check if the values are in the set # Check if the values are in the set
in(filled_set,2) #=> true in(2, filled_set) #=> true
in(filled_set,10) #=> false in(10, filled_set) #=> false
# There are functions for set intersection, union, and difference. # There are functions for set intersection, union, and difference.
other_set = Set(3, 4, 5, 6) #=> Set{Int64}(6,4,5,3) other_set = Set(3, 4, 5, 6) #=> Set{Int64}(6,4,5,3)