I have a bad feeling I have asked this before, but can't find the thread,
sorry. How do I make the following work as expected (ie print "integer")
instead of giving an error?
julia> foo(i::Integer) = print("integer")
foo (generic function with 1 method)
julia> foo(42)
integer
julia> function bar(i)
foo(i)
end
bar (generic function with 1 method)
julia> bar(42)
integer
julia> function baz(i)
foo(s::ASCIIString) = print("string")
foo(i)
end
baz (generic function with 1 method)
julia> baz(42)
ERROR: `foo` has no method matching foo(::Int64)
in baz at none:3
Thanks,
Andrew