Hi All
I found my self writing code like this a lot:
x = get_a(...)
if x != nothing
y::A = x
do_sth(y, ...)
end
In the above, I have to check for nothing first, and if it is not nothing,
then I do a type assert to make sure the type is what I expected.
Is there any function or macro in Julia that can help this?
I know in F#, I have option.bind, so option.bind f x is equivalent to a
pattern match: if x is None - > None; if x is something -> f(something)
Also in C#, I have "customers?[0]?.Orders?.Count();" (as long as there is
null before ?, it returns null immediately)
Does Julia have something similar?