A time range streamed through a filter

The complete source of flowControl_time_pipeline.ek9, compiled by the EK9 compiler. Shown on flowControl.html.

#!ek9
defines module site.flowControl.timepipeline

  defines constant
    LUNCH_START <- 12:00
    LUNCH_END <- 14:00

  defines function

    workHours() as pure
      -> time as Time
      <- workTime as Boolean: time < LUNCH_START or time > LUNCH_END

  defines program

    TimePipeLine()
      stdout <- Stdout()

      //From 9-5:30 every half hour
      start <- Time().startOfDay() + PT9H
      end <- Time().endOfDay() - PT6H30M
      thirtyMinutes <- PT30M

      for i in start ... end by thirtyMinutes | filter by workHours > stdout

Download flowControl_time_pipeline.ek9

Output

09:00:00
09:30:00
10:00:00
10:30:00
11:00:00
11:30:00
14:30:00
15:00:00
15:30:00
16:00:00
16:30:00
17:00:00