MCPcopy Create free account
hub / github.com/Effect-TS/effect / fibonacci

Function fibonacci

packages/effect/src/Schedule.ts:882–895  ·  view source on GitHub ↗
(one: Duration.Input)

Source from the content-addressed store, hash-verified

880 * @since 2.0.0
881 */
882export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
883 const oneMillis = Duration.toMillis(Duration.fromInputUnsafe(one))
884 return fromStep(effect.sync(() => {
885 let a = 0
886 let b = oneMillis
887 return constant(effect.sync(() => {
888 const next = a + b
889 a = b
890 b = next
891 const duration = Duration.millis(next)
892 return [duration, duration]
893 }))
894 }))
895}
896
897/**
898 * Returns a `Schedule` that recurs on the specified fixed `interval` and

Callers

nothing calls this directly

Calls 3

constantFunction · 0.90
fromStepFunction · 0.85
syncMethod · 0.45

Tested by

no test coverage detected