beacon-biosignals / TimeSpans.jl

A Julia package that provides a `TimeSpan` type for representing a continuous span between two points in time.
Other
6 stars 2 forks source link

define a `translate` function (or `shift`?) #1

Closed jrevels closed 3 years ago

jrevels commented 4 years ago

It would be convenient for e.g. span::TimeSpan + Second(1) to just translate span over by a second

ararslan commented 4 years ago

I could also see that meaning extend span by one second. Perhaps span .+ Second(1) would be more appropriate for translating the span?

jrevels commented 4 years ago

oooooh good point. Guess it gets tricky; I wonder if there should just be +(::AbstractTimeSpan, ::AbstractTimeSpan) where the components are added like vectors?

There really could be a whole TimeSpans.jl package that we could open source; I think something similar has been implemented in other areas of the Julia world, should do some due diligence there

jrevels commented 3 years ago

TimeSpans.jl package

done https://github.com/beacon-biosignals/TimeSpans.jl

Guess it gets tricky; I wonder if there should just be +(::AbstractTimeSpan, ::AbstractTimeSpan) where the components are added like vectors?

The new package's implementation is way more duck-type-y so I don't think it'd be wise to define this at this point (maybe a more explicit translate function though)