Reading a book on Julia
I found the following code example:
The author creates a type
type Student
name::String
end
creates an instance of this type
antony = Student("Antony Miller")
and then tests the type of antony
in two different ways
isa(antony, Student)
true
antony isa Student
true
This is an awesome way of using syntax to make code readable. However, how is the function isa()
enabled to be used as an infix operator, here? I would have guessed that the following is possible...
antony |> isa(Student)
true
...as the pipe (|>
) uses the object to the left as the first argument in the function to the right. But why is it possible to omit the pipe in the example further up? And can I use the same behavior in my own functions as well to make the code more readable (I would really like to)?