Skip to content

Commit f9fd549

Browse files
committed
inferrable version of tuple front()
1 parent 0b52431 commit f9fd549

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

base/tuple.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ safe_tail(t::Tuple{}) = ()
8383

8484
function front(t::Tuple)
8585
@_inline_meta
86-
_front((), t...)
86+
_front(t...)
8787
end
88-
front(::Tuple{}) = throw(ArgumentError("Cannot call front on an empty tuple"))
89-
_front(out, v) = out
90-
function _front(out, v, t...)
88+
_front() = throw(ArgumentError("Cannot call front on an empty tuple"))
89+
_front(v) = ()
90+
function _front(v, t...)
9191
@_inline_meta
92-
_front((out..., v), t...)
92+
(v, _front(t...)...)
9393
end
9494

9595
## mapping ##

0 commit comments

Comments
 (0)