Skip to content

Commit

Permalink
Merge pull request #114 from MikeInnes/sp/listprinting
Browse files Browse the repository at this point in the history
`show` only first 10 elements
  • Loading branch information
pfitzseb authored Feb 2, 2020
2 parents ed81810 + c1ac558 commit f4b37c5
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/Lazy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,16 @@ end
###########
# Printing
###########

Base.show(io::IO, xs::List) =
foreach(x->print(io,x), ["("] * interpose(xs, " ") * [")"])

function show(io::IO, ::MIME"text/plain", xs::List)
isempty(xs) && return println(io, "List()")

print(io, "List:")
for x in xs
print(io, "\n ")
show(io, x)
function Base.show(io::IO, xs::List)
print(io, "List: (")
for (i, x) in enumerate(interpose(xs, " "))
print(io, x)
if i > 21
print(io, "")
break
end
end
print(io, ")")
end

# Some example lists
Expand Down

0 comments on commit f4b37c5

Please sign in to comment.