See ?invoke.

display(X::Vector)=length(X)>10?print("Too long to show."): invoke(display, 
(Any,), X)

On Saturday, April 25, 2015 at 10:41:39 PM UTC-7, Jerry Xiong wrote:
>
> For example, if I want to overload the Base.display(::Vector) to repress 
> the display when the vector is too long, I coded as below:
> julia> import Base.display
>
> julia> display(X::Vector)=length(X)>10?print("Too long to show."):Base.
> display(X)
> display (generic function with 17 methods)
>
> julia> display([1,2,3])
> ERROR: stack overflow
>  in display at none:1 (repeats 39998 times)
>
> I want to call the original Base.display when the length of vector is less 
> than 10, but it is became a dead recurring. Is there any way to do it?
>

Reply via email to