Skip to content

Commit

Permalink
add unary lift, originally contributed by the magnanimous @ericphanson (
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels committed Jul 27, 2021
1 parent 8f7e31f commit 0008d52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Legolas"
uuid = "741b9549-f6ed-4911-9fbf-4a1c0c97f0cd"
authors = ["Beacon Biosignals, Inc."]
version = "0.2.2"
version = "0.2.3"

[deps]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
Expand Down
7 changes: 7 additions & 0 deletions src/Legolas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ originally constructed.
lift(::Any, ::Union{Nothing,Missing}) = missing
lift(f, x) = f(x)

"""
lift(f)
Returns a curried function, `x -> lift(f,x)`
"""
lift(f) = Base.Fix1(lift, f)

const LEGOLAS_SCHEMA_QUALIFIED_METADATA_KEY = "legolas_schema_qualified"

include("rows.jl")
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ include(joinpath(dirname(@__DIR__), "examples", "tour.jl"))
@test ismissing(Legolas.lift(sin, nothing))
@test ismissing(Legolas.lift(sin, missing))
@test Legolas.lift(sin, 1.0) == sin(1.0)
@test ismissing(Legolas.lift(sin)(nothing))
@test ismissing(Legolas.lift(sin)(missing))
@test Legolas.lift(sin)(1.0) == sin(1.0)
end

@testset "Legolas.location" begin
Expand Down

2 comments on commit 0008d52

@jrevels
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/41652

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.3 -m "<description of version>" 0008d525b835867436c5679acdb753107d798ff9
git push origin v0.2.3

Please sign in to comment.