Skip to content

Commit

Permalink
in_common
Browse files Browse the repository at this point in the history
  • Loading branch information
bramtayl committed Dec 1, 2018
1 parent 0231927 commit a5f6370
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 0 additions & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
julia 1.0
MacroTools
Markdown
23 changes: 23 additions & 0 deletions src/LightQuery.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ module LightQuery

include("Nameless.jl")

x = x -> x + 1
typeof(x)

import Base: diff_names, merge


using InteractiveUtils: @code_warntype

export Name
Expand Down Expand Up @@ -233,4 +237,23 @@ julia> @inferred remove((a = 1, b = 2.0), Names(:b))
remove(data, columns::Names{T}) where T =
select(data, Names{diff_names(propertynames(data), T)}())

export in_common
"""
in_common(data1, data2)
```jldoctest
julia> using LightQuery
julia> using Test: @inferred
julia> @inferred in_common((a = 1, b = 2.0), (a = 1, c = "3"))
Names{(:a,)}()
```
"""
function in_common(data1, data2)
data1_names = propertynames(data1)
data2_names = propertynames(data2)
Names{diff_names(data1_names, diff_names(data1_names, data2_names))}()
end

end

0 comments on commit a5f6370

Please sign in to comment.