[MOD] small changes

This commit is contained in:
Eduardo Cueto Mendoza 2020-05-07 17:53:30 -06:00
parent f3c835d7c2
commit 27cba34e93
7 changed files with 0 additions and 64 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
09_TypeHierarchiesMultipleDispatch.jl Normal file → Executable file
View File

0
10_ConversionPromotion.jl Normal file → Executable file
View File

View File

@ -1,22 +0,0 @@
# Conversion
function foobar(a,b)
x::Int8 = a
y::Int8 = b
x+y
end
println(isa(2,Float64))
println(isa(Int8,Type{Int8}))
println(convert(Int8,4))
Base.convert(::Type{Int8},x::String) = parse(Int8,x)
println(1+2.0+Int8(3))
println(typeof(1+2.0+Int8(3)))
println(promote(1,2.0,Int8(3)))
a = (3,2)
println(+(a...)) # Tuple unpacking notation
# @edit 2 + 4.0 macro to get

View File

@ -1,31 +0,0 @@
abstract Shape
type Circle <: Shape
x::Float64
y::Float64
radius::Float64
end
getposition(c::Circle) = (c.x,c.y)
function setposition(c::Circle,x,y)
c.x = x
c.y = y
end
type Rectangle <: Shape
x:: Float64
y::Float64
width::Float64
height::Float64
end
type ShapeGroup <: Shape
members::Vector{Shape}
end
function group(shapes::Shape...)
ShapeGroup(collect(shapes))
end

0
README.md Normal file → Executable file
View File

View File

@ -1,11 +0,0 @@
telltype(x) = "Unknown Type"
telltype(x::Integer) = "Integer Type"
telltype(::AbstractFloat) = "Floatingpoint Type"
telltype(::Int64) = "64 Bytes Integer"
counargs(a) = "one"
counargs(a,b) = "two"
counargs(a,b,c) = "three"
foo(a,b) = "Two variables"
foo(a::Integer,b::Integer) = "Two integers"
foo(a::Integer,b::AbstractFloat) = "An integer and a float"
foo(a::AbstractFloat,b::Integer) = "An float and an integer"