Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Feb 1, 2020
1 parent 0de1643 commit 88a8059
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/collections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ for f in (:takewhile, :splitby, :takeuntil)
@eval $(f)(f::Function, xs) = $(f)(f, seq(xs))
end

import Base.@get!

function groupby(f, xs)
result = d()
for x in xs
push!(@get!(result, f(x), []), x)
push!(get!(result, f(x), []), x)
end
return result
end

0 comments on commit 88a8059

Please sign in to comment.